From 548858e074806979548db334b47a18969a1fa46b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 5 Jul 2007 04:57:31 +0000 Subject: [PATCH] "some bugfixes: - two etemplate on one page (eg. infolog under the addressbook view) is working halfway again - fixed not working vars in onclick on grid-cells - disabled cells keep there css-class now Also calling some of the static methods now static, while trying to make process_exec static (which it is not at the moment)" --- etemplate/inc/class.uietemplate.inc.php | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index e5e3f01133..7f0bfc593e 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -191,13 +191,17 @@ $GLOBALS['egw']->translation->add_app('etemplate'); // some extensions have own texts } $id = $this->appsession_id(); - +//echo "

unsetting existing egw_info[etemplate] which had keys=".implode(',',array_keys($GLOBALS['egw_info']['etemplate']))."

\n"; // initialise $GLOBALS['egw_info']['etemplate'], in case there are multiple eTemplates on a page $GLOBALS['egw_info']['etemplate'] = array( 'name_forms' => $GLOBALS['egw_info']['etemplate']['name_forms'], 'validation_errors' => $GLOBALS['egw_info']['etemplate']['validation_errors'], 'hooked' => $GLOBALS['egw_info']['etemplate']['hooked'], + 'content' => $GLOBALS['egw_info']['etemplate']['content'], + 'hook_content' => $GLOBALS['egw_info']['etemplate']['hook_content'], + 'hook_app' => $GLOBALS['egw_info']['etemplate']['hook_app'], ); +//echo "

hooked=".(int)!!$GLOBALS['egw_info']['etemplate']['hooked'].", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}

\n"; $this->name_form =& $GLOBALS['egw_info']['etemplate']['name_form']; $this->name_forms =& $GLOBALS['egw_info']['etemplate']['name_forms']; if (!is_array($this->name_forms)) $this->name_forms = array(); @@ -324,7 +328,7 @@ 'java_script_body_tags' => $GLOBALS['egw']->js->body, 'include_xajax' => $GLOBALS['egw_info']['flags']['include_xajax'], 'dom_enabled' => $GLOBALS['egw_info']['etemplate']['dom_enabled'], - 'hooked' => $hooked != '' ? $hooked : $GLOBALS['egw_info']['etemplate']['hook_content'], + 'hooked' => $hooked ? $hooked : $GLOBALS['egw_info']['etemplate']['hook_content'], 'hook_app' => $hooked ? $GLOBALS['egw_info']['flags']['currentapp'] : $GLOBALS['egw_info']['etemplate']['hook_app'], 'app_header' => $GLOBALS['egw_info']['flags']['app_header'], 'output_mode' => $output_mode != -1 ? $output_mode : 0, @@ -333,6 +337,8 @@ 'method' => $method, 'name_vars' => $this->name_vars, ),$id); +//echo "

hooked=".(int)!!$hooked.", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}

\n"; +//echo "

session: "; foreach($sess as $key => $val) echo "$key=$val, "; echo "

\n"; /* echo "

total size session data = ".($total=strlen(serialize($sess)))."

\n"; echo "

shares bigger then 1.0% percent of it:

\n"; @@ -736,10 +742,14 @@ foreach($sess as $key => $val) unset($row_data[$col]); // omit empty/disabled cells if only one row continue; } - // can only be set via source at the moment - if (strlen($cell['onclick']) > 1 && $cell['type'] != 'button') + if (strlen($cell['onclick']) > 1 && !in_array($cell['type'],array('button','buttononly'))) { - $row_data[".$col"] .= ' onclick="'.$this->js_pseudo_funcs($cell['onclick'],$cname).'"' . + $onclick = $cell['onclick']; + if (strpos($onclick,'$') !== false || $onclick{0} == '@') + { + $onclick = $this->expand_name($onclick,$c,$r,$content['.c'],$content['.row'],$content); + } + $row_data[".$col"] .= ' onclick="'.$this->js_pseudo_funcs($onclick,$cname).'"' . ($cell['id'] ? ' id="'.$cell['id'].'"' : ''); } $colspan = $span == 'all' ? $this->cols-$c : 0+$span; @@ -885,7 +895,7 @@ foreach($sess as $key => $val) if ($this->rows == 1) { return ''; // if only one row omit cell } - $cell = $this->empty_cell(); // show nothing + $cell = $this->empty_cell('label','',array('span' => $cell['span'])); // show nothing (keep the css class!) $value = ''; } $extra_label = True; @@ -1719,7 +1729,7 @@ foreach($sess as $key => $val) } foreach($var as $key => $val) { - $var[$key] = is_array($val) ? $this->array_stripslashes($val) : stripslashes($val); + $var[$key] = is_array($val) ? etemplate::array_stripslashes($val) : stripslashes($val); } return $var; } @@ -1751,7 +1761,7 @@ foreach($sess as $key => $val) $content = array(); if (get_magic_quotes_gpc()) { - $content_in = $this->array_stripslashes($content_in); + $content_in = etemplate::array_stripslashes($content_in); } $GLOBALS['egw_info']['etemplate']['validation_errors'] = array(); $this->canceled = $this->button_pressed = False; @@ -1767,7 +1777,7 @@ foreach($sess as $key => $val) { $attr = array(); } - $value = $this->get_array($content_in,$form_name,True,$GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' ? false : true ); + $value = etemplate::get_array($content_in,$form_name,True,$GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' ? false : true ); // The comment below does only aplay to normal posts, not for xajax. Files are not supported anyway by xajax atm. // not checked checboxes are not returned in HTML and file is in $_FILES and not in $content_in if($value === false && $type == 'xajaxResponse' /*!in_array($type,array('checkbox','file'))*/) continue; @@ -1781,7 +1791,7 @@ foreach($sess as $key => $val) switch ($type) { case 'ext': - $_cont = &$this->get_array($content,$form_name,True); + $_cont = &etemplate::get_array($content,$form_name,True); if (!$this->extensionPostProcess($sub,$form_name,$_cont,$value)) { //echo "\n

unsetting content[$form_name] !!!

\n"; @@ -1791,7 +1801,7 @@ foreach($sess as $key => $val) // $form_name of $content, but under some circumstances a set/changed $_cont // does not result in a change in $content -- RalfBecker 2004/09/18 // seems to depend on the number of (not existing) dimensions of the array -- -- RalfBecker 2005/04/06 - elseif (!$this->isset_array($content,$form_name)) + elseif (!etemplate::isset_array($content,$form_name)) { //echo "

setting content[$form_name]='$_cont' because is was unset !!!

\n"; $this->set_array($content,$form_name,$_cont);