From 66f7b472bf2cd3b878655cf92454be81e0e02cf9 Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 1 Feb 2009 15:18:30 +0000 Subject: [PATCH] Userclasses admin - fix a couple of things broken by other changes --- e107_admin/userclass2.php | 12 +++---- e107_handlers/userclass_class.php | 52 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/e107_admin/userclass2.php b/e107_admin/userclass2.php index e3e8f3078..e62a58745 100644 --- a/e107_admin/userclass2.php +++ b/e107_admin/userclass2.php @@ -9,9 +9,9 @@ * Administration Area - User classes * * $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $ - * $Revision: 1.20 $ - * $Date: 2009-01-18 19:02:07 $ - * $Author: secretr $ + * $Revision: 1.21 $ + * $Date: 2009-02-01 15:18:30 $ + * $Author: e107steved $ * */ @@ -437,7 +437,7 @@ switch ($action) ".UCSLAN_24." "; - $text .= "'; + $text .= "'; $text .= " ".UCSLAN_32." @@ -459,7 +459,7 @@ switch ($action) ".UCSLAN_34." "; - $text .= "'; + $text .= "'; $text .= " ".UCSLAN_33." @@ -469,7 +469,7 @@ switch ($action) ".UCSLAN_35." "; - $text .= "'; + $text .= "'; // .r_userclass("userclass_parent", $userclass_parent, "off", "admin,classes,matchclass,public,member"). $text .= " ".UCSLAN_36." diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index c421e9e18..82580e207 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ -| $Revision: 1.30 $ -| $Date: 2009-01-20 22:37:49 $ -| $Author: secretr $ +| $Revision: 1.31 $ +| $Date: 2009-02-01 15:18:30 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -121,7 +121,8 @@ class user_class // Add in any fixed classes that aren't already defined foreach ($this->fixed_classes as $c => $d) { - if (!isset($this->class_tree[$c]) && ($c != e_UC_PUBLIC)) +// if (!isset($this->class_tree[$c]) && ($c != e_UC_PUBLIC)) + if (!isset($this->class_tree[$c])) { switch ($c) { @@ -151,16 +152,23 @@ class user_class } - // Now build the tree + // Now build the tree. + // There are just two top-level classes - 'Everybody' and 'Nobody' + $this->class_parents[e_UC_PUBLIC] = e_UC_PUBLIC; + $this->class_parents[e_UC_NOBODY] = e_UC_NOBODY; foreach ($this->class_tree as $uc) { +/* if ($uc['userclass_parent'] == e_UC_PUBLIC) { // Note parent (top level) classes $this->class_parents[$uc['userclass_id']] = $uc['userclass_id']; } else +*/ + if (($uc['userclass_id'] != e_UC_PUBLIC) && ($uc['userclass_id'] != e_UC_NOBODY)) { - if (!array_key_exists($uc['userclass_parent'],$this->class_tree)) +// if (!array_key_exists($uc['userclass_parent'],$this->class_tree)) + if (!isset($this->class_tree[$uc['userclass_parent']])) { echo "Orphaned class record: ID=".$uc['userclass_id']." Name=".$uc['userclass_name']." Parent=".$uc['userclass_parent']."
"; } @@ -526,6 +534,7 @@ class user_class function select($treename, $classnum, $current_value, $nest_level) { if ($classnum == e_UC_BLANK) return "\n"; +// echo "Display: {$classnum}, {$current_value}, {$nest_level}
"; $tmp = explode(',',$current_value); $sel = in_array($classnum,$tmp) ? " selected='selected'" : ''; if ($nest_level == 0) @@ -559,7 +568,6 @@ class user_class } else { -// $style = " style='text-indent:".(12*$nest_level)."px'"; $style = " style='text-indent:".(1.2*$nest_level)."em'"; } return "
".$this->class_tree[$classnum]['userclass_name']."
\n"; @@ -1057,22 +1065,24 @@ class user_class_admin extends user_class - function show_graphical_tree($show_debug=FALSE) - { - $this->graph_debug = $show_debug; - $indent_images = array(); - $ret = "
- class icon - ".UC_LAN_0." -
"; // 'Everyone' link - $num_parents = count($this->class_parents); - foreach ($this->class_parents as $p) + function show_graphical_tree($show_debug=FALSE) { - $num_parents--; - $ret .= $this->show_graphical_subtree($p, $indent_images, ($num_parents == 0)); + $this->graph_debug = $show_debug; + $indent_images = array(); + + $ret = "
+ class icon + +
"; // Just a generic icon here to provide a visual anchor + + $num_parents = count($this->class_parents); + foreach ($this->class_parents as $p) + { + $num_parents--; + $ret .= $this->show_graphical_subtree($p, $indent_images, ($num_parents == 0)); + } + return $ret; } - return $ret; - }