2 small bugfixes:

- default values for readonly checkboxes (x) get set now, even if checked and unchecked values are specified (but no readonly values)
- fixed readonly case of option values for selectboxes with label+title (value is an array with keys label+title)
This commit is contained in:
Ralf Becker 2005-05-21 18:21:55 +00:00
parent fc5d6daee4
commit 90e7bd7595

View File

@ -828,7 +828,7 @@
list($true_val,$false_val,$ro_true,$ro_false) = explode(',',$cell_options); list($true_val,$false_val,$ro_true,$ro_false) = explode(',',$cell_options);
$value = $value == $true_val; $value = $value == $true_val;
} }
else if (count(explode(',',$cell_options)) < 3)
{ {
$ro_true = 'x'; $ro_true = 'x';
$ro_false = ''; $ro_false = '';
@ -1073,17 +1073,31 @@
} }
if ($multiple && !is_array($value)) $value = explode(',',$value); if ($multiple && !is_array($value)) $value = explode(',',$value);
if ($readonly) if ($readonly)
{
if ($multiple)
{ {
foreach($multiple ? $value : array($value) as $val) foreach($multiple ? $value : array($value) as $val)
{ {
$html .= ($html?"<br>\n":'').$this->html->htmlspecialchars($cell['no_lang'] ? $sels[$val] : lang($sels[$val])); if (is_array($sels[$val]))
} {
$option_label = $sels[$val]['label'];
$option_title = $sels[$val]['title'];
} }
else else
{ {
$html .= $this->html->htmlspecialchars($cell['no_lang'] ? $sels[$value] : lang($sels[$value])); $option_label = $sels[$val];
$option_title = '';
}
if (!$cell['no_lang']) $option_label = lang($option_label);
if ($html) $html .= "<br>\n";
if ($option_title)
{
$html .= '<span title="'.$this->html->htmlspecialchars($option_title).'">'.$this->html->htmlspecialchars($option_label).'</span>';
}
else
{
$html .= $this->html->htmlspecialchars($option_label);
}
} }
} }
else else