diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 24f3cdcdb..1d0044a55 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1078,6 +1078,9 @@ class e_form // Callback for vetted_tree - Creates the option list for a selection box function _uc_select_cb($treename, $classnum, $current_value, $nest_level) { + $classIndex = abs($classnum); // Handle negative class values + $classSign = (substr($classnum, 0, 1) == '-') ? '-' : ''; + if($classnum == e_UC_BLANK) return $this->option(' ', ''); @@ -1097,9 +1100,10 @@ class e_form $prefix = '  '.str_repeat('--', $nest_level - 1).'>'; $style = ''; } - return $this->option($prefix.$this->_uc->uc_get_classname($classnum), $classnum, ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n"; + return $this->option($prefix.$this->_uc->uc_get_classname($classnum), '{$classSign}{$classIndex}', ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n"; } + function optgroup_open($label, $disabled = false) { return ""; diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index 46ca54d5c..9a6a0349f 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -809,22 +809,25 @@ class user_class */ public function uc_get_classname($id) { - if (isset($this->class_tree[$id])) + $cn = abs($id); + $ucString = ''; + + if (isset($this->class_tree[$cn])) { - return $this->class_tree[$id]['userclass_name']; + $ucString = $this->class_tree[$cn]['userclass_name']; } - if (isset($this->fixed_classes[$id])) + elseif (isset($this->fixed_classes[$cn])) { - return $this->fixed_classes[$id]; + $ucString = $this->fixed_classes[$cn]; } if($id < 0) { - $val = abs($id); - $name = isset($this->class_tree[$val]['userclass_name']) ? $this->class_tree[$val]['userclass_name'] : $this->fixed_classes[$val]; - return str_replace('--CLASS--', $name, UC_LAN_INVERT); + //$val = abs($id); + //$name = isset($this->class_tree[$val]['userclass_name']) ? $this->class_tree[$val]['userclass_name'] : $this->fixed_classes[$val]; + $ucString = str_replace('--CLASS--', $ucString, UC_LAN_INVERT); } - return ''; + return $ucString; }