[pLog-svn] r5696 - in plog/trunk: class/action/admin class/controller class/data/validator class/test/tests/data/validator/rules templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Fri Jul 20 16:42:12 EDT 2007


Author: oscar
Date: 2007-07-20 16:42:11 -0400 (Fri, 20 Jul 2007)
New Revision: 5696

Added:
   plog/trunk/class/action/admin/admineditcommentaction.class.php
   plog/trunk/class/action/admin/adminupdatecommentaction.class.php
   plog/trunk/class/data/validator/ipaddressvalidator.class.php
   plog/trunk/class/test/tests/data/validator/rules/ipformatrule_test.class.php
   plog/trunk/templates/admin/editcomment.template
Removed:
   plog/trunk/templates/admin/edittrackbacks.template
Modified:
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/templates/admin/editcomments.template
   plog/trunk/templates/admin/menus.xml
   plog/trunk/templates/admin/newlink.template
   plog/trunk/templates/admin/validateajax.template
Log:
Added functionality to edit a comment, based on Jon's editcomment plugin


Added: plog/trunk/class/action/admin/admineditcommentaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditcommentaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/admineditcommentaction.class.php	2007-07-20 20:42:11 UTC (rev 5696)
@@ -0,0 +1,87 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminarticlecommentslistview.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );	
+
+	/**
+	 * actions that displays the selected comment for editing
+	 */
+	class AdminEditCommentAction extends AdminAction
+	{
+	
+		function AdminEditCommentAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+			
+			$this->registerFieldValidator( "commentId", new IntegerValidator());
+			$view = new AdminArticleCommentsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr( "error_incorrect_comment_id" ));
+			
+			$this->requirePermission( "update_comment" );
+		}
+		
+		function getComment()
+		{
+            $commentId = $this->_request->getValue("commentId");
+            // fetch comment
+			$articleComments = new CommentsCommon();
+			$comment = $articleComments->getComment( $commentId );
+			if( $comment ) {
+				// just an additional check
+				if( $comment->getBlogId() != $this->_blogInfo->getId())
+					return( false );
+			}
+			return( $comment );			
+		}
+		
+		function perform()
+		{
+			if(( $comment = $this->getComment())) {
+            	$this->_view = new AdminTemplatedView( $this->_blogInfo, "editcomment" );
+
+	            $statusList = ArticleCommentStatus::getStatusList();
+	            $this->_view->setValue( "commentstatus", $statusList );
+				$this->_view->setValue( "commentTopic", $comment->getTopic());
+				$this->_view->setValue( "commentText", $comment->getText());
+				$this->_view->setValue( "authorName", $comment->getUsername());
+				$this->_view->setValue( "authorEmail", $comment->getUserEmail());
+	            $t = $comment->getDateObject();
+	            $this->_view->setValue( "commentDateTime", $t->getDay()."/".
+	                             $t->getMonth()."/".$t->getYear()." ".
+	                             $t->getHour().":".$t->getMinutes());			
+				$this->_view->setValue( "authorUrl", $comment->getUserUrl());
+				$this->_view->setValue( "commentStatus", $comment->getStatus());
+				$this->_view->setValue( "commentIp", $comment->getClientIp());
+				$this->_view->setValue( "commentId", $comment->getId());
+				$this->_view->setValue( "userAuth", $comment->isPosterAuthenticated());
+				$this->_view->setValue( "articleId", $comment->getArticleId());
+			}
+			else {
+				$this->_view = new AdminArticleCommentsListView( $this->_blogInfo );
+				$this->_view->setErrorMessage( $this->_locale->tr( "error_incorrect_comment_id" ));				
+			}
+			
+			$this->setCommonData();
+			
+			return true;
+		}
+		
+		function performAjax()
+		{
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+			if(( $comment = $this->getComment())) {
+            	$this->_view->setSuccess( true );
+				$this->_view->setValue( "comment", $comment );
+			}
+			else {
+            	$this->_view->setSuccess( false );
+				$this->_view->setErrorMessage( $this->_locale->tr( "error_incorrect_comment_id" ));				
+			}
+			
+			return( true );	
+		}
+	}
+?>
\ No newline at end of file

Added: plog/trunk/class/action/admin/adminupdatecommentaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatecommentaction.class.php	                        (rev 0)
+++ plog/trunk/class/action/admin/adminupdatecommentaction.class.php	2007-07-20 20:42:11 UTC (rev 5696)
@@ -0,0 +1,167 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/dao/commentscommon.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/ipaddressvalidator.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminarticlecommentslistview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/filter/allowedhtmlfilter.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/data/filter/trimfilter.class.php" );	
+
+	class AdminUpdateCommentAction extends AdminAction
+	{
+	    var $_commentId;
+	    var $_articleId;
+		var $_op;
+	    var $_authorEmail;
+	    var $_authorUrl;
+	    var $_authorName;
+	    var $_commentText;
+	    var $_commentTopic;
+	    var $_commentNormalizedText;
+	    var $_commentNormalizedTopic;
+	    var $_commentStatus;
+	    var $_commentDateTime;
+	    var $_commentIp;
+    
+	    function AdminUpdateCommentAction($actionInfo, $request)
+		{
+	        $this->AdminAction($actionInfo, $request);
+
+			$this->registerFieldValidator("commentId", new IntegerValidator());
+			$this->registerFieldValidator("commentText", new StringValidator(), false, $this->_locale->tr("error_empty_text"));
+			$this->registerFieldValidator("authorName", new StringValidator(), false, $this->_locale->tr("error_emtpy_text" ));
+			$this->registerFieldValidator("commentStatus", new IntegerValidator(), false, $this->_locale->tr( "error_incorrect_value" ));
+			$this->registerField("commentTopic", new StringValidator());
+			$this->registerFieldValidator("authorEmail", new EmailValidator(), true, $this->_locale->tr( "error_incorrect_email_address" ));
+			$this->registerFieldValidator("authorUrl", new HttpUrlValidator(), true, $this->_locale->tr( "invalid_url" ));
+			$this->registerField("commentDateTime");
+			$this->registerFieldValidator("commentIp", new IpAddressValidator(), true, $this->_locale->tr("invalid_ip_address"));
+			$this->registerField( "userAuth" );
+			
+			$this->requirePermission( "update_comment" );			
+
+			$view = new AdminTemplatedView($this->_blogInfo, "editcomment" );
+			$view->setErrorMessage( $this->_locale->tr("error_updating_comment2"));
+            $statusList = ArticleCommentStatus::getStatusList();
+            $view->setValue( "commentstatus", $statusList );
+			$this->setValidationErrorView( $view );
+	    }
+    
+	    function _fetchFields()
+		{
+	        $this->_commentId = $this->_request->getValue("commentId");
+	        $this->_authorEmail = $this->_request->getFilteredValue( "authorEmail", new HtmlFilter());
+	        $this->_authorUrl   = $this->_request->getFilteredValue( "authorUrl", new HtmlFilter());
+	        if( (strlen($this->_authorUrl) != 0) && ereg('^https?://',$this->_authorUrl) == false) {
+	            $this->_authorUrl = "http://".$this->_authorUrl;
+	        }
+	        $this->_authorName  = $this->_request->getValue( "authorName", new HtmlFilter());
+	        $this->_commentText = $this->_request->getValue( "commentText", new AllowedHtmlFilter());
+	        $this->_commentTopic = $this->_request->getValue( "commentTopic", new HtmlFilter());
+	        $this->_commentStatus = $this->_request->getValue( "commentStatus" );
+	        $this->_commentIp = $this->_request->getValue( "commentIp" );
+	        $this->_commentNormalizedTopic = Textfilter::normalizeText($this->_commentTopic);
+	        $this->_commentNormalizedText = Textfilter::normalizeText($this->_commentText);
+        
+	        $this->_commentDateTime = $this->_fetchCommentDateInformation();
+	    }
+
+	        // 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->getTimestamp();
+	    }
+	
+		function updateComment()
+		{
+			$this->_fetchFields();
+						
+			$comments = new CommentsCommon();
+            $comment = $comments->getComment($this->_commentId);
+            if(!$comment) {
+				return( false );
+            }
+
+            if(!ArticleCommentStatus::isValidStatus($this->_commentStatus)){
+				$this->_commentStatus = COMMENT_STATUS_NONSPAM;
+            }
+
+			$comment->setTopic($this->_commentTopic);
+			$comment->setText($this->_commentText);
+			// we do not allow to change the name of the user is the poster was authenticated
+			if( $comment->isPosterAuthenticated() == false )
+				$comment->setUserName($this->_authorName);
+			$comment->setUserEmail($this->_authorEmail);
+			$comment->setUserUrl($this->_authorUrl);
+			$comment->setDate($this->_commentDateTime);
+			$comment->setStatus($this->_commentStatus);
+			$comment->setClientIp($this->_commentIp);
+			$comment->setNormalizedTopic($this->_commentNormalizedTopic);
+			$comment->setNormalizedText($this->_commentNormalizedText);
+			
+			$result = false;
+			if( $comments->updateComment( $comment )) {
+				$result = $comment;
+				CacheControl::resetBlogCache( $this->_blogInfo->getId());
+			}
+			
+			return( $result );
+		}
+
+    
+	    function perform()
+		{
+			if($this->updateComment()) {
+			    if($this->_articleId) {
+			        $articles = new Articles();
+			        $article = $articles->getBlogArticle($this->_articleId, $this->_blogInfo->getId());
+			        $this->_view = new AdminArticleCommentsListView( $this->_blogInfo, Array("article" => $article));
+			    }
+			    else {
+			        $this->_view = new AdminPostsListView( $this->_blogInfo );
+			    }
+			    $this->_view->setSuccessMessage( $this->_locale->tr( "comment_updated_ok" ));
+			}
+			else{
+			    $this->_view = new AdminArticleCommentsListView( $this->_blogInfo);
+			    $this->_view->setErrorMessage( $this->_locale->tr( "error_updating_comment"));
+			}
+
+	        $this->setCommonData();
+	    }
+	
+		function performAjax()
+		{
+			lt_include( PLOG_CLASS_PATH."class/view/admin/ajax/adminajaxview.class.php" );
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+			if(( $comment = $this->updateComment())) {
+			    $this->_view->setSuccessMessage( $this->_locale->tr( "comment_updated_ok" ));
+				$this->_view->setValue( "comment", $comment );
+			}
+			else{
+			    $this->_view->setErrorMessage( $this->_locale->tr( "error_updating_comment"));
+			}
+
+			return( true );
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2007-07-20 20:42:11 UTC (rev 5696)
@@ -87,6 +87,8 @@
     $actions["Stats"] = "AdminStatisticsAction";
     // edit comments
     $actions["editComments"] = "AdminEditCommentsAction";
+    $actions["editComment"] = "AdminEditCommentAction";
+    $actions["updateComment"] = "AdminUpdateCommentAction";
     // deletes a comment
     $actions["deleteComment"] = "AdminDeleteCommentAction";
 	$actions["deleteComments"] = "AdminDeleteCommentAction";

Added: plog/trunk/class/data/validator/ipaddressvalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/ipaddressvalidator.class.php	                        (rev 0)
+++ plog/trunk/class/data/validator/ipaddressvalidator.class.php	2007-07-20 20:42:11 UTC (rev 5696)
@@ -0,0 +1,23 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/nonemptyrule.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/ipformatrule.class.php" );
+
+    /**
+     * \ingroup Validator
+     *
+     * Checks if the given string is a valid IP address (in dot notation)
+     */
+    class IpAddressValidator extends Validator 
+    {
+    	function IpAddressValidator()
+        {
+        	$this->Validator();
+        	
+			// it can't be empty
+        	$this->addRule( new NonEmptyRule());
+			$this->addRule( new IpFormatRule());
+        }
+    }
+?>
\ No newline at end of file

Added: plog/trunk/class/test/tests/data/validator/rules/ipformatrule_test.class.php
===================================================================
--- plog/trunk/class/test/tests/data/validator/rules/ipformatrule_test.class.php	                        (rev 0)
+++ plog/trunk/class/test/tests/data/validator/rules/ipformatrule_test.class.php	2007-07-20 20:42:11 UTC (rev 5696)
@@ -0,0 +1,52 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/ipformatrule.class.php" );
+
+	/**
+	 * \ingroup Test
+	 *
+	 * Test cases for the IpFormatRule class
+	 */
+	class IpFormatRule_Test extends LifeTypeTestCase
+	{
+		function testValid()
+		{
+			// valid test cases
+			$valid = Array(
+				"12.55.23.55",
+				"1.2.4.1",
+				"255.255.255.255",
+				"1.0.0.0",
+				"0.0.0.0"
+			);
+			
+			// process the valid ones
+			$r = new IpFormatRule();
+			foreach( $valid as $ip ) {
+				$this->assertTrue( $r->validate( $ip ), "IP address $ip should have been validated!" );
+			}
+		}
+		
+		function testInvalid()
+		{
+			// invalid test cases
+			$invalid = Array(
+				"",
+				null,
+				"1.2.4",
+				"1.2.4.1.",
+				".1.2.4.2",				
+				"a.b.c.d",
+				"257.223.555.555"
+			);
+			
+			// and the invalid ones
+			$r = new IpFormatRule();			
+			foreach( $invalid as $ip ) {
+				$this->assertFalse( $r->validate( $ip ), "IP address $ip should have not been validated" );
+				$this->assertEquals( ERROR_RULE_IP_FORMAT_WRONG, $r->getError());
+			}			
+		}
+	}
+?>
\ No newline at end of file

Added: plog/trunk/templates/admin/editcomment.template
===================================================================
--- plog/trunk/templates/admin/editcomment.template	                        (rev 0)
+++ plog/trunk/templates/admin/editcomment.template	2007-07-20 20:42:11 UTC (rev 5696)
@@ -0,0 +1,96 @@
+<link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
+<script type="text/javascript" src="js/jscalendar/calendar_stripped.js"></script>
+<script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>
+<script type="text/javascript" src="js/jscalendar/calendar-setup_stripped.js"></script>
+<form id="editComment" action="admin.php" method="post" onSubmit="Lifetype.Forms.AjaxFormProcessor(this.id,'?output=json');return(false);">
+<fieldset class="inputField">
+<legend>{$locale->tr("newLink")}</legend>
+{include file="$admintemplatepath/formvalidateajax.template"}
+
+<div id="mainPanel" style="float:left; width: 70%; border-right: 1px solid #DEDEDE;">
+<div class="field">
+<label for="commentTopic">{$locale->tr("topic")}</label>
+<div class="formHelp"></div>
+<input size="50" type="text" name="commentTopic" id="commentTopic" value="{$commentTopic}" />
+</div>
+
+<div class="field">
+<label for="commentText">{$locale->tr("text")}</label>
+<span class="required">*</span>
+<div class="formHelp"></div>
+<textarea name="commentText" id="commentText" rows="10" cols="50">{$commentText}</textarea>
+{include file="$admintemplatepath/validateajax.template" field=commentText}
+</div>
+
+<div class="field">
+<label for="authorName">{$locale->tr("author")} {if $userAuth}({$locale->tr("authenticated")}{/if})</label>
+<span class="required">*</span>
+<div class="formHelp"></div>
+<input type="text" name="authorName" id="authorName" value="{$authorName}" {if $userAuth}readonly="readonly"{/if} />
+</div>
+
+<div class="field">
+<label for="authorEmail">{$locale->tr("email")}</label>
+<div class="formHelp"></div>
+<input size="30" type="text" name="authorEmail" id="authorEmail" value="{$authorEmail}" />
+{include file="$admintemplatepath/validateajax.template" field=authorEmail}
+</div>
+
+<div class="field">
+<label for="authorUrl">{$locale->tr("url")}</label>
+<div class="formHelp"></div>
+<input size=60 type="text" name="authorUrl" id="authorUrl" value="{$authorUrl}" />
+{include file="$admintemplatepath/validateajax.template" field=authorUrl}
+</div>
+</div>
+
+<div id="optionPanel" style="float:left; width: 26%; margin-left: 8px;">
+<div class="field">
+<label for="commentDateTime">{$locale->tr("date")}</label>
+	     <input name="commentDateTime" id="commentDateTime" class="dateTime" readonly="true" type="text" size="16" value="{$commentDateTime}" style="margin-bottom: 4px;" /> 
+	     <img src="imgs/admin/cal.jpg" id="commentDateTimeSelector" alt="{$locale->tr("date")}" style="cursor: pointer; border: 0px; width: 16px; height: 14px; padding: 0;" /> 
+	   <script type="text/javascript">
+	   var MondayFirstDay = ( {$locale->firstDayOfWeek()} == 1);
+       {literal}
+	       Calendar.setup({
+	           inputField  : "commentDateTime",
+	           ifFormat    : "%d/%m/%Y %H:%M",
+	           button      : "commentDateTimeSelector",
+	           showsTime   : true,
+	           timeFormat  : "24",
+	           electric    : false,
+	           align       : "Bl",
+	           firstDay    : MondayFirstDay,
+	           singleClick : true
+	       });
+	   {/literal}
+	   </script>
+
+<div class="field">
+	<label for="commentStatus">{$locale->tr("status")}</label>
+	<div class="formHelp"></div>
+       <select name="commentStatus" id="commentStatus">
+         {foreach from=$commentstatus key=name item=status}
+           <option value="{$status}"
+             {if $commentStatus == $status} selected{/if}>
+           {$locale->tr($name)}</option>
+         {/foreach}
+       </select>
+</div>
+
+<div class="field">
+	<div class="formHelp"></div>
+	<label for="commentIp">IP</label>
+	<input type="text" name="commentIp" readonly="readonly" id="commentIp" value="{$commentIp}" />
+</div>
+</div>
+
+</fieldset>
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateComment" />
+  <input type="hidden" name="commentId" value="{$commentId}" />
+  <input type="hidden" name="articleId" value="{$articleId}" />
+  <input type="reset" name="resetButton" value="{$locale->tr("reset")}" />
+  <input type="submit" name="update" value="{$locale->tr("update")}" />
+ </div>
+</form>
\ No newline at end of file

Modified: plog/trunk/templates/admin/editcomments.template
===================================================================
--- plog/trunk/templates/admin/editcomments.template	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/templates/admin/editcomments.template	2007-07-20 20:42:11 UTC (rev 5696)
@@ -1,7 +1,7 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("editComments")}
-{js src="js/ui/plogui.js"}
 {js src="js/ui/pages/global.js"}
+{js src="js/ui/pages/editcomments.js"}
 <script type="text/javascript">
 		var errorCommentStatusMsg = '{$locale->tr("error_comment_status")}';
 		var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
@@ -32,6 +32,16 @@
                      {/foreach}
                     </select>
                     </div>
+
+                    <div class="list_nav_option">
+                    <label for="showType">{$locale->tr("type")}</label>
+                    <br />
+                    <select name="showType" id="showType">
+	                  <option value="-1" {if $showType==-1}selected="selected"{/if}>{$locale->tr("all")}</option>
+					  <option value="1" {if $showType==1}selected="selected"{/if}>{$locale->tr("comments")}</option>
+					  <option value="2" {if $showType==2}selected="selected"{/if}>{$locale->tr("trackbacks")}</option>
+                    </select>
+                    </div>
 					
                     <div class="list_nav_option">
                     <label for="search">{$locale->tr("search_terms")}</label>
@@ -81,7 +91,7 @@
                             <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}<br/>
+                            <a href="?op=editComment&commentId={$comment->getId()}" rel="overlay" id="comment_{$comment->getId()}">{$comment->getTopic()|strip_tags}</a><br/>
                             <span style="font-weight:normal">
                             &nbsp;&raquo;
                             {assign var=commentPost	value=$comment->getArticle()}
@@ -146,7 +156,7 @@
 	    {adminpager style=list}
 			{check_perms perm=update_comment}	
 			<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="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="Lifetype.UI.Pages.EditComments.submitCommentsList('deleteComments');" />
             <input type="hidden" name="op" value="" />
 			{/check_perms}
 			{check_perms perm=update_comment}
@@ -160,7 +170,7 @@
 						{if ($status != 0 && $status != 1) || $bayesian_filter_enabled}<option value="{$status}">{$locale->tr($name)}</option>{/if}
 		              {/foreach}
 		            </select>
-		            <input type="button" name="changeCommentsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitCommentsList('changeCommentsStatus');" /> 
+		            <input type="button" name="changeCommentsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="Lifetype.UI.Pages.EditComments.submitCommentsList('changeCommentsStatus');" /> 
 		        </fieldset>
 			</div>
 			{/check_perms} 

Deleted: plog/trunk/templates/admin/edittrackbacks.template
===================================================================
--- plog/trunk/templates/admin/edittrackbacks.template	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/templates/admin/edittrackbacks.template	2007-07-20 20:42:11 UTC (rev 5696)
@@ -1,167 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editTrackbacks title=$locale->tr("editTrackbacks")}
-{js src="js/ui/pages/global.js"}
-	<script type="text/javascript" src="js/ui/plogui.js"></script>
-	<script type="text/javascript">
-		var errorTrackbackStatusMsg = '{$locale->tr("error_trackback_status")}';
-		var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
-		var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
-	</script>
-	<script type="text/javascript">
-	{literal}
-	YAHOO.util.Event.addListener( window, "load", function() {
-			var t = new Lifetype.UI.TableEffects( "list" );
-			t.stripe();
-			t.highlightRows();
-		});
-	{/literal}
-	</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")} {if $post}( {$post->getTopic()} ){/if}</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">
-                    <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="editTrackbacks" />
-					{if $post}<input type="hidden" name="articleId" value="{$post->getId()}" />{/if}
-                    <input type="submit" name="show" value="{$locale->tr("show")}" class="submit" />
-                    </div>
-
-                </fieldset>
-                </form>
-            </div>
-            <br style="clear:both;" />
-        </div>
-
-        <form id="postTrackbacksList" action="admin.php" method="post">
-		{check_perms perm=update_trackback}
-        <div class="optionIcon">
-			<a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="Lifetype.UI.Pages.Global.switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
-		</div>
-		{/check_perms}
-        <div id="list">
-		  {include file="$admintemplatepath/successmessage.template"}
-		  {include file="$admintemplatepath/errormessage.template"}
-            <table id="list" class="info" summary="{$locale->tr("editTrackbacks")}">
-                <thead>
-                    <tr>
-                        <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="Lifetype.Forms.toggleAllChecks('postTrackbacksList');" /></th>
-                        <th style="width:25%;">{$locale->tr("topic")}</th>						
-                        <th style="width:45%;">{$locale->tr("text")}</th>
-                        <th style="width:5%;">{$locale->tr("author")}</th>
-						<th style="width:5%">{$locale->tr("date")}</th>
-                        <th style="width:5%">{$locale->tr("status")}</th>
-                        <th style="width:10%">IP</th>
-                        <th style="width:10%">{$locale->tr("actions")}</th>
-                    </tr>
-                </thead>
-                <tbody>
-                   {foreach from=$comments item=trackback}
-                    <tr>
-                        <td>
-                            <input class="checkbox" type="checkbox" name="trackbackIds[{$trackback->getId()}]" id="trackbackIds[{$trackback->getId()}]" value="{$trackback->getId()}" />
-                        </td>
-                        <td class="col_highlighted">
-                            {$trackback->getTopic()|strip_tags|utf8_wordwrap:12:"<br/>":true}
-                            <span style="font-weight:normal">
-							<br/>
-                            &nbsp;&raquo;
-                            {assign var=trackbackPost value=$trackback->getArticle()}
-                            <a href="{$url->postPermalink($trackbackPost)}">{$trackbackPost->getTopic()}</a>
-                            </span>
-                        </td>
-                        <td>
-                            {$trackback->getText()|strip_tags|utf8_wordwrap:35:"<br/>":true}
-                        </td>
-                        <td>
-                            <a href="{$trackback->getUserUrl()}">{$trackback->getUserName()}</a>
-                        </td>
-                        <td>
-                            {assign var=date value=$trackback->getDateObject()}
-                            {$locale->formatDate($date)}
-                        </td>
-                        <td>
-                          {foreach from=$commentstatus key=name item=status}
-                           {if $trackback->getStatus() == $status}{$locale->tr($name)}{/if}
-                          {/foreach}
-                        </td>
-                        <td style="text-align: center;">
-						  {$trackback->getClientIp()}
-                        </td>														                
-                        <td>
-							{check_perms perm=update_trackback}	
-                            <div class="list_action_button">
-                             <a href="?op=deleteTrackback&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("delete")}">
-                             	<img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
-                             </a>
-							{if $bayesian_filter_enabled}
-								{if $trackback->getStatus() == 0}
-								    <a href="?op=markTrackback&amp;mode=1&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_spam")}">
-									 <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
-									</a>
-								{elseif $trackback->getStatus() == 1}
-									<a href="?op=markTrackback&amp;mode=0&amp;articleId={if $post}{$post->getId()}{else}0{/if}&amp;trackbackId={$trackback->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}
-							{/check_perms}
-                            {if $trackback->getUserUrl()}
-                                <a href="{$trackback->getUserUrl()}" title="{$locale->tr("url")}">
-                                 <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
-                                </a>
-                            {/if}
-                            </div>
-                        </td>
-                    </tr>
-                    {/foreach}
-                </tbody>
-            </table>
-        </div>
-        <a name="bulkEdit"></a>
-        <div id="list_action_bar">
-            {adminpager style=list}
-			{check_perms perm=update_trackback}
-			<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:submitTrackbacksList('deleteTrackbacks');" />
-            <input type="hidden" name="op" value="" />
-			{/check_perms}
-			{check_perms perm=update_trackback}
-            <div id="massiveChangeOption" style="display: none;">
-                <fieldset>
-                <legend>{$locale->tr("massive_change_option")}</legend>            
-		            <label for="trackbackStatus">{$locale->tr("status")}</label>
-		            <select name="trackbackStatus" id="trackbackStatus">
-		              <option value="-1">-{$locale->tr("select")}-</option>
-		              {foreach from=$commentstatusWithoutAll key=name item=status}
-		                {if ($status != 0 && $status != 1) || $bayesian_filter_enabled}<option value="{$status}">{$locale->tr($name)}</option>{/if}
-		              {/foreach}
-		            </select>
-		            <input type="button" name="changeTrackbacksStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitTrackbacksList('changeTrackbacksStatus');" /> 
-		        </fieldset>
-			</div>
-			{/check_perms}
-        </div>            
-
-	</form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}

Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/templates/admin/menus.xml	2007-07-20 20:42:11 UTC (rev 5696)
@@ -5,7 +5,6 @@
 	       <editPosts url="?op=editPosts" andPerms="view_posts" />
 	       <editArticleCategories url="?op=editArticleCategories" andPerms="view_categories" />
 	       <editComments url="?op=editComments" andPerms="view_comments" />
-	       <editTrackbacks url="?op=editTrackbacks" andPerms="view_trackbacks" />
 	       <editLinks url="?op=editLinks" andPerms="view_links" />
 		   <editLinkCategories url="?op=editLinkCategories" andPerms="view_link_categories" />	
 		  <blogCustomFields url="?op=blogCustomFields" andPerms="view_custom_fields" />		

Modified: plog/trunk/templates/admin/newlink.template
===================================================================
--- plog/trunk/templates/admin/newlink.template	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/templates/admin/newlink.template	2007-07-20 20:42:11 UTC (rev 5696)
@@ -32,7 +32,7 @@
             <span class="required"></span>
             <div class="formHelp">{$locale->tr("link_feed_help")}</div>
             <input type="text" name="linkRssFeed" id="linkRssFeed" value="{$linkRssFeed}" />
-			{include file="$admintemplatepath/validateajax.template" field=linkRssFeed}			
+			{include file="$admintemplatepath/validateajax.template" field=linkRssFeed}
         </div>		
 
         <div class="field">

Modified: plog/trunk/templates/admin/validateajax.template
===================================================================
--- plog/trunk/templates/admin/validateajax.template	2007-07-20 17:55:49 UTC (rev 5695)
+++ plog/trunk/templates/admin/validateajax.template	2007-07-20 20:42:11 UTC (rev 5696)
@@ -1 +1,4 @@
-<div id="field_{$field}" class="fieldValidationError" style="display:none"></div>
\ No newline at end of file
+{** When using the ajax interface, we'll use this code **}
+<div id="field_{$field}" class="fieldValidationError" style="display:none"></div>
+{** otherwise we'll use the old one **}
+{include file="$admintemplatepath/validate.template"}
\ No newline at end of file



More information about the pLog-svn mailing list