diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index 9c4af8cae5..2b35d6eb9c 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -77,6 +77,12 @@ 'nextmatch-customfilter' => 'Nextmatch Custom Filterheader', 'nextmatch-header' => 'Nextmatch Header', ); + /** + * Turn on debug messages (mostly in post_process) + * + * @var boolean + */ + var $debug = false; /** * Constructor of the extension @@ -223,7 +229,7 @@ } $value['options-num_rows'] =& $row_options; - if (!isset($value['num_rows'])) $value['num_rows'] = $max; + if (!isset($value['num_rows'])) $extension_data['num_rows'] = $value['num_rows'] = $max; if ($value['num_rows'] != $max) { $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] = $max = (int)$value['num_rows']; @@ -240,7 +246,7 @@ else { if (!is_array($readonlys)) $readonlys = array(); - $total = $value['total'] = $obj->$method($value,$value['rows'],$readonlys['rows']); + $total = $extension_data['total'] = $value['total'] = $obj->$method($value,$value['rows'],$readonlys['rows']); // allow the get_rows function to override / set sel_options if (isset($value['rows']['sel_options']) && is_array($value['rows']['sel_options'])) @@ -252,7 +258,7 @@ if ($method && $total && $value['start'] >= $total) { $value['start'] = 0; - $total = $obj->$method($value,$value['rows'],$readonlys['rows']); + $total = $extension_data['total'] = $value['total'] = $obj->$method($value,$value['rows'],$readonlys['rows']); } if (is_array($value['rows'][0])) // fixed 0 based arrays { @@ -531,7 +537,9 @@ function post_process($name,&$value,&$extension_data,&$loop,&$tmpl,$value_in) { $nm_global = &$GLOBALS['egw_info']['etemplate']['nextmatch']; - //echo "
nextmatch_widget.post_process(type='$extension_data[type]', name='$name',value_in=".print_r($value_in,true).",order='$nm_global[order]'): value = "; _debug_array($value); + + if ($this->debug) { echo "
nextmatch_widget.post_process(type='$extension_data[type]', name='$name',value_in=".print_r($value_in,true).",order='$nm_global[order]'): value = "; _debug_array($value); } + switch($extension_data['type']) { case 'nextmatch': @@ -550,7 +558,7 @@ case 'nextmatch-filterheader': if ((string)$value_in != (string)$extension_data['old_value']) { - //echo "
setting nm_global[filter][".$this->last_part($name)."]='$value_in' (was '$extension_data[old_value]')
\n"; + if ($this->debug) echo "setting nm_global[filter][".$this->last_part($name)."]='$value_in' (was '$extension_data[old_value]')
\n"; $nm_global['filter'][$this->last_part($name)] = $value_in; } return False; // dont report value back, as it's in the wrong location (rows) @@ -559,6 +567,7 @@ return False; // nothing to report } $old_value = $extension_data; + if ($this->debug) { echo "old_value="; _debug_array($old_value); } $value['start'] = $old_value['start']; // need to be set, to be reported back $value['return'] = $old_value['return']; @@ -570,7 +579,7 @@ { if (isset($value['bottom'][$name]) && $value[$name] == $old_value[$name]) { - //echo "value[$name] overwritten by bottom-value[$name]='".$value['bottom'][$name]."', old_value[$name]='".$old_value[$name]."'nextmatch_widget::post_process() num_rows changed {$old_value['num_rows']} --> {$value['num_rows']} ==> looping
\n"; $loop = true; // num_rows changed } // num_rows: use old value in extension data, if $value['num_rows'] is not set because nm-header is not shown @@ -616,10 +626,13 @@ isset($value['filter']) && $value['filter'] != $old_value['filter'] || isset($value['filter2']) && $value['filter2'] != $old_value['filter2']) { - //echo "search='$old_value[search]'->'$value[search]', filter='$old_value[filter]'->'$value[filter]', filter2='$old_value[filter2]'->'$value[filter2]'
";
- //echo "new filter --> loop
search='$old_value[search]'->'$value[search]', filter='$old_value[filter]'->'$value[filter]', filter2='$old_value[filter2]'->'$value[filter2]'
";
+ echo "new filter --> loop
old_value=$old_value[order]/$old_value[sort] ==> $value[order]/$value[sort]
\n"; + if ($this->debug) echo "old_value=$old_value[order]/$old_value[sort] ==> $value[order]/$value[sort]
\n"; $loop = True; } elseif ($nm_global['filter'])