Allow extensions to mark themself as noReadonlysALL, to not set

readonly, if $readonlys['__ALL__'] is set:
required for tab-widget, to be able to disable single tabs, if whole
dialog is set to readonly (view-mode)
This commit is contained in:
Ralf Becker 2009-10-15 08:48:47 +00:00
parent ccdb259f5f
commit 29040ae9f8
2 changed files with 8 additions and 4 deletions

View File

@ -1012,8 +1012,11 @@ class etemplate extends boetemplate
$cell['onchange'] = $this->expand_name($cell['onchange'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
}
if (!$ext_type) $ext_type = $type;
// if readonlys[__ALL__] is set, also set readonlys[$name] (but only then as for extensions (eg. tabs) $readonlys[$name] can be an array!)
if ($readonlys['__ALL__']) $readonlys[$name] = true;
// if readonlys[__ALL__] is set, also set readonlys[$name] (extensions can mark themselfs as 'noReadonlysALL', eg. tab-widget!)
if ($readonlys['__ALL__'] && !$this->haveExtension($type,'noReadonlysALL'))
{
$readonlys[$name] = true;
}
$extra_label = $this->extensionPreProcess($type,$form_name,$value,$cell,$readonlys[$name]);
$readonly = $cell['readonly'] !== false && ($readonly || $cell['readonly']); // might be set or unset (===false) by extension

View File

@ -25,7 +25,8 @@
*/
var $public_functions = array(
'pre_process' => True,
'post_process' => True
'post_process' => True,
'noReadonlysALL' => true, // mark extension as not to set readonly for $readonlys['__ALL__']
);
/**
* availible extensions and there names for the editor
@ -57,7 +58,7 @@
*/
function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
//echo "<p>tab_widget::pre_process('$form_name',$value,,$extension_data)</p>\n";
//echo "<p>tab_widget::pre_process('$form_name',".array2string($value).','.array2string($readonlys).','.array2string($extension_data).")</p>\n";
if (!$cell['onchange']) // onchange allows to use the old behavior (submit for each new tab)
{