1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Fix for Menu-Manager visibility setting not saving. Fixes e107::getForm()->userclass() method not functioning as intended.

This commit is contained in:
Cameron 2015-06-02 14:25:39 -07:00
parent 879174ea03
commit f938cc320f
5 changed files with 46 additions and 12 deletions

View File

@ -983,7 +983,7 @@ class e_layout
// print_a($_GET);
$tp = e107::getParser();
$sql = e107::getDb();
$ns = e107::getRender();
$frm = e107::getForm();
@ -1021,12 +1021,12 @@ class e_layout
$checked = ($listtype == 1) ? " checked='checked' " : "";
$text .= $frm->radio('listtype', 1, $checked, array('label'=>MENLAN_26, 'class'=> 'e-save'));
$text .= $frm->radio('listtype', 1, $checked, array('label'=> $tp->toHtml(MENLAN_26,true), 'class'=> 'e-save'));
$text .= "<br />";
// $text .= "<input type='radio' class='e-save' {$checked} name='listtype' value='1' /> ".MENLAN_26."<br />";
$checked = ($listtype == 2) ? " checked='checked' " : "";
$text .= $frm->radio('listtype', 2, $checked, array('label'=>MENLAN_27, 'class'=> 'e-save'));
$text .= $frm->radio('listtype', 2, $checked, array('label'=> $tp->toHtml(MENLAN_27,true), 'class'=> 'e-save'));
// $text .= "<input type='radio' class='e-save' {$checked} name='listtype' value='2' /> ".MENLAN_27."<br />";

View File

@ -336,7 +336,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
if (trim($i)) $icn[] = e107::getUserClass()->getName($i);
}
$class_text = $frm->userclass('init_classes',$initial_classes, 'checkbox', 'classes,force');
$class_text = $frm->userclass('init_classes',$initial_classes, 'checkbox', array('options'=>'classes,force'));
// $class_text = e107::getUserClass()->uc_checkboxes('init_classes', $initial_classes, 'classes, force', TRUE);
// $class_text = e107::getUserClass()->vetted_tree('init_classes',array($e_userclass,'checkbox_desc'), $initial_classes, 'classes, force, no-excludes');

View File

@ -1790,16 +1790,34 @@ class e_form
*/
function userclass($name, $curval=255, $type=null, $options=null)
{
switch ($type)
if(!empty($options))
{
if(is_array($options))
{
$opt = $options;
}
else
{
parse_str($options,$opt);
}
}
else
{
$opt = array();
}
$optlist = vartrue($opt['options'],null);
switch ($type)
{
case 'checkbox':
return e107::getUserClass()->uc_checkboxes($name,$curval,$options,null,false);
return e107::getUserClass()->uc_checkboxes($name, $curval, $optlist, null,false);
break;
case 'dropdown':
default:
return e107::getUserClass()->uc_dropdown($name,$curval,$options);
return e107::getUserClass()->uc_dropdown($name, $curval, $optlist, $opt);
break;
}

View File

@ -580,6 +580,8 @@ class e_menuManager {
$sql = e107::getDb();
$ns = e107::getRender();
$frm = e107::getForm();
$tp = e107::getParser();
require_once(e_HANDLER."userclass_class.php");
@ -604,19 +606,19 @@ class e_menuManager {
<td>
<input type='hidden' name='menuAct[{$row['menu_id']}]' value='sv.{$row['menu_id']}' />
".MENLAN_4." ".
r_userclass('menu_class', $row['menu_class'], "off", "public,member,guest,admin,main,classes,nobody")."
$frm->userclass('menu_class', $row['menu_class'], 'dropdown', array('options'=>"public,member,guest,admin,main,classes,nobody", 'class'=>'e-save'))."
</td>
</tr>
<tr><td><div class='radio'>
";
$checked = ($listtype == 1) ? " checked='checked' " : "";
$text .= $frm->radio('listtype', 1, $checked, array('label'=>MENLAN_26, 'class'=> 'e-save'));
$text .= $frm->radio('listtype', 1, $checked, array('label'=>$tp->toHtml(MENLAN_26,true), 'class'=> 'e-save'));
$text .= "<br />";
// $text .= "<input type='radio' class='e-save' {$checked} name='listtype' value='1' /> ".MENLAN_26."<br />";
$checked = ($listtype == 2) ? " checked='checked' " : "";
$text .= $frm->radio('listtype', 2, $checked, array('label'=>MENLAN_27, 'class'=> 'e-save'));
$text .= $frm->radio('listtype', 2, $checked, array('label'=> $tp->toHtml(MENLAN_27,true), 'class'=> 'e-save'));
// $text .= "<input type='radio' class='e-save' {$checked} name='listtype' value='2' /> ".MENLAN_27."<br />";

View File

@ -430,6 +430,20 @@ class user_class
}
}
if(is_array($extra_js))
{
$options = $extra_js;
unset($extra_js);
}
$class = "tbox form-control";
if(!empty($options['class']))
{
$class .= " ".$options['class'];
}
// Inverted Classes
if(strpos($optlist, 'no-excludes') === FALSE)
{
@ -453,7 +467,7 @@ class user_class
}
// Only return the select box if we've ended up with some options
if ($text) $text = "\n<select class='tbox form-control' name='{$fieldname}' id='{$fieldname}' {$extra_js}>\n".$text."</select>\n";
if ($text) $text = "\n<select class='".$class."' name='{$fieldname}' id='{$fieldname}' {$extra_js}>\n".$text."</select>\n";
return $text;
}