phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] etemplate/inc class.uietemplate.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] etemplate/inc class.uietemplate.inc.php
Date: Wed, 06 Sep 2006 13:48:44 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    etemplate
Changes by:     Dave Hall <skwashd>     06/09/06 13:48:44

Modified files:
        inc            : class.uietemplate.inc.php 

Log message:
        a shedload of E_ALL related fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.uietemplate.inc.php?cvsroot=phpgroupware&r1=1.66&r2=1.67

Patches:
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- class.uietemplate.inc.php   6 Sep 2006 11:13:30 -0000       1.66
+++ class.uietemplate.inc.php   6 Sep 2006 13:48:44 -0000       1.67
@@ -5,7 +5,7 @@
 * @author Ralf Becker <address@hidden>
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
 * @package etemplate
-* @version $Id: class.uietemplate.inc.php,v 1.66 2006/09/06 11:13:30 skwashd 
Exp $
+* @version $Id: class.uietemplate.inc.php,v 1.67 2006/09/06 13:48:44 skwashd 
Exp $
 */
        include_once(PHPGW_INCLUDE_ROOT . 
'/etemplate/inc/class.boetemplate.inc.php');
 
@@ -390,7 +390,14 @@
                                                $cell = &$cols[$c_key];
                                                if(isset($opts[$col]))
                                                {
-                                                       
list($col_width,$col_disabled) = explode(',',$opts[$col]);
+                                                       $col_disabled = '';
+                                                       $tmp = 
explode(',',$opts[$col]);
+                                                       $col_width = $tmp[0];
+                                                       if ( count($tmp) == 2 )
+                                                       {
+                                                               $col_disabled = 
$tmp[1];
+                                                       }
+                                                       unset($tmp);
                                                }
                                                else
                                                {
@@ -422,7 +429,8 @@
                                                        }
                                                }
                                        }
-                                       if ($cell['type'] == 'template' && 
$cell['onchange'])
+                                       if ( isset($cell['type']) && 
isset($cell['onchange'])
+                                               && $cell['type'] == 'template' 
&& $cell['onchange'])
                                        {
                                                $cell['tr_class'] = $cl;
                                        }
@@ -463,10 +471,18 @@
                                        {
                                                if(isset($opts[$col]))
                                                {
-                                                       list($width,$disable) = 
explode(',',$opts[$col]);
+                                                       $disable = '';
+                                                       $tmp = explode(',', 
$opts[$col]);
+                                                       $width = $tmp[0];
+                                                       if ( count($tmp) == 2 )
+                                                       {
+                                                               $disable = 
$tmp[2];
+                                                       }
+                                                       unset($tmp);
+
                                                        if ($width)             
// width only once for a non colspan cell
                                                        {
-                                                               
$row_data[".$col"] .= " WIDTH=\"$width\"";
+                                                               
$row_data[".$col"] .= " width=\"$width\"";
                                                                $opts[$col] = 
"0,$disable";
                                                        }
                                                }
@@ -486,14 +502,20 @@
                                }
                                $rows[$row] = $row_data;
                        }
-                       if 
(!$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name])
+                       if ( 
!isset($GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name])
+                               || 
!$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] )
                        {
                                $style = $this->html->style($this->style);
                                
$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True;
                        }
                        $html = 
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING'),$no_table_tr);
 
-                       list($width,$height,,,,,$overflow) = 
explode(',',$this->size);
+                       $tmpa = explode(',',$this->size);
+                       $width = isset($tmpa[0]) ? $tmpa[0] : '';
+                       $height = isset($tmpa[1]) ? $tmpa[1] : '';
+                       $overflow = isset($tmpa[6]) ? $tmpa[6] : '';
+                       unset($tmpa);
+
                        if (!empty($overflow)) {
                                $div_style=' STYLE="'.($width?"width: $width; 
":'').($height ? "height: $height; ":'')."overflow: $overflow\"";
                                $html = $this->html->div($html,$div_style);
@@ -511,10 +533,12 @@
                 */
                function 
show_cell($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span)
                {
+                       $options = '';
                        if (is_int($this->debug) && $this->debug >= 3 || 
$this->debug == $cell['type'])
                        {
                                echo 
"<p>etemplate.show_cell($this->name,name='${cell['name']}',type='${cell['type']}',cname='$cname')</p>\n";
                        }
+
                        if(isset($cell['span']))
                        {
                                list($span) = explode(',',$cell['span']);       
// evtl. overriten later for type template
@@ -546,11 +570,15 @@
                        }
                        $value = $this->get_array($content,$name);
 
-                       if ($readonly = $cell['readonly'] || 
(@$readonlys[$name] && !is_array($readonlys[$name])) || $readonlys['__ALL__'])
+                       if ( ( isset($cell['readonly']) && $readonly = 
$cell['readonly']) 
+                               || (isset($readonlys[$name]) && 
$readonlys[$name] && !is_array($readonlys[$name])) 
+                               || isset($readonlys['__ALL__']) )
                        {
-                               $options .= ' READONLY';
+                               $options .= ' readonly';
                        }
-                       if ($cell['disabled'] || $readonly && $cell['type'] == 
'button' && !strstr($cell['size'],','))
+
+                       if ( (isset($cell['disabled']) && $cell['disabled']) 
+                               || $readonlys && ( isset($cell['type']) && 
$cell['type'] == 'button') && ( isset($cell['size']) && 
!strstr($cell['size'],',') ) )
                        {
                                if ($this->rows == 1) {
                                        return '';      // if only one row omit 
cell
@@ -560,7 +588,13 @@
                        }
                        $extra_label = True;
 
-                       list($type,$sub_type) = explode('-',$cell['type']);
+                       $sub_type = '';
+                       $cell_type = explode('-', $cell['type']);
+                       $type = $cell_type[0];
+                       if ( count($cell_type) == 2 )
+                       {
+                               $sub_type = $cell_type[1];
+                       }
                        if ((!$this->types[$cell['type']] || !empty($sub_type)) 
&& $this->haveExtension($type,'pre_process'))
                        {
                                $ext_type = $type;
@@ -569,20 +603,48 @@
                                $readonly = $readonly || $cell['readonly'];     
// might be set be extension
                                $this->set_array($content,$name,$value);
                        }
+
+                       $cell_options =  '';
+                       if ( isset($cell['size']) )
+                       {
                        $cell_options = $cell['size'];
-                       if ($cell_options[0] == '@')
+                       }
+                       if ( strlen($cell_options) && $cell_options[0] == '@')
                        {
                                $cell_options = 
$this->get_array($content,substr($cell_options,1));
                        }
+
+                       if ( !isset($cell['label']) )
+                       {
+                               $cell['label'] = '';
+                       }
                        $label = 
$this->expand_name($cell['label'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
+
+                       $help = '';
+                       if ( isset($cell['help']) )
+                       {
                        $help = $cell['help'];
-                       if ($help[0] == '@')
+                       }
+                       if ( isset($help[0]) && $help[0] == '@')
                        {
                                $help = 
$this->get_array($content,substr($help,1));
                        }
-                       $blur = $cell['blur'][0] == '@' ? 
$this->get_array($content,substr($cell['blur'],1)) :
-                               (strlen($cell['blur']) <= 1 ? $cell['blur'] : 
lang($cell['blur']));
 
+                       $blur = lang('blur');
+                       if ( isset($call['blur']) )
+                       {
+                               if ( $cell['blur'][0] == '@' )
+                               {
+                                       $blur = 
$this->get_array($content,substr($cell['blur'],1));
+                               }
+                               else if ( strlen($cell['blur']) <= 1 )
+                               {
+                                       $blur = $cell['blur'];
+                               }
+                       }
+
+                       $onBlur = '';
+                       $onFocus = '';
                        if ($this->java_script())
                        {
                                if ($blur)
@@ -596,7 +658,7 @@
                                }
                                if ($help)
                                {
-                                       if ($cell['no_lang'] < 2)
+                                       if ( isset($cell['no_lang']) && 
$cell['no_lang'] < 2)
                                        {
                                                $help = lang($help);
                                        }
@@ -612,7 +674,7 @@
                                {
                                        $options .= " onFocus=\"$onFocus\" 
onBlur=\"$onBlur\"";
                                }
-                               if ($cell['onchange'] && $cell['type'] != 
'button') // values != '1' can only set by a program (not in the editor so fa
+                               if ( isset($cell['onchange']) && 
$cell['onchange'] && $cell['type'] != 'button') // values != '1' can only set 
by a program (not in the editor so fa
                                {
                                        $options .= ' 
onChange="'.($cell['onchange']=='1'?'this.form.submit();':$cell['onchange']).'"';
                                }
@@ -621,14 +683,24 @@
                        {
                                $options = "ID=\"$form_name\" $options";
                        }
-                       list($type,$sub_type) = explode('-',$cell['type']);
+
+                       $html = '';
                        switch ($type)
                        {
                                case 'label':           //  size: 
[[b]old][[i]talic][,link]
                                        if (is_array($value))
+                                       {
                                                break;
-                                       list($style,$extra_link) = 
explode(',',$cell_options);
-                                       $value = strlen($value) > 1 && 
!$cell['no_lang'] ? lang($value) : $value;
+                                       }
+                                       $extra_link = '';
+                                       $tmp = explode(',', $cell_options);
+                                       $style = $tmp[0];
+                                       if ( count($tmp) == 2 )
+                                       {
+                                               $extra_link = $tmp[1];
+                                       }
+                                       unset($tmp);
+                                       $value = strlen($value) > 1 && ( 
!isset($cell['no_lang']) || !$cell['no_lang']) ? lang($value) : $value;
                                        $value = 
nl2br(htmlspecialchars($value));
                                        if ($value != '' && strstr($style,'b')) 
$value = $this->html->bold($value);
                                        if ($value != '' && strstr($style,'i')) 
$value = $this->html->italic($value);
@@ -640,14 +712,19 @@
                                        break;
                                case 'int':             // size: 
[min][,[max][,len]]
                                case 'float':
-                                       list($min,$max,$cell_options) = 
explode(',',$cell_options);
+                                       $tmp = explode(',', $cell_options);
+                                       $min = $tmp[0];
+                                       $max = isset($tmp[1]) ? $tmp[1] : '';
+                                       $cell_options = isset($tmp[2]) ? 
$tmp[2] : '';
+                                       unset($tmp);
+
                                        if ($cell_options == '')
                                        {
                                                $cell_options = $cell['type'] 
== 'int' ? 5 : 8;
                                        }
                                        // fall-through
                                case 'text':            // size: 
[length][,maxLength]
-                                       if ($readonly)
+                                       if (isset($readonly) && $readonly)
                                        {
                                                $html .= 
$this->html->bold(htmlspecialchars($value));
                                        }
@@ -677,9 +754,9 @@
                                        }
                                        if ($value)
                                        {
-                                               $options .= ' CHECKED';
+                                               $options .= ' checked';
                                        }
-                                       if ($readonly)
+                                       if ( isset($readonly) && $readonly)
                                        {
                                                $html .= $value ? 
$this->html->bold($ro_true) : $ro_false;
                                        }
@@ -711,7 +788,7 @@
                                        break;
                                case 'button':
                                        list($app) = explode('.',$this->name);
-                                       if ($this->java_script() && 
$cell['onchange'] != '' && !$cell['needed']) // use a link instead of a button
+                                       if ($this->java_script() && 
isset($cell['onchange']) && $cell['onchange'] != '' && !$cell['needed']) // use 
a link instead of a button
                                        {
                                                if ($cell['onchange'] == 1)
                                                {
@@ -727,18 +804,28 @@
                                        }
                                        else
                                        {
-                                               list($img,$ro_img) = 
explode(',',$cell_options);
+                                               $ro_img = '';
+                                               $tmp = explode(',', 
$cell_options);
+                                               $img = $tmp[0];
+                                               if ( count($tmp) == 2 )
+                                               {
+                                                       $ro_img = $tmp[1];
+                                               }
+                                               unset($tmp);
+
                                                if (!empty($img))
                                                {
-                                                       $options .= ' 
TITLE="'.(strlen($label)<=1||$cell['no_lang']?$label:lang($label)).'"';
+                                                       $options .= ' 
title="'.(strlen($label)<=1||$cell['no_lang']?$label:lang($label)).'"';
                                                }
-                                               $html .= !$readonly ? 
$this->html->submit_button($form_name,$label,$cell['onchange'],
-                                                       strlen($label) <= 1 || 
$cell['no_lang'],$options,$img,$app) :
-                                                       
$this->html->image($app,$ro_img);
+                                               $html .= ( !isset($readonly) || 
!$readonly )  
+                                                                       ? 
$this->html->submit_button($form_name,$label, isset($cell['onchange']) ? 
$cell['onchange'] : '', strlen($label) <= 1 || isset($cell['no_lang']) 
,$options, $img, $app) 
+                                                                       : 
$this->html->image($app,$ro_img);
                                        }
                                        $extra_label = False;
-                                       if (!$readonly)
+                                       if (!isset($readonly) || !$readonly )
+                                       {
                                                
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+                                       }
                                        break;
                                case 'hrule':
                                        $html .= $this->html->hr($cell_options);
@@ -752,7 +839,7 @@
                                                echo "<p>Object in Name in tpl 
'$this->name': "; _debug_array($this->data);
                                        }
                                        $obj_read = 'already loaded';
-                                       if (!is_object($cell['obj']))
+                                       if ( !isset($cell['obj']) || 
!is_object($cell['obj']))
                                        {
                                                if ($cell['name'][0] == '@')
                                                {
@@ -790,10 +877,19 @@
                                                }
                                                //echo 
"<p>show_cell-autorepeat($name,$show_c,$show_row,cname='$cname',idx='$idx',idx_cname='$idx_cname',span='$span'):
 content ="; _debug_array($content);
                                        }
-                                       if ($readonly)
+                                       if ( isset($readonly) && $readonly)
                                        {
                                                $readonlys['__ALL__'] = True;
                                        }
+                                       if ( !isset($cell['onchange']) )
+                                       {
+                                               $cell['onchange'] = '';
+                                       }
+
+                                       if ( !isset($cell['tr_class']) )
+                                       {
+                                               $cell['tr_class'] = '';
+                                       }
                                        $html = 
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row,$cell['onchange'],$cell['tr_class']);
                                        break;
                                case 'select':  // size:[linesOnMultiselect]
@@ -887,22 +983,34 @@
                                                        }
                                                        
$rows[$box_row][$box_col] = $html = $h;
                                                        $box_anz++;
-                                                       if ($cell[$n]['align'])
+                                                       if ( 
isset($cell[$n]['align']) && $cell[$n]['align'] )
                                                        {
                                                                
$rows[$box_row]['.'.$box_col] = 
$this->html->formatOptions($cell[$n]['align'],'ALIGN');
                                                        }
-                                                       list(,$cl) = 
explode(',',$cell[$n]['span']);
+                                                       $cl = '';
+                                                       if ( 
isset($cell[$n]['span']) )
+                                                       {
+                                                               $tmp = 
explode(',',$cell[$n]['span']);
+                                                               if ( 
count($tmp) == 2 )
+                                                               {
+                                                                       $cl = 
$tmp[1];
+                                                               }
+                                                       }
                                                        $cl = 
$this->expand_name(isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl,
                                                                
$show_c,$show_row,$content['.c'],$content['.row'],$content);
-                                                       
$rows[$box_row]['.'.$box_col] .= $this->html->formatOptions($cl,'CLASS');
+                                                       if ( 
!isset($rows[$box_row][".$box_col"]) )
+                                                       {
+                                                               
$rows[$box_row][".$box_col"] = '';
+                                                       }
+                                                       
$rows[$box_row][".$box_col"] .= $this->html->formatOptions($cl, 'CLASS');
                                                }
                                        }
                                        if ($box_anz > 1)       // a single 
cell is NOT placed into a table
                                        {
-                                               $html = "\n\n<!-- BEGIN 
$cell[type] -->\n\n".
+                                               $html = "\n\n<!-- BEGIN 
{$cell['type']} -->\n\n".
                                                        
$this->html->table($rows,$this->html->formatOptions($cell_options,',CELLPADDING,CELLSPACING').
-                                                       ($cell['align'] && 
$type == 'vbox' ? ' WIDTH="100%"' : '')).    // alignment only works if table 
has full width
-                                                       "\n\n<!-- END 
$cell[type] -->\n\n";
+                                                       (isset($cell['align']) 
&& $cell['align'] && $type == 'vbox' ? ' width="100%"' : '')).   // alignment 
only works if table has full width - 100% tables break IE
+                                                       "\n\n<!-- END 
{$cell['type']} -->\n\n";
                                        }
                                        break;
                                case 'deck':
@@ -950,7 +1058,7 @@
                                        }
                                        break;
                        }
-                       if ($ext_type && !$readonly && 
$this->haveExtension($ext_type,'post_process'))  // extension-processing need 
to be after all other and only with diff. name
+                       if ( isset($ext_type) && $ext_type && !$readonly && 
$this->haveExtension($ext_type,'post_process'))     // extension-processing 
need to be after all other and only with diff. name
                        {       // unset it first, if it is already set, to be 
after the other widgets of the ext.
                                
unset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]);
                                
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = 
'ext-'.$ext_type;
@@ -963,7 +1071,7 @@
                        }
                        if ($extra_label && ($label != '' || $html == ''))
                        {
-                               if (strlen($label) > 1 && !($cell['no_lang'] && 
$cell['label'] != $label || $cell['no_lang'] == 2))
+                               if (strlen($label) > 1 && 
!(isset($cell['no_lang']) && $cell['no_lang'] && $cell['label'] != $label || 
(isset($cell['no_lang']) && $cell['no_lang'] == 2)) )
                                {
                                        $label = lang($label);
                                }
@@ -982,7 +1090,7 @@
                                        $html = '&nbsp;';
                                }
                        }
-                       if ($extra_link)
+                       if ( isset($extra_link) && $extra_link )
                        {
                                $extra_link = 
$this->expand_name($extra_link,$show_c,$show_row,$content['.c'],$content['.row'],$content);
                                if ($extra_link[0] == '@')
@@ -1117,7 +1225,7 @@
                 */
                function java_script($consider_not_tested_as_enabled = True)
                {
-                       $ret = 
!!$GLOBALS['phpgw_info']['etemplate']['java_script'] ||
+                       $ret = ( 
isset($GLOBALS['phpgw_info']['etemplate']['java_script']) && 
$GLOBALS['phpgw_info']['etemplate']['java_script']) ||
                                $consider_not_tested_as_enabled && 
!isset($GLOBALS['phpgw_info']['etemplate']['java_script']);
                        //echo 
"<p>java_script($consider_not_tested_as_enabled)='$ret', 
java_script='".$GLOBALS['phpgw_info']['etemplate']['java_script']."', 
isset(java_script)=".isset($GLOBALS['phpgw_info']['etemplate']['java_script'])."</p>\n";
                        




reply via email to

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