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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Nov 24 05:29:06 GMT 2005


Author: jondaley
Date: 2005-11-24 05:29:06 +0000 (Thu, 24 Nov 2005)
New Revision: 2623

Added:
   plugins/trunk/editcomments/
   plugins/trunk/editcomments/class/
   plugins/trunk/editcomments/class/action/
   plugins/trunk/editcomments/class/action/admineditcommentaction.class.php
   plugins/trunk/editcomments/class/action/adminplugineditcommentsaction.class.php
   plugins/trunk/editcomments/class/action/adminupdatecommentaction.class.php
   plugins/trunk/editcomments/class/view/
   plugins/trunk/editcomments/class/view/admineditcommentsview.class.php
   plugins/trunk/editcomments/class/view/admineditcommentview.class.php
   plugins/trunk/editcomments/locale/
   plugins/trunk/editcomments/locale/locale_en_UK.php
   plugins/trunk/editcomments/plugineditcomments.class.php
   plugins/trunk/editcomments/readme.txt
   plugins/trunk/editcomments/templates/
   plugins/trunk/editcomments/templates/editcomment.template
   plugins/trunk/editcomments/templates/editcomments.template
Log:
my first plugin that gets more into lifetype's guts.  Please feel free to fix it, because I probably don't know what I am doing.

Added: plugins/trunk/editcomments/class/action/admineditcommentaction.class.php
===================================================================
--- plugins/trunk/editcomments/class/action/admineditcommentaction.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/class/action/admineditcommentaction.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,25 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentview.class.php" );
+
+	/**
+	 * actions that displays the list of comments in the blog.
+	 */
+	class AdminEditCommentAction extends AdminAction{
+	
+		function AdminEditCommentAction( $actionInfo, $request ){
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform(){
+            $commentId = $this->_request->getValue("commentId");
+
+            $this->_view = new AdminEditCommentView($this->_blogInfo, $commentId);
+
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/class/action/adminplugineditcommentsaction.class.php
===================================================================
--- plugins/trunk/editcomments/class/action/adminplugineditcommentsaction.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/class/action/adminplugineditcommentsaction.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,36 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentsview.class.php" );
+
+	/**
+	 * actions that displays the list of comments in the blog.
+	 */
+	class AdminPluginEditCommentsAction extends AdminAction{
+	
+		function AdminPluginEditCommentsAction($actionInfo, $request){
+			$this->AdminAction($actionInfo, $request);
+		}
+		
+		function perform(){
+        	$articleId = $this->_request->getValue( "articleId" );
+			$showStatus = $this->_request->getValue( "showStatus" );
+			
+			$articles = new Articles();
+			$article = $articles->getBlogArticle( $articleId, $this->_blogInfo->getId());
+			if( !$article ) {
+				$this->_view = new AdminPostsListView( $this->_blogInfo );
+				$this->_view->setErrorMessage( $this->_locale->tr("error_fetching_post" ));				
+			}
+			else{
+                $this->_view = new AdminEditCommentsView( $this->_blogInfo,
+                                                          Array("article" => $article,
+                                                                "showStatus" => $showStatus));
+            }
+
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/class/action/adminupdatecommentaction.class.php
===================================================================
--- plugins/trunk/editcomments/class/action/adminupdatecommentaction.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/class/action/adminupdatecommentaction.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,138 @@
+<?php
+
+include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
+include_once( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentview.class.php" );
+include_once( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentsview.class.php" );
+include_once( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
+
+class AdminUpdateCommentAction extends AdminAction{
+    var $_commentId;
+    var $_articleId;
+	var $_op;
+    
+    function AdminUpdateCommentAction($actionInfo, $request){
+        $this->AdminAction($actionInfo, $request);
+
+        $this->_commentId = $this->_request->getValue("commentId");
+        $this->_articleId = $this->_request->getValue("articleId");
+        $this->_op = $actionInfo->getActionParamValue();
+        if($this->_request->getValue("cancel")){
+            $this->_op = "cancel";
+        }
+        
+        if($this->_op == "updateComment"){
+            $view = new AdminEditCommentView($this->_blogInfo, $commentId);
+
+            $this->registerFieldValidator("commentId", new IntegerValidator());
+            $this->registerFieldValidator("commentText", new StringValidator());
+            $this->registerFieldValidator("authorName", new UserNameValidator());
+            $this->registerFieldValidator("commentStatus", new IntegerValidator());
+                // no validation??  
+            $this->registerField("commentTopic");
+            $this->registerField("authorEmail");
+            $this->registerField("authorUrl");
+            $this->registerField("commentDateTime");
+            $this->registerField("commentIp");
+            
+            $view->setErrorMessage( $this->_locale->tr("invalid_data"));
+            $this->setValidationErrorView( $view );
+        }
+    }
+
+    function _updateComment($id, $topic, $text, $user_name, $user_email,
+                            $user_url, $client_ip, $status, $date){
+        if(!ArticleCommentStatus::isValidStatus($status))
+            return false;
+
+        $prefix = Db::getPrefix();
+        $filter = new TextFilter();
+        $db =& Db::getDb();
+        
+        $query = "UPDATE ".$prefix."articles_comments ";
+        $query .= "set topic='".Db::qstr($topic)."', ";
+        $query .= "text='".Db::qstr($text)."', ";
+        $query .= "user_name='".Db::qstr($user_name)."', ";
+        $query .= "user_email='".Db::qstr($user_email)."', ";
+        $query .= "user_url='".Db::qstr($user_url)."', ";
+        $query .= "client_ip='".$client_ip."', ";
+        $query .= "status=".$status.", ";
+        $query .= "date='".$date->getTimestamp()."', ";
+        $query .= "normalized_text='".Db::qstr($filter->normalizeText($text))."', ";
+        $query .= "normalized_topic='".Db::qstr($filter->normalizeText($topic))."' ";
+        $query .= "WHERE id=".$id;
+//        print $query;
+        return($db->Execute( $query ));
+
+        return false;
+    }
+
+        // copied from AdminPostManagementCommon class
+    function _fetchCommentDateInformation(){
+        $commentDateTime = $this->_request->getValue("commentDateTime");
+        $dateTimeParts = explode(" ", $commentDateTime);
+        $dateParts = explode("/", $dateTimeParts[0] );
+        $timeParts = explode(":",$dateTimeParts[1] );
+        
+        $postTimestamp = new Timestamp();
+        $postTimestamp->setMinutes($timeParts[1]);
+        $postTimestamp->setHour($timeParts[0]);
+        $postTimestamp->setDay($dateParts[0]);
+        $postTimestamp->setMonth($dateParts[1]);
+        $postTimestamp->setYear($dateParts[2]);
+
+        return $postTimestamp;
+    }
+
+    
+    function perform(){
+        if($this->_op == "updateComment"){
+            $topic = $this->_request->getValue("commentTopic");
+            $text = $this->_request->getValue("commentText");
+            $name = $this->_request->getValue("authorName");
+            $email = $this->_request->getValue("authorEmail");
+            $url = $this->_request->getValue("authorUrl");
+            $dateTime = $this->_fetchCommentDateInformation();
+            $status = $this->_request->getValue("commentStatus");
+            $ip = $this->_request->getValue("commentIp");
+            
+            if($this->_updateComment($this->_commentId, $topic, $text, $name, $email,
+                                     $url, $ip, $status, $dateTime)){
+                if($this->_articleId){
+                    $articles = new Articles();
+                    $article = $articles->getBlogArticle($this->_articleId,
+                                                         $this->_blogInfo->getId());
+                    $this->_view = new AdminEditCommentsView($this->_blogInfo,
+                                                             array("article" => $article));
+                }
+                else{
+                    $this->_view = new AdminPostsListView( $this->_blogInfo );
+                }
+                $this->_view->setSuccessMessage( $this->_locale->tr("edit_comment_ok") );
+                CacheControl::resetBlogCache( $this->_blogInfo->getId());
+            }
+            else{
+                $this->_view = new AdminEditCommentView($this->_blogInfo, $id);
+                $this->_view->setErrorMessage( $this->_locale->tr("edit_comment_failed") );
+            }
+        }
+        else if($this->_articleId){
+			$articles = new Articles();
+			$article = $articles->getBlogArticle( $this->_articleId, $this->_blogInfo->getId());
+
+            $this->_view = new AdminEditCommentsView($this->_blogInfo, array("article" => $article));
+            $this->_view->setSuccessMessage( $this->_locale->tr("edit_comment_cancelled") );
+        }
+        else{
+            $this->_view = new AdminPostsListView($this->_blogInfo);
+        }
+        
+        
+        $this->setCommonData();
+    }
+}
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/class/view/admineditcommentsview.class.php
===================================================================
--- plugins/trunk/editcomments/class/view/admineditcommentsview.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/class/view/admineditcommentsview.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,84 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/articlecommentstatus.class.php" );	
+    include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
+
+	class AdminEditCommentsView extends AdminPluginTemplatedView
+	{
+        var $_article;
+        var $_commentStatus;
+        var $_page;
+        
+		function AdminEditCommentsView( $blogInfo, $params = Array() ){
+			$this->AdminPluginTemplatedView( $blogInfo, "editcomments", "editcomments" );
+			$this->_setParameters( $params );
+            $this->_page = $this->getCurrentPageFromRequest();
+
+		}
+		
+		function render(){
+			// load the comments and throw the correct event
+			$comments = new ArticleComments();
+			$postComments = $comments->getPostComments( $this->_article->getId(),
+														COMMENT_ORDER_NEWEST_FIRST,
+														$this->_commentStatus, 
+														$this->_page, 
+														DEFAULT_ITEMS_PER_PAGE );
+			$this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
+			// number of comments
+			$numPostComments = $comments->getNumPostComments( $this->_article->getId(), $this->_commentStatus );
+
+			if( $this->_commentStatus > -1 )
+				$pagerUrl = "?op=editComments&amp;articleId=".$this->_article->getId()."&amp;showStatus=".$this->_commentStatus."&amp;page=";
+			else
+				$pagerUrl = "?op=editComments&amp;articleId=".$this->_article->getId()."&amp;page=";
+				
+			// calculate the pager url
+			$pager = new Pager( $pagerUrl,
+					    $this->_page,
+					    $numPostComments,
+					    DEFAULT_ITEMS_PER_PAGE );
+														
+			// get a list with all the different comment status
+			$statusList = ArticleCommentStatus::getStatusList( true );
+			// and pass all the information to the templates
+			$this->setValue( "comments", $postComments);
+			$this->setValue( "commentstatus", $statusList );
+			$this->setValue( "currentstatus", $this->_commentStatus );
+
+			// pass the pager to the view
+			$this->setValue( "pager", $pager );+
+		
+			// pass the common data to the templates
+			$this->setValue( "post", $this->_article );
+						
+			parent::render();
+
+/*//            print "admineditcommentsview->render";
+                // fetch comments
+                // TODO: set max?  show grouped by post?
+			$_articleComments = new ArticleComments();
+            $comments = $_articleComments->getBlogComments( $this->_blogInfo->getId());
+            
+                // create a view and export the settings to the template
+            $this->setValue( "editcomments", $comments );
+            
+            parent::render();*/
+		}
+
+		function _setParameters( $params )
+		{
+			// fetch the article id
+			$this->_article = $params["article"];
+			
+			// load the status
+			$this->_commentStatus = $params["showStatus"];
+			if( !ArticleCommentStatus::isValidStatus( $this->_commentStatus )) 
+				$this->_commentStatus = COMMENT_STATUS_ALL;			
+		}
+        
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/class/view/admineditcommentview.class.php
===================================================================
--- plugins/trunk/editcomments/class/view/admineditcommentview.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/class/view/admineditcommentview.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,36 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
+
+	class AdminEditCommentView extends AdminPluginTemplatedView
+	{
+        var $_commentId;
+        
+		function AdminEditCommentView($blogInfo, $commentId){
+            $this->_commentId = $commentId;
+			$this->AdminPluginTemplatedView( $blogInfo, "editcomments", "editcomment" );
+		}
+		
+		function render(){
+                // fetch comment
+			$articleComments = new ArticleComments();
+			$comment = $articleComments->getComment($this->_commentId);
+
+            if($comment){
+                $commentDate = $comment->getDateObject();
+                $this->setValue( "commentYear", $commentDate->getYear());
+                $this->setValue( "commentMonth", $commentDate->getMonth());
+                $this->setValue( "commentDay", $commentDate->getDay());
+                $this->setValue( "commentHour", $commentDate->getHour());
+                $this->setValue( "commentMinutes", $commentDate->getMinutes());
+            }
+
+            $statusList = ArticleCommentStatus::getStatusList();
+            $this->setValue( "commentstatus", $statusList );
+			$this->setValue( "editcomment", $comment );
+
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/editcomments/locale/locale_en_UK.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/locale/locale_en_UK.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,11 @@
+<?php
+
+$messages["editComments"] = "Edit Comments";
+$messages["editComment"] = "Edit Comment";
+
+$messages["editCommentCancel"] = "Cancel";
+$messages["edit_comment_ok"] = "Comment saved successfully!";
+$messages["edit_comment_cancelled"] = "Comment edits discarded.";
+
+$messages["edit_date_format"] = "dd/mm/yyyy hh:mm:ss";
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/plugineditcomments.class.php
===================================================================
--- plugins/trunk/editcomments/plugineditcomments.class.php	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/plugineditcomments.class.php	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,30 @@
+<?php
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+	
+	class PluginEditComments extends PluginBase{
+
+		function PluginEditComments(){
+			$this->PluginBase();
+
+			$this->id = "editcomments";
+			$this->desc = "Allows blog owner to edit comment text";
+			$this->author = "Jon Daley";
+			$this->locales = Array( "en_UK" );
+			
+			$this->init();
+		}
+		
+		/**
+		 * registers all of the actions that we're going to use
+		 */
+		function init(){			
+                // Override(!) the default editComments action.  Cool
+			$this->registerAdminAction( "editComments", "AdminPluginEditCommentsAction" );
+
+                // Here are our additional features that we are adding to the regular
+                // comment adding
+            $this->registerAdminAction( "editComment", "AdminEditCommentAction" );
+			$this->registerAdminAction( "updateComment", "AdminUpdateCommentAction" );
+		}
+	}  
+?>
\ No newline at end of file

Added: plugins/trunk/editcomments/readme.txt
===================================================================
--- plugins/trunk/editcomments/readme.txt	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/readme.txt	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,18 @@
+Plugin: EditComments
+Author: Jon Daley
+Release Date: 2005/11/24
+Version: 1.0
+
+This plugin allows the blog owner to edit comments via the
+administration interface to fix typos, etc.
+
+Install:
+1. Copy the files into your plugin directory like any other plugin.
+
+Use:
+1. Go to Manage Posts -> Posts and click on a comment in the "CM"
+field.
+2. On the edit comments page, there is now a link on the far right
+   to edit the actual comment.
+3. Click that button, and you should be able to see the topic, text,
+   username, url, etc. to manually edit.

Added: plugins/trunk/editcomments/templates/editcomment.template
===================================================================
--- plugins/trunk/editcomments/templates/editcomment.template	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/templates/editcomment.template	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,78 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editComment")}
+<script type="text/javascript" src="js/calendar/datetimepicker.js"></script>
+
+<form id="editComment" action="admin.php" method="post">
+ <div id="list">
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+  <table class="info">
+    <tr>
+     <th>{$locale->tr("topic")}</th>
+     <td><input size="50" type="text" name="commentTopic" id=commentTopic"
+             value="{$editcomment->getTopic()}" /></td>
+    </tr>
+    <tr>
+     <th style="vertical-align: top">{$locale->tr("text")}</th>
+     <td><textarea name="commentText" id="commentText"
+          rows="10" cols="50">{$editcomment->getText()}</textarea>
+     </td>
+    </tr>
+    <tr>
+     <th>{$locale->tr("author")}</th>
+     <td><input type="text" name="authorName" id=authorName"
+             value="{$editcomment->getUsername()}" /></td>
+    </tr>
+    <tr>
+     <th>{$locale->tr("email")}</th>
+     <td><input size="30" type="text" name="authorEmail" id=authorEmail"
+             value="{$editcomment->getUserEmail()}" /></td>
+    </tr>
+    <tr>
+     <th>{$locale->tr("url")}</th>
+     <td><input size=60 type="text" name="authorUrl" id="authorUrl"
+             value="{$editcomment->getUserUrl()}" /></td>
+    </tr>
+    <tr>
+	 <th>{$locale->tr("date")}</th>
+      <td>
+         {$locale->tr("edit_date_format")}<br/>
+		 <input name="commentDateTime" id="commentDateTime" class="dateTime"
+               readonly="true" type="text" size="20"
+               value="{$commentDay}/{$commentMonth}/{$commentYear} {$commentHour}:{$commentMinutes}" />
+        <a href="javascript:NewCal('commentDateTime','ddmmyyyy',true,24);">
+          <img src="imgs/admin/cal.jpg"
+               alt="{$locale->tr("pick_date")}" 
+               style="border:0px" /></a>
+     </td>
+    </tr>
+    <tr>
+     <th>{$locale->tr("status")}</th>
+     <td>
+       <select name="commentStatus" id="commentStatus">
+         {foreach from=$commentstatus key=name item=status}
+           <option value="{$status}"
+             {if $editcomment->getStatus() == $status} selected{/if}>
+           {$locale->tr($name)}</option>
+         {/foreach}
+       </select>
+      </td>
+    </tr>
+    <tr>
+     <th>IP</th>
+     <td><input type="text" name="commentIp" id=commentIp"
+             value="{$editcomment->getClientIp()}" /></td>
+    </tr>
+  </table>
+ </div>
+
+ <div id="list_action_bar">
+  <input type="hidden" name="op" value="updateComment" />
+  <input type="hidden" name="commentId" value="{$editcomment->getId()}" />
+  <input type="hidden" name="articleId" value="{$editcomment->getArticleId()}" />
+  <input type="submit" name="update" value="{$locale->tr("update")}" />
+  <input type="submit" name="cancel" value="{$locale->tr("editCommentCancel")}" />
+ </div>
+</form>
+
+{include file="$admintemplatepath/footer.template"}

Added: plugins/trunk/editcomments/templates/editcomments.template
===================================================================
--- plugins/trunk/editcomments/templates/editcomments.template	2005-11-24 05:25:19 UTC (rev 2622)
+++ plugins/trunk/editcomments/templates/editcomments.template	2005-11-24 05:29:06 UTC (rev 2623)
@@ -0,0 +1,112 @@
+{* copied from /templates/admin/editcomments.template *}
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editComments")}
+        <div id="list_nav_bar">
+            <div id="list_nav_select">		
+
+                <form id="showBy" action="admin.php" method="post">
+                <fieldset>
+                <legend>{$locale->tr("show_by")}</legend>
+
+                    <div class="list_nav_option">
+                    <label for="showStatus">{$locale->tr("status")}</label>
+                    <br />
+                    <select name="showStatus" id="showStatus">
+                     {foreach from=$commentstatus key=name item=status}
+                     <option value="{$status}" {if $currentstatus == $status} selected="selected"{/if}>{$locale->tr($name)}</option>
+                     {/foreach}
+                    </select>
+                    </div>
+					
+                    <div class="list_nav_option">
+                    <br />
+                    <input type="hidden" name="op" value="editComments" />
+					<input type="hidden" name="articleId" value="{$post->getId()}" />
+                    <input type="submit" name="show" value="{$locale->tr("show")}" class="submit" />
+                    </div>
+
+                </fieldset>
+                </form>
+            </div>
+            <br style="clear:both;" />
+        </div>
+		
+        <form id="postCommentsList" 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('postCommentsList');" /></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="commentIds[{$comment->getId()}]" id="checks_{$comment->getId()}" value="{$comment->getId()}" />
+                        </td>
+                        <td class="col_highlighted">
+                            {$comment->getTopic()|strip_tags}
+                        </td>
+						<td>
+						    {$comment->getText()}
+						</td>
+                        <td>
+						  <a href="mailto:{$comment->getUserEmail()}">
+						    {$comment->getUsername()}
+						  </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=deleteComment&amp;commentId={$comment->getId()}&amp;articleId={$post->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+							{if $comment->getStatus() == 0}
+							    <a href="?op=markComment&amp;mode=1&amp;articleId={$comment->getArticleId()}&amp;commentId={$comment->getId()}">
+								 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
+								</a>
+							{elseif $comment->getStatus() == 1}
+								<a href="?op=markComment&amp;mode=0&amp;articleId={$comment->getArticleId()}&amp;commentId={$comment->getId()}">
+								 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
+								</a>
+							{/if}
+							{if $comment->getUserUrl()}
+							  <a href="{$comment->getUserUrl()}">
+							   <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
+							{/if}
+                            <a href="?op=editComment&amp;commentId={$comment->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
+                            </div>
+                        </td>
+                    </tr>
+                    {/foreach}
+                </tbody>
+            </table>
+        </div>
+
+        <div id="list_action_bar">
+	    {include file="$admintemplatepath/adminpager.template" style=list}
+            <input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />
+			<input type="hidden" name="articleId" value="{$post->getId()}" />
+            <input type="hidden" name="op" value="deleteComments" />
+        </div>
+        </form>
+{include file="$admintemplatepath/footer.template"}




More information about the pLog-svn mailing list