phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.19,1.2


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.19,1.20 class.date_widget.inc.php,1.4,1.5 class.datefield_widget.inc.php,1.5,1.6 class.editor.inc.php,1.18,1.19 class.nextmatch_widget.inc.php,1.8,1.9 class.soetemplate.inc.php,1.14,1.15 class.tab_widget.inc.php,1.7,1.8 class.uietemplate.inc.php,1.25,1.26
Date: Fri, 27 Sep 2002 12:17:41 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv21205

Modified Files:
        class.boetemplate.inc.php class.date_widget.inc.php 
        class.datefield_widget.inc.php class.editor.inc.php 
        class.nextmatch_widget.inc.php class.soetemplate.inc.php 
        class.tab_widget.inc.php class.uietemplate.inc.php 
Log Message:
big performance improvment by using references (droped php3 compatibility)

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** class.boetemplate.inc.php   25 Sep 2002 16:36:07 -0000      1.19
--- class.boetemplate.inc.php   27 Sep 2002 16:17:39 -0000      1.20
***************
*** 270,280 ****
                                                ++$n;
                                        }
!                                       if ($cell['type'] == 'template' && 
(is_object($cell['name']) || $cell['name'][0] != '@'))
                                        {
!                                               if (!is_object($cell['name']))
                                                {
!                                                       
$this->data[$row][$col]['name'] = 
CreateObject('etemplate.etemplate',$cell['name']);
                                                }
!                                               $n += 
$this->data[$row][$col]['name']->set_cell_attribute($name,$attr,$val);
                                        }
                                }
--- 270,280 ----
                                                ++$n;
                                        }
!                                       if ($cell['type'] == 'template' && 
(is_object($cell['obj']) || $cell['name'][0] != '@'))
                                        {
!                                               if (!is_object($cell['obj']))
                                                {
!                                                       
$this->data[$row][$col]['obj'] = 
CreateObject('etemplate.etemplate',$cell['name']);
                                                }
!                                               $n += 
$this->data[$row][$col]['obj']->set_cell_attribute($name,$attr,$val);
                                        }
                                }
***************
*** 298,302 ****
                /*!
                @function loadExtension
!               @syntax loadExtension( $name,$ui='' )
                @author ralfbecker
                @abstact trys to load the Extension / Widget-class from the app 
or etemplate
--- 298,302 ----
                /*!
                @function loadExtension
!               @syntax loadExtension( $type )
                @author ralfbecker
                @abstact trys to load the Extension / Widget-class from the app 
or etemplate
***************
*** 304,310 ****
                @discussion the $name might be "$name.$app" to give a app-name 
(default is the current app,or template-name)
                */
!               function loadExtension($name,&$parent,$ui='html')
                {
!                       list($class,$app) = explode('.',$name);
                        $class .= '_widget';
  
--- 304,310 ----
                @discussion the $name might be "$name.$app" to give a app-name 
(default is the current app,or template-name)
                */
!               function loadExtension($type)
                {
!                       list($class,$app) = explode('.',$type);
                        $class .= '_widget';
  
***************
*** 323,339 ****
                        if 
(!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
                        {
!                               return $this->extension[$name] = False;
                        }
!                       $this->extension[$name] = 
CreateObject($app.'.'.$class,$ui);
  
!                       if(floor(phpversion()) >= 4)
                        {
!                               $this->extension[$name]->et = &$parent;
                        }
!                       else
                        {
!                               $this->extension[$name]->et = $parent;
                        }
!                       return $this->extension[$name];
                }
  
--- 323,391 ----
                        if 
(!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
                        {
!                               return 
$GLOBALS['phpgw_info']['etemplate']['extension'][$type] = False;
                        }
!                       $GLOBALS['phpgw_info']['etemplate']['extension'][$type] 
= CreateObject($app.'.'.$class,$ui='html');
  
!                       return 
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->human_name;
!               }
! 
!               function haveExtension($type,$function='')
!               /*
!               @function haveExtension
!               @syntax haveExtension($type)
!               @abstract checks if extension is loaded and load it if it isnt
!               */
!               {
!                       return 
($GLOBALS['phpgw_info']['etemplate']['extension'][$type] || 
$this->loadExtension($type,$ui)) &&
!                               ($function == '' || 
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->public_functions[$function]);
!               }
! 
!               function extensionPreProcess(&$cell,&$value,&$readonlys)
!               /*
!               @function extensionPreProcess
!               @syntax extensionPreProcess(&$cell,&$value,&$readonlys)
!               @param &$cell table-cell on which the extension operates
!               @param &$value value of the extensions content(-array)
!               @param &$readonlys value of the extensions 
readonly-setting(-array)
!               @abstract executes the pre_process-function of the extension 
$cell[]type]
!               */
!               {
!                       if (!$this->haveExtension($type = $cell['type']))
                        {
!                               return False;
                        }
!                       return 
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->pre_process($cell,$value,
!                               
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$type][$cell['name']],$readonlys,$this);
!               }
! 
!               function extensionPostProcess(&$cell,&$value)
!               /*
!               @function extensionPostProcess
!               @syntax extensionPostProcess(&$cell,&$value)
!               @abstract executes the post_process-function of the extension 
$cell[type]
!               */
!               {
!                       if (!$this->haveExtension($type = 
$cell['type'],'post_process'))
!                       {
!                               return False;
!                       }
!                       return 
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->post_process($cell,$value,
!                               
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$type][$cell['name']],
!                               
$GLOBALS['phpgw_info']['etemplate']['loop'],$this);
!               }
! 
!               function extensionRender(&$cell,$form_name,&$value,$readonly)
!               /*
!               @function extensionRender
!               @syntax extensionRender(&$cell,$form_name,&$value,$readonly)
!               @abstract executes the render-function of the extension 
$cell[type]
!               */
!               {
!                       if (!$this->haveExtension($type = 
$cell['type'],'render'))
                        {
!                               return False;
                        }
!                       return 
$GLOBALS['phpgw_info']['etemplate']['extension'][$name]->render($cell,$form_name,$value,$readonly,
!                               
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$type][$cell['name']],$this);
                }
  
***************
*** 376,389 ****
                }
  
!               function get_array(&$arr,$idx)
                {
                        if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs))     // idx 
contains array-index
                        {
!                               eval($code = 
str_replace(']',"']",str_replace('[',"['",'$val = 
$arr['.$regs[1].']'.$regs[2].';')));
                                //echo "get_array: $code = '$val'\n";
                        }
                        else
                        {
!                               $val = $arr[$idx];
                        }
                        return $val;
--- 428,441 ----
                }
  
!               function &get_array(&$arr,$idx)
                {
                        if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs))     // idx 
contains array-index
                        {
!                               eval($code = 
str_replace(']',"']",str_replace('[',"['",'$val = 
&$arr['.$regs[1].']'.$regs[2].';')));
                                //echo "get_array: $code = '$val'\n";
                        }
                        else
                        {
!                               $val = &$arr[$idx];
                        }
                        return $val;

Index: class.date_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.date_widget.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.date_widget.inc.php   24 Sep 2002 21:57:15 -0000      1.4
--- class.date_widget.inc.php   27 Sep 2002 16:17:39 -0000      1.5
***************
*** 28,32 ****
                var $human_name = 'Date';       // this is the name for the 
editor
  
!               function date_widget($ui)
                {
                        switch($ui)
--- 28,32 ----
                var $human_name = 'Date';       // this is the name for the 
editor
  
!               function date_widget($ui='')
                {
                        switch($ui)
***************
*** 45,49 ****
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys)
                {
                        if ($cell['size'] != '')
--- 45,49 ----
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys,&$tmpl)
                {
                        if ($cell['size'] != '')
***************
*** 68,79 ****
                }
  
!               function render($cell,$form_name,$value,$readonly)
                {
                        $func = 'render_'.$this->ui;
  
!                       return $this->$func($cell,$form_name,$value,$readonly);
                }
  
!               function post_process(&$cell,&$value,&$extension_data,&$loop)
                {
                        if (!isset($value))
--- 68,82 ----
                }
  
!               function 
render(&$cell,$form_name,&$value,$readonly,&$extension_data,&$tmpl)
                {
                        $func = 'render_'.$this->ui;
  
!                       if (!method_exists($this,$func))
!                               return False;
! 
!                       return 
$this->$func($cell,$form_name,$value,$readonly,$tmpl);
                }
  
!               function 
post_process(&$cell,&$value,&$extension_data,&$loop,&$tmpl)
                {
                        if (!isset($value))
***************
*** 118,122 ****
                }
  
!               function render_html($cell,$form_name,$value,$readonly)
                {
                        if ($readonly)
--- 121,125 ----
                }
  
!               function render_html($cell,$form_name,$value,$readonly,&$tmpl)
                {
                        if ($readonly)
***************
*** 124,128 ****
                                return 
$GLOBALS['phpgw']->common->dateformatorder($value[0],$value[1],$value[2],True);
                        }
!                       return 
$this->et->sbox->getDate($form_name.'[Y]',$form_name.'[m]',$form_name.'[d]',$value,$options);
                }
        }
--- 127,131 ----
                                return 
$GLOBALS['phpgw']->common->dateformatorder($value[0],$value[1],$value[2],True);
                        }
!                       return 
$tmpl->sbox->getDate($form_name.'[Y]',$form_name.'[m]',$form_name.'[d]',$value,$options);
                }
        }

Index: class.datefield_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.datefield_widget.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.datefield_widget.inc.php      24 Sep 2002 21:57:15 -0000      1.5
--- class.datefield_widget.inc.php      27 Sep 2002 16:17:39 -0000      1.6
***************
*** 31,35 ****
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys)
                {
                        if ($cell['size'] != '')
--- 31,35 ----
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys,&$tmpl)
                {
                        if ($cell['size'] != '')
***************
*** 70,74 ****
                }
  
!               function post_process(&$cell,&$value,&$extension_data,&$loop)
                {
                        if (!isset($value))
--- 70,74 ----
                }
  
!               function 
post_process(&$cell,&$value,&$extension_data,&$loop,&$tmpl)
                {
                        if (!isset($value))

Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** class.editor.inc.php        25 Sep 2002 16:27:11 -0000      1.18
--- class.editor.inc.php        27 Sep 2002 16:17:39 -0000      1.19
***************
*** 593,596 ****
--- 593,597 ----
                function show($post_vars='')
                {
+                       echo "this->etemplate->data = "; 
_debug_array($this->etemplate->data);
                        if ($this->debug)
                        {
***************
*** 642,646 ****
                        else
                        {
!                               $show->data[$show->rows]['A']['name'] = 
$this->etemplate;
                                $vals = $post_vars['vals'];
                                $olds = $post_vars['olds'];
--- 643,647 ----
                        else
                        {
!                               $show->data[$show->rows]['A']['obj'] = 
&$this->etemplate;
                                $vals = $post_vars['vals'];
                                $olds = $post_vars['olds'];
***************
*** 674,678 ****
                                         ($ext = 
$this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
                                {
!                                       $extensions[$regs[1]] = 
$ext->human_name;
                                }
                        }
--- 675,679 ----
                                         ($ext = 
$this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
                                {
!                                       $extensions[$regs[1]] = $ext;
                                }
                        }

Index: class.nextmatch_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.nextmatch_widget.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.nextmatch_widget.inc.php      25 Sep 2002 16:36:07 -0000      1.8
--- class.nextmatch_widget.inc.php      27 Sep 2002 16:17:39 -0000      1.9
***************
*** 26,30 ****
                        'post_process' => True
                );
!               var $human_name = 'Nextmatch Widget';   // this is the name for 
the editor
  
                function nextmatch_widget($ui)
--- 26,30 ----
                        'post_process' => True
                );
!               var $human_name = 'Nextmatch';  // this is the name for the 
editor
  
                function nextmatch_widget($ui)
***************
*** 43,47 ****
                        if ($value['start'] > $total)
                        {
!                               $value['start'] = 0;
                                $total = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        }
--- 43,47 ----
                        if ($value['start'] > $total)
                        {
!                               $extension_data['start'] = $value['start'] = 0;
                                $total = 
$obj->$method($value,$value['rows'],$readonlys['rows']);
                        }
***************
*** 55,58 ****
--- 55,59 ----
  
                        $nextmatch = new 
etemplate('etemplate.nextmatch_widget');
+ 
                        if ($value['no_cat'])
                        {
***************
*** 78,82 ****
                        $cell['type'] = 'template';
                        $cell['size'] = $cell['name'];
!                       $cell['name'] = $nextmatch;
                        $cell['label'] = $cell['help'] = '';
  
--- 79,84 ----
                        $cell['type'] = 'template';
                        $cell['size'] = $cell['name'];
!                       $cell['obj'] = &$nextmatch;
!                       $cell['name'] = $nextmatch->name;
                        $cell['label'] = $cell['help'] = '';
  

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.soetemplate.inc.php   25 Sep 2002 16:36:07 -0000      1.14
--- class.soetemplate.inc.php   27 Sep 2002 16:17:39 -0000      1.15
***************
*** 181,185 ****
                        if ($this->debug == 1 || $this->debug == $this->name)
                        {
!                               echo 
"<p>soetemplate::read('$this->name','$this->template','$this->lang','$this->version')</p>\n";
                        }
                        if 
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' && 
$this->readfile())
--- 181,185 ----
                        if ($this->debug == 1 || $this->debug == $this->name)
                        {
!                               echo 
"<p>soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
                        }
                        if 
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' && 
$this->readfile())
***************
*** 439,442 ****
--- 439,450 ----
                function 
save($name='',$template='.',$lang='.',$group='',$version='.')
                {
+                       if (is_array($name))
+                       {
+                               $template = $name['template'];
+                               $lang     = $name['lang'];
+                               $group    = $name['group'];
+                               $version  = $name['version'];
+                               $name     = $name['name'];
+                       }
                        if ($name != '')
                        {
***************
*** 463,466 ****
--- 471,478 ----
                                return False;
                        }
+                       if ($this->debug > 0 || $this->debug == $this->name)
+                       {
+                               echo 
"<p>soetemplate::save('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
+                       }
                        $this->delete();        // so we have always a new 
insert
  
***************
*** 718,722 ****
                        if ($time = @filemtime($path))
                        {
!                               $templ = new etemplate(".$app",'','##');
                                if ($templ->lang != '##' || $templ->data[0] < 
$time) // need to import
                                {
--- 730,734 ----
                        if ($time = @filemtime($path))
                        {
!                               $templ = new soetemplate(".$app",'','##');
                                if ($templ->lang != '##' || $templ->data[0] < 
$time) // need to import
                                {

Index: class.tab_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.tab_widget.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.tab_widget.inc.php    25 Sep 2002 16:36:07 -0000      1.7
--- class.tab_widget.inc.php    27 Sep 2002 16:17:39 -0000      1.8
***************
*** 52,60 ****
                                        // save selected tab in persistent 
extension_data to use it in post_process
                                        $extension_data = $selected_tab = $name;
!                                       $tcell['name'] = $tab_active;
                                }
                                else
                                {
!                                       $tcell['name'] = $tab;
                                }
                                $tcell['type'] = 'template';
--- 52,62 ----
                                        // save selected tab in persistent 
extension_data to use it in post_process
                                        $extension_data = $selected_tab = $name;
!                                       $tcell['obj'] = &$tab_active;
!                                       $tcell['name'] = $tab_active->name;
                                }
                                else
                                {
!                                       $tcell['obj'] = &$tab;
!                                       $tcell['name'] = $tab->name;
                                }
                                $tcell['type'] = 'template';
***************
*** 74,78 ****
                        if (!isset($selected_tab))
                        {
!                               $tab_row['A']['name'] = $tab_active;
                                $extension_data = $selected_tab = $names[0];
                        }
--- 76,81 ----
                        if (!isset($selected_tab))
                        {
!                               $tab_row['A']['obj'] = &$tab_active;
!                               $tcell['name'] = $tab_active->name;
                                $extension_data = $selected_tab = $names[0];
                        }
***************
*** 83,92 ****
  
                        $tab_widget = new etemplate('etemplate.tab_widget');
!                       $tab_widget->set_cell_attribute('@tabs','name',$tabs);
!                       $tab_widget->set_cell_attribute('@body','name',
!                               $tmpl->tpls_in_file > 1 ? new 
etemplate($selected_tab,$tmpl->as_array()) : $selected_tab);
  
                        $cell['type'] = 'template';
!                       $cell['name'] = $tab_widget;
                        $cell['label'] = $cell['help'] = '';
  
--- 86,97 ----
  
                        $tab_widget = new etemplate('etemplate.tab_widget');
!                       $tab_widget->set_cell_attribute('@tabs','obj',$tabs);
!                       if ($tmpl->tpls_in_file > 1)
!                               
$tab_widget->set_cell_attribute('@body','obj',new 
etemplate($selected_tab,$tmpl->as_array()));
!                       else
!                               
$tab_widget->set_cell_attribute('@body','name',$selected_tab);
  
                        $cell['type'] = 'template';
!                       $cell['obj'] = &$tab_widget;
                        $cell['label'] = $cell['help'] = '';
  

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** class.uietemplate.inc.php   25 Sep 2002 23:19:31 -0000      1.25
--- class.uietemplate.inc.php   27 Sep 2002 16:17:39 -0000      1.26
***************
*** 34,38 ****
                                                // 3=calls to show_cell and 
process_show_cell, or template-name or cell-type
                var $html,$sbox;        // instance of html / sbox2-class
-               var $loop = 0;  // set by process_show if an other 
Exec-ProcessExec loop is needed
  
                /*!
--- 34,37 ----
***************
*** 216,220 ****
                        if (isset($this->data[0]))
                        {
!                               list($nul,$width) = each($this->data);
                        }
                        else
--- 215,219 ----
                        if (isset($this->data[0]))
                        {
!                               list(,$width) = each($this->data);
                        }
                        else
***************
*** 224,232 ****
                        for ($r = 0; $row = 1+$r /*list($row,$cols) = 
each($this->data)*/; ++$r)
                        {
!                               $old_cols = $cols; $old_class = $class; 
$old_height = $height;
!                               if (!(list($nul,$cols) = each($this->data)))    
// no further row
                                {
-                                       $cols = $old_cols; $class = $old_class; 
$height = $old_height;
-                                       list($nul,$cell) = each($cols); 
reset($cols);
                                        if 
(!($this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) && $idx_cname) &&
                                                
!($this->autorepeat_idx($cols['B'],1,$r,$idx,$idx_cname) && $idx_cname) ||
--- 223,228 ----
                        for ($r = 0; $row = 1+$r /*list($row,$cols) = 
each($this->data)*/; ++$r)
                        {
!                               if (!(list($r_key) = each($this->data)))        
// no further row
                                {
                                        if 
(!($this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) && $idx_cname) &&
                                                
!($this->autorepeat_idx($cols['B'],1,$r,$idx,$idx_cname) && $idx_cname) ||
***************
*** 238,251 ****
                                else
                                {
!                                       $height = $this->data[0]["h$row"];
!                                       $class = $this->data[0]["c$row"];
                                }
                                $row_data = array();
                                for ($c = 0; True /*list($col,$cell) = 
each($cols)*/; ++$c)
                                {
!                                       $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))  
        // no further cols
                                        {
-                                               $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
                                                        
!$this->isset_array($content,$idx))
--- 234,247 ----
                                else
                                {
!                                       $cols = &$this->data[$r_key];
!                                       $height = &$this->data[0]["h$row"];
!                                       $class = &$this->data[0]["c$row"];
                                }
+                               reset ($cols);
                                $row_data = array();
                                for ($c = 0; True /*list($col,$cell) = 
each($cols)*/; ++$c)
                                {
!                                       if (!(list($c_key) = each($cols)))      
        // no further cols
                                        {
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
                                                        
!$this->isset_array($content,$idx))
***************
*** 254,257 ****
--- 250,257 ----
                                                }
                                        }
+                                       else
+                                       {
+                                               $cell = &$cols[$c_key];
+                                       }
                                        $col = $this->num2chrs($c);
                                        $row_data[$col] = 
$this->show_cell($cell,$content,$sel_options,$readonlys,$cname,
***************
*** 318,322 ****
                        list($span) = explode(',',$cell['span']);       // 
evtl. overriten later for type template
  
!                       if ($cell['name'][0] == '@')
                        {
                                $cell['name'] = 
$this->get_array($content,substr($cell['name'],1));
--- 318,322 ----
                        list($span) = explode(',',$cell['span']);       // 
evtl. overriten later for type template
  
!                       if ($cell['name'][0] == '@' && $cell['type'] != 
'template')
                        {
                                $cell['name'] = 
$this->get_array($content,substr($cell['name'],1));
***************
*** 354,363 ****
                        $extra_label = True;
  
!                       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,
!                                       
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$cell['type']][$cell['name']],
!                                       $readonlys[$name],$this);
                                if (strstr($name,'|'))
                                {
--- 354,362 ----
                        $extra_label = True;
  
!                       if (!$this->types[$cell['type']] && 
$this->haveExtension($cell['type']))
                        {
!                               $type = $cell['type'];
!                               $extra_label = 
$this->extensionPreProcess($cell,$value,$readonlys[$name]);
!                               //echo "<p>$type::pre_process"; 
_debug_array($cell);
                                if (strstr($name,'|'))
                                {
***************
*** 469,472 ****
--- 468,499 ----
                                        break;
                                case 'template':        // size: index in 
content-array (if not full content is past further on)
+                                       if (is_object($cell['name']))
+                                       {
+                                               $cell['obj'] = &$cell['name'];
+                                               unset($cell['name']);
+                                               $cell['name'] = 'was Object';
+                                               echo "<p>Object in Name in tpl 
'$this->name': "; _debug_array($this->data);
+                                       }
+                                       $obj_read = 'already loaded';
+                                       if (!is_object($cell['obj']))
+                                       {
+                                               if ($cell['name'][0] == '@')
+                                               {
+                                                       $cell['obj'] = 
$this->get_array($content,substr($cell['name'],1));
+                                                       $obj_read = 
is_object($cell['obj']) ? 'obj from content' : 'obj read, obj-name from 
content';
+                                                       if 
(!is_object($cell['obj']))
+                                                       {
+                                                               $cell['obj'] = 
new etemplate($cell['obj'],$this->as_array());
+                                                       }
+                                               }
+                                               else
+                                               {  $obj_read = 'obj read';
+                                                       $cell['obj'] = new 
etemplate($cell['name'],$this->as_array());
+                                               }
+                                       }
+                                       if ($this->debug >= 3 || $this->debug 
== $cell['type'])
+                                       {
+                                               echo 
"<p>show_cell::template(tpl=$this->name,name=$cell[name]): $obj_read</p>\n";
+                                       }
                                        if 
($this->autorepeat_idx($cell,$show_c,$show_row,$idx,$idx_cname) || 
$cell['size'] != '')
                                        {
***************
*** 491,496 ****
                                                $readonlys['__ALL__'] = True;
                                        }
!                                       $templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($cell['name'],$this->as_array());
!                                       $html .= 
$templ->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
                                        break;
                                case 'select':  // size:[linesOnMultiselect]
--- 518,522 ----
                                                $readonlys['__ALL__'] = True;
                                        }
!                                       $html .= 
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
                                        break;
                                case 'select':  // size:[linesOnMultiselect]
***************
*** 549,559 ****
                                        break;
                                default:
!                                       if 
(!isset($this->extension[$cell['type']]))
                                        {
!                                               $html .= "<i>unknown type 
'$cell[type]'</i>";
                                        }
                                        else
                                        {
!                                               $html .= 
$this->extension[$cell['type']]->render($cell,$form_name,$value,$readonly);
                                        }
                                        break;
--- 575,585 ----
                                        break;
                                default:
!                                       if ($this->haveExtension($cell['type']))
                                        {
!                                               $html .= 
$this->extensionRender($cell,$form_name,$value,$readonly);
                                        }
                                        else
                                        {
!                                               $html .= "<i>unknown type 
'$cell[type]'</i>";
                                        }
                                        break;
***************
*** 614,622 ****
                        for ($r = 0; True /*list($row,$cols) = 
each($this->data)*/; ++$r)
                        {
!                               $old_cols = $cols;
!                               if (!(list($nul,$cols) = each($this->data)))    
// no further row
                                {
!                                       $cols = $old_cols;
!                                       list($nul,$cell) = each($cols); 
reset($cols);
                                        if 
((!$this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) ||
                                                $idx_cname == '' || 
!$this->isset_array($content,$idx)) &&
--- 640,646 ----
                        for ($r = 0; True /*list($row,$cols) = 
each($this->data)*/; ++$r)
                        {
!                               if (!(list($r_key) = each($this->data)))        
// no further row
                                {
!                                       //list($nul,$cell) = each($cols); 
reset($cols);
                                        if 
((!$this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) ||
                                                $idx_cname == '' || 
!$this->isset_array($content,$idx)) &&
***************
*** 627,637 ****
                                        }
                                }
                                $row = 1+$r;
                                for ($c = 0; True /*list($col,$cell) = 
each($cols)*/; ++$c)
                                {
!                                       $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))  
// no further cols
                                        {
!                                               $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
                                                        $idx_cname == '' || 
!$this->isset_array($content,$idx))
--- 651,666 ----
                                        }
                                }
+                               else
+                               {
+                                       $cols = &$this->data[$r_key];
+                               }
                                $row = 1+$r;
+                               reset($cols);
                                for ($c = 0; True /*list($col,$cell) = 
each($cols)*/; ++$c)
                                {
!                                       //$old_cell = $cell;
!                                       if (!(list($c_key/*,$cell*/) = 
each($cols)))    // no further cols
                                        {
!                                               //$cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
                                                        $idx_cname == '' || 
!$this->isset_array($content,$idx))
***************
*** 642,645 ****
--- 671,675 ----
                                        else
                                        {
+                                               $cell = &$cols[$c_key];
                                                
$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True); // get idx_cname
                                        }
***************
*** 742,747 ****
                                }
                        }
!                       if ((isset($this->extension[$cell['type']]) || 
$this->loadExtension($cell['type'],$this)) &&
!                               
isset($this->extension[$cell['type']]->public_functions['post_process']))
                        {
                                if ($this->debug > 1 || $this->debug && 
$this->debug == $this->name)
--- 772,776 ----
                                }
                        }
!                       if ($this->haveExtension($cell['type'],'post_process'))
                        {
                                if ($this->debug > 1 || $this->debug && 
$this->debug == $this->name)
***************
*** 749,755 ****
                                        echo "<p>value for 
$cell[type]::post_process: "; _debug_array($value);
                                }
!                               
$this->extension[$cell['type']]->post_process($cell,$value,
!                                       
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$cell['type']][$cell['name']],
!                                       
$GLOBALS['phpgw_info']['etemplate']['loop'],$this);
  
                                if ($this->debug > 1 || $this->debug && 
$this->debug == $this->name)
--- 778,782 ----
                                        echo "<p>value for 
$cell[type]::post_process: "; _debug_array($value);
                                }
!                               $this->extensionPostProcess($cell,$value);
  
                                if ($this->debug > 1 || $this->debug && 
$this->debug == $this->name)
***************
*** 789,799 ****
                                        break;
                                case 'template':
!                                       $templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($cell['name'],$this->as_array());
!                                       $templ->process_show($value,$readonlys);
!                                       if ($templ->loop)
                                        {
!                                               $this->loop = True;
!                                               //echo "<p>".$this->name.": 
loop set in process_show(".$templ->name.")</p>\n";
                                        }
                                        break;
                                case 'select':
--- 816,825 ----
                                        break;
                                case 'template':
!                                       if (!is_object($cell['obj']))
                                        {
!                                               $cell['obj'] = new 
etemplate($cell['name'],$this->as_array());
                                        }
+                                       //$templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($cell['name'],$this->as_array());
+                                       
$cell['obj']->process_show($value,$readonlys);
                                        break;
                                case 'select':





reply via email to

[Prev in Thread] Current Thread [Next in Thread]