[pLog-svn] r4069 - in plog/trunk: class/action/admin class/controller class/dao class/plugin class/view/admin locale templates/admin templates/standard

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Oct 1 15:44:30 GMT 2006


Author: oscar
Date: 2006-10-01 15:44:28 +0000 (Sun, 01 Oct 2006)
New Revision: 4069

Added:
   plog/trunk/class/action/admin/adminaddpermissionaction.class.php
   plog/trunk/class/action/admin/admindeletepermissionsaction.class.php
   plog/trunk/class/action/admin/adminnewpermissionaction.class.php
   plog/trunk/class/action/admin/adminpermissionslistaction.class.php
   plog/trunk/class/view/admin/adminpermissionslistview.class.php
   plog/trunk/templates/admin/newpermission.template
   plog/trunk/templates/admin/permissions.template
Modified:
   plog/trunk/class/controller/admincontrollermap.properties.php
   plog/trunk/class/dao/permission.class.php
   plog/trunk/class/dao/permissions.class.php
   plog/trunk/class/dao/userinfo.class.php
   plog/trunk/class/dao/userpermissions.class.php
   plog/trunk/class/plugin/eventlist.properties.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/templates/admin/menus.xml
   plog/trunk/templates/standard/post.template
Log:
some progress with the new user permission framework, now it is possible add, delete and list permissions via the user interface


Added: plog/trunk/class/action/admin/adminaddpermissionaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpermissionaction.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/action/admin/adminaddpermissionaction.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,59 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminpermissionslistview.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
+	include_once( PLOG_CLASS_PATH."class/dao/permissions.class.php" );	
+
+    /**
+     * \ingroup Action
+     * @private
+ 	 *
+ 	 * Adds a new permission to the database
+     */
+    class AdminAddPermissionAction extends SiteAdminAction 
+	{
+		function AdminAddPermissionAction( $actionInfo, $request )
+        {
+        	$this->SiteAdminAction( $actionInfo, $request );
+			
+			// register two validators
+			$this->registerFieldValidator( "permissionName", new StringValidator());
+			$this->registerFieldValidator( "permissionDescription", new StringValidator());
+			$this->registerField( "corePermission" );
+			$this->registerField( "adminOnlyPermission" );			
+			// and the view we should show in case there is a validation error
+			$errorView = new AdminTemplatedView( $this->_blogInfo, "newpermission" );
+			$errorView->setErrorMessage( $this->_locale->tr("error_adding_permission" ));			
+			$this->setValidationErrorView( $errorView );
+		}
+		
+        function perform()
+        {
+			// add the permission and check success
+			$perm = new Permission( 
+				$this->_request->getValue( "permissionName"), 
+				$this->_request->getValue( "permissionDescription" )
+			);
+			if( $this->_request->getValue( "corePermission" ) == 1 )
+				$perm->setCorePermission( true );
+			if( $this->_request->getValue( "adminOnlyPermission" ) == 1 )
+					$perm->setAdminOnlyPermission( true );
+			
+			$perms = new Permissions();
+			$this->notifyEvent( EVENT_PRE_PERMISSION_ADD, Array( "permission" => &$perm ));			
+			if( $perms->addPermission( $perm )) {
+				$this->notifyEvent( EVENT_POST_PERMISSION_ADD, Array( "permission" => &$perm ));
+				$this->_view = new AdminPermissionsListView( $this->_blogInfo );
+				$this->_view->setSuccessMessage( $this->_locale->tr("permission_added_ok" ));
+				$this->setCommonData();
+			}
+			else {
+				$this->_view->setErrorMessage( $this->_locale->tr("permission_added_ok" ));
+				$this->_view->setError( true );
+				$this->setCommonData( true );
+			}
+        }
+    }
+?>

Added: plog/trunk/class/action/admin/admindeletepermissionsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletepermissionsaction.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/action/admin/admindeletepermissionsaction.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,116 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/emptyvalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminpermissionslistview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+     *
+     * Deletes an permission
+     */
+    class AdminDeletePermissionsAction extends SiteAdminAction 
+	{
+
+    	var $_permId;
+        var $_permIds;
+
+    	/**
+         * Constructor. If nothing else, it also has to call the constructor of the parent
+         * class, BlogAction with the same parameters
+         */
+        function AdminDeletePermissionsAction( $actionInfo, $request )
+        {
+        	$this->SiteAdminAction( $actionInfo, $request );
+			$this->_mode = $actionInfo->getActionParamValue();
+        	
+			if( $this->_mode == "deletePermission" ) 
+					$this->registerFieldValidator( "permId", new IntegerValidator());
+			else 
+					$this->registerFieldValidator( "permIds", new ArrayValidator());
+				
+			$view = new AdminPermissionsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_permission_id"));
+			$this->setValidationErrorView( $view );		
+        }
+
+		/**
+		 * @private
+		 */
+		function _deletePermissions()
+		{
+            $perms = new Permissions();
+			
+			$errorMessage = "";
+			$successMessage = "";
+			$totalOk = 0;
+			
+            foreach( $this->_permIds as $permId ) {
+				// get the permission
+            	$perm = $perms->getPermission( $permId );
+				
+				if( $perm ) {
+					// get how many articles it has
+					$numUsers = $perm->getNumUsersWithPermission();
+										
+					// if everything correct, we can proceed and delete it
+					if( $numUsers > 0 || $perm->isCorePermission()) {
+						$errorMessage .= $this->_locale->pr( "error_permission_cannot_be_deleted", $perm->getName())."<br/>";
+					}
+					else {									
+						// fire the pre-event
+						$this->notifyEvent( EVENT_PRE_DELETE_PERMISSION, Array( "permission" => &$perm ));
+						
+						if( !$perms->deletePermission( $permId ))
+							$errorMessage .= $this->_locale->pr("error_deleting_permission", $perm->getName())."<br/>";
+						else {
+							if( $totalOk < 2 )
+								$successMessage .= $this->_locale->pr( "permission_deleted_ok", $perm->getName())."<br/>";
+							else
+								$successMessage = $this->_locale->pr( "permissions_deleted_ok", $totalOk );
+								
+							// fire the pre-event
+							$this->notifyEvent( EVENT_POST_DELETE_PERMISSION, Array( "permission" => &$perm ));
+						}
+					}
+				}
+				else {
+					$errorMessage .= $this->_locale->pr("error_deleting_permission2", $permId)."<br/>";
+				}
+        	}
+        				
+			// prepare the view and all the information it needs to know
+			$this->_view = new AdminPermissionsListView( $this->_blogInfo );
+			if( $errorMessage != "" ) 
+				$this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" ) {
+				// and clear the cache to avoid outdated information
+				CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );			
+				$this->_view->setSuccessMessage( $successMessage );
+			}
+				
+			$this->setCommonData();
+			
+			return true;
+		}
+
+        /**
+         * Carries out the specified action
+         */
+        function perform()
+        {
+			if( $this->_mode == "deletePermission" ) {
+				$this->_permIds = Array();
+				$this->_permIds[] = $this->_request->getValue( "permId" );
+			}
+			else
+				$this->_permIds = $this->_request->getValue( "permIds" );
+			
+            return $this->_deletePermissions();
+        }
+    }
+?>

Added: plog/trunk/class/action/admin/adminnewpermissionaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewpermissionaction.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/action/admin/adminnewpermissionaction.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,20 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+ 	 *
+ 	 * Shows the form to add a new permission
+     */
+    class AdminNewPermissionAction extends SiteAdminAction 
+	{
+        function perform()
+        {
+			$this->_view = new AdminTemplatedView( $this->_blogInfo, "newpermission" );
+			$this->setCommonData();
+        }
+    }
+?>

Added: plog/trunk/class/action/admin/adminpermissionslistaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpermissionslistaction.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/action/admin/adminpermissionslistaction.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,20 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminpermissionslistview.class.php" );
+
+    /**
+     * \ingroup Action
+     * @private
+ 	 *
+ 	 * Lists all the permissions available
+     */
+    class AdminPermissionsListAction extends SiteAdminAction 
+	{
+        function perform()
+        {
+			$this->_view = new AdminPermissionsListView( $this->_blogInfo );
+			$this->setCommonData();
+        }
+    }
+?>

Modified: plog/trunk/class/controller/admincontrollermap.properties.php
===================================================================
--- plog/trunk/class/controller/admincontrollermap.properties.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/controller/admincontrollermap.properties.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -298,4 +298,12 @@
 	// edit and update blog categories
 	$actions["editBlogCategory"] = "AdminEditBlogCategoryAction";
 	$actions["updateBlogCategory"] = "AdminUpdateBlogCategoryAction";
-?>
+	// permissions
+	$actions["permissionsList"] = "AdminPermissionsListAction";
+	$actions["deletePermission"] = "AdminDeletePermissionsAction";
+	$actions["deletePermissions"] = "AdminDeletePermissionsAction";	
+	$actions["editPermission"] = "AdminEditPermissionAction";	
+	$actions["updatePermission"] = "AdminUpdatePermissionAction";		
+	$actions["newPermission"] = "AdminNewPermissionAction";	
+	$actions["addPermission"] = "AdminAddPermissionAction";		
+?>
\ No newline at end of file

Modified: plog/trunk/class/dao/permission.class.php
===================================================================
--- plog/trunk/class/dao/permission.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/dao/permission.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -1,6 +1,5 @@
 <?php
 
-	include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
     include_once( PLOG_CLASS_PATH."class/database/dbobject.class.php" );
 
     /**
@@ -95,5 +94,17 @@
 		{
 			$this->_adminOnly = $adminOnly;
 		}
+		
+		/**
+		 * Returns the number of users who have been granted this permission
+		 *
+		 * @return An integer
+		 */
+		function getNumUsersWithPermission()
+		{
+			include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+			$perms = new UserPermissions();
+			return( $perms->getNumUsersWithPermission( $this->getId()));
+		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/dao/permissions.class.php
===================================================================
--- plog/trunk/class/dao/permissions.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/dao/permissions.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -89,7 +89,7 @@
 			$permissions = $this->getAll( "all", 
 			                             CACHE_PERMISSIONS_ALL, 
 			                             Array( CACHE_PERMISSIONS => "getId" ),
-			                             Array( "permission" => "ASC" ));			                            
+			                             Array( "permission" => "ASC" ));
 			if( !$permissions )
 				return( Array());				
 			                             			                             

Modified: plog/trunk/class/dao/userinfo.class.php
===================================================================
--- plog/trunk/class/dao/userinfo.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/dao/userinfo.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -23,6 +23,7 @@
 		var $_resourcePictureId;
 		var $_resourcePicture;
 		var $_status;
+		var $_perms;
 
 		/**
 		 * Constructor. Creates a new UserInfo object with the given information.
@@ -54,6 +55,7 @@
             $this->_siteAdmin = false;
 			$this->setPictureId( $resourcePictureId );
 			$this->setProperties( $properties );
+			$this->_perms = Array();
 			
 			// by defaults, users are in status "active"
 			$this->setStatus( USER_STATUS_ACTIVE );
@@ -300,5 +302,28 @@
 			
 			return( get_object_vars( $this ));
 		}*/
+		
+		function hasPermission( $permission, $blogId )
+		{
+			if( !isset($this->perms[$blogId] )) {
+				include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+				$perms = new UserPermissions();
+				$this->perms[$blogId] = $perms->getUserPermissions( $this->getId(), $blogId );
+			}
+			
+			return( isset( $this->perms[$blogId][$permission] ));
+		}
+		
+		function getPermissions( $blogId )
+		{
+			if( !isset($this->perms[$blogId] )) {
+				include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+				$perms = new UserPermissions();
+				$kk = $perms->getUserPermissions( $this->getId(), $blogId );
+				$this->perms[$blogId] = $kk;
+			}
+			
+			return( $this->perms[$blogId] );
+		}
 	}
 ?>

Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/dao/userpermissions.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -39,7 +39,7 @@
             $perms = Array();
 			
             // check if the user is the blog owner
-			include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+			/*include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
 			$blogs = new Blogs();
 			$blogInfo = $blogs->getBlogInfo( $blogId );
 			if( !$blogInfo )
@@ -48,12 +48,13 @@
 			if( $blogInfo->getOwnerId() == $userId ) {
 				$perm = new UserPermission( $userId, $blogId, PERMISSION_BLOG_OWNER, 0 );
 				$perms[] = $perm;
-            }
+            }*/
 			
 			// get all the user permissions from the db table
 			$userPerms = $this->getMany( "user_id",
 			                             $userId,
 			                             CACHE_USER_PERMISSIONS );
+			
 			if( !is_array( $userPerms ))
 				$userPerms = Array();
 				
@@ -210,8 +211,48 @@
 			}
 			
 			return( $result );
-        }		
+        }
 
+		/**
+		 * Returns the number of users who have a certain permission
+		 *
+		 * @param permId
+		 */
+		function getNumUsersWithPermission( $permId )
+		{
+			$query = "SELECT COUNT(DISTINCT user_id) AS total FROM ".$this->getPrefix()."users_permissions
+			          WHERE permission_id = ".Db::qstr( $permId );
+			
+            // execute it
+            $result = $this->Execute( $query );
+
+            if( !$result )
+                return 0;
+
+            // if no error, get the result
+            $row = $result->FetchRow();
+            $result->Close();
+
+            $total = $row["total"];
+            if( $total == "" ) $total = 0;
+
+            return $total;			
+		}
+		
+		/**
+		 * Returns all users who have the given permission, using paging if necessary
+		 *
+		 * @param permId
+		 * @param page
+		 * @param itemsPerPage
+		 * Return an Array of UserInfo objects or an empty array if no users have this
+		 * permission.
+		 */
+		function getUsersWithPermission( $permId, $page = -1, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
+		{
+			// tbd
+		}        
+
         /**
          * @private
          */

Modified: plog/trunk/class/plugin/eventlist.properties.php
===================================================================
--- plog/trunk/class/plugin/eventlist.properties.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/plugin/eventlist.properties.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -178,4 +178,11 @@
 	define( "EVENT_GLOBAL_CATEGORIES_LOADED", ++$eventValue );	
 	// post-processing of templates
 	define( "EVENT_PROCESS_BLOG_TEMPLATE_OUTPUT", ++$eventValue );
+	// handling of permissions
+	define( "EVENT_PRE_ADD_PERMISSION", ++$eventValue );
+	define( "EVENT_POST_ADD_PERMISSION", ++$eventValue );
+	define( "EVENT_PRE_UPDATE_PERMISSION", ++$eventValue );
+	define( "EVENT_POST_UPDATE_PERMISSION", ++$eventValue );
+	define( "EVENT_PRE_DELETE_PERMISSION", ++$eventValue );
+	define( "EVENT_POST_DELETE_PERMISSION", ++$eventValue );
 ?>
\ No newline at end of file

Added: plog/trunk/class/view/admin/adminpermissionslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminpermissionslistview.class.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/class/view/admin/adminpermissionslistview.class.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,32 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+	
+    /**
+     * \ingroup View
+     * @private
+     */	
+	class AdminPermissionsListView extends AdminTemplatedView
+	{
+		
+		function AdminPermissionsListView( $blogInfo, $params = Array())
+		{
+			$this->AdminTemplatedView( $blogInfo, "permissions" );
+		}
+		
+        /**
+         * Carries out the specified action
+         */
+        function render()
+        {
+			// load all permissions available
+			$perms = new Permissions();
+			$allPerms = $perms->getAllPermissions();
+			
+			$this->setValue( "perms", $allPerms );
+
+			parent::render();
+        }
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/locale/locale_en_UK.php	2006-10-01 15:44:28 UTC (rev 4069)
@@ -1086,4 +1086,21 @@
 $messages['dropdown_list_field'] = 'Drop-down list';
 $messages['values'] = 'Field values';
 $messages['field_values'] = 'Values that will be shown as options in this field. The first one will be used as the default option.';
+
+$messages['permission_added_ok'] = 'Permission added successfullly';
+$messages['core_perm'] = 'Core Permission';
+$messages['admin_only'] = 'Admin Only';
+$messages['permissionsList'] = 'Permissions';
+$messages['newPermission'] = 'New Permission';
+$messages['permission_name_help'] = 'Unique name for the new permission';
+$messages['permission_description_help'] = 'Description given for the permission';
+$messages['core_perm_help'] = 'If this permission is part of the core permissions, it will not be possible to delete it';
+$messages['admin_only_help'] = 'Whether this permission can only be assigned by administrator users';
+$messages['error_adding_new_permission'] = 'There was an error adding the new permission, please check your data';
+$messages['error_incorrect_permission_id'] = 'The permission identifier was not correct';
+$messages['error_permission_cannot_be_deleted'] = 'Permission "%s" cannot be deleted because either it has been granted to at least one user or it is a core permission.';
+$messages['error_deleting_permission'] = 'There was an error deleting permission "%s"';
+$messages['permission_deleted_ok'] = 'Permission "%s" was deleted successfully';
+$messages['permissions_deleted_ok'] = '%s permissions successfully deleted';
+$messages['error_deleting_permission2'] = 'There was an error deleting permission with identifier "%s"';
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/menus.xml
===================================================================
--- plog/trunk/templates/admin/menus.xml	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/templates/admin/menus.xml	2006-10-01 15:44:28 UTC (rev 4069)
@@ -45,6 +45,8 @@
 		<Users ignoreBreadCrumbs="1">
 			<createUser url="?op=createUser" siteAdmin="1" />
 			<editSiteUsers url="?op=editSiteUsers" siteAdmin="1" />
+			<permissionsList url="?op=permissionsList" siteAdmin="1" />
+			<newPermission url="?op=newPermission" siteAdmin="1" />			
 		</Users>
 		<Blogs ignoreBreadCrumbs="1">
 			<createBlog url="?op=createBlog" siteAdmin="1" />

Added: plog/trunk/templates/admin/newpermission.template
===================================================================
--- plog/trunk/templates/admin/newpermission.template	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/templates/admin/newpermission.template	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,49 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=newPermission title=$locale->tr("newPermission")}
+
+ <form name="addBlogCategory" method="post" action="admin.php">
+  <fieldset class="inputField">
+   <legend>{$locale->tr("newPermission")}</legend>
+   {include file="$admintemplatepath/formvalidate.template" message=$locale->tr("error_adding_new_permission")}   
+   
+   <div class="field">
+    <label for="permissionName">{$locale->tr("name")}</label>
+    <span class="required">*</span>
+    <div class="formHelp">{$locale->tr("permission_name_help")}</div>
+    <input type="text" value="{$permissionName}" id="permissionName" name="permissionName" />
+    {include file="$admintemplatepath/validate.template" field=permissionName message=$locale->tr("error_empty_name")}
+   </div>
+   
+   <div class="field">
+    <label for="permissionDescription">{$locale->tr("description")}</label>
+    <span class="required">*</span>
+    <div class="formHelp">{$locale->tr("permission_description_help")}</div>	
+    <textarea name="permissionDescription" cols="60" id="permissionDescription" rows="5">{$permissionDescription}</textarea>
+    {include file="$admintemplatepath/validate.template" field=permissionDescription message=$locale->tr("error_empty_description")}  
+   </div>
+
+   <div class="field">
+    <label for="corePermission">{$locale->tr("core_perm")}</label>
+    <div class="formHelp">
+     <input class="checkbox" type="checkbox" id="corePermission" name="corePermission" value="1" {if $corePermission}checked="checked"{/if}/>
+     {$locale->tr("core_perm_help")}
+   </div>
+  </div> 
+   
+   <div class="field">
+    <label for="adminOnlyPermission">{$locale->tr("admin_only")}</label>
+    <div class="formHelp">
+     <input class="checkbox" type="checkbox" id="adminOnlyPermission" name="adminOnlyPermission" value="1" {if $adminOnlyPermission}checked="checked"{/if} />
+     {$locale->tr("admin_only_help")}
+   </div>
+  </div>
+
+  </fieldset>
+  <div class="buttons">
+   <input type="hidden" name="op" value="addPermission" />
+   <input type="reset" name="Reset" value="{$locale->tr("reset")}" />
+   <input type="submit" name="Add" value="{$locale->tr("add")}" />
+  </div> 
+ </form>
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plog/trunk/templates/admin/permissions.template
===================================================================
--- plog/trunk/templates/admin/permissions.template	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/templates/admin/permissions.template	2006-10-01 15:44:28 UTC (rev 4069)
@@ -0,0 +1,59 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=permissionsList title=$locale->tr("permissionsList")}
+
+        <div id="list_nav_bar">
+            <div id="list_nav_select">
+			            
+ <form id="deletePermissions" action="admin.php" method="post">
+ <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" name="all" id="all" value="1" onclick="toggleAllChecks('deletePermissions');" /></th>
+    <th style="width:200px;">{$locale->tr("name")}</th>
+    <th style="width:375px;">{$locale->tr("description")}</th>
+    <th style="width:95px;">{$locale->tr("core_perm")}</th>
+    <th style="width:95px;">{$locale->tr("admin_only")}</th>
+    <th style="width:95px;">{$locale->tr("actions")}</th>
+   </tr>
+  </thead>
+  <tbody> 
+  {foreach from=$perms item=perm}
+  <tr class="{cycle values="odd, even"}">
+   <td>
+	 {if !$perm->isCorePermission()}
+      <input class="checkbox" type="checkbox" name="permIds[{counter}]" id="checks_{$perm->getId()}" value="{$perm->getId()}" />
+     {/if}
+   </td>  
+   <td class="col_highlighted">
+    <a href="admin.php?op=editPermission&amp;permId={$perm->getId()}">{$perm->getName()}</a>
+   </td>
+   <td>
+	{$locale->tr($perm->getDescription())}
+   </td>
+   <td>
+	{if $perm->isCorePermission()}{$locale->tr("yes")}{else}{$locale->tr("no")}{/if}
+   </td>
+   <td>
+	{if $perm->isAdminOnlyPermission()}{$locale->tr("yes")}{else}{$locale->tr("no")}{/if}
+   </td>
+   <td>
+     <div class="list_action_button">
+       {if !$perm->isCorePermission()}<a href="?op=editPermission&amp;permId={$perm->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>{/if}
+       {if !$perm->isCorePermission()}<a href="?op=deletePermission&amp;permId={$perm->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>{/if}
+     </div>
+   </td>
+  </tr>
+  {/foreach}
+ </tbody> 
+ </table>
+ </div>
+ <div id="list_action_bar">
+  <input type="hidden" name="op" value="deletePermissions"/>
+  <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+ </div>
+ </form>
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Modified: plog/trunk/templates/standard/post.template
===================================================================
--- plog/trunk/templates/standard/post.template	2006-09-29 09:38:57 UTC (rev 4068)
+++ plog/trunk/templates/standard/post.template	2006-10-01 15:44:28 UTC (rev 4069)
@@ -27,3 +27,6 @@
 </p>
 
 {/if}
+
+{assign var=mood value=$post->getField("mood")}
+My mood is: {$mood}<br/>
\ No newline at end of file



More information about the pLog-svn mailing list