mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
added ability to specify some extra styles for the multiselectbox with checkboxes
This commit is contained in:
parent
125214e0d2
commit
a615cada89
@ -221,7 +221,7 @@
|
||||
$cell['no_lang'] = True;
|
||||
break;
|
||||
|
||||
case 'select-cat': // !$type == globals cats too
|
||||
case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect
|
||||
if (!is_object($GLOBALS['egw']->categories))
|
||||
{
|
||||
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
|
||||
@ -243,6 +243,7 @@
|
||||
$cell['sel_options'][$cat['cat_id']] = $s;
|
||||
}
|
||||
}
|
||||
$cell['size'] = $rows.($type2 ? ','.$type2 : '');
|
||||
$cell['no_lang'] = True;
|
||||
break;
|
||||
|
||||
@ -321,7 +322,7 @@
|
||||
$value = intval($value);
|
||||
break;
|
||||
|
||||
case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries
|
||||
case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries[,extraStyleMultiselect]]
|
||||
if (!defined('MCAL_M_SUNDAY'))
|
||||
{
|
||||
define('MCAL_M_SUNDAY',1);
|
||||
@ -386,6 +387,7 @@
|
||||
{
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'][$name] = 'ext-select-dow';
|
||||
}
|
||||
$cell['size'] = $rows.($type2 ? ','.$type2 : '');
|
||||
break;
|
||||
|
||||
case 'select-day':
|
||||
|
@ -1162,9 +1162,9 @@
|
||||
|
||||
if ($set_readonlys_all) unset($readonlys['__ALL__']);
|
||||
break;
|
||||
case 'select': // size:[linesOnMultiselect|emptyLabel]
|
||||
case 'select': // size:[linesOnMultiselect|emptyLabel,extraStyleMulitselect]
|
||||
$sels = array();
|
||||
list($multiple) = explode(',',$cell_options);
|
||||
list($multiple,$extraStyleMultiselect) = explode(',',$cell_options,2);
|
||||
if (!empty($multiple) && 0+$multiple <= 0)
|
||||
{
|
||||
$sels[''] = $multiple < 0 ? 'all' : $multiple;
|
||||
@ -1257,7 +1257,7 @@
|
||||
if ($multiple && is_numeric($multiple)) // eg. "3+" would give a regular multiselectbox
|
||||
{
|
||||
$html .= $this->html->checkbox_multiselect($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$cell['no_lang'],$options,$multiple);
|
||||
$cell['no_lang'],$options,$multiple,true,$extraStyleMultiselect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -260,10 +260,12 @@ class html
|
||||
* @param string $options additional options (e.g. 'width')
|
||||
* @param int $multiple number of lines for a multiselect, default 3
|
||||
* @param boolean $selected_first show the selected items before the not selected ones, default true
|
||||
* @param string $style='' extra style settings like "width: 100%", default '' none
|
||||
* @return string to set for a template or to echo into html page
|
||||
*/
|
||||
function checkbox_multiselect($name, $key, $arr=0,$no_lang=false,$options='',$multiple=3,$selected_first=true)
|
||||
function checkbox_multiselect($name, $key, $arr=0,$no_lang=false,$options='',$multiple=3,$selected_first=true,$style='')
|
||||
{
|
||||
//echo "<p align=right>checkbox_multiselect('$name',".print_r($key,true).",".print_r($arr,true).",$no_lang,'$options',$multiple,$selected_first,'$style')</p>\n";
|
||||
if (!is_array($arr))
|
||||
{
|
||||
$arr = array('no','yes');
|
||||
@ -320,7 +322,10 @@ class html
|
||||
' id="'.$base_name.'['.$val.']'.'" '.($title ? 'title="'.$this->htmlspecialchars($title).'" ':'')).
|
||||
$this->htmlspecialchars($label),$base_name.'['.$val.']')."<br />\n";
|
||||
}
|
||||
$style = 'height: '.(1.7*$multiple).'em; width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.55)).'em; background-color: white; overflow: auto; border: lightgray 2px inset;';
|
||||
if ($style && substr($style,-1) != ';') $style .= '; ';
|
||||
if (!strstr($style,'height')) $style .= 'height: '.(1.7*$multiple).'em; ';
|
||||
if (!strstr($style,'width')) $style .= 'width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.55)).'em; ';
|
||||
$style .= 'background-color: white; overflow: auto; border: lightgray 2px inset;';
|
||||
|
||||
return $this->div($html,$options,'',$style);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user