[pLog-svn] r861 - in plugins/trunk/contentfilter: . class/action class/view templates

mark at devel.plogworld.net mark at devel.plogworld.net
Thu Jan 27 11:31:01 GMT 2005


Author: mark
Date: 2005-01-27 11:31:01 +0000 (Thu, 27 Jan 2005)
New Revision: 861

Added:
   plugins/trunk/contentfilter/class/view/adminblogfilteredcontentview.class.php
   plugins/trunk/contentfilter/class/view/admineditblogfilteredcontentview.class.php
   plugins/trunk/contentfilter/class/view/adminnewblogfilteredcontentview.class.php
Modified:
   plugins/trunk/contentfilter/class/action/adminaddblogfilteredcontentaction.class.php
   plugins/trunk/contentfilter/class/action/adminblogfilteredcontentsaction.class.php
   plugins/trunk/contentfilter/class/action/admindeleteblogfilteredcontentaction.class.php
   plugins/trunk/contentfilter/class/action/admineditblogfilteredcontentaction.class.php
   plugins/trunk/contentfilter/class/action/adminnewblogfilteredcontentaction.class.php
   plugins/trunk/contentfilter/class/action/adminupdateblogfilteredcontentaction.class.php
   plugins/trunk/contentfilter/class/action/adminupdatefilteredcontentaction.class.php
   plugins/trunk/contentfilter/plugincontentfilter.class.php
   plugins/trunk/contentfilter/templates/addblogfilteredcontent.template
   plugins/trunk/contentfilter/templates/addfilteredcontent.template
   plugins/trunk/contentfilter/templates/blogfilteredcontent.template
   plugins/trunk/contentfilter/templates/editblogfilteredcontent.template
Log:
Update blogcontentfilter UI.
todo:
process()

Modified: plugins/trunk/contentfilter/class/action/adminaddblogfilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/adminaddblogfilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/adminaddblogfilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,10 +1,10 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );    
     include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
     include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminnewblogfilteredcontentview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminblogfilteredcontentview.class.php" );
 
     /**
      * Adds new blocked content to the blog
@@ -18,54 +18,49 @@
     	function AdminAddBlogFilteredContentAction( $actionInfo, $request )
         {
         	$this->BlogOwnerAdminAction( $actionInfo, $request );
+
+			// data validation
+			$this->registerFieldValidator( "filteredContent", new StringValidator());
+			$this->_form->registerField( "reason" );
+			$view = new AdminNewBlogFilteredContentView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_provide_content_to_block" ));
+			$this->setValidationErrorView( $view );          	
         }
 
-        function validate()
+        function perform()
         {
+            // fetch the data
         	$this->_newFilteredContent = $this->_request->getValue( "filteredContent" );
             $this->_reason = $this->_request->getValue( "reason" );
 
-            $val = new StringValidator();
-            if( !$val->validate( $this->_newFilteredContent )) {
-            	$this->_view = new AdminErrorView( $this->_blogInfo );
-				$message = $this->_locale->tr("error_provide_content_to_block");
-				$message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
-                $this->_view->setMessage( $message );
-
-                $this->setCommonData();
-
-                return false;
-            }
-
-            return true;
-        }
-
-        function perform()
-        {
         	// create the dao object and add the info to the db
         	$filteredContents = new FilteredContents();
 			$filteredContent = new FilteredContent( $this->_newFilteredContent, $this->_blogInfo->getId(), $this->_reason );			
 			
 			// throw the pre-event
-			$this->notifyEvent( EVENT_PRE_FILTERED_CONTENT_ADD, Array( "content" => &$filteredContent ));			
+			$this->notifyEvent( EVENT_PRE_FILTERED_CONTENT_ADD, Array( "content" => &$filteredContent ));
+			// and add the filtered content to the database			
             $result = $filteredContents->addBlogFilteredContent( $filteredContent );
 
             // and give some feedback to the user
             if( !$result ) {
-            	$message = $this->_locale->tr("error_adding_blocked_content");
-				$message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
-                $this->_view = new AdminErrorView( $this->_blogInfo );
+                $this->_view = new AdminNewBlogFilteredContentView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_adding_blocked_content"));
+                $this->setCommonData();							
+
+                return false;                
             }
-            else {
-				$this->notifyEvent( EVENT_POST_FILTERED_CONTENT_ADD, Array( "content" => &$filteredContent ));
-            	$message = $this->_locale->tr("blocked_content_added_ok");
-				$message .= "<br/><br/><a href=\"admin.php?op=blogFilteredContent\">".$this->_locale->tr("view")."</a>";
-                $this->_view = new AdminMessageView( $this->_blogInfo );
-            }
 
-            $this->_view->setMessage( $message );
+			$this->notifyEvent( EVENT_POST_FILTERED_CONTENT_ADD, Array( "content" => &$filteredContent ));
+
+            $this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+            $this->_view->setSuccessMessage( $this->_locale->tr("blocked_content_added_ok") );
             $this->setCommonData();
 
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+            // better to return true if everything fine
             return true;
         }
     }

Modified: plugins/trunk/contentfilter/class/action/adminblogfilteredcontentsaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/adminblogfilteredcontentsaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/adminblogfilteredcontentsaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,8 +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/contentfilter/class/dao/filteredcontents.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminblogfilteredcontentview.class.php" );
 
     /**
      * Shows the list of content that has been blocked by the current blog
@@ -20,12 +19,8 @@
          */
         function perform()
         {
-        	// get the content that has been filtered by this blog
-            $filteredContents = new FilteredContents();
-            $blogFilteredContents = $filteredContents->getBlogFilteredContents( $this->_blogInfo->getId());
-
-            $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "contentfilter", "blogfilteredcontent" );
-            $this->_view->setValue( "filteredcontent", $blogFilteredContents );
+            $this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+            
             $this->setCommonData();
 
             // better to return true if everything fine

Modified: plugins/trunk/contentfilter/class/action/admindeleteblogfilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/admindeleteblogfilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/admindeleteblogfilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,9 +1,10 @@
 <?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."class/data/validator/arrayvalidator.class.php" );    
     include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminnewblogfilteredcontentview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminblogfilteredcontentview.class.php" );
 
     /**
      * removes filtered content from a blog
@@ -12,54 +13,76 @@
 	{
 
     	var $_deleteFilteredContents;
+    	var $_contentId;
+    	var $_op;
 
-        function AdminBlogFilteredContentsAction( $actionInfo, $request )
+        function AdminDeleteBlogFilteredContentAction( $actionInfo, $request )
         {
         	$this->BlogOwnerAdminAction( $actionInfo, $request );
+			
+			$this->_op = $actionInfo->getActionParamValue();
+			
+			$view = new AdminBlogFilteredContentView( $this->_blogInfo );			
+			if( $this->_op == "deleteBlogFilteredContent" ) {
+				$this->registerFieldValidator( "contentId", new IntegerValidator());
+				$view->setErrorMessage( $this->_locale->tr("error_incorrect_content_id"));	
+			}
+			else {
+				$this->registerFieldValidator( "deleteBlogFilteredContent", new ArrayValidator());
+				$view->setErrorMessage( $this->_locale->tr("error_no_block_content_selected"));
+			}
+			$this->setValidationErrorView( $view );          	
         }
 
-        function validate()
-        {
-        	$this->_deleteFilteredContents = $this->_request->getValue( "deleteBlogFilteredContent" );
-
-            if( count($this->_deleteFilteredContents) == 0 ) {
-            	$this->_view = new AdminErrorView( $this->_blogInfo );
-                $this->_view->setMessage( $this->_locale->tr("error_no_contents_selected_to_remove"));
-                $this->setCommonData();
-
-                return false;
-            }
-
-            return true;
-        }
-
         /**
          * Carries out the specified action
          */
-        function perform()
+		function perform()
+		{
+			if( $this->_op == "deleteBlogFilteredContent" ) {
+				$this->_deleteFilteredContents = Array();
+				$this->_contentId = $this->_request->getValue( "contentId" );
+				$this->_deleteFilteredContents[] = $this->_contentId;
+			}
+			else
+				$this->_deleteFilteredContents = $this->_request->getValue( "deleteBlogFilteredContent" );
+			
+			$this->_deleteBlogFilteredContents();
+		}
+		         
+        function _deleteBlogFilteredContents()
         {
         	// get the content that has been filtered by this blog
             $filteredContents = new FilteredContents();
-            $blogFilteredContents = $filteredContents->getBlogFilteredContents( $this->_blogInfo->getId());
 
             // loop through the array of things to remove
-            $message = "";
+            $errorMessage = "";
+			$successMessage = "";
+			$numOk = 0;
             foreach( $this->_deleteFilteredContents as $filteredContentId ) {
             	// fetch the content
                 $blogFilteredContent = $filteredContents->getBlogFilteredContent( $filteredContentId, $this->_blogInfo->getId() );
 				$this->notifyEvent( EVENT_PRE_FILTERED_CONTENT_DELETE, Array( "content" => &$blogFilteredContent ));
                 // first remove it
                 if( !$filteredContents->removeBlogFilteredContent( $filteredContentId, $this->_blogInfo->getId()))
-                	$message .= $this->_locale->pr("error_deleting_content", $blogFilteredContent->getRegExp(false))."<br/><br/>";
+                	$errorMessage .= $this->_locale->pr("error_deleting_content", $blogFilteredContent->getRegExp(false))."<br/>";
                 else {
-                	$message .= $this->_locale->pr("content_deleted_ok", $blogFilteredContent->getRegExp(false))."<br/><br/>";
+					$numOk++;
+					if( $numOk > 1 )
+						$successMessage = $this->_locale->pr("contents_deleted_ok", $numOk );
+					else
+						$successMessage = $this->_locale->pr("content_deleted_ok", $blogFilteredContent->getRegExp(false));
 					$this->notifyEvent( EVENT_POST_FILTERED_CONTENT_DELETE, Array( "content" => &$blogFilteredContent ));
 				}
             }
 
-            $this->_view = new AdminMessageView( $this->_blogInfo );
-            $this->_view->setMessage( $message );
+            $this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+            if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
             $this->setCommonData();
+       
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());
 
             // better to return true if everything fine
             return true;

Modified: plugins/trunk/contentfilter/class/action/admineditblogfilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/admineditblogfilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/admineditblogfilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,10 +1,10 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
     include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
     include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/admineditblogfilteredcontentview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminblogfilteredcontentview.class.php" );     
 
     /**
      * Shows a form to add a new blocked content to the blog
@@ -17,39 +17,32 @@
     	function AdminEditBlogFilteredContentAction( $actionInfo, $request )
         {
         	$this->BlogOwnerAdminAction( $actionInfo, $request );
+        	
+			// data validation stuff
+			$this->registerFieldValidator( "contentId", new IntegerValidator());
+			$view = new AdminBlogFilteredContentView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_content_id") );
+			$this->setValidationErrorView( $view );            	
         }
 
-        function validate()
+        function perform()
         {
+        	// fetch the data
         	$this->_contentId = $this->_request->getValue( "contentId" );
 
-            $val = new IntegerValidator();
-            if( !$val->validate( $this->_contentId )) {
-            	$this->_view = new AdminErrorView( $this->_locale->tr("error_incorrect_content_id"));
-                $this->setCommonData();
-
-                return false;
-            }
-
-            return true;
-        }
-
-        function perform()
-        {
         	// fetch the filtered content that we're going to edit
             $contents = new FilteredContents();
             $filteredContent = $contents->getBlogFilteredContent( $this->_contentId, $this->_blogInfo->getId());
 
             if( !$filteredContent ) {
-            	$this->_view = new AdminErrorView( $this->_blogInfo );
-                $this->_view->setMessage( $this->_locale->tr("error_fetching_filtered_content"));
+            	$this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_filtered_content"));
                 $this->setCommonData();
 
             	return false;
             }
 
-        	$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "contentfilter", "editblogfilteredcontent" );
-            $this->_view->setValue( "filteredcontent", $filteredContent );
+        	$this->_view = new AdminEditBlogFilteredContentView( $this->_blogInfo , $this->_contentId );
             $this->setCommonData();
 
             return true;

Modified: plugins/trunk/contentfilter/class/action/adminnewblogfilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/adminnewblogfilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/adminnewblogfilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -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/contentfilter/class/view/adminnewblogfilteredcontentview.class.php" );
 
     /**
      * Shows a form to add a new blocked content to the blog
@@ -15,7 +15,8 @@
 
         function perform()
         {
-        	$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "contentfilter", "addblogfilteredcontent" );
+        	$this->_view = new AdminNewBlogFilteredContentView( $this->_blogInfo );
+        	
             $this->setCommonData();
 
             return true;

Modified: plugins/trunk/contentfilter/class/action/adminupdateblogfilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/adminupdateblogfilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/adminupdateblogfilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,15 +1,16 @@
 <?php
 
-	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
     include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
     include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/admineditblogfilteredcontentview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminblogfilteredcontentview.class.php" ); 
 
     /**
      * updates filtered content from a blog
      */
-    class AdminUpdateBlogFilteredContentAction extends SiteAdminAction {
+    class AdminUpdateBlogFilteredContentAction extends BlogOwnerAdminAction
+    {
 
     	var $_filteredContentRule;
         var $_reason;
@@ -17,43 +18,38 @@
 
     	function AdminUpdateBlogFilteredContentAction( $actionInfo, $request )
         {
-        	$this->SiteAdminAction( $actionInfo, $request );
+        	$this->BlogOwnerAdminAction( $actionInfo, $request );
+			
+            // fetch the data
+            $this->_contentId = $this->_request->getValue( "contentId" );
+			
+			// set up the data validators
+			// data validation
+			$this->registerFieldValidator( "contentId", new IntegerValidator());
+			$this->registerFieldValidator( "filteredContent", new StringValidator());
+			$this->_form->registerField( "reason" );
+			$view = new AdminEditBlogFilteredContentView( $this->_blogInfo, $this->_contentId );
+			$view->setErrorMessage( $this->_locale->tr("error_provide_content_to_block" ));
+			$this->setValidationErrorView( $view );            	
         }
 
-        function validate()
+        function perform()
         {
+        	// fetch the data
         	$this->_filteredContentRule = $this->_request->getValue( "filteredContent" );
             $this->_reason = $this->_request->getValue( "reason" );
-            $this->_contentId = $this->_request->getValue( "contentId" );
 
-            $val = new StringValidator();
-            if( !$val->validate( $this->_filteredContentRule )) {
-            	$this->_view = new AdminErrorView( $this->_blogInfo );
-				$message = $this->_locale->tr("error_provide_content_to_block");
-				$message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";				
-                $this->_view->setMessage( $message );
-                $this->setCommonData();
-
-                return false;
-            }
-
-            return true;
-        }
-
-        function perform()
-        {
         	// create the dao object and add the info to the db
         	$filteredContents = new FilteredContents();
             $content = $filteredContents->getBlogFilteredContent( $this->_contentId, $this->_blogInfo->getId());
 
             // check if we could find the information, or give up otherwise...
             if( !$content ) {
-            	$this->_view = new AdminErrorView( $this->_blogInfo );
-                $this->_view->setMessage( $this->_locale->tr("error_fetching_filtered_content"));
-				$message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";				
+            	$this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_filtered_content") );
                 $this->setCommonData();
 
-            	return false;
+                return false;   
             }
 
             $content->setRegExp( $this->_filteredContentRule );
@@ -65,18 +61,16 @@
 
             // and give some feedback to the user
             if( !$result ) {
-            	$message = $this->_locale->tr("error_updating_blocked_content");
-				$message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";				
-                $this->_view = new AdminErrorView( $this->_blogInfo );
+            	$this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blocked_content") );
+                $this->setCommonData();
+
+                return false; 
             }
-            else {
-            	$message = $this->_locale->tr("blocked_content_updated_ok");
-				$message .= "<br/><br/><a href=\"admin.php?op=blogFilteredContent\">".$this->_locale->tr("view")."</a>";
-				$this->notifyEvent( EVENT_POST_FILTERED_CONTENT_UPDATE, Array( "content" => &$content ));				
-                $this->_view = new AdminMessageView( $this->_blogInfo );
-            }
 
-            $this->_view->setMessage( $message );
+			$this->notifyEvent( EVENT_POST_FILTERED_CONTENT_UPDATE, Array( "content" => &$content ));
+          	$this->_view = new AdminBlogFilteredContentView( $this->_blogInfo );
+            $this->_view->setSuccessMessage( $this->_locale->tr("blocked_content_updated_ok") );
             $this->setCommonData();
 
             return true;

Modified: plugins/trunk/contentfilter/class/action/adminupdatefilteredcontentaction.class.php
===================================================================
--- plugins/trunk/contentfilter/class/action/adminupdatefilteredcontentaction.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/action/adminupdatefilteredcontentaction.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -7,7 +7,7 @@
     include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/view/adminfilteredcontentview.class.php" ); 
 
     /**
-     * Adds new blocked content to the blog
+     * updates filtered content from a blog
      */
     class AdminUpdateFilteredContentAction extends SiteAdminAction 
 	{

Added: plugins/trunk/contentfilter/class/view/adminblogfilteredcontentview.class.php
===================================================================
--- plugins/trunk/contentfilter/class/view/adminblogfilteredcontentview.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/view/adminblogfilteredcontentview.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -0,0 +1,28 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );	
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class AdminBlogFilteredContentView extends AdminPluginTemplatedView
+	{
+
+		function AdminBlogFilteredContentView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "contentfilter", "blogfilteredcontent" );
+		}
+		
+		function render()
+		{
+        	// get the content that has been filtered by this blog
+            $filteredContents = new FilteredContents();
+            $blogFilteredContents = $filteredContents->getBlogFilteredContents( $this->_blogInfo->getId());
+
+            $this->setValue( "filteredcontent", $blogFilteredContents );	
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/contentfilter/class/view/admineditblogfilteredcontentview.class.php
===================================================================
--- plugins/trunk/contentfilter/class/view/admineditblogfilteredcontentview.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/view/admineditblogfilteredcontentview.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -0,0 +1,30 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/contentfilter/class/dao/filteredcontents.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class AdminEditBlogFilteredContentView extends AdminPluginTemplatedView
+	{
+        var $_contentId;
+		
+		function AdminEditBlogFilteredContentView( $blogInfo, $contentId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "contentfilter", "editblogfilteredcontent" );
+			
+			$this->_contentId = $contentId;
+		}
+		
+		function render()
+		{
+            $contents = new FilteredContents();
+            $filteredContent = $contents->getBlogFilteredContent( $this->_contentId, $this->_blogInfo->getId());
+            
+            $this->setValue( "filteredcontent", $filteredContent ); 
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/contentfilter/class/view/adminnewblogfilteredcontentview.class.php
===================================================================
--- plugins/trunk/contentfilter/class/view/adminnewblogfilteredcontentview.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/class/view/adminnewblogfilteredcontentview.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -0,0 +1,22 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class AdminNewBlogFilteredContentView extends AdminPluginTemplatedView
+	{
+
+		function AdminNewBlogFilteredContentView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "contentfilter", "addblogfilteredcontent" );
+		}
+		
+		function render()
+		{
+        	// get the content that has been filtered by this blog
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/contentfilter/plugincontentfilter.class.php
===================================================================
--- plugins/trunk/contentfilter/plugincontentfilter.class.php	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/plugincontentfilter.class.php	2005-01-27 11:31:01 UTC (rev 861)
@@ -55,6 +55,7 @@
 			$this->registerAdminAction( "editBlogFilteredContent", "AdminEditBlogFilteredContentAction" );
 			$this->registerAdminAction( "updateBlogFilteredContent", "AdminUpdateBlogFilteredContentAction" );
 			$this->registerAdminAction( "deleteBlogFilteredContent", "AdminDeleteBlogFilteredContentAction" );
+			$this->registerAdminAction( "deleteBlogFilteredContents", "AdminDeleteBlogFilteredContentAction" );
 			
 			$menu =& Menu::getMenu();
 			if( !$menu->entryExists( "/menu/Manage/blogSecurity" ))

Modified: plugins/trunk/contentfilter/templates/addblogfilteredcontent.template
===================================================================
--- plugins/trunk/contentfilter/templates/addblogfilteredcontent.template	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/templates/addblogfilteredcontent.template	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,24 +1,33 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=newBlogFilteredContent title=$locale->tr("newBlogFilteredContent")}
-<p>{$locale->tr("add_filtered_content_intro")}</p>
 <form name="newBlogFilteredContent" action="admin.php" method="post">
- <table width="100%">
-  <tr>
-   <td class="alignright" width="25%">{$locale->tr("content_to_block")}: </td>
-   <td><input style="width:100%" type="text" name="filteredContent" value=""/></td>
-  </tr>
-  <tr>
-   <td class="alignright">{$locale->tr("reason")}: </td>
-   <td><input type="text" style="width:100%" name="reason" value=""/></td>
-  </tr>
-  <tr>
-   <td>&nbsp;</td>
-   <td>
-    <input type="hidden" name="op" value="addBlogFilteredContent" />
-    <input type="submit" name="Add" value="{$locale->tr("block_this")}"/>
-   </td>
-  </tr>
- </table>
+ <fieldset class="inputField">
+ <legend>{$locale->tr("addFilteredContent")}</legend>
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"} 
+  <div class="field">
+   <label for="filteredContent">{$locale->tr("content_to_block")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("content_to_block_help")}</div>
+   <input type="text" name="filteredContent" id="filteredContent" value=""/>
+   {include file="$admintemplatepath/validate.template" field=filteredContent message=$locale->tr("error_provide_content_to_block")}
+  </div>
+
+  <div class="field">
+   <label for="reason">{$locale->tr("reason")}</label>
+   <span class="required"></span>
+   <div class="formHelp">{$locale->tr("reason_help")}</div>
+   <input type="text" name="reason" id="reason" value=""/>
+  </div>
+
+ </fieldset>
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="addBlogFilteredContent" />
+  <input type="reset" value="{$locale->tr("reset")}" name="reset"/>	
+  <input type="submit" name="Add" value="{$locale->tr("add")}"/>
+ </div>    
+
 </form>
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}

Modified: plugins/trunk/contentfilter/templates/addfilteredcontent.template
===================================================================
--- plugins/trunk/contentfilter/templates/addfilteredcontent.template	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/templates/addfilteredcontent.template	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,6 +1,6 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=newFilteredContent title=$locale->tr("newFilteredContent")}
-<form name="newBlogFilteredContent" action="admin.php" method="post">
+<form name="newFilteredContent" action="admin.php" method="post">
  <fieldset class="inputField">
  <legend>{$locale->tr("addFilteredContent")}</legend>
   {include file="$admintemplatepath/successmessage.template"}

Modified: plugins/trunk/contentfilter/templates/blogfilteredcontent.template
===================================================================
--- plugins/trunk/contentfilter/templates/blogfilteredcontent.template	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/templates/blogfilteredcontent.template	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,28 +1,39 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=blogFilteredContent title=$locale->tr("blogFilteredContent")}
-<p>
-{$locale->tr("filtered_content_intro")}
-</p>
 <form name="blogFilteredContent" action="admin.php" method="post">
-<table width="100%" border="1">
- <tr>
-  <th width="40%">{$locale->tr("content")}</th>
-  <th>{$locale->tr("reason")}</th>
-  <th>{$locale->tr("date")}</th>
-  <th>{$locale->tr("delete")}</th>
- </tr>
-{foreach from=$filteredcontent item=content}
- <tr>
-  <td valign="top"><a href="admin.php?op=editBlogFilteredContent&amp;contentId={$content->getId()}">{$content->getRegExp(true)}</a></td>
-  <td valign="top">{$content->getReason()}</td>
-  {assign var=contentDate value=$content->getDateObject()}
-  <td valign="top">{$locale->formatDate($contentDate,"%d/%m/%Y %H:%M")}</td>
-  <td valign="top" align="center"><input type="checkbox" name="deleteBlogFilteredContent[{$content->getId()}]" value="{$content->getId()}"/></td>
- </tr>
-{/foreach}
-</table>
-<input type="hidden" name="op" value="deleteBlogFilteredContent" />
-<input type="submit" value="{$locale->tr("delete_selected")}" name="deleteSelected" />
+ <div id="list">
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+  <table class="info">
+   <tr>
+   <tr>
+    <th style="width:10px;"><input class="checkbox" type="checkbox" class="check" name="all" id="all" value="1" onclick="toggleAllChecks('blogFilteredContent');" /></th>
+    <th style="width:150px;">{$locale->tr("content")}</th>
+    <th style="width:350px;">{$locale->tr("reason")}</th>
+    <th style="width:150px;">{$locale->tr("date")}</th>
+    <th style="width:95px;">{$locale->tr("actions")}</th>
+   </tr>
+   {foreach from=$filteredcontent item=content}
+    <tr>
+     <td align="center"><input class="checkbox" type="checkbox" name="deleteBlogFilteredContent[{$content->getId()}]" value="{$content->getId()}"/></td>
+     <td class="col_highlighted"><a href="admin.php?op=editBlogFilteredContent&amp;contentId={$content->getId()}">{$content->getRegExp(true)}</a></td>
+     <td>{$content->getReason()}</td>
+     {assign var=contentDate value=$content->getDateObject()}
+     <td>{$locale->formatDate($contentDate,"%d/%m/%Y %H:%M")}</td>
+     <td>
+      <div class="list_action_button">
+       <a href="?op=editBlogFilteredContent&amp;contentId={$content->getId()}"><img src="imgs/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
+       <a href="?op=deleteBlogFilteredContent&amp;contentId={$content->getId()}"><img src="imgs/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+      </div>
+    </td>     
+    </tr>     
+   {/foreach}
+  </table>
+  <div id="list_action_bar">
+   <input type="hidden" name="op" value="deleteBlogFilteredContents" />
+   <input type="submit" value="{$locale->tr("delete")}" name="deleteSelected" />
+  </div> 
+ </div>
 </form>
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}

Modified: plugins/trunk/contentfilter/templates/editblogfilteredcontent.template
===================================================================
--- plugins/trunk/contentfilter/templates/editblogfilteredcontent.template	2005-01-27 09:34:45 UTC (rev 860)
+++ plugins/trunk/contentfilter/templates/editblogfilteredcontent.template	2005-01-27 11:31:01 UTC (rev 861)
@@ -1,29 +1,34 @@
 {include file="$admintemplatepath/header.template"}
 {include file="$admintemplatepath/navigation.template" showOpt=blogFilteredContent title=$locale->tr("blogFilteredContent")}
-<p>Anything added here will not be allowed as valid text in a comment, and any attempt
-by a casual user to post a comment with blocked content will block the comment. Regular
-expressions or a simple string can be used. Regular expressions are much more powerful
-but they're also much more complex and you should be careful with them, because you
-could potentially block all content with the wrong regular expression.</p>
 <form name="editBlogFilteredContent" action="admin.php" method="post">
- <table width="100%">
-  <tr>
-   <td class="alignright" width="25%">{$locale->tr("content_to_block")}: </td>
-   <td><input style="width:100%" type="text" name="filteredContent" value="{$filteredcontent->getRegExp()}"/></td>
-  </tr>
-  <tr>
-   <td class="alignright">{$locale->tr("reason")}: </td>
-   <td><input type="text" style="width:100%" name="reason" value="{$filteredcontent->getReason()}"/></td>
-  </tr>
-  <tr>
-   <td>&nbsp;</td>
-   <td>
-    <input type="hidden" name="op" value="updateBlogFilteredContent" />
-    <input type="hidden" name="contentId" value="{$filteredcontent->getId()}" />
-    <input type="submit" name="Add" value="{$locale->tr("update")}"/>
-   </td>
-  </tr>
- </table>
+ <fieldset class="inputField">
+ <legend>{$locale->tr("editFilteredContent")}</legend>
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"} 
+  <div class="field">
+   <label for="filteredContent">{$locale->tr("content_to_block")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("content_to_block_help")}</div>
+   <input type="text" name="filteredContent" id="filteredContent" value="{$filteredcontent->getRegExp()}"/>
+   {include file="$admintemplatepath/validate.template" field=filteredContent message=$locale->tr("error_provide_content_to_block")}
+  </div>
+
+  <div class="field">
+   <label for="reason">{$locale->tr("reason")}</label>
+   <span class="required"></span>
+   <div class="formHelp">{$locale->tr("reason_help")}</div>
+   <input type="text" name="reason" id="reason" value="{$filteredcontent->getReason()}"/>
+  </div>
+
+ </fieldset>
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateBlogFilteredContent" />
+  <input type="hidden" name="contentId" value="{$filteredcontent->getId()}" />
+  <input type="reset" value="{$locale->tr("reset")}" name="reset"/>
+  <input type="submit" name="Add" value="{$locale->tr("update")}"/>
+ </div>   
+
 </form>
 {include file="$admintemplatepath/footernavigation.template"}
 {include file="$admintemplatepath/footer.template"}




More information about the pLog-svn mailing list