display readonly text widgets with a given length as readonly input and not just as text

This commit is contained in:
Ralf Becker 2006-12-07 18:59:53 +00:00
parent 76ebb5167f
commit 9a96320225
2 changed files with 18 additions and 13 deletions

View File

@ -339,6 +339,7 @@
'percent_allowed'=> $percent_allowed,
'empty_not_0' => $empty_not_0,
);
$cell['size'] = '4,,/^-?[0-9]*[,.]?[0-9]*'.($percent_allowed ? '%?' : '').'$/';
}
if ($value)
{
@ -353,7 +354,6 @@
}
}
$cell['type'] = 'text';
$cell['size'] = '4,,/^-?[0-9]*[,.]?[0-9]*'.($percent_allowed ? '%?' : '').'$/';
$cell_name = $cell['name'];
$cell['name'] .= '[value]';

View File

@ -941,7 +941,7 @@
case 'int': // size: [min],[max],[len],[precission (only float)]
case 'float':
list($min,$max,$cell_options,$pre) = explode(',',$cell_options);
if ($cell_options == '')
if ($cell_options == '' && !$readonly)
{
$cell_options = $cell['type'] == 'int' ? 5 : 8;
}
@ -953,7 +953,8 @@
// fall-through
case 'passwd' :
case 'text': // size: [length][,maxLength[,preg]]
if ($readonly)
$cell_opts = explode(',',$cell_options,3);
if ($readonly && !$cell_opts[0])
{
$html .= strlen($value) ? $this->html->bold($this->html->htmlspecialchars($value)) : '';
}
@ -961,16 +962,20 @@
{
$html .= $this->html->input($form_name,$value,$type == 'passwd' ? 'password' : '',
$options.$this->html->formatOptions($cell_options,'SIZE,MAXLENGTH'));
$cell_options = explode(',',$cell_options,3);
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'maxlength' => $cell_options[1],
'needed' => $cell['needed'],
'preg' => $cell_options[2],
'min' => $min, // int and float only
'max' => $max,
);
if (!$readonly)
{
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'maxlength' => $cell_opts[1],
'needed' => $cell['needed'],
'preg' => $cell_opts[2],
'min' => $min, // int and float only
'max' => $max,
);
}
}
unset($cell_opts);
break;
case 'textarea': // Multiline Text Input, size: [rows][,cols]
if ($readonly && !$cell_options)
@ -1172,7 +1177,7 @@
}
if (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type'])
{
echo "<p>show_cell::template(tpl=$this->name,name=$cell[name]): $obj_read</p>\n";
echo "<p>show_cell::template(tpl=$this->name,name=$cell[name]): $obj_read, readonly=$readonly</p>\n";
}
if ($this->autorepeat_idx($cell,$show_c,$show_row,$idx,$idx_cname) || $cell_options != '')
{