From ba4bb53c29afe1dbb8e2134663ff828a1033b5e4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 28 Mar 2014 17:32:32 +0000 Subject: [PATCH] fixed not working autorepeat if $row_cont was used --- etemplate/inc/class.etemplate_widget.inc.php | 14 +++++++++----- .../inc/class.etemplate_widget_grid.inc.php | 16 +++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget.inc.php b/etemplate/inc/class.etemplate_widget.inc.php index 8b41acac3f..aedd34cdf1 100644 --- a/etemplate/inc/class.etemplate_widget.inc.php +++ b/etemplate/inc/class.etemplate_widget.inc.php @@ -7,7 +7,7 @@ * @subpackage api * @link http://www.egroupware.org * @author Ralf Becker - * @copyright 2002-13 by RalfBecker@outdoor-training.de + * @copyright 2002-14 by RalfBecker@outdoor-training.de * @version $Id$ */ @@ -991,12 +991,16 @@ class etemplate_widget_box extends etemplate_widget { $pat = substr($pat,$pat[1] == '{' ? 2 : 1); - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || substr($pat,0,4) == 'row_'); + $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || + substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); - if ($Ok && ($value = self::get_array(self::$request->content, - $fname=self::form_name($cname, $check_widget->id, $expand))) !== false && isset($value)) + if ($Ok && ($fname=self::form_name($cname, $check_widget->id, $expand)) && + // need to break if fname ends in [] as get_array() will ignore it and returns whole array + // for an id like "run[$row_cont[appname]]" + substr($fname, -2) != '[]' && + ($value = self::get_array(self::$request->content, $fname)) !== null) // null = not found (can be false!) { - error_log(__METHOD__."($widget,$cname) $this autorepeating row $expand[row] because of $check_widget->id = '$fname' is ".array2string($value)); + //error_log(__METHOD__."($widget,$cname) $this autorepeating row $expand[row] because of $check_widget->id = '$fname' is ".array2string($value)); return true; } } diff --git a/etemplate/inc/class.etemplate_widget_grid.inc.php b/etemplate/inc/class.etemplate_widget_grid.inc.php index 28e59b0442..4aea1ad0d2 100644 --- a/etemplate/inc/class.etemplate_widget_grid.inc.php +++ b/etemplate/inc/class.etemplate_widget_grid.inc.php @@ -7,7 +7,7 @@ * @subpackage api * @link http://www.egroupware.org * @author Ralf Becker - * @copyright 2002-11 by RalfBecker@outdoor-training.de + * @copyright 2002-14 by RalfBecker@outdoor-training.de * @version $Id$ */ @@ -184,20 +184,26 @@ class etemplate_widget_grid extends etemplate_widget_box substr($pat,0,4) == 'col_'); break; case 'row': - $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || substr($pat,0,4) == 'row_'); + $Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' || + substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont'); + //error_log(__METHOD__."() pat='$pat' --> Ok=".array2string($Ok)); break; default: return false; } - if ($Ok && ($value = self::get_array(self::$request->content, - $fname=self::form_name($cname, $child->id, $expand))) !== false && isset($value)) + if ($Ok && ($fname=self::form_name($cname, $child->id, $expand)) && + // need to break if fname ends in [] as get_array() will ignore it and returns whole array + // for an id like "run[$row_cont[appname]]" + substr($fname, -2) != '[]' && + ($value = self::get_array(self::$request->content,$fname)) !== null) // null = not found (can be false!) { - //error_log(__METHOD__."('$method_name', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); + //error_log(__METHOD__."('$cname', ) $this autorepeating row $expand[row] because of $child->id = '$fname' is ".array2string($value)); return true; } } } } + //error_log(__METHOD__."('$cname', ) $this NOT autorepeating row $expand[row]"); return false; } }