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.18,1.1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.18,1.19 class.nextmatch_widget.inc.php,1.7,1.8 class.soetemplate.inc.php,1.13,1.14 class.tab_widget.inc.php,1.6,1.7 class.uietemplate.inc.php,1.22,1.23
Date: Wed, 25 Sep 2002 12:36:09 -0400

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

Modified Files:
        class.boetemplate.inc.php class.nextmatch_widget.inc.php 
        class.soetemplate.inc.php class.tab_widget.inc.php 
        class.uietemplate.inc.php 
Log Message:
multiple tpls in file get are now automaticaly load, even if name != filename

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** class.boetemplate.inc.php   24 Sep 2002 10:00:58 -0000      1.18
--- class.boetemplate.inc.php   25 Sep 2002 16:36:07 -0000      1.19
***************
*** 55,68 ****
                @function boetemplate
                @abstract constructor of class
                @discussion Calls the constructor of soetemplate
                */
!               function boetemplate()
                {
-                       $this->soetemplate();
- 
                        $this->public_functions += array(
                                'disable_cells' => True,
                                'set_cell_attribute' => True
                        );
                }
  
--- 55,74 ----
                @function boetemplate
                @abstract constructor of class
+               @param $name     name of etemplate or array with name and other 
keys
+               @param $load_via name/array with keys of other etemplate to 
load in order to get $name
                @discussion Calls the constructor of soetemplate
                */
!               function boetemplate($name='',$load_via='')
                {
                        $this->public_functions += array(
                                'disable_cells' => True,
                                'set_cell_attribute' => True
                        );
+                       $this->soetemplate();
+ 
+                       if (empty($name) || 
!$this->read($name,'','',0,'',$load_via))
+                       {
+                               $this->init($name);
+                       }
                }
  
***************
*** 467,477 ****
                        if ($cname = 
$this->in_cache($name,$template,$lang,$group))
                        {
!                               reset($this->db_cols);
!                               while (list($db_col,$col) = 
each($this->db_cols))
!                               {
!                                       $this->$col = 
$GLOBALS['phpgw_info']['etemplate']['cache'][$cname][$col];
!                               }
!                               $this->rows = count($this->data) - 1;
!                               $this->cols = count($this->data[1]); // 1 = 
first row, not 0
                                return True;
                        }
--- 473,478 ----
                        if ($cname = 
$this->in_cache($name,$template,$lang,$group))
                        {
!                               
$this->init($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]);
! 
                                return True;
                        }
***************
*** 483,489 ****
                @abstract Reads an eTemplate from the cache or database / 
filesystem (and updates the cache)
                @param as discripted in soetemplate::read
                @result True if a fitting template is found, else False
                */
!               function 
read($name,$template='default',$lang='default',$group=0,$version='')
                {
                        if 
(!$this->read_from_cache($name,$template,$lang,$group,$version))
--- 484,491 ----
                @abstract Reads an eTemplate from the cache or database / 
filesystem (and updates the cache)
                @param as discripted in soetemplate::read
+               @param $load_via name/array of keys of etemplate to load in 
order to get $name (only as second try!)
                @result True if a fitting template is found, else False
                */
!               function 
read($name,$template='default',$lang='default',$group=0,$version='',$load_via='')
                {
                        if 
(!$this->read_from_cache($name,$template,$lang,$group,$version))
***************
*** 491,494 ****
--- 493,502 ----
                                if 
(!soetemplate::read($name,$template,$lang,$group,$version))
                                {
+                                       if ($load_via && (is_string($load_via) 
||
+                                           !isset($load_via['tpls_in_file']) 
|| $load_via['tpls_in_file'] > 1))
+                                       {
+                                               soetemplate::read($load_via);
+                                               return 
$this->read_from_cache($name,$template,$lang,$group,$version);
+                                       }
                                        return False;
                                }

Index: class.nextmatch_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.nextmatch_widget.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.nextmatch_widget.inc.php      24 Sep 2002 21:57:15 -0000      1.7
--- class.nextmatch_widget.inc.php      25 Sep 2002 16:36:07 -0000      1.8
***************
*** 32,36 ****
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys)
                {
                        //echo "<p>nextmatch_widget.pre_process: value = "; 
_debug_array($value);
--- 32,36 ----
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys,&$tmpl)
                {
                        //echo "<p>nextmatch_widget.pre_process: value = "; 
_debug_array($value);
***************
*** 52,55 ****
--- 52,57 ----
                                $value['template'] = $cell['size'];
                        }
+                       $value['template'] = new 
etemplate($value['template'],$tmpl->as_array());
+ 
                        $nextmatch = new 
etemplate('etemplate.nextmatch_widget');
                        if ($value['no_cat'])
***************
*** 82,86 ****
                }
  
!               function post_process(&$cell,&$value,&$extension_data,&$loop)
                {
                        //echo "<p>nextmatch_widget.post_process: value = "; 
_debug_array($value);
--- 84,88 ----
                }
  
!               function 
post_process(&$cell,&$value,&$extension_data,&$loop,&$tmpl)
                {
                        //echo "<p>nextmatch_widget.post_process: value = "; 
_debug_array($value);

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.soetemplate.inc.php   24 Sep 2002 10:00:58 -0000      1.13
--- class.soetemplate.inc.php   25 Sep 2002 16:36:07 -0000      1.14
***************
*** 116,119 ****
--- 116,129 ----
  
                /*!
+               @function set_rows_cols()
+               @abstract initialises rows & cols from the size of the 
data-array
+               */
+               function set_rows_cols()
+               {
+                       $this->rows = count($this->data) - 1;
+                       $this->cols = count($this->data[1]); // 1 = first row, 
not 0
+               }
+ 
+               /*!
                @function init
                @abstract initialises all internal data-structures of the 
eTemplate and sets the keys
***************
*** 137,142 ****
--- 147,155 ----
                                $this->lang = '';
                        }
+                       $this->tpls_in_file = is_array($name) ? 
$name['tpls_in_file'] : 0;
+ 
                        if (is_array($name) && isset($name['data']))
                        {
+                               $this->set_rows_cols();
                                return; // data already set
                        }
***************
*** 259,263 ****
                                $this->xul_io = 
CreateObject('etemplate.xul_io');
                        }
!                       if (!is_array($this->xul_io->import(&$this,$xul)))
                        {
                                return False;
--- 272,278 ----
                                $this->xul_io = 
CreateObject('etemplate.xul_io');
                        }
!                       $loaded = $this->xul_io->import(&$this,$xul);
! 
!                       if (!is_array($loaded))
                        {
                                return False;
***************
*** 265,268 ****
--- 280,285 ----
                        $this->name = $app . '.' . $name;       // if template 
was copied or app was renamed
  
+                       $this->tpls_in_file = count($loaded);
+ 
                        return True;
                }
***************
*** 354,359 ****
                                }
                        }
!                       $this->rows = count($this->data) - 1;
!                       $this->cols = count($this->data[1]); // 1 = first row, 
not 0
                }
  
--- 371,375 ----
                                }
                        }
!                       $this->set_rows_cols();
                }
  
***************
*** 408,411 ****
--- 424,430 ----
                        {
                                $arr['data'] = serialize($arr['data']);
+                       }
+                       if ($this->tpls_in_file) {
+                               $arr['tpls_in_file'] = $this->tpls_in_file;
                        }
                        return $arr;

Index: class.tab_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.tab_widget.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.tab_widget.inc.php    24 Sep 2002 21:57:15 -0000      1.6
--- class.tab_widget.inc.php    25 Sep 2002 16:36:07 -0000      1.7
***************
*** 32,36 ****
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys)
                {
                        $labels = explode('|',$cell['label']);
--- 32,36 ----
                }
  
!               function 
pre_process(&$cell,&$value,&$extension_data,&$readonlys,&$tmpl)
                {
                        $labels = explode('|',$cell['label']);
***************
*** 84,88 ****
                        $tab_widget = new etemplate('etemplate.tab_widget');
                        $tab_widget->set_cell_attribute('@tabs','name',$tabs);
!                       
$tab_widget->set_cell_attribute('@body','name',$selected_tab);
  
                        $cell['type'] = 'template';
--- 84,89 ----
                        $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';
***************
*** 93,97 ****
                }
  
!               function post_process(&$cell,&$value,&$extension_data,&$loop)
                {
                        $old_value = array(
--- 94,98 ----
                }
  
!               function 
post_process(&$cell,&$value,&$extension_data,&$loop,&$tmpl)
                {
                        $old_value = array(
***************
*** 99,103 ****
                                        $extension_data => array(True)
                        ));
!                       
$this->pre_process($cell,$old_value,$extension_data,$dummy);
  
                        if (is_array($value['_tab_widget']))
--- 100,104 ----
                                        $extension_data => array(True)
                        ));
!                       
$this->pre_process($cell,$old_value,$extension_data,$dummy,$tmpl);
  
                        if (is_array($value['_tab_widget']))

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** class.uietemplate.inc.php   24 Sep 2002 22:34:21 -0000      1.22
--- class.uietemplate.inc.php   25 Sep 2002 16:36:07 -0000      1.23
***************
*** 35,44 ****
                var $html,$sbox;        // instance of html / sbox2-class
                var $loop = 0;  // set by process_show if an other 
Exec-ProcessExec loop is needed
                /*!
                @function etemplate
                @abstract constructor of etemplate class, reads an eTemplate if 
$name is given
!               @param as soetemplate.read
                */
!               function 
etemplate($name='',$template='default',$lang='default',$group=0,$version='',$rows=2,$cols=2)
                {
                        $this->public_functions += array(
--- 35,46 ----
                var $html,$sbox;        // instance of html / sbox2-class
                var $loop = 0;  // set by process_show if an other 
Exec-ProcessExec loop is needed
+ 
                /*!
                @function etemplate
                @abstract constructor of etemplate class, reads an eTemplate if 
$name is given
!               @param $name     name of etemplate or array with name and other 
keys
!               @param $load_via name/array with keys of other etemplate to 
load in order to get $name
                */
!               function etemplate($name='',$load_via='')
                {
                        $this->public_functions += array(
***************
*** 48,61 ****
                                'process_show'  => True,
                        );
-                       $this->boetemplate();
                        $this->html = CreateObject('etemplate.html');   // 
should  be in the api (older version in infolog)
                        $this->sbox = CreateObject('etemplate.sbox2');  // 
older version is in the api
  
!                       if (empty($name) || 
!$this->read($name,$template,$lang,$group,$version))
!                       {
!                               
$this->init($name,$template,$lang,$group,$version,$rows,$cols);
!                               return False;
!                       }
!                       return True;
                }
  
--- 50,57 ----
                                'process_show'  => True,
                        );
                        $this->html = CreateObject('etemplate.html');   // 
should  be in the api (older version in infolog)
                        $this->sbox = CreateObject('etemplate.sbox2');  // 
older version is in the api
  
!                       $this->boetemplate($name,$load_via);
                }
  
***************
*** 367,371 ****
                        {
                                $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,'|'))
                                {
--- 363,368 ----
                        {
                                $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,'|'))
                                {
***************
*** 499,503 ****
                                                $readonlys['__ALL__'] = True;
                                        }
!                                       $templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($cell['name']);
                                        $html .= 
$templ->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
                                        break;
--- 496,500 ----
                                                $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;
***************
*** 759,763 ****
                                
$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)
--- 756,760 ----
                                
$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)
***************
*** 797,801 ****
                                        break;
                                case 'template':
!                                       $templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($name);
                                        $templ->process_show($value,$readonlys);
                                        if ($templ->loop)
--- 794,798 ----
                                        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)





reply via email to

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