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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Oct 22 18:18:00 GMT 2006


Author: oscar
Date: 2006-10-22 18:17:59 +0000 (Sun, 22 Oct 2006)
New Revision: 4159

Modified:
   plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php
   plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminnewarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
   plog/trunk/templates/admin/editarticlecategories.template
Log:
permissions for dealing with article categories


Modified: plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php	2006-10-22 18:17:59 UTC (rev 4159)
@@ -38,6 +38,8 @@
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newpostcategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_article_category" ));			
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requirePermission( "add_category" );
 
         }
 
@@ -72,7 +74,11 @@
 				// 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 AdminArticleCategoriesListView( $this->_blogInfo );
+				if( $this->userHasPermission( "view_categories" )) 
+					$this->_view = new AdminArticleCategoriesListView( $this->_blogInfo );
+				else
+					$this->_view = new AdminTemplatedView( $this->_blogInfo, "newpostcategory" );
+					
 				$this->_view->setSuccess( true );
 				$this->_view->setSuccessMessage( $this->_locale->pr("category_added_ok", $category->getName()));
 				

Modified: plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php	2006-10-22 18:17:59 UTC (rev 4159)
@@ -19,6 +19,8 @@
         function AdminEditArticleCategoriesAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+
+			$this->requirePermission( "view_categories" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php	2006-10-22 18:17:59 UTC (rev 4159)
@@ -34,6 +34,8 @@
 			$errorView = new AdminArticleCategoriesListView( $this->_blogInfo );
 			$errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id"));
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requirePermission( "update_category" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminnewarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewarticlecategoryaction.class.php	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/class/action/admin/adminnewarticlecategoryaction.class.php	2006-10-22 18:17:59 UTC (rev 4159)
@@ -18,9 +18,11 @@
          * Constructor. If nothing else, it also has to call the constructor of the parent
          * class, BlogAction with the same parameters
          */
-        function AdminNewPostAction( $actionInfo, $request )
+        function AdminNewArticleCategoryAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+
+			$this->requirePermission( "add_category" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php	2006-10-22 18:17:59 UTC (rev 4159)
@@ -41,6 +41,8 @@
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_article_category" ));
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requirePermission( "update_category" );			
         }
 
         /**
@@ -76,8 +78,16 @@
 			$category->setProperties( $this->_properties );
 			$category->setDescription( $this->_categoryDescription );
 			
-			// this is view we're going to use to show our messages
-			$this->_view = new AdminArticleCategoriesListView( $this->_blogInfo );			
+			if( $this->userHasPermission( "view_categories" ))
+				$this->_view = new AdminArticleCategoriesListView( $this->_blogInfo );			
+			else {
+				$this->_view = new AdminTemplatedView( $this->_blogInfo, "editarticlecategory" );
+	            $this->_view->setValue( "category", $category );
+				$this->_view->setValue( "categoryName", $category->getName());
+				$this->_view->setValue( "categoryDescription", $category->getDescription());
+				$this->_view->setValue( "categoryInMainPage", $category->isInMainPage());
+				$this->_view->setValue( "categoryId", $category->getId());				
+			}
 			
             if( !$categories->updateCategory( $category )) {
                 $this->_view->setErrorMessage( $this->_locale->tr("error_updating_article_category"));

Modified: plog/trunk/templates/admin/editarticlecategories.template
===================================================================
--- plog/trunk/templates/admin/editarticlecategories.template	2006-10-22 17:48:30 UTC (rev 4158)
+++ plog/trunk/templates/admin/editarticlecategories.template	2006-10-22 18:17:59 UTC (rev 4159)
@@ -46,10 +46,10 @@
       <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=editArticleCategory&amp;categoryId={$category->getId()}">{$category->getName()}</a>
+    {check_perms perm=update_category}<a href="admin.php?op=editArticleCategory&amp;categoryId={$category->getId()}">{/check_perms}{$category->getName()}{check_perms perm=update_category}</a>{/check_perms}
    </td>
    {if $category->getNumArticles() > 0}
-    <td><a href="admin.php?op=editPosts&amp;showCategory={$category->getId()}&amp;showStatus=0&amp;showMonth=-1">({$category->getNumAllArticles()})</a></td>
+    <td>{check_perms perm=view_articles}<a href="admin.php?op=editPosts&amp;showCategory={$category->getId()}&amp;showStatus=0&amp;showMonth=-1">{/check_perms}({$category->getNumAllArticles()}){check_perms perm=view_articles}</a>{/check_perms}</td>
    {else}
     <td>(0)</td>
    {/if}
@@ -58,8 +58,10 @@
    </td>
    <td>
      <div class="list_action_button">
+	 {check_perms perm=update_category}
        <a href="?op=editArticleCategory&amp;categoryId={$category->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
        <a href="?op=deleteArticleCategory&amp;categoryId={$category->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+	 {/check_perms}
      </div>
    </td>
   </tr>
@@ -69,8 +71,10 @@
  </div>
  <div id="list_action_bar">
   {adminpager style=list}
-  <input type="hidden" name="op" value="deleteArticleCategories"/>
-  <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+  {check_perms perm=update_category}
+   <input type="hidden" name="op" value="deleteArticleCategories"/>
+   <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+  {/check_perms}
  </div>
  </form>
 



More information about the pLog-svn mailing list