[pLog-svn] r4496 - plog/trunk/class/template/menu
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Jan 4 22:34:11 GMT 2007
Author: oscar
Date: 2007-01-04 22:34:11 +0000 (Thu, 04 Jan 2007)
New Revision: 4496
Modified:
plog/trunk/class/template/menu/menu.class.php
Log:
Fixed an issue with menu entries not being properly displayed, when new entries are dynamically added to the menu structure,
Modified: plog/trunk/class/template/menu/menu.class.php
===================================================================
--- plog/trunk/class/template/menu/menu.class.php 2007-01-04 22:12:33 UTC (rev 4495)
+++ plog/trunk/class/template/menu/menu.class.php 2007-01-04 22:34:11 UTC (rev 4496)
@@ -169,6 +169,33 @@
$entryOrder, // order, use '-1' to specify that it should be the last
$entry // object
);
+
+ //
+ // this is a bit tricky, but the problem is that when we adde a new menu entry (a new node to the tree)
+ // the nodes above it should also inherit the new permission that is required to view this entry. Otherwise
+ // if a new node is added with let's say permission 'manage_plugins' but the nodes above it only have 'view_links' and
+ // 'edit_links', then that entry and all the ones above it would not rendered by the MenuRenderer class.
+ // By means of the code below, we're replicating the needed permissions to all the parent nodes so that we can get the
+ // upper level entries to be displayed
+ //
+ $path = split( "/", $entryPath );
+ $currentPath = "";
+ foreach( $path as $step ) {
+ if( $step != "" ) {
+ $currentPath = $currentPath."/".$step;
+ $node =& $this->getEntryAt( $this->_prepareEntryPath( $currentPath ));
+ // add the new node's orPerms and andPerms
+ $curOrPerms = $node->getAttribute( "orPerms" );
+ if( $curOrPerms != "" ) {
+ $node->setAttribute( "orPerms", $curOrPerms.",".$entry->getAttribute( "orPerms" ));
+ }
+ $curAndPerms = $node->getAttribute( "andPerms" );
+ if( $curAndPerms != "" ) {
+ $node->setAttribute( "andPerms", $curAndPerms.",".$entry->getAttribute( "andPerms" ));
+ }
+ }
+ }
+
$ok = $this->isError( $node );
More information about the pLog-svn
mailing list