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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Mar 22 05:40:36 EDT 2007


Author: oscar
Date: 2007-03-22 05:40:36 -0400 (Thu, 22 Mar 2007)
New Revision: 5154

Added:
   plog/branches/lifetype-1.2/class/action/admin/adminchangeblogstatusaction.class.php
Modified:
   plog/branches/lifetype-1.2/class/controller/admincontrollermap.properties.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_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
   plog/branches/lifetype-1.2/templates/admin/siteblogs.template
Log:
added support for mass updating blogs in the admin interface. This required new strings, let's try and see how it works when we add new strings in minor releases. I've added the default English strings to all locale files, can you guys (Mark, Reto) take care of updating your locales? I will try to chase the translators of the other locales.


Added: plog/branches/lifetype-1.2/class/action/admin/adminchangeblogstatusaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminchangeblogstatusaction.class.php	                        (rev 0)
+++ plog/branches/lifetype-1.2/class/action/admin/adminchangeblogstatusaction.class.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -0,0 +1,103 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteblogslistview.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Implements bulk changes of blogs
+     */
+    class AdminChangeBlogStatusAction extends AdminAction 
+	{
+
+        var $_postIds;
+        var $_postStatus;
+
+    	/**
+         * Constructor. If nothing else, it also has to call the constructor of the parent
+         * class, BlogAction with the same parameters
+         */
+        function AdminChangeBlogStatusAction( $actionInfo, $request )
+        {
+        	$this->AdminAction( $actionInfo, $request );
+			$this->registerFieldValidator( "blogIds", new ArrayValidator());
+			$this->registerFieldValidator( "blogStatus", new IntegerValidator() );
+			$view = new AdminSiteBlogsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_blog_id"));
+			$this->setValidationErrorView( $view );
+			
+			$this->requireAdminPermission( "update_site_blog" );	
+        }
+
+        /**
+         * Carries out the specified action
+         */
+        function _changeBlogsStatus()
+        {
+        	// Chanages the post status field by selection
+            $blogs = new Blogs();
+            $errorMessage = "";
+			$successMessage = "";
+			$totalOk = 0;
+			
+            foreach( $this->_blogIds as $blogId ) {
+            	// get the post
+                $blog = $blogs->getBlogInfo( $blogId );
+				
+				if( $blog ) {
+					// fire the event
+					$this->notifyEvent( EVENT_PRE_BLOG_UPDATE, Array( "blog" => &$blog ));
+					
+					// update the post status
+					$blog->setStatus( $this->_blogStatus );
+					$result = $blogs->updateBlog( $blog );
+					
+					if( !$result ) {
+						$errorMessage .= $this->_locale->pr("error_updating_blog", $blog->getBlog())."<br/>";
+					}
+					else {
+						$totalOk++;
+						if( $totalOk < 2 ) 
+							$successMessage .= $this->_locale->pr("blog_updated_ok", $blog->getBlog())."<br/>";
+						else
+							$successMessage = $this->_locale->pr("blogs_updated_ok", $totalOk );
+						// fire the post event
+						$this->notifyEvent( EVENT_POST_BLOG_UPDATE, Array( "article" => &$blog ));					
+					}
+				}
+				else {
+					$errorMessage .= $this->_locale->pr( "error_updating_blog2", $blogId )."<br/>";
+				}
+            }
+			
+			// clean up the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+			$this->_view = new AdminSiteBlogsListView( $this->_blogInfo );
+			if( $errorMessage != "" ) 
+				$this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" )
+				$this->_view->setSuccessMessage( $successMessage );
+				
+			$this->setCommonData();
+			
+            return true;
+        }
+		
+		function perform()
+		{
+			// prepare the parameters.. If there's only one category id, then add it to
+			// an array.
+			$this->_blogIds = $this->_request->getValue( "blogIds" );
+			$this->_blogStatus = $this->_request->getValue( "blogStatus" );
+				
+			$this->_changeBlogsStatus();
+		}
+    }
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/branches/lifetype-1.2/class/controller/admincontrollermap.properties.php	2007-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/class/controller/admincontrollermap.properties.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -316,4 +316,6 @@
 	// global plugin settings
 	$actions["pluginSettings"] = "AdminPluginSettingsAction";
 	$actions["updatePluginSettings"] = "AdminUpdatePluginSettingsAction";	
+	// bulk update of blogs
+	$actions["changeBlogStatus"] = "AdminChangeBlogStatusAction";
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php
===================================================================
--- plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_ca_ES.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1162,4 +1162,9 @@
 $messages['error_resources_disabled'] = 'El suport per a afegir nous fitxers al seu bloc ha estat desactivat en aquest lloc web';
 
 $messages['help_login_admin_panel'] = 'Faci clic sobre el nom del bloc per a administrar-lo';
+
+$messages['blog_updated_ok'] = 'El bloc "%s" ha estat actualitzat correctament.';
+$messages['blogs_updated_ok'] = '%s blocs han estat actualitzats correctament.';
+$messages['error_updating_blog2'] = 'S\'ha produït un error actualitzant el bloc amb identificador "%s"';
+$messages['error_updating_blog'] = 'S\'ha produït un error actualitzant el bloc "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_de_DE.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1148,4 +1148,9 @@
 
 $messages['error_resources_disabled'] = 'Sorry, das Hochladen neuer Ressourcen wurde deaktiviert.';
 $messages['help_login_admin_panel'] = 'Klicken Sie auf den Name des Blogs, um zu den Administrationsseiten zu gelangen.';
-?>
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
+?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_en_UK.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1145,4 +1145,9 @@
 
 $messages['error_resources_disabled'] = 'Sorry, support for uploading new resources has been disabled in this site';
 $messages['help_login_admin_panel'] = 'Click the blog name to enter the administration page.';
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_es_ES.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1156,4 +1156,9 @@
 $messages['error_resources_disabled'] = 'El soporte para añadir nuevos ficheros a su bitácora ha sido desactivado en est servidor.';
 
 $messages['help_login_admin_panel'] = 'Haga clic en el nombre de la bitácora para administrarla';
+
+$messages['blog_updated_ok'] = 'La bitácora "%s" fue actualizada correctamente.';
+$messages['blogs_updated_ok'] = '%s bitácoras fueron actualizadas correctamente';
+$messages['error_updating_blog2'] = 'Hubo un error actualizando la bitácora cuyo identificador es "%s"';
+$messages['error_updating_blog'] = 'Hubo un error actualizando la bitácora "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_fr_FR.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1326,4 +1326,8 @@
 $messages['same_as_image'] = 'Même que l\'image originale';
 $messages['agreement'] = 'Acceptation des conditions'; 
 
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_it_IT.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1144,4 +1144,8 @@
 $messages['error_resources_disabled'] = 'Spiacenti, il supporto per il caricamento di nuove risorse è stato disabilitato in questo sito';
 $messages['help_login_admin_panel'] = 'Clicca sul nome del blog per entrare nella pagina di amministrazione.';
 
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_nl_NL.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1224,4 +1224,8 @@
 $messages['purging_error'] = 'Het is misgelopen tijdens het purgen van de data';
 $messages['help_login_admin_panel'] = 'Klik op de blog naam om op de administratie pagina te komen.';
 
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 ?>
\ 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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_CN.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1145,4 +1145,9 @@
 
 $messages['error_resources_disabled'] = '抱歉!本网站的上传功能已经被管理者关闭。';
 $messages['help_login_admin_panel'] = '点选博客名称,进入博客管理页面。';
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%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-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/locale/admin/locale_zh_TW.php	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1145,4 +1145,9 @@
 
 $messages['error_resources_disabled'] = '抱歉!本網站的上傳功能已經被管理者關閉。';
 $messages['help_login_admin_panel'] = '點選網誌名稱,進入網誌管理頁面。';
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog whose identifier is "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 ?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/templates/admin/siteblogs.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/siteblogs.template	2007-03-22 08:55:28 UTC (rev 5153)
+++ plog/branches/lifetype-1.2/templates/admin/siteblogs.template	2007-03-22 09:40:36 UTC (rev 5154)
@@ -1,5 +1,11 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editSiteBlogs title=$locale->tr("editSiteBlogs")}
+<script type="text/javascript" src="js/ui/plogui.js"></script>
+<script type="text/javascript">
+	var errorCommentStatusMsg = '{$locale->tr("error_comment_status")}';
+	var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
+	var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
+</script>
         <div id="list_nav_bar">
             <div id="list_nav_select">
             
@@ -34,6 +40,11 @@
  </div> 
  
  <form id="editBlogs" method="post" action="admin.php">
+{check_perms adminperm=update_site_blog}	
+     <div class="optionIcon">
+		<a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
+	</div>
+{/check_perms}	
   <div id="list"> 
   {include file="$admintemplatepath/successmessage.template"}
   {include file="$admintemplatepath/errormessage.template"}
@@ -96,6 +107,21 @@
     <input type="hidden" name="op" value="deleteBlogs"/>
     <input type="submit" name="{$locale->tr("delete")}" value="{$locale->tr("delete")}"/>  
     {/check_perms}
+	{check_perms adminperm=update_site_blog}
+    <div id="massiveChangeOption" style="display: none">
+        <fieldset>	
+        <legend>{$locale->tr("massive_change_option")}</legend>            
+            <label for="blogStatus">{$locale->tr("status")}</label>
+            <select name="blogStatus" id="blogStatus">
+              <option value="-1">-{$locale->tr("select")}-</option>
+		    	{foreach from=$blogstatus key=name item=status}
+		      		{if $status != -1}<option value="{$status}">{$locale->tr($name)}</option>{/if}
+		    	{/foreach}	
+            </select>
+            <input type="button" name="changeBlogStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitBlogsList('changeBlogStatus');" /> 
+        </fieldset>
+	</div>
+	{/check_perms}
   </div> 
  </form>
 {include file="$admintemplatepath/footernavigation.template"}



More information about the pLog-svn mailing list