--- phpMyEdit.class.1.152.php 2004-11-20 07:49:29.189382400 +0100 +++ phpMyEdit.class.php 2004-11-20 08:58:47.674584000 +0100 @@ -148,6 +148,7 @@ var $navigation; // navigation style var $tabs; // TAB names var $timer = null; // phpMyEdit_timer object + var $childs; // subforms // Predefined variables var $comp_ops = array('<'=>'<','<='=>'<=','='=>'=','>='=>'>=','>'=>'>'); @@ -1082,6 +1083,9 @@ echo ' wrap="virtual"'; } echo '>',htmlspecialchars($row["qf$k"]),'',"\n"; + } elseif (isset($this->fdd[$k]['child'])) { + $tmp = $this->childs[$this->fds[$k]]; + $tmp->execute(); } else { $size_ml_props = ''; $maxlen = intval($this->fdd[$k]['maxlen']); @@ -1118,7 +1122,11 @@ $css_postfix = @$this->fdd[$k]['css']['postfix']; $css_class_name = $this->getCSSclass('value', null, true, $css_postfix); echo 'getColAttributes($k),">\n"; - echo $this->cellDisplay($k, $row, $css_class_name); + if (isset($this->fdd[$k]['child'])) { + $this->childs[$this->fds[$k]]->execute(); + } else { + echo $this->cellDisplay($k, $row, $css_class_name); + } echo '',"\n"; } /* }}} */ @@ -3027,6 +3035,41 @@ !isset($this->cgi['prefix']['operation']) && $this->cgi['prefix']['operation'] = 'PME_op_'; !isset($this->cgi['prefix']['sys']) && $this->cgi['prefix']['sys'] = 'PME_sys_'; !isset($this->cgi['prefix']['data']) && $this->cgi['prefix']['data'] = 'PME_data_'; + // Childs + if(isset($opts['childs'])) { + global $HTTP_POST_VARS, $HTTP_GET_VARS; + $all_CGI = array_merge(Array(), @$HTTP_POST_VARS, @$HTTP_GET_VARS); + $cgi_parent = Array(); + foreach($all_CGI as $key => $val) { + if(preg_match('/^('.$this->cgi['prefix']['sys'].'.*)/', $key, $parts)) { + $cgi_parent[$key] = $val; + } + } + foreach($opts['childs'] as $key => $val) { + $val['display']['form'] = false; //form's tag not required for childs + $val['execute'] = 0; //don't execute childs now ! + $no = false; + foreach($all_CGI as $key2 => $val2) { + $no = $no || preg_match('/^('.$val['cgi']['prefix']['sys'].')(save|more|cancel|operation)+(add|view|change|copy|delete)?/', $key2, $parts); + } + foreach($all_CGI as $key2 => $val2) { + if(preg_match('/^('.$val['cgi']['prefix']['sys'].')('.$this->cgi['prefix']['sys'].'.*)/', $key2, $parts)) { + if($no && $parts[2] != $this->cgi['prefix']['sys'].'current_tab') { + $this->cgi['overwrite'][$parts[2]] = $val2; + } + $val['cgi']['persist'][$val['cgi']['prefix']['sys'].$parts[2]] = $val2; + } + } + foreach($cgi_parent as $key2 => $val2) { //keep (but protect) parents CGI var + $val['cgi']['persist'][$val['cgi']['prefix']['sys'].$key2] = $val2; + } + $this->childs[$key] = new phpMyEdit($val); + $this->childs[$key]->is_child = true; + $this->childs[$key]->parent = $this; + } + } else { + $this->childs = false; + } // Sorting variables $this->sfn = $this->get_sys_cgi_var('sfn'); isset($this->sfn) || $this->sfn = array();