[pLog-svn] r3295 - in plog/trunk/class: action/admin summary/action

mark at devel.lifetype.net mark at devel.lifetype.net
Fri Apr 28 07:03:31 GMT 2006


Author: mark
Date: 2006-04-28 07:03:30 +0000 (Fri, 28 Apr 2006)
New Revision: 3295

Modified:
   plog/trunk/class/action/admin/adminaddblogaction.class.php
   plog/trunk/class/summary/action/dofinishregister.class.php
Log:
1. Create a default MyLinksCategory when add a blog through addBlogAction.

2. Assign a GlobalArticleCategoryId to the default article when add a blog throught add BlogAction

3. some code re-arrange and cosmetics.

Modified: plog/trunk/class/action/admin/adminaddblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogaction.class.php	2006-04-28 06:54:01 UTC (rev 3294)
+++ plog/trunk/class/action/admin/adminaddblogaction.class.php	2006-04-28 07:03:30 UTC (rev 3295)
@@ -65,7 +65,20 @@
 
                 return false;
             }
-            
+
+            // get the default global article category id
+			include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
+	        $globalArticleCategories = new GlobalArticleCategories();
+	        $globalArticleCategoryId = $this->_config->getValue("default_global_article_category_id");
+            if( !empty( $globalArticleCategoryId ) ) {
+            	$globalArticleCategory = $globalArticleCategories->getGlobalArticleCategory( $globalArticleCategoryId );
+            	if( empty( $globalArticleCategory ) )
+            		$globalArticleCategoryId = 0;
+            }	
+            else {
+				$globalArticleCategoryId = 0;
+			}
+			            
             // add a default category and a default post
             $articleCategories = new ArticleCategories();
             $articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
@@ -83,6 +96,7 @@
                                     0, 
                                     Array(), 
                                     "welcome" );
+            $article->setGlobalCategoryId( $globalArticleCategoryId );  // set the default ArticleGlobalCategory id to article
             $t = new Timestamp();
             $article->setDateObject( $t );
             $articles = new Articles();
@@ -100,7 +114,13 @@
                                        Array(),   // no properties
                                        true );  // show the album in the interface
             $albums = new GalleryAlbums();
-            $albums->addAlbum( $album );            
+            $albums->addAlbum( $album );
+            
+            // add a new default mylinkscategory
+    		include_once( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
+            $linksCategory = new MyLinksCategory( $locale->tr("register_default_category" ), $newBlogId );
+            $linksCategories = new MyLinksCategories();
+            $linksCategories->addMyLinksCategory( $linksCategory );            
 
             // and inform everyone that everything went ok
 			$this->notifyEvent( EVENT_POST_BLOG_ADD, Array( "blog" => &$blog ));

Modified: plog/trunk/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/trunk/class/summary/action/dofinishregister.class.php	2006-04-28 06:54:01 UTC (rev 3294)
+++ plog/trunk/class/summary/action/dofinishregister.class.php	2006-04-28 07:03:30 UTC (rev 3295)
@@ -9,8 +9,6 @@
     include_once( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );
     include_once( PLOG_CLASS_PATH."class/dao/article.class.php" );
 	include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
-    include_once( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
-	include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
 	include_once( PLOG_CLASS_PATH."class/summary/mail/summarymailer.class.php" );
 
     /**
@@ -134,6 +132,7 @@
             $this->_blogInfo = $blogInfo;
 
             // get the default global article category id
+	        include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
 	        $globalArticleCategories = new GlobalArticleCategories();
 	        $globalArticleCategoryId = $this->_config->getValue("default_global_article_category_id");
             if( !empty( $globalArticleCategoryId ) ) {
@@ -185,6 +184,7 @@
             $albums->addAlbum( $album );
             
             // add a new default mylinkscategory
+    		include_once( PLOG_CLASS_PATH."class/dao/mylinkscategories.class.php" );
             $linksCategory = new MyLinksCategory( $locale->tr("register_default_category" ), $this->_blogInfo->getId() );
             $linksCategories = new MyLinksCategories();
             $linksCategories->addMyLinksCategory( $linksCategory ); 



More information about the pLog-svn mailing list