[pLog-svn] r4260 - in plugins/branches/lifetype-1.1/unported/editcomments: class/action class/view locale templates

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Wed Nov 8 04:26:39 GMT 2006


Author: jondaley
Date: 2006-11-08 04:26:37 +0000 (Wed, 08 Nov 2006)
New Revision: 4260

Modified:
   plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminplugineditcommentsaction.class.php
   plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminupdatecommentaction.class.php
   plugins/branches/lifetype-1.1/unported/editcomments/class/view/admineditcommentsview.class.php
   plugins/branches/lifetype-1.1/unported/editcomments/locale/locale_en_UK.php
   plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomment.template
   plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomments.template
Log:
updated to 1.1

Modified: plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminplugineditcommentsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminplugineditcommentsaction.class.php	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminplugineditcommentsaction.class.php	2006-11-08 04:26:37 UTC (rev 4260)
@@ -1,36 +1,15 @@
 <?php
-
-	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentsview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/action/admin/admineditcommentsaction.class.php" );
 
 	/**
 	 * actions that displays the list of comments in the blog.
 	 */
-	class AdminPluginEditCommentsAction extends AdminAction{
-	
+	class AdminPluginEditCommentsAction extends AdminEditCommentsAction{
 		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->AdminEditCommentsAction($actionInfo, $request);
+            $this->_viewClass = "AdminEditCommentsView";
+        }
 
-			$this->setCommonData();
-			
-			return true;
-		}
 	}
 ?>
\ No newline at end of file

Modified: plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminupdatecommentaction.class.php
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminupdatecommentaction.class.php	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/class/action/adminupdatecommentaction.class.php	2006-11-08 04:26:37 UTC (rev 4260)
@@ -112,12 +112,12 @@
                 else{
                     $this->_view = new AdminPostsListView( $this->_blogInfo );
                 }
-                $this->_view->setSuccessMessage( $this->_locale->tr("edit_comment_ok") );
+                $this->_view->setSuccessMessage( $this->_locale->tr("pluginEditCommentsOk") );
                 CacheControl::resetBlogCache( $this->_blogInfo->getId());
             }
             else{
                 $this->_view = new AdminEditCommentView($this->_blogInfo, $id);
-                $this->_view->setErrorMessage( $this->_locale->tr("edit_comment_failed") );
+                $this->_view->setErrorMessage( $this->_locale->tr("pluginEditCommentsFailed") );
             }
         }
         else if($this->_articleId){
@@ -125,7 +125,7 @@
 			$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") );
+            $this->_view->setSuccessMessage( $this->_locale->tr("pluginEditCommentsCancelled") );
         }
         else{
             $this->_view = new AdminPostsListView($this->_blogInfo);

Modified: plugins/branches/lifetype-1.1/unported/editcomments/class/view/admineditcommentsview.class.php
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/class/view/admineditcommentsview.class.php	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/class/view/admineditcommentsview.class.php	2006-11-08 04:26:37 UTC (rev 4260)
@@ -16,38 +16,100 @@
 			$this->AdminPluginTemplatedView( $blogInfo, "editcomments", "editcomments" );
 			$this->_setParameters( $params );
             $this->_page = $this->getCurrentPageFromRequest();
-
 		}
 		
-		function render(){
+		/**
+		 * @private
+		 */
+		function _setParameters( $params )
+		{
+			// fetch the article id
+			$this->_article = null;
+			if( isset( $params["article"] ))
+				$this->_article = $params["article"];
+						
+			// load the status
+			if( isset( $params["showStatus"] ))
+				$this->_commentStatus = $params["showStatus"];
+				
+			if( !ArticleCommentStatus::isValidStatus( $this->_commentStatus )) 
+				$this->_commentStatus = COMMENT_STATUS_ALL;	
+				
+			// laod the search terms
+			$this->_searchTerms = "";
+			if( isset( $params["searchTerms"] ))			
+				$this->_searchTerms = $params["searchTerms"];
+		}
+		
+		/**
+		 * show the contents of the view
+		 */
+		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 );
+			$comments = new CommentsCommon();
+			if( $this->_article ) {
+				// load only the comments of the given post
+				$postComments = $comments->getPostComments( $this->_article->getId(),
+															COMMENT_ORDER_NEWEST_FIRST,
+															$this->_commentStatus, 
+															COMMENT_TYPE_COMMENT,
+															$this->_page, 
+															DEFAULT_ITEMS_PER_PAGE );
+				// number of comments
+				$numPostComments = $comments->getNumPostComments( $this->_article->getId(), 
+				                                                  $this->_commentStatus,
+																  COMMENT_TYPE_COMMENT );
+				// id of the article, for the pager...
+				$articleId = $this->_article->getId();
+			}
+			else {
+                    // load all comments given the current status
+				$postComments = $comments->getBlogComments( $this->_blogInfo->getId(),
+				                                            COMMENT_ORDER_NEWEST_FIRST,
+				                                            $this->_commentStatus,
+															COMMENT_TYPE_COMMENT,
+															$this->_searchTerms,
+														    $this->_page,
+														    DEFAULT_ITEMS_PER_PAGE );
+				// number of comments
+				$numPostComments = $comments->getNumBlogComments( $this->_blogInfo->getId(),
+				                                                  $this->_commentStatus,
+																  COMMENT_TYPE_COMMENT,
+																  $this->_searchTerms );
+				// no article id...
+				$articleId = 0;
+			}
 			$this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
-			// number of comments
-			$numPostComments = $comments->getNumPostComments( $this->_article->getId(), $this->_commentStatus );
+			
+            $pagerUrl = "?op=editComments";
 
-			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=";
+			if( $this->_commentStatus > -1 ){
+				$pagerUrl .= "&amp;articleId={$articleId}&amp;showStatus=".
+                    $this->_commentStatus."&amp;searchTerms=".
+                    $this->_searchTerms."&amp;page=";
+            }
+			else{
+				$pagerUrl .= "&amp;articleId={$articleId}&amp;searchTerms=".
+                    $this->_searchTerms."&amp;page=";
+            }
 				
 			// calculate the pager url
 			$pager = new Pager( $pagerUrl,
 					    $this->_page,
 					    $numPostComments,
-					    DEFAULT_ITEMS_PER_PAGE );
+					    DEFAULT_ITEMS_PER_PAGE );					
 														
 			// get a list with all the different comment status
 			$statusList = ArticleCommentStatus::getStatusList( true );
+			$statusListWithoutAll = ArticleCommentStatus::getStatusList( false );
+			
 			// and pass all the information to the templates
 			$this->setValue( "comments", $postComments);
 			$this->setValue( "commentstatus", $statusList );
+			$this->setValue( "commentstatusWithoutAll", $statusListWithoutAll );
 			$this->setValue( "currentstatus", $this->_commentStatus );
+			$this->setValue( "searchTerms", $this->_searchTerms );
 
 			// pass the pager to the view
 			$this->setValue( "pager", $pager );+
@@ -56,29 +118,7 @@
 			$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

Modified: plugins/branches/lifetype-1.1/unported/editcomments/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/locale/locale_en_UK.php	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/locale/locale_en_UK.php	2006-11-08 04:26:37 UTC (rev 4260)
@@ -1,11 +1,11 @@
 <?php
 
-$messages["editComments"] = "Edit Comments";
-$messages["editComment"] = "Edit Comment";
+$messages["pluginEditCommentsEdit"] = "Edit Comment";
 
-$messages["editCommentCancel"] = "Cancel";
-$messages["edit_comment_ok"] = "Comment saved successfully!";
-$messages["edit_comment_cancelled"] = "Comment edits discarded.";
+$messages["pluginEditCommentsCancel"] = "Cancel";
+$messages["pluginEditCommentsOk"] = "Comment saved successfully!";
+$messages["pluginEditCommentsCancelled"] = "Comment edits discarded.";
+$messages["pluginEditCommentsFailed"] = "Comment editing failed.";
 
-$messages["edit_date_format"] = "dd/mm/yyyy hh:mm:ss";
+$messages["pluginEditCommentsDateFormat"] = "dd/mm/yyyy hh:mm:ss";
 ?>
\ No newline at end of file

Modified: plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomment.template
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomment.template	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomment.template	2006-11-08 04:26:37 UTC (rev 4260)
@@ -1,5 +1,5 @@
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editComment")}
+{include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("pluginEditCommentsEdit")}
 <script type="text/javascript" src="js/calendar/datetimepicker.js"></script>
 
 <form id="editComment" action="admin.php" method="post">
@@ -36,7 +36,7 @@
     <tr>
 	 <th>{$locale->tr("date")}</th>
       <td>
-         {$locale->tr("edit_date_format")}<br/>
+         {$locale->tr("pluginEditCommentsDateFormat")}<br/>
 		 <input name="commentDateTime" id="commentDateTime" class="dateTime"
                readonly="true" type="text" size="20"
                value="{$commentDay}/{$commentMonth}/{$commentYear} {$commentHour}:{$commentMinutes}" />
@@ -71,7 +71,7 @@
   <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")}" />
+  <input type="submit" name="cancel" value="{$locale->tr("pluginEditCommentsCancel")}" />
  </div>
 </form>
 

Modified: plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomments.template
===================================================================
--- plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomments.template	2006-11-08 03:31:27 UTC (rev 4259)
+++ plugins/branches/lifetype-1.1/unported/editcomments/templates/editcomments.template	2006-11-08 04:26:37 UTC (rev 4260)
@@ -1,12 +1,17 @@
-{* copied from /templates/admin/editcomments.template *}
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editPosts title=$locale->tr("editComments")}
+{include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("editComments")}
+	<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">		
 
                 <form id="showBy" action="admin.php" method="post">
                 <fieldset>
-                <legend>{$locale->tr("show_by")}</legend>
+                <legend>{$locale->tr("show_by")} {if $post}({$post->getTopic()}){/if}</legend>
 
                     <div class="list_nav_option">
                     <label for="showStatus">{$locale->tr("status")}</label>
@@ -19,12 +24,17 @@
                     </div>
 					
                     <div class="list_nav_option">
+                    <label for="search">{$locale->tr("search_terms")}</label>
                     <br />
+                    <input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
+                    </div>					
+					
+                    <div class="list_nav_option">
+                    <br />
                     <input type="hidden" name="op" value="editComments" />
-					<input type="hidden" name="articleId" value="{$post->getId()}" />
+					<input type="hidden" name="articleId" value="{if $post}{$post->getId()}{else}0{/if}" />
                     <input type="submit" name="show" value="{$locale->tr("show")}" class="submit" />
                     </div>
-
                 </fieldset>
                 </form>
             </div>
@@ -32,17 +42,20 @@
         </div>
 		
         <form id="postCommentsList" action="admin.php" method="post">
+        <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>
         <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:10px;"><input class="checkbox" type="checkbox" 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("date")}</th>
                         <th style="width:60px;">{$locale->tr("status")}</th>
                         <th style="width:45px;">IP</th>
                         <th style="width:95px;">{$locale->tr("actions")}</th>
@@ -55,10 +68,10 @@
                             <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}
+                            {$comment->getTopic()|strip_tags|utf8_wordwrap:12:"<br/>":true}
                         </td>
 						<td>
-						    {$comment->getText()}
+						    {$comment->getText()|strip_tags|utf8_wordwrap:35:"<br/>":true}
 						</td>
                         <td>
 						  <a href="mailto:{$comment->getUserEmail()}">
@@ -79,19 +92,22 @@
                         </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>
+                            <a href="?op=deleteComment&amp;commentId={$comment->getId()}&amp;articleId={if $post}{$post->getId()}{else}0{/if}" title="{$locale->tr("delete")}">
+                            	<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()}">
+							    <a href="?op=markComment&amp;mode=1&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_spam")}">
 								 <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()}">
+								<a href="?op=markComment&amp;mode=0&amp;articleId={if $post}{$comment->getArticleId()}{else}0{/if}&amp;commentId={$comment->getId()}" title="{$locale->tr("mark_as_no_spam")}">
 								 <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
 								</a>
 							{/if}
 							{if $comment->getUserUrl()}
-							  <a href="{$comment->getUserUrl()}">
+							  <a href="{$comment->getUserUrl()}" title="{$locale->tr("url")}">
 							   <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
+							  </a>
 							{/if}
                             <a href="?op=editComment&amp;commentId={$comment->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
                             </div>
@@ -101,12 +117,26 @@
                 </tbody>
             </table>
         </div>
-
+		<a name="bulkEdit"></a>
         <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" />
+	    {adminpager style=list}
+			<input type="hidden" name="articleId" value="{if $post}{$post->getId()}{else}0{/if}" />
+            <input type="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="javascript:submitCommentsList('deleteComments');" />
+            <input type="hidden" name="op" value="" />
+            <div id="massiveChangeOption" style="display: none">
+                <fieldset>
+                <legend>{$locale->tr("massive_change_option")}</legend>            
+		            <label for="commentStatus">{$locale->tr("status")}</label>
+		            <select name="commentStatus" id="commentStatus">
+		              <option value="-1">-{$locale->tr("select")}-</option>
+		              {foreach from=$commentstatusWithoutAll key=name item=status}
+		                <option value="{$status}">{$locale->tr($name)}</option>
+		              {/foreach}
+		            </select>
+		            <input type="button" name="changeCommentsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitCommentsList('changeCommentsStatus');" /> 
+		        </fieldset>
+			</div>           
         </div>
         </form>
+{include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}



More information about the pLog-svn mailing list