added extra-row for single-line selectbox in options and ability to have select-options set by an extension and by $sel_options or $content["options-$name"

changed names of theme-css-styles to be compatible with ceb's changes, html::themeStyles is used for 0.9.14
This commit is contained in:
Ralf Becker 2002-10-03 16:52:42 +00:00
parent 402d5c67c5
commit d59e5aaebc
2 changed files with 27 additions and 24 deletions

View File

@ -274,16 +274,16 @@ class html
} }
/*! /*!
@function nextMatchStyles @function themeStyles
@abstract returns simple stylesheet for nextmatch row-colors @abstract returns simple stylesheet for nextmatch row-colors
@result the classes 'nmh' = nextmatch header, 'nmr0'+'nmr1' = alternating rows @result the classes 'th' = nextmatch header, 'row_on'+'row_off' = alternating rows
*/ */
function nextMatchStyles() function themeStyles()
{ {
return $this->style( return $this->style(
".nmh { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n". ".th { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
".nmr1 { background: ".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n". ".row_on { background: ".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
".nmr0 { background: ".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n" ".row_off { background: ".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n"
); );
} }

View File

@ -55,8 +55,7 @@
list($a,$b,$c,$d) = explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']); list($a,$b,$c,$d) = explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
//echo "Version: $a.$b.$c.$d\n"; //echo "Version: $a.$b.$c.$d\n";
if ($this->stable = $a <= 0 && $b <= 9 && $c <= 14) $this->stable = $a <= 0 && $b <= 9 && $c <= 14;
$this->class_conf = array();
} }
/*! /*!
@ -103,7 +102,7 @@
$GLOBALS['phpgw_info']['etemplate']['loop'] = False; $GLOBALS['phpgw_info']['etemplate']['loop'] = False;
$GLOBALS['phpgw_info']['etemplate']['form_options'] = ''; // might be set in show $GLOBALS['phpgw_info']['etemplate']['form_options'] = ''; // might be set in show
$GLOBALS['phpgw_info']['etemplate']['to_process'] = array(); $GLOBALS['phpgw_info']['etemplate']['to_process'] = array();
$html .= ($this->stable ? $this->html->nextMatchStyles()."\n\n" : ''). // so they get included once $html .= ($this->stable ? $this->html->themeStyles()."\n\n" : ''). // so they get included once
$this->html->form($this->include_java_script() . $this->html->form($this->include_java_script() .
$this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),array( $this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),array(
'etemplate_exec_id' => $id, 'etemplate_exec_id' => $id,
@ -295,9 +294,9 @@
$rows[".$row"] .= $this->html->formatOptions($height,'HEIGHT'); $rows[".$row"] .= $this->html->formatOptions($height,'HEIGHT');
list($cl) = explode(',',$class); list($cl) = explode(',',$class);
if ($cl == 'nmr') if ($cl == 'nmr' || $cl == 'row')
{ {
$cl .= $nmr_alternate++ & 1; // alternate color $cl = 'row_'.($nmr_alternate++ & 1 ? 'off' : 'on'); // alternate color
} }
$cl = isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl; $cl = isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl;
$rows[".$row"] .= $this->html->formatOptions($cl,'CLASS'); $rows[".$row"] .= $this->html->formatOptions($cl,'CLASS');
@ -566,44 +565,48 @@
$html .= $cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row); $html .= $cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
break; break;
case 'select': // size:[linesOnMultiselect] case 'select': // size:[linesOnMultiselect]
$sels = array();
list($multiple) = explode(',',$cell['size']);
if (!empty($multiple) && 0+$multiple <= 0)
{
$sels[''] = $multiple < 0 ? lang('all') : lang($multiple);
$multiple = 0;
}
if (!empty($cell['sel_options'])) if (!empty($cell['sel_options']))
{ {
if (!is_array($cell)) if (!is_array($cell['sel_options']))
{ {
$sel_options = array();
$opts = explode(',',$cell['sel_options']); $opts = explode(',',$cell['sel_options']);
while (list(,$opt) = each($opts)) while (list(,$opt) = each($opts))
{ {
list($k,$v) = explode('=',$opt); list($k,$v) = explode('=',$opt);
$sel_options[$k] = $v; $sels[$k] = $v;
} }
} }
else else
{ {
$sel_options = $cell['sel_options']; $sels += $cell['sel_options'];
} }
} }
elseif (isset($sel_options[$name])) if (isset($sel_options[$name]))
{ {
$sel_options = $sel_options[$name]; $sels += $sel_options[$name];
} }
elseif (isset($sel_options[$org_name])) elseif (isset($sel_options[$org_name]))
{ {
$sel_options = $sel_options[$org_name]; $sels += $sel_options[$org_name];
} }
elseif (isset($content["options-$name"])) if (isset($content["options-$name"]))
{ {
$sel_options = $content["options-$name"]; $sels += $content["options-$name"];
} }
list($multiple) = explode(',',$cell['size']);
if ($readonly) if ($readonly)
{ {
$html .= $cell['no_lang'] ? $sel_options[$value] : lang($sel_options[$value]); $html .= $cell['no_lang'] ? $sels[$value] : lang($sels[$value]);
} }
else else
{ {
$html .= $this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sel_options, $html .= $this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
$cell['no_lang'],$options,$multiple); $cell['no_lang'],$options,$multiple);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type']; $GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
} }