[pLog-svn] r4289 - in plog/trunk: class/action/admin templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Nov 12 13:11:01 GMT 2006


Author: oscar
Date: 2006-11-12 13:11:00 +0000 (Sun, 12 Nov 2006)
New Revision: 4289

Modified:
   plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
   plog/trunk/templates/admin/globalarticlecategories.template
Log:
added permissions to global article category management


Modified: plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -29,15 +29,17 @@
          */
         function AdminAddGlobalArticleCategoryAction( $actionInfo, $request )
         {
-        		$this->AdminAction( $actionInfo, $request );
+        	$this->AdminAction( $actionInfo, $request );
 			
-			    // register two validators
-				$this->registerFieldValidator( "categoryName", new StringValidator());
-				$this->registerFieldValidator( "categoryDescription", new StringValidator());
-				// and the view we should show in case there is a validation error
-				$errorView = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
-				$errorView->setErrorMessage( $this->_locale->tr("error_adding_global_article_category" ));			
-				$this->setValidationErrorView( $errorView );
+			// register two validators
+			$this->registerFieldValidator( "categoryName", new StringValidator());
+			$this->registerFieldValidator( "categoryDescription", new StringValidator());
+			// and the view we should show in case there is a validation error
+			$errorView = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
+			$errorView->setErrorMessage( $this->_locale->tr("error_adding_global_article_category" ));			
+			$this->setValidationErrorView( $errorView );
+				
+			$this->requireAdminPermission( "add_global_category" );				
         }
 
         /**
@@ -63,7 +65,10 @@
 				// lists all the article categories... without forgetting that we should let the
 				// next class know that we actually added a category alongside a message
 				// and the category that we just added!
-				$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+				if( $this->userHasPermission( "view_global_categories", ADMIN_PERMISSION ))
+					$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
+				else
+					$this->_view = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
 				$this->_view->setSuccess( true );
 				$this->_view->setSuccessMessage( $this->_locale->pr("global_category_added_ok", $category->getName()));
 				

Modified: plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/admindeleteglobalarticlecategoryaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -41,6 +41,8 @@
 			$view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_incorrect_global_category_id"));
 			$this->setValidationErrorView( $view );		
+			
+			$this->requireAdminPermission( "update_global_category" );
         }
 
 		/**

Modified: plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -25,6 +25,8 @@
         	$this->AdminAction( $actionInfo, $request );
 			
 			$this->_searchTerms = $this->_request->getValue( "searchTerms" );
+			
+			$this->requireAdminPermission( "view_global_categories" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -39,6 +39,8 @@
 			$errorView = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
 			$errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id"));
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requireAdminPermission( "update_global_category" );			
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/adminnewglobalarticlecategoryaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -25,6 +25,8 @@
         function AdminNewGlobalArticleCategoryAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+
+			$this->requireAdminPermission( "add_global_category" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2006-11-12 13:11:00 UTC (rev 4289)
@@ -43,6 +43,8 @@
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editglobalarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_article_category" ));
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requireAdminPermission( "update_global_category" );
         }
 
         /**

Modified: plog/trunk/templates/admin/globalarticlecategories.template
===================================================================
--- plog/trunk/templates/admin/globalarticlecategories.template	2006-11-12 13:10:35 UTC (rev 4288)
+++ plog/trunk/templates/admin/globalarticlecategories.template	2006-11-12 13:11:00 UTC (rev 4289)
@@ -43,13 +43,15 @@
       <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$category->getId()}" value="{$category->getId()}" />
    </td>  
    <td class="col_highlighted">
-    <a href="admin.php?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}">{$category->getName()}</a>
+    {check_perms adminperm=update_global_category}<a href="admin.php?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}">{/check_perms}{$category->getName()}{check_perms adminperm=update_global_category}</a>{/check_perms}
    </td>   
   
    <td>
      <div class="list_action_button">
+      {check_perms adminperm=update_global_category}	
        <a href="?op=editGlobalArticleCategory&amp;categoryId={$category->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
        <a href="?op=deleteGlobalArticleCategory&amp;categoryId={$category->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+      {/check_perms}
      </div>
    </td>
   </tr>
@@ -59,8 +61,10 @@
  </div>
  <div id="list_action_bar">
   {adminpager style=list}
+  {check_perms adminperm=update_global_category}
   <input type="hidden" name="op" value="deleteGlobalArticleCategories"/>
   <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+  {/check_perms}
  </div>
  </form>
 



More information about the pLog-svn mailing list