[pLog-svn] r3178 - in plog/trunk: . class/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Tue Apr 4 03:33:41 GMT 2006


Author: mark
Date: 2006-04-04 03:33:39 +0000 (Tue, 04 Apr 2006)
New Revision: 3178

Modified:
   plog/trunk/class/dao/blogcategory.class.php
   plog/trunk/class/dao/globalarticlecategory.class.php
   plog/trunk/wizard.php
Log:
1. Some fix of BlogCategory and GlobalArticleCategory
2. Modify the wizard. Now, the wizard will create default Blog Category and default Global Article Category and assign them to deafult $blog and $article object

Modified: plog/trunk/class/dao/blogcategory.class.php
===================================================================
--- plog/trunk/class/dao/blogcategory.class.php	2006-04-04 02:16:38 UTC (rev 3177)
+++ plog/trunk/class/dao/blogcategory.class.php	2006-04-04 03:33:39 UTC (rev 3178)
@@ -15,6 +15,7 @@
 		var $_name;
 		var $_description;
 		var $_properties;
+		var $_mangledName;
 		var $_numBlogs;
 		var $_numActiveBlogs;
 
@@ -33,7 +34,8 @@
 			                        "description" => "getDescription",
 			                        "properties" => "getProperties",
 			                        "num_blogs" => "getNumBlogs",
-			                        "num_active_blogs" => "getNumActiveBlogs" );
+			                        "num_active_blogs" => "getNumActiveBlogs",
+			                        "mangled_name" => "getMangledName" );
 		}
 
         /**
@@ -146,6 +148,21 @@
 		function getProperties()
 		{
 			return( $this->_properties );
-		}	
+		}
+
+		function setMangledName( $mangledName )
+		{
+			$this->_mangledName = $mangledName;
+		}
+		
+		function getMangledName()
+		{
+			if( $this->_mangledName == "" ) {
+				include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+				$this->_mangledName = Textfilter::urlize( $this->getName() );
+			}
+			
+			return( $this->_mangledName );
+		}		
 	}
 ?>

Modified: plog/trunk/class/dao/globalarticlecategory.class.php
===================================================================
--- plog/trunk/class/dao/globalarticlecategory.class.php	2006-04-04 02:16:38 UTC (rev 3177)
+++ plog/trunk/class/dao/globalarticlecategory.class.php	2006-04-04 03:33:39 UTC (rev 3178)
@@ -140,11 +140,16 @@
 			return( $this->_properties );
 		}	
 		
+		function setMangledName( $mangledName )
+		{
+			$this->_mangledName = $mangledName;
+		}
+		
 		function getMangledName()
 		{
 			if( $this->_mangledName == "" ) {
 				include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-				$this->_mangledName = Textfilter::urlize( $this->_mangledName );
+				$this->_mangledName = Textfilter::urlize( $this->getName() );
 			}
 			
 			return( $this->_mangledName );

Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-04-04 02:16:38 UTC (rev 3177)
+++ plog/trunk/wizard.php	2006-04-04 03:33:39 UTC (rev 3178)
@@ -58,6 +58,8 @@
     include_once( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );    
     
     // table schemas
     include_once( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
@@ -969,6 +971,17 @@
 
         function perform()
         {
+            // Before we add a new blog, we need to add blog category and global article category first
+            // add blog category
+            $blogCategories = new BlogCategories();
+            $blogCategory = new BlogCategory( "General", "General" );
+            $blogCategoryId = $blogCategories->addBlogCategory( $blogCategory );
+
+            // add global article category
+            $globalArticleCategories = new GlobalArticleCategories();
+            $globalArticleCategory = new GlobalArticleCategory( "General", "General" );
+            $globalArticleCategoryId = $globalArticleCategories->addGlobalArticleCategory( $globalArticleCategory );
+            
             // retrieve the values from the view
             $this->_blogName = $this->_request->getValue( "blogName" );
             $this->_ownerId  = $this->_request->getValue( "ownerid" );
@@ -979,6 +992,8 @@
             // configure the blog
             $blogs = new Blogs();
             $blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
+            // set the default BlogCategory id to blog
+            $blog->setBlogCategoryId( $blogCategoryId );
             $blog->setProperties( $this->_blogProperties );
             $blog->setStatus( BLOG_STATUS_ACTIVE );
             $blogSettings = $blog->getSettings();
@@ -1001,7 +1016,7 @@
             // if the blog was created, we can add some basic information
             // add a category
             $articleCategories = new ArticleCategories();
-            $articleCategory = new ArticleCategory( "General", "", $newblogId, true );
+            $articleCategory = new ArticleCategory( "General", "General", $newblogId, true );
             $catId = $articleCategories->addArticleCategory( $articleCategory );
 
             // load the right locale
@@ -1010,6 +1025,9 @@
             $articleTopic = $locale->tr( "register_default_article_topic" );
             $articleText  = $locale->tr( "register_default_article_text" );
             $article = new Article( $articleTopic, $articleText, Array( $catId ), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, Array(), "welcome" );
+            // set the default ArticleGlobalCategory id to article
+            $article->setGlobalCategoryId( $globalArticleCategoryId );
+            // set the current time to article
             $t = new Timestamp();
             $article->setDateObject( $t );
             $articles = new Articles();



More information about the pLog-svn mailing list