forked from extern/egroupware
some etemplate fixes:
- date-widget does no longer set extension-data if readonly (not used and can conflict with other widgets using the same name, as it was the problem in PM) - select-widget: fix for "can not unselect the last category" - red error-messages have now a "white-space: nowrap" for nice formatting - confirm-message did not quote single quotes (') correct, which caused the complete confirm dialog to fail and allways execute the button - readonly textarea's without column and row specification are rendered now as <pre></pre> to only take space needed
This commit is contained in:
parent
0c13c33fd2
commit
d1d4bc610e
@ -97,10 +97,16 @@
|
|||||||
}
|
}
|
||||||
list($data_format,$options,$options2) = explode(',',$cell['size']);
|
list($data_format,$options,$options2) = explode(',',$cell['size']);
|
||||||
if ($type == 'date-houronly' && empty($data_format)) $data_format = 'H';
|
if ($type == 'date-houronly' && empty($data_format)) $data_format = 'H';
|
||||||
|
|
||||||
|
$readonly = $cell['readonly'] || $readonlys;
|
||||||
|
|
||||||
|
if (!$readonly) // dont set extension-data on readonly, it's not needed and can conflict with other widgets
|
||||||
|
{
|
||||||
$extension_data = array(
|
$extension_data = array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'data_format' => $data_format,
|
'data_format' => $data_format,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if (!$value)
|
if (!$value)
|
||||||
{
|
{
|
||||||
$value = array(
|
$value = array(
|
||||||
@ -145,8 +151,6 @@
|
|||||||
}
|
}
|
||||||
$time_0h0 = !(int)$value['H'] && !(int)$value['i'];
|
$time_0h0 = !(int)$value['H'] && !(int)$value['i'];
|
||||||
|
|
||||||
$readonly = $cell['readonly'] || $readonlys;
|
|
||||||
|
|
||||||
$timeformat = array(3 => 'H', 4 => 'i');
|
$timeformat = array(3 => 'H', 4 => 'i');
|
||||||
if ($this->timeformat == '12' && $readonly && $value['H'] !== '')
|
if ($this->timeformat == '12' && $readonly && $value['H'] !== '')
|
||||||
{
|
{
|
||||||
@ -327,6 +331,8 @@
|
|||||||
}
|
}
|
||||||
if (!in_array($input_format,array('d','h','dh','m','hm','dhm'))) $input_format = 'dh'; // hours + days
|
if (!in_array($input_format,array('d','h','dh','m','hm','dhm'))) $input_format = 'dh'; // hours + days
|
||||||
|
|
||||||
|
if (!$readonly) // dont set extension-data on readonly, it's not needed and can conflict with other widgets
|
||||||
|
{
|
||||||
$extension_data = array(
|
$extension_data = array(
|
||||||
'type' => $cell['type'],
|
'type' => $cell['type'],
|
||||||
'data_format' => $data_format,
|
'data_format' => $data_format,
|
||||||
@ -336,6 +342,7 @@
|
|||||||
'percent_allowed'=> $percent_allowed,
|
'percent_allowed'=> $percent_allowed,
|
||||||
'empty_not_0' => $empty_not_0,
|
'empty_not_0' => $empty_not_0,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
if ($value)
|
if ($value)
|
||||||
{
|
{
|
||||||
switch($data_format)
|
switch($data_format)
|
||||||
|
@ -560,6 +560,6 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//echo "<p>select_widget::post_process('$name',,'$extension_data',,,'$value_in'): value='$value', is_null(value)=".(int)is_null($value)."</p>\n";
|
//echo "<p>select_widget::post_process('$name',,'$extension_data',,,'$value_in'): value='$value', is_null(value)=".(int)is_null($value)."</p>\n";
|
||||||
return !is_null($value);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -953,8 +953,15 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'textarea': // Multiline Text Input, size: [rows][,cols]
|
case 'textarea': // Multiline Text Input, size: [rows][,cols]
|
||||||
|
if ($readonly && !$cell_options)
|
||||||
|
{
|
||||||
|
$html .= '<pre style="margin-top: 0px;">'.$this->html->htmlspecialchars($value)."</pre>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$html .= $this->html->textarea($form_name,$value,
|
$html .= $this->html->textarea($form_name,$value,
|
||||||
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
|
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
|
||||||
|
}
|
||||||
if (!$readonly)
|
if (!$readonly)
|
||||||
{
|
{
|
||||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
|
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
|
||||||
@ -1065,7 +1072,7 @@
|
|||||||
elseif (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$cell['onclick'],$matches))
|
elseif (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$cell['onclick'],$matches))
|
||||||
{
|
{
|
||||||
$question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase
|
$question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase
|
||||||
$onclick = preg_replace('/confirm\(["\']{1}(.*)["\']{1}\)/','confirm(\''.$question.'\')',$onclick);
|
$onclick = preg_replace('/confirm\(["\']{1}(.*)["\']{1}\)/','confirm(\''.addslashes($question).'\')',$onclick);
|
||||||
//$onclick = "return confirm('".str_replace('\'','\\\'',$this->html->htmlspecialchars($question))."');";
|
//$onclick = "return confirm('".str_replace('\'','\\\'',$this->html->htmlspecialchars($question))."');";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1532,7 +1539,7 @@
|
|||||||
// if necessary show validation-error behind field
|
// if necessary show validation-error behind field
|
||||||
if (isset($GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name]))
|
if (isset($GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name]))
|
||||||
{
|
{
|
||||||
$html .= ' <font color="red">'.$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name].'</font>';
|
$html .= ' <span style="color: red; white-space: nowrap;">'.$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name].'</span>';
|
||||||
}
|
}
|
||||||
// generate an extra div, if we have an onclick handler and NO children or it's an extension
|
// generate an extra div, if we have an onclick handler and NO children or it's an extension
|
||||||
//echo "<p>$this->name($this->onclick_handler:$this->no_onclick:$this->onclick_proxy): $cell[type]/$cell[name]</p>\n";
|
//echo "<p>$this->name($this->onclick_handler:$this->no_onclick:$this->onclick_proxy): $cell[type]/$cell[name]</p>\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user