[pLog-svn] r1166 - in plugins/trunk/moderate: . class class/action class/view locale templates

mark at devel.plogworld.net mark at devel.plogworld.net
Wed Feb 23 10:08:00 GMT 2005


Author: mark
Date: 2005-02-23 10:07:59 +0000 (Wed, 23 Feb 2005)
New Revision: 1166

Added:
   plugins/trunk/moderate/class/view/
   plugins/trunk/moderate/class/view/adminmoderatepluginsettingsview.class.php
   plugins/trunk/moderate/class/view/adminunmoderatedcommentsview.class.php
   plugins/trunk/moderate/locale/locale_zh_TW.php
Modified:
   plugins/trunk/moderate/class/action/adminmoderatepluginsettingsaction.class.php
   plugins/trunk/moderate/class/action/adminmoderatepluginupdatesettingsaction.class.php
   plugins/trunk/moderate/class/action/adminunmoderatedcommentsaction.class.php
   plugins/trunk/moderate/class/action/adminupdateunmoderatedcommentsaction.class.php
   plugins/trunk/moderate/pluginmoderate.class.php
   plugins/trunk/moderate/templates/pluginsettings.template
   plugins/trunk/moderate/templates/unmoderatedcomments.template
Log:
Moderate Plugin complete!! locale messages need to refine.

Modified: plugins/trunk/moderate/class/action/adminmoderatepluginsettingsaction.class.php
===================================================================
--- plugins/trunk/moderate/class/action/adminmoderatepluginsettingsaction.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/action/adminmoderatepluginsettingsaction.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,7 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/view/adminmoderatepluginsettingsview.class.php" );
 
     class AdminModeratePluginSettingsAction extends BlogOwnerAdminAction 
 	{
@@ -20,12 +20,11 @@
          */
         function perform()
         {
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "moderate", "pluginsettings" );
-			$this->_view->setValue( "pluginEnabled", $this->_blogSettings->getValue( "plugin_moderate_enabled" ));
-            $this->setCommonData();
-
-            // better to return true if everything fine
-            return true;
+            $this->_view = new AdminModeratePluginSettingsView( $this->_blogInfo );
+			
+			$this->setCommonData();
+			
+			return true;
         }
     }
 ?>

Modified: plugins/trunk/moderate/class/action/adminmoderatepluginupdatesettingsaction.class.php
===================================================================
--- plugins/trunk/moderate/class/action/adminmoderatepluginupdatesettingsaction.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/action/adminmoderatepluginupdatesettingsaction.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,8 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );	
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/view/adminmoderatepluginsettingsview.class.php" );
 
     class AdminModeratePluginUpdateSettingsAction extends BlogOwnerAdminAction 
 	{
@@ -20,13 +19,9 @@
 		
 		function validate()
 		{
-			$this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+            $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+            $this->_pluginEnabled = ($this->_pluginEnabled != "" );			
 			
-			if( $this->_pluginEnabled == "" )
-				$this->_pluginEnabled = false;
-			else
-				$this->_pluginEnabled = true;
-				
 			return true;
 		}
 		
@@ -35,26 +30,33 @@
          */
         function perform()
         {
+            // // update the plugin configurations to blog setting
 			$blogSettings = $this->_blogInfo->getSettings();
-			$blogSettings->setValue( "plugin_moderate_enabled", $this->_pluginEnabled );
-			$this->_blogInfo->setSettings( $blogSettings );
+            $blogSettings->setValue( "plugin_moderate_enabled", $this->_pluginEnabled );
+            $this->_blogInfo->setSettings( $blogSettings ); 
+		
+			// save the blogs settings
 			$blogs = new Blogs();
+            if( !$blogs->updateBlog( $this->_blogInfo->getId(), $this->_blogInfo )) {
+                $this->_view = new AdminModeratePluginSettingsView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
+                $this->setCommonData();
+
+                return false;                       
+            }
 			
-			// update the settings in the db, and make sure that everything went fine
-			if( !$blogs->updateBlogSettings( $this->_blogInfo->getId(), $this->_blogInfo->getSettings())) {
-				$this->_view = new AdminErrorView( $this->_blogInfo );
-				$this->_view->setMessage( "There was an error saving the plugin configuration." );
-				$this->setCommonData();
-				return false;
-			}
+			// if everything went ok...
+            $this->_blogInfo->setSettings( $blogSettings );
+            $this->_session->setValue( "blogInfo", $this->_blogInfo );
+            $this->saveSession();
 			
-			$this->_session->setValue( "blogInfo", $this->_blogInfo );
-			$this->saveSession();			
-			$this->_view = new AdminMessageView( $this->_blogInfo );
-			$this->_view->setMessage( "Plugin settings saved successfully!" );
-            $this->setCommonData();
-
-            // better to return true if everything fine
+			$this->_view = new AdminModeratePluginSettingsView( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("moderate_settings_saved_ok"));			
+			$this->setCommonData();
+			
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());					
+            
             return true;
         }
     }

Modified: plugins/trunk/moderate/class/action/adminunmoderatedcommentsaction.class.php
===================================================================
--- plugins/trunk/moderate/class/action/adminunmoderatedcommentsaction.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/action/adminunmoderatedcommentsaction.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,9 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
-	include_once( PLOG_CLASS_PATH."plugins/moderate/class/dao/unmoderatedcomments.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/view/adminunmoderatedcommentsview.class.php" );
 
 	/**
 	 * actions that displays the list of unmoderated comments in the blog.
@@ -18,31 +16,8 @@
 		
 		function perform()
 		{
-			// fetch the comments that have not been moderated yet
-			$comments = new UnmoderatedComments();
-			$unmoderatedComments = $comments->getUnmoderatedComments( $this->_blogInfo->getId());
-			
-			$blogSettings = $this->_blogInfo->getSettings();
-			if( !$blogSettings->getValue( "plugin_moderate_enabled" )) {
-				$this->_view = new AdminMessageView( $this->_blogInfo );
-				$this->_view->setMessage( "The plugin is currently disabled. Please enable it in order to use this feature." );
-				$this->setCommonData();
-				
-				return false;			
-			}
-			
-			// check if there is in fact any comment waiting to be moderated...
-			if( count($unmoderatedComments) == 0 ) {
-				$this->_view = new AdminMessageView( $this->_blogInfo );
-				$this->_view->setMessage( "There were no posts waiting to be moderated" );
-				$this->setCommonData();
-				
-				return false;
-			}
-			
-			// and if so, create a view and show them
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "moderate", "unmoderatedcomments" );
-			$this->_view->setValue( "comments", $unmoderatedComments );
+			$this->_view = new AdminUnmoderatedCommentsview( $this->_blogInfo );
+
 			$this->setCommonData();
 			
 			return true;

Modified: plugins/trunk/moderate/class/action/adminupdateunmoderatedcommentsaction.class.php
===================================================================
--- plugins/trunk/moderate/class/action/adminupdateunmoderatedcommentsaction.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/action/adminupdateunmoderatedcommentsaction.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,8 +1,8 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
+    include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );	
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/view/adminunmoderatedcommentsview.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/moderate/class/dao/unmoderatedcomments.class.php" );
 
 	/**
@@ -11,30 +11,55 @@
 	class AdminUpdateUnmoderatedCommentsAction extends AdminAction
 	{
 	
-		var $_commentIds;
+		var $_updateComments;
+		var $_commentId;
 		var $_mode;
 	
 		function AdminUpdateUnmoderatedCommentsAction( $request, $actionInfo )
 		{
 			$this->AdminAction( $request, $actionInfo );
+
+			$this->_op = $request->getActionParamValue();
+			
+			$view = new AdminUnmoderatedCommentsview( $this->_blogInfo );			
+			if( $this->_op == "updateUnmoderatedComment" ) {
+				$this->registerFieldValidator( "commentId", new IntegerValidator());
+				$view->setErrorMessage( $this->_locale->tr("error_incorrect_comment_id"));	
+			}
+			else {
+				$this->registerFieldValidator( "updateComments", new ArrayValidator());
+				$view->setErrorMessage( $this->_locale->tr("error_no_unmoderated_comment_selected"));
+			}
+			$this->setValidationErrorView( $view ); 			
 		}
 		
-		function validate()
+		function perform()
 		{
-			// fetch the ids of the comments that were selected
-			$this->_commentIds = $this->_request->getValue( "updateComments" );
-			print_r($this->_commentIds);			
-			
-			if( !is_array($this->_commentIds) || empty($this->_commentIds )) {
-				$this->_view = new AdminErrorView( $this->_blogInfo );
-				$this->_view->setMessage( "There were no comments selected to update." );
-				$this->setCommonData();
+			if( $this->_op == "updateUnmoderatedComment" ) {
+				$this->_updateComments = Array();
+				$this->_commentId = $this->_request->getValue( "commentId" );
+				$this->_updateComments[] = $this->_commentId;
+				$this->_mode = $this->_request->getValue( "mode" );
+			} else {
+				$this->_updateComments = $this->_request->getValue( "updateComments" );
+				if( $this->_request->getValue( "moderate" )) {
+				    $this->_mode = 1;
+				} else {
+				    $this->_mode = 0;
+				}
+		    }
 				
-				return false;
-			}
-			
-			return true;
+			$this->_updateComments();
 		}
+
+		function _updateComments()
+		{
+			// and the mode, whether we're allowing them or rejecting them
+			if( $this->_mode )
+				return $this->_acceptComments();
+			else
+				return $this->_rejectComments();
+		}
 		
 		/**
 		 * changes the status of the comments to be ok
@@ -43,13 +68,16 @@
 		{
 			$comments = new UnmoderatedComments();
 			
-			foreach( $this->_commentIds as $commentId ) {
+			foreach( $this->_updateComments as $commentId ) {
 				$comments->updateCommentStatus( $commentId, COMMENT_STATUS_NONSPAM );
 			}
 			
-			$this->_view = new AdminMessageView( $this->_blogInfo );
-			$this->_view->setMessage( "Comments moderated successfully!" );
+			$this->_view = new AdminUnmoderatedCommentsview( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("moderate_comments_moderated_ok") );
 			$this->setCommonData();
+
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());			
 			
 			return true;
 		}
@@ -61,25 +89,18 @@
 		{
 			$comments = new UnmoderatedComments();
 			
-			foreach( $this->_commentIds as $commentId ) {
+			foreach( $this->_updateComments as $commentId ) {
 				$comments->deleteComment( $commentId );
 			}
 			
-			$this->_view = new AdminMessageView( $this->_blogInfo );
-			$this->_view->setMessage( "Comments rejected (removed) successfully!" );
+			$this->_view = new AdminUnmoderatedCommentsview( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("moderate_comments_rejected_ok") );
 			$this->setCommonData();
+
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());			
 			
 			return true;
 		}
-		
-		
-		function perform()
-		{
-			// and the mode, whether we're allowing them or rejecting them
-			if( $this->_request->getValue( "moderate" ))
-				return $this->_acceptComments();
-			else
-				return $this->_rejectComments();
-		}
 	}
 ?>
\ No newline at end of file

Added: plugins/trunk/moderate/class/view/adminmoderatepluginsettingsview.class.php
===================================================================
--- plugins/trunk/moderate/class/view/adminmoderatepluginsettingsview.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/view/adminmoderatepluginsettingsview.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -0,0 +1,28 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class AdminModeratePluginSettingsView extends AdminPluginTemplatedView
+	{
+
+		function AdminModeratePluginSettingsView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "moderate", "pluginsettings" );
+		}
+		
+		function render()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_moderate_enabled" );
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );		
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/moderate/class/view/adminunmoderatedcommentsview.class.php
===================================================================
--- plugins/trunk/moderate/class/view/adminunmoderatedcommentsview.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/class/view/adminunmoderatedcommentsview.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -0,0 +1,40 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/dao/unmoderatedcomments.class.php" );	
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class AdminUnmoderatedCommentsview extends AdminPluginTemplatedView
+	{
+
+		function AdminUnmoderatedCommentsview( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "moderate", "unmoderatedcomments" );
+		}
+		
+		function render()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_moderate_enabled" );
+
+			// fetch the comments that have not been moderated yet
+			$comments = new UnmoderatedComments();
+			$unmoderatedComments = $comments->getUnmoderatedComments( $this->_blogInfo->getId());			
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );
+			$this->setValue( "comments", $unmoderatedComments );
+
+            if (!$pluginEnabled) {
+                $locale = $this->_blogInfo->getLocale();
+                $text = $locale->tr("error_moderate_not_enabled");
+                $this->setErrorMessage( $text );
+            }  						
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/moderate/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/moderate/locale/locale_zh_TW.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/locale/locale_zh_TW.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -0,0 +1,7 @@
+<?php
+
+$messages["comment_status_unmoderated"] = "未上架";
+$messages["moderatePluginSettings"] = "迴響阻隔設定";
+$messages["unmoderatedComments"] = "未上架迴響列表";
+
+?>
\ No newline at end of file

Modified: plugins/trunk/moderate/pluginmoderate.class.php
===================================================================
--- plugins/trunk/moderate/pluginmoderate.class.php	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/pluginmoderate.class.php	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,6 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/moderate/class/dao/unmoderatedcomments.class.php" );
 	
 	/**
 	 * implements moderation of comments
@@ -15,7 +16,7 @@
 			$this->id = "moderate";
 			$this->description = "Provides moderation of comments";
 			$this->author = "The pLog Team";
-			$this->locales = Array( "en_UK" );
+			$this->locales = Array( "en_UK", "zh_TW" );
 			
 			$this->init();
 		}
@@ -56,13 +57,18 @@
 			// register an action that will allow users to see which comments have not been
 			// accepted yet
 			$this->registerAdminAction( "unmoderatedComments", "AdminUnmoderatedCommentsAction" );
+			$this->registerAdminAction( "updateUnmoderatedComment", "AdminUpdateUnmoderatedCommentsAction" );
 			$this->registerAdminAction( "updateUnmoderatedComments", "AdminUpdateUnmoderatedCommentsAction" );
 			$this->registerAdminAction( "moderatePluginSettings", "AdminModeratePluginSettingsAction" );
 			$this->registerAdminAction( "moderatePluginUpdateSettings", "AdminModeratePluginUpdateSettingsAction" );
 			
 			// add a menu entry
 			$this->addMenuEntry( "/menu/Manage/managePosts", "unmoderatedComments", "admin.php?op=unmoderatedComments", "", false, false );
-			$this->addMenuEntry( "/menu/controlCenter/manageSettings", "moderatePluginSettings", "admin.php?op=moderatePluginSettings", "", true, false );			
+
+			$menu =& Menu::getMenu();
+            if( !$menu->entryExists( "/menu/controlCenter/manageAntiSpamPlugins" ))                     
+                $this->addMenuEntry( "/menu/controlCenter", "manageAntiSpamPlugins", "", "", true, false );
+            $this->addMenuEntry( "/menu/controlCenter/manageAntiSpamPlugins", "moderatePluginSettings", "admin.php?op=moderatePluginSettings", "", true, false );
 		}
 	}  
 ?>
\ No newline at end of file

Modified: plugins/trunk/moderate/templates/pluginsettings.template
===================================================================
--- plugins/trunk/moderate/templates/pluginsettings.template	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/templates/pluginsettings.template	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,19 +1,24 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=moderatePluginSettings title=$locale->tr("moderatePluginSettings")}
-<p>
- This plugin will allow you to put comments in a queue and will not be published until they have been
- either accepted or rejected by you. Accepting a comment will automatically publish it in the site, while
- rejecting the comment will remove it from the database. 
-</p>
-<p>
- Please remember that filters (bayesian filter, host blocking, etc) take preference over plugins, so filters
- will always be executed before any plugin.
-</p>
-<form name="pluginModerateSettings" action="admin.php" method="post">
- <input type="checkbox" name="pluginEnabled" value="1" {if $pluginEnabled}checked="checked"{/if} />
- Enable this plugin.<br/><br/>
- <input type="hidden" name="op" value="moderatePluginUpdateSettings" />
- <input type="submit" name="{$locale->tr("update")}" value="{$locale->tr("update")}" />
+<form name="pluginModerateSettings" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("label_configuration")}</legend>  
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}   
+  <div class="field">
+   <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
+   <div class="formHelp">   
+    <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("moderate_plugin_enabled")}
+   </div>
+  </div>
+  
+ </fieldset>  
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="moderatePluginUpdateSettings" />
+  <input type="reset" name="{$locale->tr("reset")}" />    
+  <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+ </div>
 </form>
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plugins/trunk/moderate/templates/unmoderatedcomments.template
===================================================================
--- plugins/trunk/moderate/templates/unmoderatedcomments.template	2005-02-23 08:32:48 UTC (rev 1165)
+++ plugins/trunk/moderate/templates/unmoderatedcomments.template	2005-02-23 10:07:59 UTC (rev 1166)
@@ -1,36 +1,75 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=unmoderatedComments title=$locale->tr("unmoderatedComments")}
-<form name="comments" action="admin.php" method="post">
-<table  border="1" width="100%">
- <tr>
-  <th width="10%">{$locale->tr("topic")}</th>
-  <th width="35%">{$locale->tr("text")}</th>
-  <th>{$locale->tr("date")}</th>
-  <th>{$locale->tr("posted_by")}</th>
-  <th>{$locale->tr("email")}</th>
-  <th>{$locale->tr("url")}</th>
-  <th>{$locale->tr("ip_address")}</th>
-  <th>{$locale->tr("status")}</th>
-  <th>{$locale->tr("select")}</th>
- </tr>
- {foreach from=$comments item=comment}
-  <tr>
-   <td valign="top">{$comment->getTopic()}</td>
-   <td valign="top">{$comment->getText()}</td>
-   {assign var="date" value=$comment->getDateObject()}
-   <td>{$locale->formatDate($date,"%d/%m/%Y %H:%M")}</td>
-   <td>{$comment->getUserName()}</td>
-   <td><a href="mailto:{$comment->getUserEmail()}">{$comment->getUserEmail()}</a></td>
-   <td><a href="{$comment->getUserUrl()}">{$comment->getUserUrl()}</a></td>
-   <td>{$comment->getClientIp()} <a href="admin.php?op=blogBlockHostFromPosting&amp;hostIp={$comment->getClientIp()}">(Block)</a></td>
-   <td>Unmoderated</td>
-   <td align="center"><input type="checkbox" name="updateComments[{counter}]" value="{$comment->getId()}"/>
-  </tr>
- {/foreach}
- </table>
- <input type="hidden" name="op" value="updateUnmoderatedComments"/>
- <input type="submit" name="moderate" value="Moderate Selected Comemnts" /><br/>
- <input type="submit" name="reject" value="Reject Selected Comemnts" /><br/> 
+{if $pluginEnabled}
+<form id="unmoderatedComments" action="admin.php" method="post">
+ <div id="list">
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+  <table class="info">
+   <thead>
+    <tr>					
+     <th style="width:10px;"><input class="checkbox" type="checkbox" class="check" name="all" id="all" value="1" onclick="toggleAllChecks('unmoderatedComments');" /></th>
+     <th style="width:85px;">{$locale->tr("topic")}</th>						
+     <th style="width:360px;">{$locale->tr("text")}</th>
+     <th style="width:70px;">{$locale->tr("author")}</th>
+	 <th stlye="width:60px;">{$locale->tr("date")}</th>
+     <th style="width:60px;">{$locale->tr("status")}</th>
+     <th style="width:45px;">IP</th>
+     <th style="width:95px;">{$locale->tr("actions")}</th>
+    </tr>
+   </thead>
+   <tbody>
+    {foreach from=$comments item=comment}
+     <tr class="{cycle values="odd, even"}">
+      <td>
+       <input class="checkbox" type="checkbox" name="updateComments[{$comment->getId()}]" id="checks_{$comment->getId()}" value="{$comment->getId()}" />
+      </td>
+      <td class="col_highlighted">
+       {$comment->getTopic()}
+      </td>
+	  <td>
+	   {$comment->getText()}
+	  </td>
+      <td>
+	   <a href="mailto:{$comment->getUserEmail()}">
+	    {$comment->getUserEmail()}
+	   </a>
+      </td>						
+      <td>
+       {assign var=date value=$comment->getDateObject()}
+       {$locale->formatDate($date)}
+      </td>
+      <td>
+       {foreach from=$commentstatus key=name item=status}
+        {if $comment->getStatus() == $status}{$locale->tr($name)}{/if}
+       {/foreach}
+      </td>
+      <td style="text-align: center;">
+	   {$comment->getClientIp()}
+      </td>						
+      <td>
+       <div class="list_action_button">
+	    <a href="?op=updateUnmoderatedComment&amp;mode=1&amp;commentId={$comment->getId()}">
+		 <img src="imgs/icon_add-16.png" alt="{$locale->tr("moderate")}" />
+		</a>
+		<a href="?op=updateUnmoderatedComment&amp;mode=0&amp;commentId={$comment->getId()}">
+		 <img src="imgs/icon_delete-16.png" alt="{$locale->tr("reject")}" />
+		</a>
+       </div>
+      </td>
+     </tr>
+    {/foreach}
+   </tbody>
+  </table>
+ </div>
+
+ <div id="list_action_bar">
+  <input type="hidden" name="op" value="updateUnmoderatedComments"/>
+  <input type="submit" name="moderate" value="{$locale->tr("moderate")}" />
+  <input type="submit" name="reject" value="{$locale->tr("reject")}" />
+ </div>
 </form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
+{else}
+ {include file="$admintemplatepath/errormessage.template"}
+{/if}
+{include file="$admintemplatepath/footer.template"}




More information about the pLog-svn mailing list