mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
new multiselection type for the preferences
This commit is contained in:
parent
f0a2cd141e
commit
d22d90be43
@ -170,7 +170,11 @@
|
|||||||
{
|
{
|
||||||
if(isset($value) && $value != '' && $value != '**NULL**')
|
if(isset($value) && $value != '' && $value != '**NULL**')
|
||||||
{
|
{
|
||||||
if(is_array($value))
|
if(is_array($value) && !isset($value['pw']))
|
||||||
|
{
|
||||||
|
$value = implode(',',$value); // multiselect
|
||||||
|
}
|
||||||
|
elseif(is_array($value))
|
||||||
{
|
{
|
||||||
$value = $value['pw'];
|
$value = $value['pw'];
|
||||||
if(empty($value))
|
if(empty($value))
|
||||||
|
@ -250,13 +250,15 @@
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
|
case 'multiselect':
|
||||||
$this->create_select_box(
|
$this->create_select_box(
|
||||||
$valarray['label'],
|
$valarray['label'],
|
||||||
$valarray['name'],
|
$valarray['name'],
|
||||||
$valarray['values'],
|
$valarray['values'],
|
||||||
$valarray['help'],
|
$valarray['help'],
|
||||||
$valarray['default'],
|
$valarray['default'],
|
||||||
$valarray['run_lang']
|
$valarray['run_lang'],
|
||||||
|
$valarray['type'] == 'multiselect'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'check':
|
case 'check':
|
||||||
@ -499,7 +501,7 @@
|
|||||||
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
|
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True)
|
function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True,$multiple=false)
|
||||||
{
|
{
|
||||||
$_appname = $this->check_app();
|
$_appname = $this->check_app();
|
||||||
if($this->is_forced_value($_appname,$name))
|
if($this->is_forced_value($_appname,$name))
|
||||||
@ -511,26 +513,45 @@
|
|||||||
{
|
{
|
||||||
$default = $this->bo->prefs[$name];
|
$default = $this->bo->prefs[$name];
|
||||||
}
|
}
|
||||||
|
//echo "<p>uisettings::create_select_box('$label','$name',".print_r($values,true).",,'$default',$run_lang,$multiple)</p>\n";
|
||||||
|
|
||||||
switch($GLOBALS['type'])
|
require_once(EGW_API_INC.'/class.html.inc.php');
|
||||||
|
$html = html::singleton();
|
||||||
|
|
||||||
|
if (!$multiple)
|
||||||
{
|
{
|
||||||
case 'user':
|
switch($GLOBALS['type'])
|
||||||
$s = '<option value="">' . lang('Use default') . '</option>';
|
{
|
||||||
break;
|
case 'user':
|
||||||
case 'default':
|
$extra = array('' => lang('Use default'));
|
||||||
$s = '<option value="">' . lang('No default') . '</option>';
|
break;
|
||||||
break;
|
case 'default':
|
||||||
case 'forced':
|
$extra = array('' => lang('No default'));
|
||||||
$s = '<option value="**NULL**">' . lang('Users choice') . '</option>';
|
break;
|
||||||
break;
|
case 'forced':
|
||||||
|
$extra = array('**NULL**' => lang('Users choice'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($extra) $values = array_merge($extra,$values);
|
||||||
|
|
||||||
|
$select = $html->select($GLOBALS['type'].'['.$name.']',$default,$values,true);
|
||||||
}
|
}
|
||||||
$s .= $this->create_option_string($default,$values);
|
else
|
||||||
if($GLOBALS['type'] == 'user')
|
|
||||||
{
|
{
|
||||||
$def_text = $GLOBALS['egw']->preferences->default[$_appname][$name];
|
if (!is_array($default)) $default = explode(',',$default);
|
||||||
$def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').': '.$values[$def_text].'</font></i>' : '';
|
$select = $html->input_hidden($GLOBALS['type'].'['.$name.']','',false); // causes bosettings not to ignore unsetting all
|
||||||
|
$select .= $html->checkbox_multiselect($GLOBALS['type'].'['.$name.']',$default,$values,true,'',5);
|
||||||
}
|
}
|
||||||
$this->t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\">$s</select>$def_text");
|
if($GLOBALS['type'] == 'user' && $GLOBALS['egw']->preferences->default[$_appname][$name])
|
||||||
|
{
|
||||||
|
$defs = array();
|
||||||
|
foreach(explode(',',$GLOBALS['egw']->preferences->default[$_appname][$name]) as $def)
|
||||||
|
{
|
||||||
|
if ($values[$def]) $defs[] = $values[$def];
|
||||||
|
}
|
||||||
|
$def_text = ' <i><font size="-1">'.lang('default').': '.implode(', ',$defs).'</font></i>';
|
||||||
|
}
|
||||||
|
$this->t->set_var('row_value',$select.$def_text);
|
||||||
$this->t->set_var('row_name',$run_lang !== -1 ? lang($label) : $label);
|
$this->t->set_var('row_name',$run_lang !== -1 ? lang($label) : $label);
|
||||||
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
|
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user