phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: etemplate/inc class.uietemplate.inc.php,1.9,1.10


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.uietemplate.inc.php,1.9,1.10
Date: Sun, 09 Jun 2002 17:40:09 -0400

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

Modified Files:
        class.uietemplate.inc.php 
Log Message:
some changes to get the tab-widget working:
- the template is saved in the app_session for process_exec and not read again 
from the db
- extensions can request (trough $templ->loop = True) to have an other loop 
through exec process_exec (e.g. to show an other tab)
- extensions can have persitant data (via app_session) in 
$GLOBALS[phpgw_info][etemplate][extension_data][<extension-name>]



Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uietemplate.inc.php   7 Jun 2002 21:26:05 -0000       1.9
--- class.uietemplate.inc.php   9 Jun 2002 21:40:06 -0000       1.10
***************
*** 30,36 ****
        class etemplate extends boetemplate
        {
!               var $debug;//='etemplate.editor.edit'; // 1=calls to show and 
process_show, 2=content after process_show,
                                                // 3=calls to show_cell and 
process_show_cell, or template-name or cell-type
                var $html,$sbox;        // instance of html / sbox2-class
  
                /*!
--- 30,37 ----
        class etemplate extends boetemplate
        {
!               var $debug;//'test.tabs2';//='etemplate.editor.edit'; // 
1=calls to show and process_show, 2=content after process_show,
                                                // 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
  
                /*!
***************
*** 78,82 ****
                @returns nothing
                */
!               function 
exec($method,$content,$sel_options='',$readonlys='',$preserv='')
                {
                        if (!$sel_options)
--- 79,83 ----
                @returns nothing
                */
!               function 
exec($method,$content,$sel_options='',$readonlys='',$preserv='',$changes='')
                {
                        if (!$sel_options)
***************
*** 92,112 ****
                                $preserv = array();
                        }
                        $GLOBALS['phpgw']->common->phpgw_header();
  
!                       $id = $this->save_appsession(array(
!                               'name' => $this->name,
!                               'template' => $this->template,
!                               'lang' => $this->lang,
!                               'group' => $this->group,
                                'readonlys' => $readonlys,
                                'content' => $content,
                                'sel_options' => $sel_options,
                                'preserv' => $preserv,
                                'method' => $method
!                       ));
! 
!                       $html = 
$this->html->nextMatchStyles($this->style)."\n\n". // so they get included once
!                               
$this->html->form($this->show($content,$sel_options,$readonlys,'exec'),
!                                       array('etemplate_exec_id' => 
$id),'/index.php?menuaction=etemplate.etemplate.process_exec');
  
                        list($a,$b,$c,$d) = 
explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
--- 93,116 ----
                                $preserv = array();
                        }
+                       if (!$changes)
+                       {
+                               $changes = array();
+                       }
                        $GLOBALS['phpgw']->common->phpgw_header();
  
!                       $id = $this->appsession_id();
!                       $html = 
$this->html->nextMatchStyles($this->style)."\n\n". // so they get included once
!                               
$this->html->form($this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),
!                                       array('etemplate_exec_id' => 
$id),'/index.php?menuaction=etemplate.etemplate.process_exec');
! 
!                       $id = $this->save_appsession($this->as_array(1) + array(
                                'readonlys' => $readonlys,
                                'content' => $content,
+                               'changes' => $changes,
                                'sel_options' => $sel_options,
                                'preserv' => $preserv,
+                               'extension_data' => 
$GLOBALS['phpgw_info']['etemplate']['extension_data'],
                                'method' => $method
!                       ),$id);
  
                        list($a,$b,$c,$d) = 
explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
***************
*** 134,137 ****
--- 138,142 ----
                {
                        $session_data = 
$this->get_appsession($GLOBALS['HTTP_POST_VARS']['etemplate_exec_id']);
+                       //echo "<p>process_exec($this->name) session_data ="; 
_debug_array($session_data);
  
                        $content = $GLOBALS['HTTP_POST_VARS']['exec'];
***************
*** 140,151 ****
                                $content = array();
                        }
!                       $this->read($session_data);
                        
$this->process_show($content,$session_data['readonlys']);
  
!                       // set application name so that lang, etc. works
!                       list($GLOBALS['phpgw_info']['flags']['currentapp']) = 
explode('.',$session_data['method']);
  
!                       //echo "<p>uietemplate.process_exec: 
ExecMethod('${exec['method']}')</p>\n";
!                       
ExecMethod($session_data['method'],array_merge($content,$session_data['preserv']));
                }
  
--- 145,172 ----
                                $content = array();
                        }
!                       $this->init($session_data);
!                       $GLOBALS['phpgw_info']['etemplate']['extension_data'] = 
$session_data['extension_data'];
! 
!                       //echo "process_exec($this->name) content ="; 
_debug_array($content);
                        
$this->process_show($content,$session_data['readonlys']);
  
!                       //echo "process_exec($this->name) process_show(content) 
="; _debug_array($content);
!                       //echo "process_exec($this->name) session_data[changes] 
="; _debug_array($session_data['changes']);
!                       $content = 
$this->complete_array_merge($session_data['changes'],$content);
!                       //echo "process_exec($this->name) 
merge(changes,content) ="; _debug_array($content);
! 
!                       if ($this->loop)
!                       {
!                               //echo "<p>process_exec($this->name): <font 
color=red>loop is set</font>, content=</p>\n"; _debug_array($content);
!                               
$this->exec($session_data['method'],$session_data['content'],$session_data['sel_options'],
!                                       
$session_data['readonlys'],$session_data['preserv'],$content);
!                       }
!                       else
!                       {
!                               // set application name so that lang, etc. works
!                               
list($GLOBALS['phpgw_info']['flags']['currentapp']) = 
explode('.',$session_data['method']);
  
!                               
ExecMethod($session_data['method'],$this->complete_array_merge($content,$session_data['preserv']));
!                       }
                }
  
***************
*** 167,172 ****
                @returns the generated HTML
                */
!               function 
show($content,$sel_options='',$readonlys='',$cname='cont',
!                                               $show_c=0,$show_row=0)
                {
                        if (!$sel_options)
--- 188,192 ----
                @returns the generated HTML
                */
!               function 
show($content,$sel_options='',$readonlys='',$cname='cont',$show_c=0,$show_row=0)
                {
                        if (!$sel_options)
***************
*** 191,195 ****
                                '.row' => $show_row
                        );
!                               reset($this->data);
                        if (isset($this->data[0]))
                        {
--- 211,215 ----
                                '.row' => $show_row
                        );
!                       reset($this->data);
                        if (isset($this->data[0]))
                        {
***************
*** 295,301 ****
  
                        $name = 
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
-                       $value = $content[$name];
  
!                       if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs))    // name 
contains array-index
                        {
                                $form_name = $cname == '' ? $name : 
$cname.'['.$regs[1].']'.$regs[2];
--- 315,324 ----
  
                        $name = 
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
  
!                       if (strstr($name,'|'))  // extension which uses whole 
content array
!                       {
!                               $value = $content;
!                       }
!                       elseif (ereg('^([^[]*)(\\[.*\\])$',$name,$regs))        
// name contains array-index
                        {
                                $form_name = $cname == '' ? $name : 
$cname.'['.$regs[1].']'.$regs[2];
***************
*** 326,330 ****
                            (isset($this->extension[$cell['type']]) || 
$this->loadExtension($cell['type'],$this)))
                        {
!                               $extra_label = 
$this->extension[$cell['type']]->pre_process($cell,$value);
                                $content[$name] = $value;       // set result 
for template
                        }
--- 349,353 ----
                            (isset($this->extension[$cell['type']]) || 
$this->loadExtension($cell['type'],$this)))
                        {
!                               $extra_label = 
$this->extension[$cell['type']]->pre_process($cell,$value,$this);
                                $content[$name] = $value;       // set result 
for template
                        }
***************
*** 576,580 ****
                                                $cell['type'] == 'hrule';
  
!                                       if ($idx_cname == '' && $cell['type'] 
== 'template')    // only templates
                                        {
                                                if ($readonly && 
!isset($readonlys['__ALL__']))         // can't unset whole content!!!
--- 599,603 ----
                                                $cell['type'] == 'hrule';
  
!                                       if ($idx_cname == '' && $cell['type'] 
== 'template' || strstr($name,'|'))       // only templates or extensions
                                        {
                                                if ($readonly && 
!isset($readonlys['__ALL__']))         // can't unset whole content!!!
***************
*** 651,654 ****
--- 674,681 ----
                        if ($this->debug >= 3 || $this->debug == $this->name || 
$this->debug == $cell['type'])
                        {
+                               if (is_object($name))
+                               {
+                                       $name = $name->name;
+                               }
                                echo "<p>process_show_cell(c=$c, r=$r, 
name='$name',type='${cell['type']}') start: isset(value)=".(0+isset($value)).", 
value=";
                                if (is_array($value))
***************
*** 661,664 ****
--- 688,713 ----
                                }
                        }
+                       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)
+                               {
+                                       echo "<p>value for 
$cell[type]::post_process: "; _debug_array($value);
+                               }
+                               
$this->extension[$cell['type']]->post_process($cell,$value,$this);
+ 
+                               if ($this->debug > 1 || $this->debug && 
$this->debug == $this->name)
+                               {
+                                       echo "<p>value after 
$cell[type]::post_process: ";
+                                       if (is_array($value))
+                                       {
+                                               _debug_array($value);
+                                       }
+                                       else
+                                       {
+                                               echo "'$value'</p>";
+                                       }
+                               }
+                       }
                        switch ($cell['type'])
                        {
***************
*** 684,689 ****
                                        break;
                                case 'template':
!                                       $templ = new etemplate($name);
                                        $templ->process_show($value,$readonlys);
                                        break;
                                case 'select':
--- 733,743 ----
                                        break;
                                case 'template':
!                                       $templ = is_object($cell['name']) ? 
$cell['name'] : new etemplate($name);
                                        $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':
***************
*** 696,706 ****
                                        break;
                                default: // do nothing, $value is correct as is
-                                       if 
((isset($this->extension[$cell['type']]) || 
$this->loadExtension($cell['type'],$this)) &&
-                                           
isset($this->extension[$cell['type']]->public_functions['post_process']))
-                                       {
-                                               //echo "value for post_process: 
"; _debug_array($value);
-                                               
$this->extension[$cell['type']]->post_process($cell,$value);
-                                               //echo "<p>value after 
post_process: '$value'";
-                                       }
                        }
                        if ($this->debug >= 3 || $this->debug == $this->name || 
$this->debug == $cell['type'])
--- 750,753 ----




reply via email to

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