[pLog-svn] r3890 - in plog/trunk: class/action/admin class/view/admin templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed Aug 16 14:22:17 GMT 2006


Author: oscar
Date: 2006-08-16 14:22:16 +0000 (Wed, 16 Aug 2006)
New Revision: 3890

Modified:
   plog/trunk/class/action/admin/admindoregisterblogaction.class.php
   plog/trunk/class/view/admin/adminregisterblogview.class.php
   plog/trunk/templates/admin/registerblog.template
Log:
Fixed issue 1019, and also found another issue with the locale for the new blog not being set correctly.


Modified: plog/trunk/class/action/admin/admindoregisterblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindoregisterblogaction.class.php	2006-08-15 21:32:35 UTC (rev 3889)
+++ plog/trunk/class/action/admin/admindoregisterblogaction.class.php	2006-08-16 14:22:16 UTC (rev 3890)
@@ -4,6 +4,7 @@
 	include_once( PLOG_CLASS_PATH."class/view/admin/adminregisterblogview.class.php" );
 	include_once( PLOG_CLASS_PATH."class/view/admin/admindashboardview.class.php" );	
 	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );	
     include_once( PLOG_CLASS_PATH."class/data/validator/domainvalidator.class.php" );	
 	include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
 	include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
@@ -24,15 +25,17 @@
             $this->registerFieldValidator( "blogMainDomain", new DomainValidator(), true );
             $this->registerFieldValidator( "blogLocale", new StringValidator());
 			$this->registerFieldValidator( "templateId", new StringValidator());
+			$this->registerFieldValidator( "blogCategory", new IntegerValidator());
 			$this->setValidationErrorView( new AdminRegisterBlogView( $this->_userInfo ));
 		}
 		
 		function perform()
 		{
 			// if the validation of data went fine, then we can proceed and add the blog
-			$localeCode = $this->_request->getValue( "localeId" );
+			$localeCode = $this->_request->getValue( "blogLocale" );
 			$template = $this->_request->getValue( "templateId" );
 			$name = $this->_request->getValue( "blogName" );
+			$blogCategory = $this->_request->getValue( "blogCategory" );
 			
 			// create the blog...
 			$blog = new BlogInfo( $name, $this->_userInfo->getId(),  // owner id
@@ -74,10 +77,12 @@
                 // set the template
 			$blog->setTemplate( $template );
 			// set the locale
-			$locale = Locales::getLocale( $localeCode );
+			$locale =& Locales::getLocale( $localeCode );
 			$blog->setLocale( $locale );
 			// and set the status to ready
 			$blog->setStatus( BLOG_STATUS_ACTIVE );
+			// set the blog category
+			$blog->setBlogCategoryId( $blogCategory );
 			
 			// and finally add everything to the db
 			$blogs = new Blogs();
@@ -88,7 +93,7 @@
 			
 			$newBlogId = $blog->getId();
             $articleCategories = new ArticleCategories();
-            $articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
+            $articleCategory = new ArticleCategory( $locale->tr("register_default_category"), "", $newBlogId, true );
             $catId = $articleCategories->addArticleCategory( $articleCategory );
             $articleTopic = $locale->tr( "register_default_article_topic" );
             $articleText  = $locale->tr( "register_default_article_text" );

Modified: plog/trunk/class/view/admin/adminregisterblogview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminregisterblogview.class.php	2006-08-15 21:32:35 UTC (rev 3889)
+++ plog/trunk/class/view/admin/adminregisterblogview.class.php	2006-08-16 14:22:16 UTC (rev 3890)
@@ -5,6 +5,7 @@
 	include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
 	include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
 	include_once( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
 	
 	class AdminRegisterBlogView extends View
 	{
@@ -65,6 +66,11 @@
 
             $ts = new TemplateSets();
             $this->setValue( "templates", $ts->getGlobalTemplateSets());
+            
+            // and the blog categories
+            $blogCategories = new BlogCategories();
+            $this->setValue( "blogcategories", $blogCategories->getBlogCategories());
+            
             // assign all the values
             $template->assign( $this->_params->getAsArray());
 

Modified: plog/trunk/templates/admin/registerblog.template
===================================================================
--- plog/trunk/templates/admin/registerblog.template	2006-08-15 21:32:35 UTC (rev 3889)
+++ plog/trunk/templates/admin/registerblog.template	2006-08-16 14:22:16 UTC (rev 3890)
@@ -60,6 +60,18 @@
      {include file="$admintemplatepath/validate.template" field=blogLocale message=$locale->tr("error_empty_locale")}
    </div>
    
+  <div class="field">
+     <label for="blogCategory">{$locale->tr("blog_category")}</label>
+     <span class="required">*</span>
+     <div class="formHelp">{$locale->tr("blog_category_help")}</div>
+     <select name="blogCategory" id="blogCategory">
+      {foreach from=$blogcategories item=blogcategory}
+        <option value="{$blogcategory->getId()}">{$blogcategory->getName()}</option>
+      {/foreach}
+     </select>
+     {include file="$admintemplatepath/validate.template" field=blogCategory message=$locale->tr("error_incorrect_blog_category")}
+   </div>   
+   
 
    <div class="field">
 	<label for="">{$locale->tr("select_template")}</label>



More information about the pLog-svn mailing list