[pLog-svn] r5289 - in plog/branches/lifetype-1.2: class/action/admin locale/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Sun Apr 8 14:14:45 EDT 2007


Author: mark
Date: 2007-04-08 14:14:45 -0400 (Sun, 08 Apr 2007)
New Revision: 5289

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php
   plog/branches/lifetype-1.2/class/action/admin/adminaddtemplateaction.class.php
   plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php
   plog/branches/lifetype-1.2/locale/admin/locale_de_DE.php
   plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
   plog/branches/lifetype-1.2/locale/admin/locale_en_US.php
   plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php
   plog/branches/lifetype-1.2/locale/admin/locale_fr_FR.php
   plog/branches/lifetype-1.2/locale/admin/locale_it_IT.php
   plog/branches/lifetype-1.2/locale/admin/locale_nl_NL.php
   plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php
   plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php
Log:
Fix addTemplate/addBlogTemplate bug I describe here http://bugs.lifetype.net/view.php?id=1266

And a new locale error_template_exist for this fix.

Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddblogtemplateaction.class.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -77,7 +77,6 @@
 
             $result = $uploads->process( $tmpFolder );
             if( $result < 0 ) {
-
                 $this->_view->setErrorMessage( $this->_locale->tr("error_uploads_disabled"));
                 $this->setCommonData();
 
@@ -85,7 +84,16 @@
             }
 
             $upload   = new FileUpload( $files["templateFile"] );
+			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );            
 
+			// Check the template set exist or not
+			if( TemplateSets::isTemplate( $templateName ) || TemplateSets::isBlogTemplate( $templateName, $this->_blogInfo->getId() ) ) {
+                $this->_view->setErrorMessage( $this->_locale->pr("error_template_exist", $templateName));
+                $this->setCommonData();
+
+                return false;
+            }
+
             // and make it go through the template sandbox to check if
             // we're dealing with a 'healthy' file
             $templateSandbox = new TemplateSandbox();
@@ -125,7 +133,6 @@
 
             // if the template set was installed ok in the template folder, we can record
             // it as a valid set
-			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
             $ts->addTemplate( $templateName, $this->_blogInfo->getId());
 
             // remove the file

Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddtemplateaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddtemplateaction.class.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddtemplateaction.class.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -88,7 +88,17 @@
 
             // and from there, unpack it
             $upload   = new FileUpload( $files['templateFile'] );
+			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );            
 
+			// Check the template set exist or not
+			if( TemplateSets::isTemplate( $templateName ) ) {
+				$this->_view = new AdminSiteTemplatesListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->pr("error_template_exist", $templateName));
+                $this->setCommonData();
+
+                return false;
+            }
+
             $templateSandbox = new TemplateSandbox();
             $valid = $templateSandbox->checkTemplateSet( $upload->getFileName(), $tmpFolder.'/');
 
@@ -121,7 +131,6 @@
             // if the template set was installed ok in the template folder, we can record
             // it as a valid set
             $ts = new TemplateSetStorage();
-			$templateName = TemplateSandbox::toTemplateSetName( $upload->getFileName() );
             $ts->addTemplate( $templateName );
 
             $this->_view = new AdminSiteTemplatesListView( $this->_blogInfo );

Modified: plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1183,4 +1183,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_de_DE.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_de_DE.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_de_DE.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1170,4 +1170,6 @@
 $messages['quick_permission_selection'] = 'Berechtigungsmuster w&auml;hlen';
 $messages['basic_blog_permission'] = 'Dem Benutzer das Hinzuf&uuml;gen, &Auml;ndern und L&ouml;schen von Artikeln, Links und Ressourcen erlauben.';
 $messages['full_blog_permission'] = 'Dem Benutzer die selben Berechtigungen wie dem Blog Besitzer geben.';
-?>
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1166,4 +1166,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
-?>
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_en_US.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_en_US.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_US.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -8,4 +8,4 @@
 $messages['controlCenter'] = 'Control Center';
 $messages['pluginCenter'] = 'Plugin Center';
 
-?>
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1177,4 +1177,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_fr_FR.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_fr_FR.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_fr_FR.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1346,4 +1346,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_it_IT.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_it_IT.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_it_IT.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1165,4 +1165,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_nl_NL.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_nl_NL.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_nl_NL.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1244,4 +1244,6 @@
 $messages['quick_permission_selection'] = 'Quick permission selection';
 $messages['basic_blog_permission'] = 'Allow blog user add, update and delete posts, links and resources';
 $messages['full_blog_permission'] = 'Allow blog user access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error upload the template, template "%s" already exist.';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1166,4 +1166,6 @@
 $messages['quick_permission_selection'] = '快速权限设定选单';
 $messages['basic_blog_permission'] = '博客作者可以新增、编修与删除文章、链接与文件';
 $messages['full_blog_permission'] = '博客作者可以跟博客拥有者一样,操作所有功能';
+
+$messages['error_template_exist'] = '上传模版时发生错误,“%s”模版已经存在。';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php	2007-04-08 17:41:50 UTC (rev 5288)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php	2007-04-08 18:14:45 UTC (rev 5289)
@@ -1166,4 +1166,6 @@
 $messages['quick_permission_selection'] = '快速權限設定選單';
 $messages['basic_blog_permission'] = '網誌作者可以新增、編修與刪除文章、連結與檔案';
 $messages['full_blog_permission'] = '網誌作者可以跟網誌擁有者一樣,操作所有功能';
+
+$messages['error_template_exist'] = '上傳模版時發生錯誤,「%s」模版已經存在。';
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list