phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] etemplate/inc class.boetemplate.inc.php class.h...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] etemplate/inc class.boetemplate.inc.php class.h...
Date: Mon, 12 Feb 2007 14:45:38 +0000

CVSROOT:        /sources/phpgroupware
Module name:    etemplate
Changes by:     Sigurd Nes <sigurdne>   07/02/12 14:45:37

Modified files:
        inc            : class.boetemplate.inc.php class.html.inc.php 
                         class.select_widget.inc.php 
                         class.uietemplate.inc.php 

Log message:
        closing in

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.boetemplate.inc.php?cvsroot=phpgroupware&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.html.inc.php?cvsroot=phpgroupware&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.select_widget.inc.php?cvsroot=phpgroupware&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.uietemplate.inc.php?cvsroot=phpgroupware&r1=1.76&r2=1.77

Patches:
Index: class.boetemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- class.boetemplate.inc.php   11 Feb 2007 21:58:04 -0000      1.42
+++ class.boetemplate.inc.php   12 Feb 2007 14:45:37 -0000      1.43
@@ -13,7 +13,7 @@
  * the Free Software Foundation; either version 2 of the License, or   *
  * at your option) any later version.                                  *
  \**********************************************************************/
- /* $Id: class.boetemplate.inc.php,v 1.42 2007/02/11 21:58:04 sigurdne Exp $ */
+ /* $Id: class.boetemplate.inc.php,v 1.43 2007/02/12 14:45:37 sigurdne Exp $ */
 
        include_once(PHPGW_INCLUDE_ROOT . 
'/etemplate/inc/class.soetemplate.inc.php');
 
@@ -396,7 +396,7 @@
                        {
                                foreach($cols as $col => $cell)
                                {
-                                       if ($cell['name'] == $name)
+                                       if (isset($cell['name']) && 
$cell['name'] == $name)
                                        {
                                                $this->data[$row][$col][$attr] 
= $val;
                                                ++$n;

Index: class.html.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- class.html.inc.php  11 Feb 2007 21:58:04 -0000      1.28
+++ class.html.inc.php  12 Feb 2007 14:45:37 -0000      1.29
@@ -1,19 +1,12 @@
 <?php
- /**********************************************************************\
- * phpGroupWare - eTemplate                                            *
- * http://www.phpgroupware.org                                         *
- * This program is part of the GNU project, see http://www.gnu.org/    *
- *                                                                     *
- * Copyright 2002, 2003 Free Software Foundation, Inc.                 *
- *                                                                     *
- * Originally Written by Ralf Becker - <address@hidden>        *
- * --------------------------------------------                                
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or   *
- * at your option) any later version.                                  *
- \**********************************************************************/
- /* $Id: class.html.inc.php,v 1.28 2007/02/11 21:58:04 sigurdne Exp $ */
+/**
+* eTemplate - basic application development environment
+* @copyright Copyright (C) 2002-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
+* @author Ralf Becker <address@hidden>
+* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+* @package etemplate
+* @version $Id: class.html.inc.php,v 1.29 2007/02/12 14:45:37 sigurdne Exp $
+*/
 
 class html
 {
@@ -86,11 +79,11 @@
 
        function input_hidden($vars,$value='',$ignore_empty=True)
        {
+               $html = '';
                if (!is_array($vars))
                {
                        $vars = array( $vars => $value );
                }
-               $html = '';
                foreach($vars as $name => $value)
                {
                        if (is_array($value))
@@ -161,14 +154,14 @@
                        ($image == '' || $accesskey ? $lang_u : '').'</button>';
        }
 
-       /*!
-       @function link
-       @abstract creates an absolut link + the query / get-variables
-       @param $url phpgw-relative link, may include query / get-vars
-       @parm $vars query or array ('name' => 'value', ...) with query
-       @example 
link('/index.php?menuaction=infolog.uiinfolog.get_list',array('info_id' => 123))
-       @example  = 
'http://domain/phpgw-path/index.php?menuaction=infolog.uiinfolog.get_list&info_id=123'
-       @result absolut link already run through $phpgw->link
+       /**
+        * creates an absolut link + the query / get-variables
+       *
+        * @param $url phpgw-relative link, may include query / get-vars
+        * $vars query or array ('name' => 'value', ...) with query
+        * 
link('/index.php?menuaction=infolog.uiinfolog.get_list',array('info_id' => 123))
+        *  = 
'http://domain/phpgw-path/index.php?menuaction=infolog.uiinfolog.get_list&info_id=123'
+        * @return absolut link already run through $GLOBALS['phpgw']->link
        */
        function link($url, $vars='')
        {
@@ -215,17 +208,16 @@
                        $hidden_vars,$url,$url_vars,$form_name,'',$method);
        }
 
-       /*!
-       @function table
-       @abstracts creates table from array with rows
-       @discussion abstract the html stuff
-       @param $rows array with rows, each row is an array of the cols
-       @param $options options for the table-tag
-       @example $rows = array ( '1'  => array( 1 => 'cell1', '.1' => 
'colspan=3',
-       @example                                2 => 'cell2', 3 => 'cell3', 
'.3' => 'width="10%"' ),
-       @example                 '.1' => 'BGCOLOR="#0000FF"' );
-       @example table($rows,'WIDTH="100%"') = '<table WIDTH="100%"><tr><td 
colspan=3>cell1</td><td>cell2</td><td width="10%">cell3</td></tr></table>'
-       @result string with html-code of the table
+       /**
+        * creates table from array with rows
+        * abstract the html stuff
+        * @param $rows array with rows, each row is an array of the cols
+        * @param $options options for the table-tag
+        * $rows = array ( '1'  => array( 1 => 'cell1', '.1' => 'colspan=3',
+        *                                2 => 'cell2', 3 => 'cell3', '.3' => 
'width="10%"' ),
+        *                 '.1' => 'BGCOLOR="#0000FF"' );
+        * table($rows,'WIDTH="100%"') = '<table WIDTH="100%"><tr><td 
colspan=3>cell1</td><td>cell2</td><td width="10%">cell3</td></tr></table>'
+        * @return string with html-code of the table
        */
        function table($rows,$options = '',$no_table_tr=False)
        {
@@ -270,47 +262,6 @@
                return $html;
        }
 
-
-       function table_16($rows,$options = '',$no_table_tr=False)
-       {
-               $html = $no_table_tr ? '' : "<TABLE $options>\n";
-
-               foreach($rows as $key => $row)
-               {
-                       if (!is_array($row))
-                       {
-                               continue;                                       
// parameter
-                       }
-                       $html .= $no_table_tr && $key == 1 ? '' : "\t<TR 
".$rows['.'.$key].">\n";
-
-                       foreach($row as $key => $cell)
-                       {
-                               if ($key[0] == '.')
-                               {
-                                       continue;                               
// parameter
-                               }
-                               $table_pos = strpos($cell,'<TABLE');
-                               $td_pos = strpos($cell,'<TD');
-                               if ($td_pos !== False && ($table_pos === False 
|| $td_pos < $table_pos))
-                               {
-                                       $html .= $cell;
-                               }
-                               else
-                               {
-                                       $html .= "\t\t<TD 
".$row['.'.$key].">$cell</TD>\n";
-                               }
-                       }
-                       $html .= "\t</TR>\n";
-               }
-               $html .= "</TABLE>\n";
-
-               if ($no_table_tr)
-               {
-                       $html = substr($html,0,-16);
-               }
-               return $html;
-       }
-       
        function sbox_submit( $sbox,$no_script=0 )
        {
                $html = str_replace('<select','<select 
onChange="this.form.submit()" ',
@@ -374,19 +325,18 @@
                return "<hr $options>\n";
        }
 
-       /*!
-       @function formatOptions
-       @abstract formats option-string for most of the above functions
-       @param $options String (or Array) with option-values eg. '100%,,1'
-       @param $names String (or Array) with the option-names eg. 
'WIDTH,HEIGHT,BORDER'
-       @example formatOptions('100%,,1','WIDTH,HEIGHT,BORDER') = ' 
WIDTH="100%" BORDER="1"'
-       @result option string
+       /**
+        * formats option-string for most of the above functions
+       *
+        * @param $options String (or Array) with option-values eg. '100%,,1'
+        * @param $names String (or Array) with the option-names eg. 
'WIDTH,HEIGHT,BORDER'
+        * formatOptions('100%,,1','WIDTH,HEIGHT,BORDER') = ' WIDTH="100%" 
BORDER="1"'
+        * @return option string
        */
        function formatOptions($options,$names)
        {
                if (!is_array($options)) $options = explode(',',$options);
                if (!is_array($names))   $names   = explode(',',$names);
-
                $html = '';
                while (list($n,$val) = each($options))
                        if ($val != '' && $names[$n] != '')
@@ -395,27 +345,35 @@
                return $html;
        }
 
-       /*!
-       @function themeStyles
-       @abstract returns simple stylesheet (incl. <STYLE> tags) for nextmatch 
row-colors
-       @result the classes 'th' = nextmatch header, 'row_on'+'row_off' = 
alternating rows
+       /**
+        * returns simple stylesheet (incl. <STYLE> tags) for nextmatch 
row-colors
+       *
+        * @return the classes 'th' = nextmatch header, 'row_on'+'row_off' = 
alternating rows
        */
        function themeStyles()
        {
                return $this->style($this->theme2css());
        }
 
-       /*!
-       @function theme2css
-       @abstract returns simple stylesheet for nextmatch row-colors
-       @result the classes 'th' = nextmatch header, 'row_on'+'row_off' = 
alternating rows
+       /**
+        * returns simple stylesheet for nextmatch row-colors
+       *
+        * @return the classes 'th' = nextmatch header, 'row_on'+'row_off' = 
alternating rows
        */
        function theme2css()
        {
-               return 
-                       ".th { background: 
".$GLOBALS['phpgw_info']['theme']['th_bg']."; font-weight: bold; }\n".
-                       ".row_on,.th_bright { background: 
".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
-                       ".row_off { background: 
".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n";
+               //XXX Temporary fix, Caeies
+               //if(isset($GLOBALS['phpgw_info']['theme']))
+               //{
+               //      return 
+               //              ".th { background: 
".$GLOBALS['phpgw_info']['theme']['th_bg']."; font-weight: bold; }\n".
+               //              ".row_on,.th_bright { background: 
".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
+               //              ".row_off { background: 
".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n";
+               //}
+               //else
+               //{
+                       return '';
+               //}
        }
 
        function style($styles)

Index: class.select_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.select_widget.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- class.select_widget.inc.php 10 Feb 2007 16:03:46 -0000      1.11
+++ class.select_widget.inc.php 12 Feb 2007 14:45:37 -0000      1.12
@@ -1,26 +1,18 @@
 <?php
- /**********************************************************************\
- * phpGroupWare - eTemplate                                            *
- * http://www.phpgroupware.org                                         *
- * This program is part of the GNU project, see http://www.gnu.org/    *
- *                                                                     *
- * Copyright 2002, 2003 Free Software Foundation, Inc.                 *
- *                                                                     *
- * Originally Written by Ralf Becker - <address@hidden>        *
- * --------------------------------------------                                
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or   *
- * at your option) any later version.                                  *
- \**********************************************************************/
- /* $Id: class.select_widget.inc.php,v 1.11 2007/02/10 16:03:46 sigurdne Exp $ 
*/
-
-       /*!
-       @class select_widget
-       @author ralfbecker
-       @abstract Several select-boxes with predefined phpgw specific content.
-       @discussion This widget replaces the old sbox class
-       @discussion This widget is independent of the UI as it only uses 
etemplate-widgets and has therefor no render-function
+/**
+* eTemplate - basic application development environment
+* @copyright Copyright (C) 2002-2006 Free Software Foundation, Inc. 
http://www.fsf.org/
+* @author Ralf Becker <address@hidden>
+* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+* @package etemplate
+* @version $Id: class.select_widget.inc.php,v 1.12 2007/02/12 14:45:37 
sigurdne Exp $
+*/
+
+       /**
+        * Several select-boxes with predefined phpgw specific content.
+        *
+        * This widget replaces the old sbox class
+        * This widget is independent of the UI as it only uses 
etemplate-widgets and has therefor no render-function
        */
        class select_widget
        {
@@ -380,7 +372,7 @@
 
                function 
pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
                {
-                       list($rows,$type,$type2,$type3) = 
explode(',',$cell['size']);
+                       @list($rows,$type,$type2,$type3) = 
explode(',',$cell['size']);
 
                        switch ($cell['type'])
                        {
@@ -420,7 +412,7 @@
                                case 'select-cat':      // !$type == globals 
cats too
                                        if 
(!is_object($GLOBALS['phpgw']->categories))
                                        {
-                                               $GLOBALS['phpgw']->categories = 
CreateObject('phpgwapi.categories');
+                                               $GLOBALS['phpgw']->categories = 
createObject('phpgwapi.categories');
                                        }
                                        $cats = 
$GLOBALS['phpgw']->categories->return_sorted_array(0,False,'','','',!$type);
 

Index: class.uietemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- class.uietemplate.inc.php   11 Feb 2007 21:58:04 -0000      1.76
+++ class.uietemplate.inc.php   12 Feb 2007 14:45:37 -0000      1.77
@@ -13,7 +13,7 @@
  * the Free Software Foundation; either version 2 of the License, or   *
  * at your option) any later version.                                  *
  \**********************************************************************/
- /* $Id: class.uietemplate.inc.php,v 1.76 2007/02/11 21:58:04 sigurdne Exp $ */
+ /* $Id: class.uietemplate.inc.php,v 1.77 2007/02/12 14:45:37 sigurdne Exp $ */
 
        include_once(PHPGW_INCLUDE_ROOT . 
'/etemplate/inc/class.boetemplate.inc.php');
 
@@ -313,15 +313,15 @@
                function process_exec()
                {
                        //echo "process_exec: _POST ="; _debug_array($_POST);
-                       $session_data = 
$this->get_appsession($_POST['etemplate_exec_id']);
+                       $session_data = 
$this->get_appsession(isset($_POST['etemplate_exec_id']) ? 
$_POST['etemplate_exec_id'] : '');
                        //echo "<p>process_exec: session_data ="; 
_debug_array($session_data);
 
-                       if (!$_POST['etemplate_exec_id'] || 
!is_array($session_data) || count($session_data) < 10)
+                       if ((!isset($_POST['etemplate_exec_id']) || 
!$_POST['etemplate_exec_id']) || !is_array($session_data) || 
count($session_data) < 10)
                        {
                                // this prevents an empty screen, if the 
sessiondata gets lost somehow
                                $this->location(array('menuaction' => 
$_GET['menuaction']));
                        }
-                       $content = $_POST['exec'];
+                       $content = isset($_POST['exec']) ? $_POST['exec'] : '';
                        if (!is_array($content))
                        {
                                $content = array();
@@ -589,7 +589,7 @@
                                                        $width = $tmp[0];
                                                        if ( count($tmp) == 2 )
                                                        {
-                                                               $disable = 
$tmp[2];
+                                                               $disable = 
$tmp[1];
                                                        }
                                                        unset($tmp);
 
@@ -827,7 +827,7 @@
                 * @param for rest see show
                 * @return the generated HTML
                 */
-               function 
show_cell($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span)
+               function 
show_cell_head($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span)
                {
                        $options = '';
                        if (is_int($this->debug) && $this->debug >= 3 || 
$this->debug == $cell['type'])
@@ -1413,19 +1413,30 @@
                @result the generated HTML
                @todo - consider delete this function (from .16)
                */
-               function 
show_cell_16($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span)
+               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";
                        }
+//                     list($span) = explode(',',$cell['span']);       // 
evtl. overriten later for type template
+
+                       if(isset($cell['span']))
+                       {
                        list($span) = explode(',',$cell['span']);       // 
evtl. overriten later for type template
+                       }
+                       else
+                       {
+                               $span = '';
+                       }
 
-                       if ($cell['name'][0] == '@' && $cell['type'] != 
'template')
+
+                       if (isset($cell['name'][0]) && $cell['name'][0] == '@' 
&& $cell['type'] != 'template')
                        {
                                $cell['name'] = 
$this->get_array($content,substr($cell['name'],1));
                        }
-                       $name = 
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
+                       $name = $this->expand_name(isset($cell['name']) ? 
$cell['name'] : '',$show_c,$show_row,$content['.c'],$content['.row'],$content);
 
                        $name_parts = explode('[',str_replace(']','',$name));
                        if (!empty($cname))
@@ -1443,7 +1454,8 @@
                        {
                                $options .= ' READONLY';
                        }
-                       if ($cell['disabled'] || $readonly && $cell['type'] == 
'button' && !strstr($cell['size'],','))
+       
+                       if ((isset($cell['disabled']) && $cell['disabled']) || 
(isset($readonly) && $readonly) && $cell['type'] == 'button' && 
!strstr($cell['size'],','))
                        {
                                if ($this->rows == 1) {
                                        return '';      // if only one row omit 
cell
@@ -1453,8 +1465,9 @@
                        }
                        $extra_label = True;
 
-                       list($type,$sub_type) = explode('-',$cell['type']);
-                       if ((!$this->types[$cell['type']] || !empty($sub_type)) 
&& $this->haveExtension($type,'pre_process'))
+                       @list($type,$sub_type) = explode('-',$cell['type']); // 
fix this
+
+/*                     if ((!$this->types[$cell['type']] || !empty($sub_type)) 
&& $this->haveExtension($type,'pre_process'))
                        {
                                $ext_type = $type;
                                $extra_label = 
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
@@ -1462,6 +1475,19 @@
                                $readonly = $readonly || $cell['readonly'];     
// might be set be extension
                                $this->set_array($content,$name,$value);
                        }
+*/
+
+                       if (((!isset($this->types[$cell['type']]) || 
!$this->types[$cell['type']]) || !empty($sub_type)) && 
$this->haveExtension($type,'pre_process'))
+                       {
+                               $ext_type = $type;
+                               $extra_label = 
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
+
+                               $readonly = (isset($readonly) && $readonly) || 
(isset($cell['readonly']) && $cell['readonly']); // might be set be extension
+                               $this->set_array($content,$name,$value);
+                       }
+
+
+/*
                        $cell_options = $cell['size'];
                        if ($cell_options[0] == '@')
                        {
@@ -1516,11 +1542,96 @@
                        {
                                $options = "ID=\"$form_name\" $options";
                        }
-                       list($type,$sub_type) = explode('-',$cell['type']);
+*/
+
+                       $cell_options =  '';
+                       if ( isset($cell['size']) )
+                       {
+                               $cell_options = $cell['size'];
+                       }
+                       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 ( isset($help[0]) && $help[0] == '@')
+                       {
+                               $help = 
$this->get_array($content,substr($help,1));
+                       }
+
+                       $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'];
+                               }
+                               $blur = lang($blur);
+                       }
+
+                       $onBlur = '';
+                       $onFocus = '';
+                       if ($this->java_script())
+                       {
+                               if ($blur)
+                               {
+                                       if (empty($value))
+                                       {
+                                               $value = $blur;
+                                       }
+                                       $onFocus .= 
"if(this.value=='".addslashes(htmlspecialchars($blur))."') this.value='';";
+                                       $onBlur  .= "if(this.value=='') 
this.value='".addslashes(htmlspecialchars($blur))."';";
+                               }
+                               if ($help)
+                               {
+                                       if ( isset($cell['no_lang']) && 
$cell['no_lang'] < 2)
+                                       {
+                                               $help = lang($help);
+                                       }
+                                       $onFocus .= 
"self.status='".addslashes(htmlspecialchars($help))."'; return true;";
+                                       $onBlur  .= "self.status=''; return 
true;";
+                                       if ($cell['type'] == 'button' || 
$cell['type'] == 'file')       // for button additionally when mouse over button
+                                       {
+                                               $options .= " 
onMouseOver=\"self.status='".addslashes(htmlspecialchars($help))."'; return 
true;\"";
+                                               $options .= " 
onMouseOut=\"self.status=''; return true;\"";
+                                       }
+                               }
+                               if ($onBlur)
+                               {
+                                       $options .= " onFocus=\"$onFocus\" 
onBlur=\"$onBlur\"";
+                               }
+                               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']).'"';
+                               }
+                       }
+                       if ($form_name != '')
+                       {
+                               $options = "ID=\"$form_name\" $options";
+                       }
+
+                       $html = '';
+
+                       @list($type,$sub_type) = explode('-',$cell['type']);
                        switch ($type)
                        {
                                case 'label':           //  size: 
[[b]old][[i]talic][,link]
-                                       if (is_array($value))
+/*                                     if (is_array($value))
                                                break;
                                        list($style,$extra_link) = 
explode(',',$cell_options);
                                        $value = strlen($value) > 1 && 
!$cell['no_lang'] ? lang($value) : $value;
@@ -1529,20 +1640,67 @@
                                        if ($value != '' && strstr($style,'i')) 
$value = $this->html->italic($value);
                                        $html .= $value;
                                        break;
+                                       
+*/
+
+                                       if (is_array($value))
+                                       {
+                                               break;
+                                       }
+                                       $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);
+                                       $html .= $value;
+                                       break;
+
+
                                case 'html':
                                        $extra_link = $cell_options;
                                        $html .= $value;
                                        break;
                                case 'int':             // size: 
[min][,[max][,len]]
                                case 'float':
-                                       list($min,$max,$cell_options) = 
explode(',',$cell_options);
+/*                                     list($min,$max,$cell_options) = 
explode(',',$cell_options);
                                        if ($cell_options == '')
                                        {
                                                $cell_options = $cell['type'] 
== 'int' ? 5 : 8;
                                        }
                                        // fall-through
+*/
+                                       $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;
+                                       }
+
                                case 'text':            // size: 
[length][,maxLength]
-                                       if ($readonly)
+/*                                     if ($readonly)
+                                       {
+                                               $html .= 
$this->html->bold(htmlspecialchars($value));
+                                       }
+                                       else
+                                       {
+                                               $html .= 
$this->html->input($form_name,$value,'',
+                                                       
$options.$this->html->formatOptions($cell_options,'SIZE,MAXLENGTH'));
+                                               
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+                                       }
+                                       break;
+*/
+                                       if (isset($readonly) && $readonly)
                                        {
                                                $html .= 
$this->html->bold(htmlspecialchars($value));
                                        }
@@ -1554,11 +1712,19 @@
                                        }
                                        break;
                                case 'textarea':        // Multiline Text 
Input, size: [rows][,cols]
-                                       $html .= 
$this->html->textarea($form_name,$value,
+/*                                     $html .= 
$this->html->textarea($form_name,$value,
                                                
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
                                        if (!$readonly)
                                                
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
                                        break;
+*/
+                                       $html .= 
$this->html->textarea($form_name,$value,
+                                               
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
+                                       if (!isset($readonly) || !$readonly)
+                                               
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+                                       break;
+
+
                                case 'checkbox':
                                        if (!empty($cell_options))
                                        {
@@ -1570,11 +1736,11 @@
                                                $ro_true = 'x';
                                                $ro_false = '';
                                        }
-                                       if ($value)
+                                       if (isset($value) && $value)
                                        {
                                                $options .= ' CHECKED';
                                        }
-                                       if ($readonly)
+                                       if ( isset($readonly) && $readonly)
                                        {
                                                $html .= $value ? 
$this->html->bold($ro_true) : $ro_false;
                                        }
@@ -1605,8 +1771,8 @@
                                        }
                                        break;
                                case 'button':
-                                       list($app) = explode('.',$this->name);
-                                       if ($this->java_script() && 
$cell['onchange'] != '' && !$cell['needed']) // use a link instead of a button
+       /*                              list($app) = explode('.',$this->name);
+                                       if ($this->java_script() && 
isset($cell['onchange']) && $cell['onchange'] != '' && !$cell['needed']) // use 
a link instead of a button
                                        {
                                                if ($cell['onchange'] == 1)
                                                {
@@ -1625,16 +1791,59 @@
                                                list($img,$ro_img) = 
explode(',',$cell_options);
                                                if (!empty($img))
                                                {
-                                                       $options .= ' 
TITLE="'.(strlen($label)<=1||$cell['no_lang']?$label:lang($label)).'"';
+                                                       $options .= ' 
TITLE="'.(strlen($label)<=1|| isset($cell['no_lang']) && 
$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) :
+                                               $html .= !isset($readonly) || 
!$readonly ? 
$this->html->submit_button($form_name,$label,isset($cell['onchange']) ? 
$cell['onchange'] : '',
+                                                       strlen($label) <= 1 || 
(isset($cell['no_lang']) && $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;
+       */
+                                       list($app) = explode('.',$this->name);
+                                       if ($this->java_script() && 
isset($cell['onchange']) && $cell['onchange'] != '' && !$cell['needed']) // use 
a link instead of a button
+                                       {
+                                               if ($cell['onchange'] == 1)
+                                               {
+                                                       $html .= 
$this->html->input_hidden($form_name,'',False) . "\n";
+                                                       $html .= '<a href="" 
onClick="set_element(document.eTemplate,\''.$form_name.'\',\'pressed\'); 
document.eTemplate.submit(); return false;" '.$options.'>' .
+                                                               (strlen($label) 
<= 1 || $cell['no_lang'] ? $label : lang($label)) . '</a>';
+                                               }
+                                               else    // use custom javascript
+                                               {
+                                                       $html .= '<a href="" 
onClick="'.$cell['onchange'].'; return false;" '.$options.'>' .
+                                                               (strlen($label) 
<= 1 || $cell['no_lang'] ? $label : lang($label)) . '</a>';
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $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||(isset($cell['no_lang']) && 
$cell['no_lang'])?$label:lang($label)).'"';
+                                               }
+                                               $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 (!isset($readonly) || !$readonly )
+                                       {
+                                               
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+                                       }
+                                       break;
+
+       
                                case 'hrule':
                                        $html .= $this->html->hr($cell_options);
                                        break;
@@ -1647,7 +1856,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] == '@')
                                                {
@@ -1685,11 +1894,11 @@
                                                }
                                                //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;
                                        }
-                                       $html = 
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row,$cell['onchange'],$cell['tr_class']);
+                                       $html = 
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row,isset($cell['onchange'])
 ? $cell['onchange'] : '',isset($cell['tr_class']) ? $cell['tr_class'] : '');
                                        break;
                                case 'select':  // size:[linesOnMultiselect]
                                        $sels = array();
@@ -1735,14 +1944,14 @@
                                        {
                                                $sels += 
$content["options-$name"];
                                        }
-                                       if ($readonly)
+                                       if (isset($readonly) && $readonly)
                                        {
                                                $html .= $cell['no_lang'] ? 
$sels[$value] : lang($sels[$value]);
                                        }
                                        else
                                        {
                                                $html .= 
$this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
-                                                       
$cell['no_lang'],$options,$multiple);
+                                                       isset($cell['no_lang']) 
? $cell['no_lang'] : '',$options,$multiple);
                                                
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
                                        }
                                        break;
@@ -1763,7 +1972,7 @@
                                        break;
                                case 'vbox':
                                case 'hbox':
-                                       $rows = array();
+/*                                     $rows = array();
                                        $box_row = 1;
                                        $box_col = 'A';
                                        $box_anz = 0;
@@ -1800,6 +2009,57 @@
                                                        "\n\n<!-- END 
$cell[type] -->\n\n";
                                        }
                                        break;
+*/
+                                       $rows = array();
+                                       $box_row = 1;
+                                       $box_col = 'A';
+                                       $box_anz = 0;
+                                       for ($n = 1; $n <= $cell_options; ++$n)
+                                       {
+                                               $h = 
$this->show_cell($cell[$n],$content,$sel_options,$readonlys,$cname,$show_c,$show_row,$nul);
+                                               if ($h != '' && $h != '&nbsp;')
+                                               {
+                                                       if ($cell['type'] == 
'vbox')
+                                                       {
+                                                               $box_row = $n;
+                                                       }
+                                                       else
+                                                       {
+                                                               $box_col = 
$this->num2chrs($n);
+                                                       }
+                                                       
$rows[$box_row][$box_col] = $html = $h;
+                                                       $box_anz++;
+                                                       if ( 
isset($cell[$n]['align']) && $cell[$n]['align'] )
+                                                       {
+                                                               
$rows[$box_row]['.'.$box_col] = 
$this->html->formatOptions($cell[$n]['align'],'ALIGN');
+                                                       }
+                                                       $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);
+                                                       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".
+                                                       
$this->html->table($rows,$this->html->formatOptions($cell_options,',CELLPADDING,CELLSPACING').
+                                                       (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':
                                        for ($n = 1; $n <= $cell_options && 
(empty($value) || $value != $cell[$n]['name']); ++$n) ;
                                        if ($n > $cell_options)
@@ -1845,7 +2105,8 @@
                                        }
                                        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 ($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;
@@ -1858,7 +2119,8 @@
                        }
                        if ($extra_label && ($label != '' || $html == ''))
                        {
-                               if (strlen($label) > 1 && !($cell['no_lang'] && 
$cell['label'] != $label || $cell['no_lang'] == 2))
+//                             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);
                                }
@@ -1877,7 +2139,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] == '@')




reply via email to

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