From 29040ae9f89c853c66398b2d3bcf489d2184c3ec Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 15 Oct 2009 08:48:47 +0000 Subject: [PATCH] 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) --- etemplate/inc/class.etemplate.inc.php | 7 +++++-- etemplate/inc/class.tab_widget.inc.php | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index b5860dcc94..3cb5a02359 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -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 diff --git a/etemplate/inc/class.tab_widget.inc.php b/etemplate/inc/class.tab_widget.inc.php index 1fb0dce492..ac89f41c34 100644 --- a/etemplate/inc/class.tab_widget.inc.php +++ b/etemplate/inc/class.tab_widget.inc.php @@ -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 "

tab_widget::pre_process('$form_name',$value,,$extension_data)

\n"; + //echo "

tab_widget::pre_process('$form_name',".array2string($value).','.array2string($readonlys).','.array2string($extension_data).")

\n"; if (!$cell['onchange']) // onchange allows to use the old behavior (submit for each new tab) {