From 7bd87b11802d02b8685aff840117db0942950ba6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 24 Sep 2002 21:57:15 +0000 Subject: [PATCH] changed interface for extensions to: pre_process(&$cell,&$value,&$extension_data,&$readonlys) post_process(&$cell,&$value,&$extension_data,&$loop) --- etemplate/inc/class.date_widget.inc.php | 4 ++-- etemplate/inc/class.datefield_widget.inc.php | 4 ++-- etemplate/inc/class.nextmatch_widget.inc.php | 22 ++++++++++---------- etemplate/inc/class.tab_widget.inc.php | 16 +++++++------- etemplate/inc/class.uietemplate.inc.php | 12 +++++++---- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index 9a6a9ba95d..edbe6a6154 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -44,7 +44,7 @@ return 0; } - function pre_process(&$cell,&$value,&$templ) + function pre_process(&$cell,&$value,&$extension_data,&$readonlys) { if ($cell['size'] != '') { @@ -74,7 +74,7 @@ return $this->$func($cell,$form_name,$value,$readonly); } - function post_process(&$cell,&$value,&$templ) + function post_process(&$cell,&$value,&$extension_data,&$loop) { if (!isset($value)) { diff --git a/etemplate/inc/class.datefield_widget.inc.php b/etemplate/inc/class.datefield_widget.inc.php index e7d5d4b309..71e134f246 100644 --- a/etemplate/inc/class.datefield_widget.inc.php +++ b/etemplate/inc/class.datefield_widget.inc.php @@ -30,7 +30,7 @@ { } - function pre_process(&$cell,&$value,&$templ) + function pre_process(&$cell,&$value,&$extension_data,&$readonlys) { if ($cell['size'] != '') { @@ -69,7 +69,7 @@ return True; // extra Label is ok } - function post_process(&$cell,&$value,&$templ) + function post_process(&$cell,&$value,&$extension_data,&$loop) { if (!isset($value)) { diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 661209449d..083318b4c5 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -31,11 +31,11 @@ { } - function pre_process(&$cell,&$value,&$templ,&$readonlys) + function pre_process(&$cell,&$value,&$extension_data,&$readonlys) { //echo "

nextmatch_widget.pre_process: value = "; _debug_array($value); // save values in persistent extension_data to be able use it in post_process - $GLOBALS['phpgw_info']['etemplate']['extension_data']['nextmatch_widget'][$cell['name']] = $value; + $extension_data = $value; list($app,$class,$method) = explode('.',$value['get_rows']); $obj = CreateObject($app.'.'.$class); @@ -45,7 +45,7 @@ $value['start'] = 0; $total = $obj->$method($value,$value['rows'],$readonlys['rows']); } - $GLOBALS['phpgw_info']['etemplate']['extension_data']['nextmatch_widget'][$cell['name']]['total'] = $total; + $extension_data['total'] = $total; if ($cell['size']) { @@ -81,11 +81,11 @@ return False; // NO extra Label } - function post_process(&$cell,&$value,&$templ) + function post_process(&$cell,&$value,&$extension_data,&$loop) { //echo "

nextmatch_widget.post_process: value = "; _debug_array($value); - $old_value = $GLOBALS['phpgw_info']['etemplate']['extension_data']['nextmatch_widget'][$cell['name']]; + $old_value = $extension_data; list($value['cat_id']) = $value['cat_id']; list($value['filter']) = $value['filter']; @@ -93,7 +93,7 @@ $value['start'] = $old_value['start']; // need to be set, to be reported back $max = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; - $templ->loop = False; + $loop = False; if ($value['start_search'] || $value['cat_id'] != $old_value['cat_id'] || $old_value['filter'] != '' && $value['filter'] != $old_value['filter'] || $old_value['filter2'] != '' && $value['filter2'] != $old_value['filter2']) @@ -101,27 +101,27 @@ //echo "

search='$old_value[search]'->'$value[search]', filter='$old_value[filter]'->'$value[filter]', filter2='$old_value[filter2]'->'$value[filter2]'
"; //echo "new filter --> loop

"; //_debug_array($old_value); - $templ->loop = True; + $loop = True; } elseif ($value['first']) { $value['start'] = 0; - $templ->loop = True; + $loop = True; } elseif ($value['left']) { $value['start'] = $old_value['start'] - $max; - $templ->loop = True; + $loop = True; } elseif ($value['right']) { $value['start'] = $old_value['start'] + $max; - $templ->loop = True; + $loop = True; } elseif ($value['last']) { $value['start'] = (int) (($old_value['total']-2) / $max) * $max; - $templ->loop = True; + $loop = True; } return True; } diff --git a/etemplate/inc/class.tab_widget.inc.php b/etemplate/inc/class.tab_widget.inc.php index be8b5ea8e9..fcc03097a9 100644 --- a/etemplate/inc/class.tab_widget.inc.php +++ b/etemplate/inc/class.tab_widget.inc.php @@ -31,7 +31,7 @@ { } - function pre_process(&$cell,&$value,&$templ) + function pre_process(&$cell,&$value,&$extension_data,&$readonlys) { $labels = explode('|',$cell['label']); $helps = explode('|',$cell['help']); @@ -50,7 +50,7 @@ if (is_array($value['_tab_widget']) && $value['_tab_widget'][$name][0]) { // save selected tab in persistent extension_data to use it in post_process - $GLOBALS['phpgw_info']['etemplate']['extension_data']['tab_widget'][$cell['name']] = $selected_tab = $name; + $extension_data = $selected_tab = $name; $tcell['name'] = $tab_active; } else @@ -74,7 +74,7 @@ if (!isset($selected_tab)) { $tab_row['A']['name'] = $tab_active; - $GLOBALS['phpgw_info']['etemplate']['extension_data']['tab_widget'][$cell['name']] = $selected_tab = $names[0]; + $extension_data = $selected_tab = $names[0]; } $tabs->data[1] = $tab_row; $tabs->rows = 1; @@ -92,13 +92,13 @@ return False; // NO extra Label } - function post_process(&$cell,&$value,&$templ) + function post_process(&$cell,&$value,&$extension_data,&$loop) { $old_value = array( '_tab_widget' => array( - $GLOBALS['phpgw_info']['etemplate']['extension_data']['tab_widget'][$cell['name']] => array(True) + $extension_data => array(True) )); - $this->pre_process($cell,$old_value,$templ); + $this->pre_process($cell,$old_value,$extension_data,$dummy); if (is_array($value['_tab_widget'])) { @@ -106,12 +106,10 @@ { if (is_array($val) && $val[0]) { - $templ->loop = True; + $loop = True; } } } - //$templ->loop = is_array($value['_tab_widget']); - return True; } } \ No newline at end of file diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 488bc14db8..211c094b67 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -101,6 +101,7 @@ $id = $this->appsession_id(); + $GLOBALS['phpgw_info']['etemplate']['loop'] = False; $GLOBALS['phpgw_info']['etemplate']['form_options'] = ''; // might be set in show $html .= $this->html->nextMatchStyles($this->style)."\n\n". // so they get included once $this->html->form($this->include_java_script() . @@ -165,7 +166,7 @@ $content = $this->complete_array_merge($session_data['changes'],$content); //echo "process_exec($this->name) merge(changes,content) ="; _debug_array($content); - if ($this->loop) + if ($GLOBALS['phpgw_info']['etemplate']['loop']) { //echo "

process_exec($this->name): loop is set, content=

\n"; _debug_array($content); $this->exec($session_data['method'],$session_data['content'],$session_data['sel_options'], @@ -364,7 +365,8 @@ if (!$this->types[$cell['type']] && (isset($this->extension[$cell['type']]) || $this->loadExtension($cell['type'],$this))) { - $extra_label = $this->extension[$cell['type']]->pre_process($cell,$value,$this,$readonlys[$name]); + $extra_label = $this->extension[$cell['type']]->pre_process($cell,$value, + $GLOBALS['phpgw_info']['etemplate']['extension_data'][$cell['type']][$cell['name']],$readonlys[$name]); if (strstr($name,'|')) { $content = $this->complete_array_merge($content,$value); @@ -457,7 +459,7 @@ if ($this->java_script() && $cell['onchange']) { $html .= $this->html->input_hidden($form_name,'',False) . "\n"; - $html .= '' . + $html .= '' . (strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . ''; } else @@ -754,7 +756,9 @@ { echo "

value for $cell[type]::post_process: "; _debug_array($value); } - $this->extension[$cell['type']]->post_process($cell,$value,$this); + $this->extension[$cell['type']]->post_process($cell,$value, + $GLOBALS['phpgw_info']['etemplate']['extension_data'][$cell['type']][$cell['name']], + $GLOBALS['phpgw_info']['etemplate']['loop']); if ($this->debug > 1 || $this->debug && $this->debug == $this->name) {