[pLog-svn] r5916 - in plugins/branches/lifetype-1.2: . trash trash/class/action trash/class/view trash/locale trash/templates

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Sep 7 06:11:41 EDT 2007


Author: jondaley
Date: 2007-09-07 06:11:41 -0400 (Fri, 07 Sep 2007)
New Revision: 5916

Added:
   plugins/branches/lifetype-1.2/trash/
Removed:
   plugins/branches/lifetype-1.2/abtrash/
Modified:
   plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php
   plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php
   plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php
   plugins/branches/lifetype-1.2/trash/locale/locale_en_UK.php
   plugins/branches/lifetype-1.2/trash/pluginabtrash.class.php
   plugins/branches/lifetype-1.2/trash/readme.txt
   plugins/branches/lifetype-1.2/trash/templates/viewtrash.template
Log:
renamed abTrash to trash.
added validation of input when deleting multiple posts.
added more error messages on errors.
added $source parameter to parent::constructor,
   and removed now unneeded menu include
removed duplicate locale string




Copied: plugins/branches/lifetype-1.2/trash (from rev 5915, plugins/branches/lifetype-1.2/abtrash)

Modified: plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/class/action/adminemptytrashaction.class.php	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php	2007-09-07 10:11:41 UTC (rev 5916)
@@ -1,10 +1,7 @@
 <?php
 
    	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-    lt_include( PLOG_CLASS_PATH."plugins/abtrash/class/view/adminviewtrashview.class.php" );
-    lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+    lt_include( PLOG_CLASS_PATH."plugins/trash/class/view/adminviewtrashview.class.php" );
 	
 	/**
      * empty trash
@@ -17,6 +14,7 @@
 	    
         function AdminEmptyTrashAction( $actionInfo, $request )
         {
+            lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
         	$this->AdminAction( $actionInfo, $request );
         	
 			// data validation stuff...
@@ -24,7 +22,8 @@
 				$this->registerFieldValidator( "postId", new IntegerValidator());
 				$this->_postIds[] = $this->_request->getValue( "postId" );
 			} else {
-				$this->registerFieldValidator( "postIds", new ArrayValidator());
+                lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+				$this->registerFieldValidator( "postIds", new ArrayValidator(new IntegerValidator()));
 				$this->_postIds = $this->_request->getValue( "postIds" );
 			}
 
@@ -39,6 +38,8 @@
         
         function perform()
         {
+            lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+
             $articles = new Articles();
             $errorMessage = "";
 			$successMessage = "";
@@ -55,11 +56,12 @@
 				    
                     // we won't permanently delete undeleted posts
 				    if( POST_STATUS_DELETED != $post->getStatus() ) {
-                        $this->setCommonData();
-			            return true;
+				        $errorMessage .= $this->_locale->tr("error_remove_deleted_only")."<br />";
+                        continue;
                     }
                     
 				    if( $post->getUserId() == $this->_userInfo->getId() ) {
+                            // TODO: check if we have permission to update other's articles, instead of assuming we don't
 				        $result = $articles->deleteArticle( $postId, $post->getUser(), $this->_blogInfo->getId(), true);
 				    } else {
 				        $errorMessage .= $this->_locale->tr("error_can_only_update_own_articles")." ";
@@ -71,11 +73,14 @@
 				    } else {
 				        $totalOk++;
 				        if( $totalOk < 2 ) 
-				        	$successMessage .= $this->_locale->pr("article_deleted_ok", $post->getTopic())."<br/>";
+				        	$successMessage = $this->_locale->pr("article_deleted_ok", $post->getTopic())."<br/>";
 				        else
 				        	$successMessage = $this->_locale->pr("articles_deleted_ok", $totalOk );
 				    }
                 }
+                else{
+                    $errorMessage .= $this->_locale->pr("error_deleting_article2", $postId)."<br />";
+                }                    
             }
 			
 			if( $errorMessage != "" ) 

Modified: plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/class/action/adminviewtrashaction.class.php	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php	2007-09-07 10:11:41 UTC (rev 5916)
@@ -1,7 +1,7 @@
 <?php
 
 	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-	lt_include( PLOG_CLASS_PATH."plugins/abtrash/class/view/adminviewtrashview.class.php" );
+	lt_include( PLOG_CLASS_PATH."plugins/trash/class/view/adminviewtrashview.class.php" );
 	
 	/**
      * view trash

Modified: plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/class/view/adminviewtrashview.class.php	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php	2007-09-07 10:11:41 UTC (rev 5916)
@@ -12,7 +12,7 @@
 	    
 		function AdminViewTrashView( $blogInfo )
 		{
-			$this->AdminPluginTemplatedView( $blogInfo, "abtrash", "viewtrash" );
+			$this->AdminPluginTemplatedView( $blogInfo, "trash", "viewtrash" );
 			$this->_page = $this->getCurrentPageFromRequest();
 			
 			$blogSettings = $blogInfo->getSettings();
@@ -38,7 +38,7 @@
 
             $this->setValue( "posts", $posts );
 			
-			// throw the even in case somebody is listening to it
+			// throw the event in case somebody is listening to it
 			$this->notifyEvent( EVENT_POSTS_LOADED, Array( "posts" => &$posts ));
 			
             $this->setValue( "pager", $pager );

Modified: plugins/branches/lifetype-1.2/trash/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/locale/locale_en_UK.php	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/locale/locale_en_UK.php	2007-09-07 10:11:41 UTC (rev 5916)
@@ -1,6 +1,5 @@
 <?php
 $messages['trash'] = 'Trash';
-$messages['emptyTrash'] = 'Empty Trash';
-$messages['comments'] = 'Comments';
-
+$messages['emptyTrash'] = 'Permanently remove selected articles';
+$messages['error_remove_deleted_only'] = 'Sorry, you can only permanently remove articles that have been marked as \'deleted\'';
 ?>
\ No newline at end of file

Modified: plugins/branches/lifetype-1.2/trash/pluginabtrash.class.php
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/pluginabtrash.class.php	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/pluginabtrash.class.php	2007-09-07 10:11:41 UTC (rev 5916)
@@ -1,21 +1,17 @@
 <?php
 
     lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-    lt_include( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
-    
-    /**
-     * CrystalPoll class
-     */
-    class PluginABTrash extends PluginBase
+
+    class PluginTrash extends PluginBase
     {
-        function PluginABTrash( $source = "" )
+        function PluginTrash( $source = "" )
         {
-            $this->PluginBase();
-            $this->id = "abTrash";
-            $this->desc = "This plugin make you able to delete deleted posts permanently";
+            $this->PluginBase($source);
+            $this->id = "trash";
+            $this->desc = "This plugin allows the post owner to remove deleted posts permanently";
             $this->author = "Ahmad Fathi Saleh (Al Bawaba Team)";
             $this->locale = "locale_en_UK";
-            $this->version = "20070906";
+            $this->version = "20070907";
             if( "admin" == $source ) {
                 $this->adminInit();
             }

Modified: plugins/branches/lifetype-1.2/trash/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/readme.txt	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/readme.txt	2007-09-07 10:11:41 UTC (rev 5916)
@@ -1,8 +1,8 @@
-Plugin: abTrash
-Author: Ahmad Fathi Saleh
-Release Date: 2007/09/06
-Version: 20070906
-
-This plugin make you able to delete deleted posts permanently.
+Plugin: Trash
+Author: Ahmad Fathi Saleh
+Release Date: 2007/09/06
+Version: 20070907
 
+This plugin allows the post owner to remove deleted posts permanently.
 
+

Modified: plugins/branches/lifetype-1.2/trash/templates/viewtrash.template
===================================================================
--- plugins/branches/lifetype-1.2/abtrash/templates/viewtrash.template	2007-09-07 09:30:56 UTC (rev 5915)
+++ plugins/branches/lifetype-1.2/trash/templates/viewtrash.template	2007-09-07 10:11:41 UTC (rev 5916)
@@ -33,7 +33,7 @@
                         <th style="width:50%;">{$locale->tr("topic")}</th>
                         <th style="width:10%;">{$locale->tr("date")}</th>
                         <th style="width:15%;">{$locale->tr("author")}</th>
-                        <th style="width:10%;text-align:center;">{$locale->tr("comments")}</th>
+                        <th style="width:10%;text-align:center;">{$locale->tr("editComments")}</th>
                         <th style="width:10%;">{$locale->tr("actions")}</th>
                     </tr>
                 </thead>
@@ -100,4 +100,4 @@
 
         </form>
 {include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
+{include file="$admintemplatepath/footer.template"}



More information about the pLog-svn mailing list