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.30,1.3


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.30,1.31 class.editor.inc.php,1.27,1.28 class.html.inc.php,1.13,1.14 class.soetemplate.inc.php,1.21,1.22 class.uietemplate.inc.php,1.43,1.44 class.xul_io.inc.php,1.21,1.22
Date: Sun, 13 Oct 2002 20:36:38 -0400

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

Modified Files:
        class.boetemplate.inc.php class.editor.inc.php 
        class.html.inc.php class.soetemplate.inc.php 
        class.uietemplate.inc.php class.xul_io.inc.php 
Log Message:
lots of fixes and additions:
- load_via works now in boetemplate::read
- included templates are relative to the includeing tpl, if they contain no '.'
- xul_io is alway writing the comple/absolute name
- HBox gets width=100% if alignment other then left set (new!)
- added links as 2. option to label
- added header function to uietemplate

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** class.boetemplate.inc.php   12 Oct 2002 16:34:43 -0000      1.30
--- class.boetemplate.inc.php   14 Oct 2002 00:36:36 -0000      1.31
***************
*** 44,48 ****
                        'file'  => 'FileUpload',        // show an input 
type='file', set the local name as ${name}_path
                        'vbox'  => 'VBox',                      // a (vertical) 
box to contain widgets in rows, size = # of rows
!                       'hbox'  => 'HBox'                       // a 
(horizontal) box to contain widgets in cols, size = # of cols
                );
                /*!
--- 44,48 ----
                        'file'  => 'FileUpload',        // show an input 
type='file', set the local name as ${name}_path
                        'vbox'  => 'VBox',                      // a (vertical) 
box to contain widgets in rows, size = # of rows
!                       'hbox'  => 'HBox'                       // a 
(horizontal) box to contain widgets in cols, size = # of cols 
                );
                /*!
***************
*** 107,110 ****
--- 107,114 ----
                function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
                {
+                       if (strstr($name,'$') === False)
+                       {
+                               return $name;
+                       }
                        if (!$cont)
                        {
***************
*** 565,571 ****
                function 
read($name,$template='default',$lang='default',$group=0,$version='',$load_via='')
                {
!                       if (is_array($name) && empty($name['name']) || 
empty($name))
                        {
                                return False;
                        }
                        if 
(!$this->read_from_cache($name,$template,$lang,$group,$version))
--- 569,587 ----
                function 
read($name,$template='default',$lang='default',$group=0,$version='',$load_via='')
                {
!                       if (is_array($name)) {
!                               $pname = &$name['name'];
!                       }
!                       else
!                       {
!                               $pname = &$name;
!                       }       
!                       if (empty($pname))
                        {
                                return False;
+                       }
+                       $parent = is_array($load_via) ? $load_via['name'] : 
$load_via;
+          if (strstr($pname,'.') === False && !empty($parent))
+                       {
+                               $pname = $parent . '.' . $pname;
                        }
                        if 
(!$this->read_from_cache($name,$template,$lang,$group,$version))

Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** class.editor.inc.php        12 Oct 2002 16:34:43 -0000      1.27
--- class.editor.inc.php        14 Oct 2002 00:36:36 -0000      1.28
***************
*** 166,184 ****
                                                        case 'hbox':
                                                                
$cell['cell_tpl'] = '.vbox';
-                                                               if 
($cell['size'] < 2)
-                                                               {
-                                                                       
$cell['size'] = 2;
-                                                               }
-                                                               for ($n = 1; $n 
<= $cell['size']; ++$n) // create new rows
-                                                               {
-                                                                       if 
(!isset($cell[$n]) || !is_array($cell[$n]))
-                                                                       {
-                                                                               
$cell[$n] = $this->etemplate->empty_cell();
-                                                                       }
-                                                               }
-                                                               while 
(isset($cell[$n]))        // unset not longer used rows
-                                                               {
-                                                                       
unset($cell[$n++]);
-                                                               }
                                                                break;
                                                }
--- 166,169 ----
***************
*** 252,256 ****
                        while (isset($content[$name = 
$this->etemplate->num2chrs($col) . $row]))
                        {
!                               $row_data[$this->etemplate->num2chrs($col++)] = 
$content[$name];
                                if (!isset($content[$name = 
$this->etemplate->num2chrs($col) . $row]))  // try new row
                                {
--- 237,264 ----
                        while (isset($content[$name = 
$this->etemplate->num2chrs($col) . $row]))
                        {
!                               $cell = &$content[$name];
!                               switch ($cell['type'])
!                               {
!                                       case 'vbox':
!                                       case 'hbox':
!                                               if ($cell['size'] < 2)
!                                               {
!                                                       $cell['size'] = 2;
!                                               }
!                                               for ($n = 1; $n <= 
$cell['size']; ++$n) // create new rows
!                                               {
!                                                       if (!isset($cell[$n]) 
|| !is_array($cell[$n]))
!                                                       {
!                                                               $cell[$n] = 
$this->etemplate->empty_cell();
!                                                       }
!                                               }
!                                               while (isset($cell[$n]))        
// unset not longer used rows
!                                               {
!                                                       unset($cell[$n++]);
!                                               }
!                                               break;
!                               }
!                               $row_data[$this->etemplate->num2chrs($col++)] = 
$cell;
! 
                                if (!isset($content[$name = 
$this->etemplate->num2chrs($col) . $row]))  // try new row
                                {

Index: class.html.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.html.inc.php  12 Oct 2002 16:34:43 -0000      1.13
--- class.html.inc.php  14 Oct 2002 00:36:36 -0000      1.14
***************
*** 174,177 ****
--- 174,178 ----
                }
                list($url,$v) = explode('?',$url);      // url may contain 
additional vars
+               if ($url == '') $url = '/index.php';
                if ($v)
                        $vars .= ($vars ? '&' : '') . $v;
***************
*** 275,279 ****
                if (!strstr($url,'/') && count(explode('.',$url)) == 3)
                        $url = "/index.php?menuaction=$url";
! 
                return '<a href="'.$this->link($url,$vars).'" 
'.$options.'>'.$content.'</a>';
        }
--- 276,285 ----
                if (!strstr($url,'/') && count(explode('.',$url)) == 3)
                        $url = "/index.php?menuaction=$url";
!               
!               if (is_array($url))
!               {
!                       $vars = $url;
!                       $url = '/index.php';
!               }
                return '<a href="'.$this->link($url,$vars).'" 
'.$options.'>'.$content.'</a>';
        }

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.soetemplate.inc.php   12 Oct 2002 16:34:43 -0000      1.21
--- class.soetemplate.inc.php   14 Oct 2002 00:36:36 -0000      1.22
***************
*** 708,712 ****
  
                        $langarr = $solangfile->load_app($app,$lang);
! 
                        $to_trans = $this->getToTranslateApp($app);
                        if (is_array($additional))
--- 708,715 ----
  
                        $langarr = $solangfile->load_app($app,$lang);
!                       if (!is_array($langarr))
!                       {
!                               $langarr = array();
!                       }
                        $to_trans = $this->getToTranslateApp($app);
                        if (is_array($additional))
***************
*** 722,732 ****
  
                        for ($new = $n = 0; list($message_id,$content) = 
each($to_trans); ++$n) {
-                               if (!isset($langarr[$content]) && 
!isset($langarr[$message_id]))
-                               {       // caused by not lowercased-message_id's
-                                       $langarr[$message_id] = 
$langarr[$content];
-                                       unset($langarr[$content]);
-                               }
                                if (!isset($langarr[$message_id]))
                                {
                                        $langarr[$message_id] = array(
                                                'message_id' => $message_id,
--- 725,734 ----
  
                        for ($new = $n = 0; list($message_id,$content) = 
each($to_trans); ++$n) {
                                if (!isset($langarr[$message_id]))
                                {
+                                       if (isset($langarr[$content]))  // 
caused by not lowercased-message_id's
+                                       {
+                                               unset($langarr[$content]);
+                                       }
                                        $langarr[$message_id] = array(
                                                'message_id' => $message_id,

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** class.uietemplate.inc.php   12 Oct 2002 22:37:29 -0000      1.43
--- class.uietemplate.inc.php   14 Oct 2002 00:36:36 -0000      1.44
***************
*** 60,63 ****
--- 60,77 ----
  
                /*!
+               @function header
+               @abstract Abstracts a html-header call
+               @discussion In other UI's than html this needs to call the 
methode, defined by menuaction or
+               @discussion open a browser-window for any other links.
+               */
+               function header($vars='')
+               {
+                       Header('Location: ' . $this->html->link(is_array($vars) 
? '/index.php' : $vars,
+                               is_array($vars) ? $vars : ''));      
+ 
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+ 
+               /*!
                @function exec
                @abstract Generats a Dialog from an eTemplate - abstract the 
UI-layer
***************
*** 205,209 ****
                        $result = count($vals) == 1 ? $val != '' : $val == 
$check_val;
                        if ($not) $result = !$result;
!                       echo "<p>check_disabled: '".($not?'!':'')."$disabled' = 
'$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = 
".($result?'True':'False')."</p>\n";
                        return $result;
                }
--- 219,223 ----
                        $result = count($vals) == 1 ? $val != '' : $val == 
$check_val;
                        if ($not) $result = !$result;
!                       //echo "<p>check_disabled: '".($not?'!':'')."$disabled' 
= '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = 
".($result?'True':'False')."</p>\n";
                        return $result;
                }
***************
*** 340,343 ****
--- 354,361 ----
                                        list(,$cl) = explode(',',$cell['span']);
                                        $cl = isset($this->class_conf[$cl]) ? 
$this->class_conf[$cl] : $cl;
+                                       if (strstr($cl,'$') !== False)
+                                       {
+                                               $cl = 
$this->expand_name($cl,$c,$r,'','',$content);
+                                       }
                                        $row_data[".$col"] .= 
$this->html->formatOptions($cl,'CLASS');
                                }
***************
*** 450,462 ****
                        switch ($type)
                        {
!                               case 'label':           //  size: 
[[b]old][[i]talic]
                                        if (is_array($value))
                                                break;
                                        $value = strlen($value) > 1 && 
!$cell['no_lang'] ? lang($value) : $value;
!                                       if ($value != '' && 
strstr($cell['size'],'b')) $value = $this->html->bold($value);
!                                       if ($value != '' && 
strstr($cell['size'],'i')) $value = $this->html->italic($value);
                                        $html .= $value;
                                        break;
                                case 'html':
                                        $html .= $value;
                                        break;
--- 468,482 ----
                        switch ($type)
                        {
!                               case 'label':           //  size: 
[[b]old][[i]talic][,link]
                                        if (is_array($value))
                                                break;
+                                       list($style,$extra_link) = 
explode(',',$cell['size']);
                                        $value = strlen($value) > 1 && 
!$cell['no_lang'] ? lang($value) : $value;
!                                       if ($value != '' && strstr($style,'b')) 
$value = $this->html->bold($value);
!                                       if ($value != '' && strstr($style,'i')) 
$value = $this->html->italic($value);
                                        $html .= $value;
                                        break;
                                case 'html':
+                                       $extra_link = $cell['size'];
                                        $html .= $value;
                                        break;
***************
*** 664,668 ****
                                        $image = 
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
                                                $image,strlen($label) > 1 && 
!$cell['no_lang'] ? lang($label) : $label,'BORDER="0"');
!                                       $html .= $cell['size'] == '' ? $image : 
$this->html->a_href($image,$cell['size']);
                                        $extra_label = False;
                                        break;
--- 684,689 ----
                                        $image = 
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
                                                $image,strlen($label) > 1 && 
!$cell['no_lang'] ? lang($label) : $label,'BORDER="0"');
!                                       $html .= $image;
!                                       $extra_link = $cell['size'];
                                        $extra_label = False;
                                        break;
***************
*** 704,708 ****
                                        if ($box_anz > 1)       // a single 
cell is NOT placed into a table
                                        {
!                                               $html = "\n\n<!-- BEGIN 
$cell[type] -->\n\n".$this->html->table($rows)."\n\n<!-- END $cell[type] 
-->\n\n";
                                        }
                                        break;
--- 725,732 ----
                                        if ($box_anz > 1)       // a single 
cell is NOT placed into a table
                                        {
!                                               $html = "\n\n<!-- BEGIN 
$cell[type] -->\n\n".
!                                                       
$this->html->table($rows,$this->html->formatOptions($cell['size'],',CELLPADDING,CELLSPACING').
!                                                       ($cell['align'] ? ' 
WIDTH="100%"' : '')).       // alignment only works if table has full width
!                                                       "\n\n<!-- END 
$cell[type] -->\n\n";
                                        }
                                        break;
***************
*** 742,745 ****
--- 766,777 ----
                                        $html = '&nbsp;';
                                }
+                       }
+                       if ($extra_link)
+                       {
+                               if ($extra_link[0] == '@')
+                               {
+                                       $extra_link = 
$this->get_array($content,substr($extra_link,1));
+                               }
+                               return 
$this->html->a_href($html,$extra_link,'',$help != '' ? 
'TITLE="'.lang($help).'"' : '');
                        }
                        return $html;

Index: class.xul_io.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.xul_io.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.xul_io.inc.php        12 Oct 2002 22:39:01 -0000      1.21
--- class.xul_io.inc.php        14 Oct 2002 00:36:36 -0000      1.22
***************
*** 122,126 ****
                }
  
!               function 
cell2widget($cell,&$spanned,$etempl,&$root,$embeded_too=True)
                {
                        $type = $cell['type'];
--- 122,126 ----
                }
  
!               function 
cell2widget($cell,&$spanned,$etempl,&$root,&$embeded_too)
                {
                        $type = $cell['type'];
***************
*** 129,141 ****
                                list(,$type) = each($type);
                        }
-                       if ($type == 'template' && $cell['name'][0] != '@' && 
$embeded_too)
-                       {
-                               $embeded = new etemplate();
-                               if 
($embeded->read($embeded->expand_name($cell['name'],0,0),'default','default',0,'',$etempl->as_array()))
-                               {
-                                       
$this->etempl2grid($embeded,&$root,$embeded_too);
-                               }
-                               unset($embeded);
-                       }
                        if (substr($type,0,6) == 'select')
                        {
--- 129,132 ----
***************
*** 169,173 ****
                        case 'nextmatch':
                                $embeded = new 
etemplate($cell['size'],$etempl->as_array());
!                               
$this->etempl2grid($embeded,&$root,$embeded_too);
                                unset($embeded);
                                break;
--- 160,168 ----
                        case 'nextmatch':
                                $embeded = new 
etemplate($cell['size'],$etempl->as_array());
!                               if ($embeded_too)
!                               {
!                                       
$this->etempl2grid($embeded,&$root,$embeded_too);
!                               }
!                               $cell['size'] = $embeded->name;
                                unset($embeded);
                                break;
***************
*** 184,188 ****
  
                                        $embeded = new 
etemplate($names[$n],$etempl->as_array());
!                                       
$this->etempl2grid($embeded,&$root,$embeded_too);
                                        $grid = new xmlnode('grid');
                                        
$grid->set_attribute('id',$embeded->name);
--- 179,186 ----
  
                                        $embeded = new 
etemplate($names[$n],$etempl->as_array());
!                                       if ($embeded_too)
!                                       {
!                                               
$this->etempl2grid($embeded,&$root,$embeded_too);
!                                       }
                                        $grid = new xmlnode('grid');
                                        
$grid->set_attribute('id',$embeded->name);
***************
*** 206,215 ****
                        case 'vbox':
                        case 'hbox':
!                               for ($n = 1; $n <= $cell['size']; ++$n)
                                {
                                        
$widget->add_node($this->cell2widget($cell[$n],$no_span,$etempl,$root,$embeded_too));
                                        unset($cell[$n]);
                                }
!                               unset($cell['size']);
                                break;
                        }
--- 204,227 ----
                        case 'vbox':
                        case 'hbox':
!                               list($anz,$options) = 
split(',',$cell['size'],2);
!                               for ($n = 1; $n <= $anz; ++$n)
                                {
                                        
$widget->add_node($this->cell2widget($cell[$n],$no_span,$etempl,$root,$embeded_too));
                                        unset($cell[$n]);
                                }
!                               $cell['size'] = $options;
!                               break;
! 
!                       case 'grid':
!                               if ($cell['name'][0] != '@' && $embeded_too)
!                               {
!                                       $embeded = new etemplate();
!                                       if 
($embeded->read($name=$embeded->expand_name($cell['name'],0,0),'default','default',0,'',$etempl->as_array()))
!                                       {
!                                               
$this->etempl2grid($embeded,&$root,$embeded_too);
!                                       }
!                                       $cell['name'] = $embeded->name;
!                                       unset($embeded);
!                               }
                                break;
                        }
***************
*** 241,246 ****
                }
  
!               function etempl2grid($etempl,&$root,$embeded_too=True)
                {
                        $xul_grid = new xmlnode('grid');
                        $xul_grid->set_attribute('id',$etempl->name);
--- 253,271 ----
                }
  
!               function etempl2grid($etempl,&$root,&$embeded_too)
                {
+                       if (is_array($embeded_too))
+                       {
+                               if (isset($embeded_too[$etempl->name]))
+                               {
+                                       return; // allready embeded 
+                               }
+                       }
+                       else
+                       {
+                               $embeded_too = array();
+                       }
+                       $embeded_too[$etempl->name] = True;
+                       
                        $xul_grid = new xmlnode('grid');
                        $xul_grid->set_attribute('id',$etempl->name);
***************
*** 305,309 ****
                        $xul_overlay = new xmlnode('overlay');
  
!                       $this->etempl2grid($etempl,&$xul_overlay);
  
                        $doc->add_root($xul_overlay);
--- 330,335 ----
                        $xul_overlay = new xmlnode('overlay');
  
!                       $embeded_too = True;
!                       $this->etempl2grid($etempl,&$xul_overlay,$embeded_too);
  
                        $doc->add_root($xul_overlay);
***************
*** 338,342 ****
                        {
                                $pcell = &$box[$node_level-1];
!                               $pcell[++$pcell['size']] = $cell;
                        }
                }
--- 364,368 ----
                        {
                                $pcell = &$box[$node_level-1];
!                               $pcell[++$pcell['anz']] = $cell;
                        }
                }
***************
*** 507,511 ****
                                                else
                                                {
!                                                       
$this->add_cell($etempl,$box[$node['level']],&$box,&$col,$node['level']);
                                                        
unset($box[$node['level']]);
                                                }
--- 533,540 ----
                                                else
                                                {
!                                                       $cell = 
&$box[$node['level']];
!                                                       $cell['size'] = 
$cell['anz'] . ($cell['size'] != '' ? ','.$cell['size'] : '');
!                                                       unset($cell['anz']);
!                                                       
$this->add_cell($etempl,$cell,&$box,&$col,$node['level']);
                                                        
unset($box[$node['level']]);
                                                }





reply via email to

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