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.1.1.1,


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.1.1.1,1.2 class.db_tools.inc.php,1.1.1.1,1.2 class.editor.inc.php,1.1.1.1,1.2 class.html.inc.php,1.1.1.1,1.2 class.soetemplate.inc.php,1.1.1.1,1.2 class.uietemplate.inc.php,1.1.1.1,1.2
Date: Thu, 14 Feb 2002 09:06:32 -0500

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

Modified Files:
        class.boetemplate.inc.php class.db_tools.inc.php 
        class.editor.inc.php class.html.inc.php 
        class.soetemplate.inc.php class.uietemplate.inc.php 
Log Message:
new fieldtypes: int, float
db_tools: import of existing db-tables via schema proc (needs some modification 
in the schema proc-class to allow calls from regular app !!!)
lots of other changes and improvments

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.boetemplate.inc.php   6 Feb 2002 09:03:16 -0000       1.1.1.1
--- class.boetemplate.inc.php   14 Feb 2002 14:06:30 -0000      1.2
***************
*** 24,29 ****
        {
                var $types = array(
!                       'label' => 'Label',     // Label $cell['label'] is (to 
be translated) textual content
!                       'text'  => 'Text',      // Textfield 1 Line (size = 
[length][,maxlength])
                        'textarea' => 'Textarea',       // Multiline Text Input 
(size = [rows][,cols])
                        'checkbox'=> 'Checkbox',
--- 24,31 ----
        {
                var $types = array(
!                       'label' => 'Label',                     // Label 
$cell['label'] is (to be translated) textual content
!                       'text'  => 'Text',                      // Textfield 1 
Line (size = [length][,maxlength])
!                       'int'           => 'Integer',           // like text, 
but only numbers (size = [min][,max])
!                       'float' => 'Floating Point', // --------------- " 
--------------------------
                        'textarea' => 'Textarea',       // Multiline Text Input 
(size = [rows][,cols])
                        'checkbox'=> 'Checkbox',
***************
*** 35,39 ****
                        'date'  => 'Date',                      // Datefield, 
size='' timestamp or size=format like 'm/d/Y'
                        'select'        =>      'Selectbox',    // Selectbox 
($sel_options[$name] or $content[options-$name] is array with options)
!                       // if size > 1 then multiple selections, size lines 
showed
                        'select-percent' => 'Select Percentage',
                        'select-priority' => 'Select Priority',
--- 37,41 ----
                        'date'  => 'Date',                      // Datefield, 
size='' timestamp or size=format like 'm/d/Y'
                        'select'        =>      'Selectbox',    // Selectbox 
($sel_options[$name] or $content[options-$name] is array with options)
!                                                                               
                // if size > 1 then multiple selections, size lines showed
                        'select-percent' => 'Select Percentage',
                        'select-priority' => 'Select Priority',
***************
*** 43,52 ****
                        'select-cat' => 'Select Cathegory', // 
Cathegory-Selection, size: -1=Single+All, 0=Single, >0=Multiple with size lines
                        'select-account' => 'Select Account',   // 
label=accounts(default),groups,both
!                       // size: -1=Single+not assigned, 0=Single, >0=Multiple
                        'raw'           => 'Raw',       // Raw html in 
$content[$cell['name']]
                );
                var $aligns = array(
!                       ''       => 'Left',
!                       'right'  => 'Right',
                        'center' => 'Center'
                );
--- 45,54 ----
                        'select-cat' => 'Select Cathegory', // 
Cathegory-Selection, size: -1=Single+All, 0=Single, >0=Multiple with size lines
                        'select-account' => 'Select Account',   // 
label=accounts(default),groups,both
!                                                                               
                                                // size: -1=Single+not 
assigned, 0=Single, >0=Multiple
                        'raw'           => 'Raw',       // Raw html in 
$content[$cell['name']]
                );
                var $aligns = array(
!                       '' => 'Left',
!                       'right' => 'Right',
                        'center' => 'Center'
                );
***************
*** 63,67 ****
  
                /*!
!               @function 
expand_name($name,$c,$row,$c_='',$row_='',$cont=array())
                @abstract allows a few variables (eg. row-number) to be used in 
field-names
                @discussion This is mainly used for autorepeat, but other use 
is possible.
--- 65,69 ----
  
                /*!
!               @function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
                @abstract allows a few variables (eg. row-number) to be used in 
field-names
                @discussion This is mainly used for autorepeat, but other use 
is possible.
***************
*** 88,92 ****
                function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
                {
!                       if(!$cont)
                        {
                                $cont = array();
--- 90,94 ----
                function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
                {
!                       if (!$cont)
                        {
                                $cont = array();
***************
*** 146,150 ****
                                {
                                        $Ok = $pat[0] == 'c' && 
!(substr($pat,0,4) == 'cont' ||
!                                       substr($pat,0,2) == 'c_' || 
substr($pat,0,4) == 'col_');
                                }
                                else
--- 148,152 ----
                                {
                                        $Ok = $pat[0] == 'c' && 
!(substr($pat,0,4) == 'cont' ||
!                                                       substr($pat,0,2) == 
'c_' || substr($pat,0,4) == 'col_');
                                }
                                else
***************
*** 157,162 ****
                                echo "$this->name ".($check_col ? 'col' : 
'row')."-check: c=$c, r=$r, idx='$org_idx' ==> ".($Ok?'True':'False')."<p>\n";
                        }
- 
                        return $Ok;
                }
!       }
--- 159,163 ----
                                echo "$this->name ".($check_col ? 'col' : 
'row')."-check: c=$c, r=$r, idx='$org_idx' ==> ".($Ok?'True':'False')."<p>\n";
                        }
                        return $Ok;
                }
!       };
\ No newline at end of file

Index: class.db_tools.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.db_tools.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.db_tools.inc.php      6 Feb 2002 09:03:21 -0000       1.1.1.1
--- class.db_tools.inc.php      14 Feb 2002 14:06:30 -0000      1.2
***************
*** 35,39 ****
                        'error_writing' => 'Error: writing file !!!',
                        'give_table_name' => 'Please enter table-name first 
!!!',
!                       'new_table' => 'New table created'
                );
                var $types = array(
--- 35,40 ----
                        'error_writing' => 'Error: writing file !!!',
                        'give_table_name' => 'Please enter table-name first 
!!!',
!                       'new_table' => 'New table created',
!                       'select_app' => 'Select an app first !!!'
                );
                var $types = array(
***************
*** 55,59 ****
                @abstract constructor of class
                */
!               function db_tools()
                {
                        $this->editor = 
CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
--- 56,60 ----
                @abstract constructor of class
                */
!               function db_tools($lang_on_messages=True)
                {
                        $this->editor = 
CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
***************
*** 70,73 ****
--- 71,80 ----
                                $this->apps[$name] = $data['title'];
                        }
+                       if ($lang_on_messages)
+                       {
+                               reset($this->messages);
+                               while(list($key,$msg) = each($this->messages))
+                                       $this->messages[$key] = lang($msg);
+                       }
                }
  
***************
*** 82,86 ****
                                $this->app = $GLOBALS['HTTP_GET_VARS']['app'];
                        }
- 
                        if (isset($GLOBALS['HTTP_POST_VARS']['cont']))
                        {
--- 89,92 ----
***************
*** 136,140 ****
  
                                reset($this->data[$posted_table]['fd']);
!                               while ($col-- > 0 && list($key,$data) = 
each($this->data[$posted_table]['fd']));
  
                                unset($this->data[$posted_table]['fd'][$key]);
--- 142,146 ----
  
                                reset($this->data[$posted_table]['fd']);
!                               while ($col-- > 0 && list($key,$data) = 
each($this->data[$posted_table]['fd'])) ;
  
                                unset($this->data[$posted_table]['fd'][$key]);
***************
*** 144,154 ****
                                $this->data[$posted_table]['fd'][''] = array();
                        }
!                       elseif (isset($content['add_table']))
                        {
!                               if (!$content['new_table_name'])
                                {
                                        $msg .= 
$this->messages['give_table_name'];
                                }
!                               else
                                {
                                        $this->table = 
$content['new_table_name'];
--- 150,164 ----
                                $this->data[$posted_table]['fd'][''] = array();
                        }
!                       elseif ($content['add_table'] || $content['import'])
                        {
!                               if (!$this->app)
!                               {
!                                       $msg .= $this->messages['select_app'];
!                               }
!                               elseif (!$content['new_table_name'])
                                {
                                        $msg .= 
$this->messages['give_table_name'];
                                }
!                               elseif ($content['add_table'])
                                {
                                        $this->table = 
$content['new_table_name'];
***************
*** 156,159 ****
--- 166,189 ----
                                        $msg .= $this->messages['new_table'];
                                }
+                               else // import
+                               {
+                                       $oProc = 
CreateObject('setup.schema_proc','mysql');
+                                       $oProc->m_odb = $GLOBALS['phpgw']->db;
+                                       
$oProc->m_oTranslator->_GetColumns($oProc,$content['new_table_name'],$nul);
+ 
+                                       while (list($key,$tbldata) = each 
($oProc->m_oTranslator->sCol))
+                                       {
+                                               $cols .= $tbldata;
+                                       }
+                                       eval('$cols = array('. $cols . ');');
+ 
+                                       $this->data[$this->table = 
$content['new_table_name']] = array(
+                                               'fd' => $cols,
+                                               'pk' => 
$oProc->m_oTranslator->pk,
+                                               'fk' => 
$oProc->m_oTranslator->fk,
+                                               'ix' => 
$oProc->m_oTranslator->ix,
+                                               'uc' => 
$oProc->m_oTranslator->uc
+                                       );
+                               }
                        }
                        elseif ($content['editor'])
***************
*** 172,177 ****
                                $table_names[$this->table] = $this->table;
                        }
! 
!                       $sel_options = array(
                                'table_name' => $table_names,
                                'type' => $this->types,
--- 202,206 ----
                                $table_names[$this->table] = $this->table;
                        }
!    $sel_options = array(
                                'table_name' => $table_names,
                                'type' => $this->types,
***************
*** 183,192 ****
                        }
                        $no_button = array( );
! 
                        if ($this->debug)
                        {
                                echo 'editor.edit: content ='; 
_debug_array($content);
                        }
!                       
$this->editor->exec('etemplate.db_tools.edit',$content,$sel_options,$no_buttons,
                                array('posted_table' => 
$this->table,'posted_app' => $this->app));
                }
--- 212,224 ----
                        }
                        $no_button = array( );
!                       if (!$this->app || !$this->table)
!                       {
!                               $no_button += array('write_tables' => True);
!                       }
                        if ($this->debug)
                        {
                                echo 'editor.edit: content ='; 
_debug_array($content);
                        }
!                       
$this->editor->exec('etemplate.db_tools.edit',$content,$sel_options,$no_button,
                                array('posted_table' => 
$this->table,'posted_app' => $this->app));
                }
***************
*** 233,237 ****
                        $this->app = $posted_app;
                        $this->data = array();
!          $this->read($posted_app,$this->data);
  
                        if (isset($this->data[$posted_table]) &&
--- 265,269 ----
                        $this->app = $posted_app;
                        $this->data = array();
!                       $this->read($posted_app,$this->data);
  
                        if (isset($this->data[$posted_table]) &&
***************
*** 304,308 ****
                        $table['ix'] = array();
                        $table['uc'] = array();
!          for (reset($content),$n = 1; isset($content["Row$n"]); ++$n)
                        {
                                $col = $content["Row$n"];
--- 336,340 ----
                        $table['ix'] = array();
                        $table['uc'] = array();
!                       for (reset($content),$n = 1; isset($content["Row$n"]); 
++$n)
                        {
                                $col = $content["Row$n"];
***************
*** 316,319 ****
--- 348,352 ----
                                                        case 'type':    // 
selectbox ensures type is not empty
                                                        case 'precision':
+                                                       case 'scale':
                                                        case 'nullable':
                                                                if ($val != '' 
|| $prop == 'nullable')
***************
*** 368,372 ****
                                return False;
                        }
- 
                        if ($this->debug >= 5)
                        {
--- 401,404 ----
***************
*** 405,409 ****
                                        $def .= "'$key' => ";
                                }
- 
                                if (is_array($val))
                                {
--- 437,440 ----
***************
*** 458,468 ****
                        {
                                $header = "<?php\n\n";
!                               }
! 
                        if (!($f = fopen($file,'w')))
                        {
                                return False;
                        }
- 
                        $def .= "\t\$phpgw_baseline = ";
                        $def .= $this->write_array($phpgw_baseline,1);
--- 489,497 ----
                        {
                                $header = "<?php\n\n";
!                       }
                        if (!($f = fopen($file,'w')))
                        {
                                return False;
                        }
                        $def .= "\t\$phpgw_baseline = ";
                        $def .= $this->write_array($phpgw_baseline,1);
***************
*** 490,493 ****
--- 519,523 ----
                                        'type' => ''.$props['type'],
                                        'precision' => 0+$props['precision'],
+                                       'scale' => 0+$props['scale'],
                                        'nullable' => !!$props['nullable'],
                                        'default' => ''.$props['default']
***************
*** 526,530 ****
                function writeLangFile()
                {
!                       
$this->tmpl->writeLangFile('etemplate','en',$this->messages);
                }
!       }
--- 556,564 ----
                function writeLangFile()
                {
!                       $m = new db_tools(False);       // no lang on messages
!                       
$this->tmpl->writeLangFile('etemplate','en',$m->messages);
                }
!       };
! 
! 
! 

Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.editor.inc.php        6 Feb 2002 09:03:14 -0000       1.1.1.1
--- class.editor.inc.php        14 Feb 2002 14:06:30 -0000      1.2
***************
*** 22,26 ****
                        'deleted'   => 'Template deleted',
                        'saved'     => 'Template saved',
!                       'error_writing' => 'Error: while saveing !!!'
                );
  
--- 22,27 ----
                        'deleted'   => 'Template deleted',
                        'saved'     => 'Template saved',
!                       'error_writing' => 'Error: while saveing !!!',
!                       'other_version' => 'only an other Version found !!!'
                );
  
***************
*** 35,39 ****
                );
  
!               function editor()
                {
                        $this->etemplate = CreateObject('etemplate.etemplate');
--- 36,40 ----
                );
  
!               function editor($lang_on_messages=True)
                {
                        $this->etemplate = CreateObject('etemplate.etemplate');
***************
*** 41,44 ****
--- 42,52 ----
  
                        $this->editor = new etemplate('etemplate.editor');
+ 
+                       if ($lang_on_messages)
+                       {
+                               reset($this->messages);
+                               while (list($key,$msg) = each($this->messages))
+                                       $this->messages[$key] = lang($msg);
+                       }
                }
  
***************
*** 50,54 ****
                                $msg .= $this->messages['not_found'];
                        }
- 
                        $content = $this->etemplate->as_array() + array(
                                'cols' => $this->etemplate->cols,
--- 58,61 ----
***************
*** 57,61 ****
                        $cols_spanned = array();
                        reset($this->etemplate->data);
!                       if (isset($this->etemplate->data[0])) 
each($this->etemplate->data);
                        $no_button = array('values' => True,'edit' => True);
                        while (list($row,$cols) = each($this->etemplate->data))
--- 64,71 ----
                        $cols_spanned = array();
                        reset($this->etemplate->data);
!                       if (isset($this->etemplate->data[0]))
!                       {
!                               each($this->etemplate->data);
!                       }
                        $no_button = array('values' => True,'edit' => True);
                        while (list($row,$cols) = each($this->etemplate->data))
***************
*** 114,122 ****
                        
$this->editor->exec('etemplate.editor.process_edit',$content,
                                array(
!                                       'type'  => $this->etemplate->types,
                                        'align' => $this->etemplate->aligns
                                ),
!                               $no_button,$cols_spanned
!                       );
                }
  
--- 124,131 ----
                        
$this->editor->exec('etemplate.editor.process_edit',$content,
                                array(
!                                       'type' => $this->etemplate->types,
                                        'align' => $this->etemplate->aligns
                                ),
!                               $no_button,$cols_spanned);
                }
  
***************
*** 150,155 ****
                                        }
                                        $this->etemplate->data[$row] = 
$row_data;
!                                       ++$row; $col = 0;
!                                       $row_data = array();
                                }
                        }
--- 159,163 ----
                                        }
                                        $this->etemplate->data[$row] = 
$row_data;
!                                       ++$row; $col = 0; $row_data = array();
                                }
                        }
***************
*** 266,270 ****
                                if (!$this->etemplate->read($content))
                                {
!                                       $msg = $this->messages['not_found'];
                                }
                        }
--- 274,283 ----
                                if (!$this->etemplate->read($content))
                                {
!                                       $content['version'] = '';       // 
trying it without version
!                                       $msg = $this->messages['other_version'];
!                                       if (!$this->etemplate->read($content))
!                                       {
!                                               $msg = 
$this->messages['not_found'];
!                                       }
                                }
                        }
***************
*** 293,299 ****
                                if (substr($content['name'],0,9) == 'etemplate')
                                {
!                                       $additional = $this->messages + 
$this->etemplate->types + $this->etemplate->aligns;
                                }
- 
                                $msg = 
$this->etemplate->writeLangFile($content['name'],'en',$additional);
                        }
--- 306,312 ----
                                if (substr($content['name'],0,9) == 'etemplate')
                                {
!                                       $m = new editor(False);
!                                       $additional = $m->messages + 
$this->etemplate->types + $this->etemplate->aligns;
                                }
                                $msg = 
$this->etemplate->writeLangFile($content['name'],'en',$additional);
                        }
***************
*** 312,316 ****
                                $read_ok = 
$this->etemplate->read($GLOBALS['HTTP_POST_VARS']);
                        }
- 
                        if (isset($GLOBALS['HTTP_POST_VARS']['yes']))   // 
Delete
                        {
--- 325,328 ----
***************
*** 352,356 ****
                                $msg = $this->messages['not_found'];
                        }
- 
                        if (!$msg && isset($post_vars['delete']))
                        {
--- 364,367 ----
***************
*** 393,395 ****
                        
$show->exec('etemplate.editor.show',$content,array(),$no_buttons,array('olds' 
=> $vals),'');
                }
!       }
--- 404,409 ----
                        
$show->exec('etemplate.editor.show',$content,array(),$no_buttons,array('olds' 
=> $vals),'');
                }
!       };
! 
! 
! 

Index: class.html.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.html.inc.php  6 Feb 2002 09:03:36 -0000       1.1.1.1
--- class.html.inc.php  14 Feb 2002 14:06:30 -0000      1.2
***************
*** 1,8 ****
  <?php
        
/**************************************************************************\
!       * phpGroupWare - InfoLog                                                
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by Ralf Becker <address@hidden>                  *
-       * originaly based on todo written by Joseph Engo <address@hidden>  *
        * --------------------------------------------                          
   *
        *  This program is free software; you can redistribute it and/or modify 
it *
--- 1,7 ----
  <?php
        
/**************************************************************************\
!       * phpGroupWare - HTML creation class                                    
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by Ralf Becker <address@hidden>                  *
        * --------------------------------------------                          
   *
        *  This program is free software; you can redistribute it and/or modify 
it *
***************
*** 14,277 ****
        /* $Id$ */
  
!       class html
        {
!               var $prefered_img_title;
  
!               function html()
                {
!                       global $HTTP_USER_AGENT;
!                       // should be Ok for all HTML 4 compatible browsers
!                       $this->prefered_img_title = 
stristr($HTTP_USER_AGENT,'konqueror') ? 'title' : 'alt';
                }
! 
!               function input_hidden($vars,$value='')
                {
!                       if (!is_array($vars))
                        {
!                               $vars = array( $vars => $value );
                        }
-                       while (list($name,$value) = each($vars))
-                       {
-                               if (is_array($value))
-                               {
-                                       $value = serialize($value);
-                               }
-                               $del = strchr($value,'"') ? "'" : '"';
-                               if ($value && !($name == 'filter' && $value == 
'none')) // dont need to send all the empty vars
-                               {
-                                       $html .= "<INPUT TYPE=HIDDEN 
NAME=\"$name\" VALUE=$del$value$del>\n";
-                               }
-                       }
-                       return $html;
                }
  
!               function textarea($name,$value='',$options='' )
!               {
!                       return "<TEXTAREA name=\"$name\" 
$options>$value</TEXTAREA>\n";
!               }
  
!               function input($name,$value='',$type='',$options='' )
!               {
!                       if ($type)
!                       {
!                               $type = "TYPE=$type";
!                       }
  
!                       return "<INPUT $type NAME=\"$name\" VALUE=\"$value\" 
$options>\n";
!               }
  
!               function 
submit_button($name,$lang,$onClick='',$no_lang=0,$options='')
!               {
!                       if (!$no_lang)
!                       {
!                               $lang = lang($lang);
!                       }
!                       if ($onClick)
!                       {
!                               $options .= " onClick=\"$onClick\"";
!                       }
!                       return $this->input($name,$lang,'SUBMIT',$options);
!               }
  
!               /*!
!               @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'
!               @returns absolut link already run through $phpgw->link
!               */
!               function link($url,$vars='')
                {
!                       if (is_array( $vars ))
                        {
!                               $v = array( );
!                               while(list($name,$value) = each($vars))
                                {
!                                       if ($value && !($name == 'filter' && 
$value == 'none')) // dont need to send all the empty vars
!                                       {
!                                               $v[] = "$name=$value";
!                                       }
                                }
-                               $vars = implode('&',$v);
-                       }
-                       list($url,$v) = explode('?',$url);      // url may 
contain additional vars
-                       if ($v)
-                       {
-                               $vars .= ($vars ? '&' : '') . $v;
                        }
! 
!                       return $GLOBALS['phpgw']->link($url,$vars);
                }
  
!               function checkbox($name,$value='')
!               {
!                       return "<input type=\"checkbox\" name=\"$name\" 
value=\"True\"" .($value ? ' checked' : '') . ">\n";
!               }
  
!               function 
form($content,$hidden_vars,$url,$url_vars='',$method='POST')
!               {
!                       $html = "<form method=\"$method\" 
action=\"".$this->link($url,$url_vars)."\">\n";
!                       $html .= $this->input_hidden($hidden_vars);
  
!                       if ($content)
!                       {
!                               $html .= $content;
!                               $html .= "</form>\n";
!                       }
!                       return $html;
!               }
  
!               function 
form_1button($name,$lang,$hidden_vars,$url,$url_vars='',$method='POST')
!               {
!                       return $this->form($this->submit_button($name,$lang),
!                       $hidden_vars,$url,$url_vars,$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>'
!               @returns string with html-code of the table
!               */
!               function table($rows,$options = '')
!               {
!                       $html = "<TABLE $options>\n";
! 
!                       while (list($key,$row) = each($rows))
!                       {
!                               if (!is_array($row))
!                               {
!                                       continue;                               
        // parameter
!                               }
!                               $html .= "\t<TR ".$rows['.'.$key].">\n";
!                               while (list($key,$cell) = each($row))
!                               {
!                                       if ($key[0] == '.')
!                                       {
!                                               continue;                       
        // parameter
!                                       }
!                                       $html .= "\t\t<TD 
".$row['.'.$key].">$cell</TD>\n";
!                               }
!                               $html .= "\t</TR>\n";
!                       }
!                       $html .= "</TABLE>\n";
  
!                       return $html;
!               }
  
!               function sbox_submit( $sbox,$no_script=0 )
                {
!                       $html = str_replace('<select','<select 
onChange="this.form.submit()" ',
!                       $sbox);
!                       if ($no_script)
!                       {
!                               $html .= 
'<noscript>'.$this->submit_button('send','>').'</noscript>';
!                       }
!                       return $html;
                }
  
!               function image( $app,$name,$title='',$options='' )
!               {
!                       if (!($path = 
$GLOBALS['phpgw']->common->image($app,$name)))
!                       {
!                               $path = $name;          // name may already 
contain absolut path
!                       }
  
!                       if ($title)
!                       {
!                               $options .= " 
$this->prefered_img_title=\"$title\"";
!                       }
!                       return "<IMG SRC=\"$path\" $options>";
                }
  
!               function a_href( $content,$url,$vars='',$options='')
!               {
!                       if (!strstr($url,'/') && count(explode('.',$url)) == 3)
!                       {
!                               $url = "/index.php?menuaction=$url";
!                       }
  
!                       return '<a href="'.$this->link($url,$vars).'" 
'.$options.'>'.$content.'</a>';
!               }
  
!               function bold($content)
!               {
!                       return '<b>'.$content.'</b>';
!               }
  
!               function italic($content)
!               {
!                       return '<i>'.$content.'</i>';
!               }
  
!               function hr($width,$options='')
!               {
!                       if ($width)
!                       {
!                               $options .= " WIDTH=$width";
!                       }
!                       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"'
!               @returns option string
!               */
!               function formatOptions($options,$names)
!               {
!                       if (!is_array($options))
!                       {
!                               $options = explode(',',$options);
!                       }
!                       if (!is_array($names))
!                       {
!                               $names   = explode(',',$names);
!                       }
  
!                       while (list($n,$val) = each($options))
!                       {
!                               if ($val != '' && $names[$n] != '')
!                               {
!                                       $html .= ' '.$names[$n].'="'.$val.'"';
!                               }
!                       }
  
!                       return $html;
!               }
  
!               /*!
!               @function nextMatchStyles
!               @abstract returns simple stylesheet for nextmatch row-colors
!               @returns the classes 'nmh' = nextmatch header, 'nmr0'+'nmr1' = 
alternating rows
!               */
!               function nextMatchStyles()
!               {
!                       return $this->style(
!                               ".nmh { background: 
".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
!                               ".nmr1 { background: 
".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
!                               ".nmr0 { background: 
".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n"
!                       );
!               }
  
!               function style($styles)
!               {
!                       return $styles ? "<STYLE 
type=\"text/css\">\n<!--\n$styles\n-->\n</STYLE>" : '';
!               }
  
!               function label($content,$options='')
!               {
!                       return "<LABEL $options>$content</LABEL>";
!               }
        }
--- 13,240 ----
        /* $Id$ */
  
! class html
! {
!       var $prefered_img_title;
! 
!       function html()
        {
!               global $HTTP_USER_AGENT;
!                                                                               
                                                // should be Ok for all HTML 4 
compatible browsers
!               $this->prefered_img_title = 
stristr($HTTP_USER_AGENT,'konqueror') ? 'title' : 'alt';
!       }
  
!       function input_hidden($vars,$value='')
!       {
!               if (!is_array($vars))
                {
!                       $vars = array( $vars => $value );
                }
!               while (list($name,$value) = each($vars))
                {
!                       if (is_array($value)) $value = serialize($value);
!                       $del = strchr($value,'"') ? "'" : '"';
!                       if ($value && !($name == 'filter' && $value == 'none')) 
// dont need to send all the empty vars
                        {
!                               $html .= "<INPUT TYPE=HIDDEN NAME=\"$name\" 
VALUE=$del$value$del>\n";
                        }
                }
+               return $html;
+       }
  
!       function textarea($name,$value='',$options='' )
!       {
!               return "<TEXTAREA name=\"$name\" $options>$value</TEXTAREA>\n";
!       }
  
!       function input($name,$value='',$type='',$options='' )
!       {
!               if ($type) $type = "TYPE=$type";
  
!               return "<INPUT $type NAME=\"$name\" VALUE=\"$value\" 
$options>\n";
!       }
  
!       function submit_button($name,$lang,$onClick='',$no_lang=0,$options='')
!       {
!               if (!$no_lang) $lang = lang($lang);
!               if ($onClick) $options .= " onClick=\"$onClick\"";
!               return $this->input($name,$lang,'SUBMIT',$options);
!       }
  
!       /*!
!       @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'
!       @returns absolut link already run through $phpgw->link
!       */
!       function link($url,$vars='')
!       {
!               if (is_array( $vars ))
                {
!                       $v = array( );
!                       while(list($name,$value) = each($vars))
                        {
!                               if ($value && !($name == 'filter' && $value == 
'none')) // dont need to send all the empty vars
                                {
!                                       $v[] = "$name=$value";
                                }
                        }
!                       $vars = implode('&',$v);
                }
+               list($url,$v) = explode('?',$url);      // url may contain 
additional vars
+               if ($v)
+                       $vars .= ($vars ? '&' : '') . $v;
  
!               return $GLOBALS['phpgw']->link($url,$vars);
!       }
  
!       function checkbox($name,$value='')
!       {
!               return "<input type=\"checkbox\" name=\"$name\" value=\"True\"" 
.($value ? ' checked' : '') . ">\n";
!       }
  
!       function form($content,$hidden_vars,$url,$url_vars='',$method='POST')
!       {
!               $html = "<form method=\"$method\" 
action=\"".$this->link($url,$url_vars)."\">\n";
!               $html .= $this->input_hidden($hidden_vars);
  
!               if ($content) {
!                       $html .= $content;
!                       $html .= "</form>\n";
                }
+               return $html;
+       }
  
!       function form_1button($name,$lang,$hidden_vars,$url,$url_vars='',
!                                                                $method='POST')
!       {
!               return $this->form($this->submit_button($name,$lang),
!                                                                
$hidden_vars,$url,$url_vars,$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>'
!       @returns string with html-code of the table
!       */
!       function table($rows,$options = '')
!       {
!               $html = "<TABLE $options>\n";
  
!               while (list($key,$row) = each($rows)) {
!                       if (!is_array($row))
!                               continue;                                       
// parameter
!                       $html .= "\t<TR ".$rows['.'.$key].">\n";
!                       while (list($key,$cell) = each($row)) {
!                               if ($key[0] == '.')
!                                       continue;                               
// parameter
!                               $html .= "\t\t<TD 
".$row['.'.$key].">$cell</TD>\n";
!                       }
!                       $html .= "\t</TR>\n";
!               }
!               $html .= "</TABLE>\n";
!               
!               return $html;
!       }
!       
!       function sbox_submit( $sbox,$no_script=0 )
!       {
!               $html = str_replace('<select','<select 
onChange="this.form.submit()" ',
!                                                                 $sbox);
!               if ($no_script)
                {
!                       $html .= 
'<noscript>'.$this->submit_button('send','>').'</noscript>';
                }
+               return $html;
+       }
  
!       function image( $app,$name,$title='',$options='' )
!       {
!               if (!($path = $GLOBALS['phpgw']->common->image($app,$name)))
!                       $path = $name;          // name may already contain 
absolut path
  
!               if ($title)
!               {
!                       $options .= " $this->prefered_img_title=\"$title\"";
                }
+               return "<IMG SRC=\"$path\" $options>";
+       }
  
!       function a_href( $content,$url,$vars='',$options='')
!       {
!               if (!strstr($url,'/') && count(explode('.',$url)) == 3)
!                       $url = "/index.php?menuaction=$url";
  
!               return '<a href="'.$this->link($url,$vars).'" 
'.$options.'>'.$content.'</a>';
!       }
  
!       function bold($content)
!       {
!               return '<b>'.$content.'</b>';
!       }
  
!       function italic($content)
!       {
!               return '<i>'.$content.'</i>';
!       }
  
!       function hr($width,$options='')
!       {
!               if ($width)
!                       $options .= " WIDTH=$width";
!               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"'
!       @returns option string
!       */
!       function formatOptions($options,$names)
!       {
!               if (!is_array($options)) $options = explode(',',$options);
!               if (!is_array($names))   $names   = explode(',',$names);
  
!               while (list($n,$val) = each($options))
!                       if ($val != '' && $names[$n] != '')
!                               $html .= ' '.$names[$n].'="'.$val.'"';
  
!               return $html;
!       }
  
!       /*!
!       @function nextMatchStyles
!       @abstract returns simple stylesheet for nextmatch row-colors
!       @returns the classes 'nmh' = nextmatch header, 'nmr0'+'nmr1' = 
alternating rows
!       */
!       function nextMatchStyles()
!       {
!               return $this->style(
!                       ".nmh { background: 
".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
!                       ".nmr1 { background: 
".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
!                       ".nmr0 { background: 
".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n"
!               );
!       }
  
!       function style($styles)
!       {
!               return $styles ? "<STYLE 
type=\"text/css\">\n<!--\n$styles\n-->\n</STYLE>" : '';
!       }
  
!       function label($content,$options='')
!       {
!               return "<LABEL $options>$content</LABEL>";
        }
+ }

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.soetemplate.inc.php   6 Feb 2002 09:03:12 -0000       1.1.1.1
--- class.soetemplate.inc.php   14 Feb 2002 14:06:30 -0000      1.2
***************
*** 33,42 ****
        {
                var $public_functions = array(
!                       'init' => True,
!                       'read' => True,
!                       'save' => True,
!                       'delete' => True,
!                       'dump2setup'    => True,
!                       'import_dump'   => True,
                        'writeLangFile' => True
                );
--- 33,42 ----
        {
                var $public_functions = array(
!                       'init'  => True,
!                       'read'  => True,
!                       'save'  => True,
!                       'delete'        => True,
!                       'dump2setup'    => True,
!                       'import_dump'   => True,
                        'writeLangFile' => True
                );
***************
*** 49,55 ****
                var $style;             // embeded CSS style-sheet
                var $db,$db_name = 'phpgw_etemplate'; // DB name
!               var $db_key_cols = array('et_name' => 'name','et_template' => 
'template','et_lang' => 'lang',
!               'et_group' => 'group','et_version' => 'version');
!               var $db_data_cols = array('et_data' => 'data','et_size' => 
'size','et_style' => 'style');
                var $db_cols;
  
--- 49,64 ----
                var $style;             // embeded CSS style-sheet
                var $db,$db_name = 'phpgw_etemplate'; // DB name
!               var $db_key_cols = array(
!                       'et_name' => 'name',
!                       'et_template' => 'template',
!                       'et_lang' => 'lang',
!                       'et_group' => 'group',
!                       'et_version' => 'version'
!               );
!               var $db_data_cols = array(
!                       'et_data' => 'data',
!                       'et_size' => 'size',
!                       'et_style' => 'style'
!               );
                var $db_cols;
  
***************
*** 148,152 ****
                                $this->test_import($this->name);        // 
import updates in setup-dir
                        }
- 
                        $pref_lang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
                        $pref_templ = 
$GLOBALS['phpgw_info']['server']['template_set'];
--- 157,160 ----
***************
*** 204,208 ****
                                $this->$name = $this->db->f($db_col);
                        }
- 
                        $this->data = unserialize(stripslashes($this->data));
  
--- 212,215 ----
***************
*** 245,249 ****
                                return $arr;
                        }
- 
                        while (list($key,$val) = each($arr))
                        {
--- 252,255 ----
***************
*** 281,285 ****
                                $arr['data'] = serialize($arr['data']);
                        }
- 
                        return $arr;
                }
--- 287,290 ----
***************
*** 313,323 ****
                                $this->version = $version;
                        }
! 
!                       if ($this->name == '')
                        {
-                               // name need to be set !!!
                                return False;
                        }
- 
                        $this->delete();        // so we have always a new 
insert
  
--- 318,325 ----
                                $this->version = $version;
                        }
!                       if ($this->name == '')  // name need to be set !!!
                        {
                                return False;
                        }
                        $this->delete();        // so we have always a new 
insert
  
***************
*** 369,373 ****
                                $vals .= ($vals ? ' AND ' : '') . $db_col . 
"='" . $this->$col . "'";
                        }
- 
                        $this->db->query("DELETE FROM $this->db_name WHERE 
$vals",__LINE__,__FILE__);
  
--- 371,374 ----
***************
*** 391,395 ****
                                return 0;
                        }
- 
                        fwrite($f,"<?php\n// eTemplates for Application '$app', 
generated by etemplate.dump() ".date('Y-m-d H:i')."\n\n");
                        for ($n = 0; $this->db->next_record(); ++$n)
--- 392,395 ----
***************
*** 422,432 ****
                                while (list($col,$cell) = each($cols))
                                {
!                                       if (!$cell['no_lang'] && 
strlen($cell['label']) > 1)
                                        {
!                                               $to_trans[$cell['label']] = 
$cell['label'];
                                        }
                                        if (strlen($cell['help']) > 1)
                                        {
!                                               $to_trans[$cell['help']] = 
$cell['help'];
                                        }
                                }
--- 422,432 ----
                                while (list($col,$cell) = each($cols))
                                {
!                                       if (strlen($cell['label']) > 1)
                                        {
!                                               
$to_trans[strtolower($cell['label'])] = $cell['label'];
                                        }
                                        if (strlen($cell['help']) > 1)
                                        {
!                                               
$to_trans[strtolower($cell['help'])] = $cell['help'];
                                        }
                                }
***************
*** 467,473 ****
                function writeLangFile($app,$lang='en',$additional='')
                {
!                       if(!$additional)
                        {
!                               $additional = array();
                        }
                        list($app) = explode('.',$app);
--- 467,473 ----
                function writeLangFile($app,$lang='en',$additional='')
                {
!                       if (!$additional)
                        {
!                               $addtional = array();
                        }
                        list($app) = explode('.',$app);
***************
*** 480,498 ****
                        if (is_array($additional))
                        {
                                while (list($nul,$msg) = each($additional))
                                {
!                                       $to_trans[$msg] = $msg;
                                }
                        }
!                       for ($new = $n = 0; list($message_id,$content) = 
each($to_trans); ++$n)
!                       {
                                if (!isset($langarr[$message_id]))
                                {
!                                       $langarr[$message_id] = 
array('message_id' => $message_id,'app_name' => $app,'content' => $content);
                                        ++$new;
                                }
                        }
- 
                        ksort($langarr);
                        $solangfile->write_file($app,$langarr,$lang);
                        $solangfile->loaddb($app,$lang);
--- 480,518 ----
                        if (is_array($additional))
                        {
+                               //echo "writeLangFile: additional ="; 
_debug_array($additional);
+                               reset($additional);
                                while (list($nul,$msg) = each($additional))
                                {
!                                       $to_trans[strtolower($msg)] = $msg;
                                }
                        }
!                       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,
!                                               'app_name' => $app,
!                                               'content' => $content
!                                       );
                                        ++$new;
                                }
                        }
                        ksort($langarr);
+ 
+                       $dir = PHPGW_SERVER_ROOT . "/$app/setup";
+                       if (!is_writeable($dir))
+                       {
+                               return "Error: webserver is not allowed to 
write into '$dir' !!!";
+                       }
+                       $file = "$dir/phpgw_$lang.lang";
+                       if (file_exists($file))
+                       {
+                               rename($file,"$dir/phpgw_$lang.old.lang");
+                       }
                        $solangfile->write_file($app,$langarr,$lang);
                        $solangfile->loaddb($app,$lang);
***************
*** 555,557 ****
                        return $ret;
                }
!       }
--- 575,577 ----
                        return $ret;
                }
!       };

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.uietemplate.inc.php   6 Feb 2002 09:03:29 -0000       1.1.1.1
--- class.uietemplate.inc.php   14 Feb 2002 14:06:30 -0000      1.2
***************
*** 31,35 ****
        {
                var $debug;//='etemplate.editor.edit'; // 1=calls to show and 
process_show, 2=content after process_show,
!               // 3=calls to show_cell and process_show_cell, or template-name 
or cell-type
                var $html,$sbox;        // instance of html / sbox2-class
  
--- 31,35 ----
        {
                var $debug;//='etemplate.editor.edit'; // 1=calls to show and 
process_show, 2=content after process_show,
!                                               // 3=calls to show_cell and 
process_show_cell, or template-name or cell-type
                var $html,$sbox;        // instance of html / sbox2-class
  
***************
*** 42,49 ****
                {
                        $this->public_functions += array(
!                               'exec'         => True,
!                               'process_exec' => True,
!                               'show'         => True,
!                               'process_show' => True,
                        );
                        $this->boetemplate();
--- 42,49 ----
                {
                        $this->public_functions += array(
!                               'exec'                  => True,
!                               'process_exec'  => True,
!                               'show'                  => True,
!                               'process_show'  => True,
                        );
                        $this->boetemplate();
***************
*** 81,93 ****
                function 
exec($method,$content,$sel_options='',$readonlys='',$preserv='',$cname='cont')
                {
!                       if(!$sel_options)
                        {
                                $sel_options = array();
                        }
!                       if(!$readonlys)
                        {
                                $readonlys = array();
                        }
!                       if(!$preserv)
                        {
                                $preserv = array();
--- 81,93 ----
                function 
exec($method,$content,$sel_options='',$readonlys='',$preserv='',$cname='cont')
                {
!                       if (!$sel_options)
                        {
                                $sel_options = array();
                        }
!                       if (!$readonlys)
                        {
                                $readonlys = array();
                        }
!                       if (!$preserv)
                        {
                                $preserv = array();
***************
*** 97,109 ****
  
                        echo $this->html->nextMatchStyles($this->style)."\n\n". 
// so they get included once
!                       
$this->html->form($this->show($content,$sel_options,$readonlys,$cname),array(
!                               'etemplate_exec[name]' => $this->name,
!                               'etemplate_exec[template]' => $this->template,
!                               'etemplate_exec[lang]' => $this->lang,
!                               'etemplate_exec[group]' => $this->group,
!                               'etemplate_exec[readonlys]' => $readonlys,
!                               'etemplate_exec[cname]' => $cname,
!                               'etemplate_exec[method]' => $method
!                       
)+$preserv,'/index.php?menuaction=etemplate.etemplate.process_exec');
                }
  
--- 97,109 ----
  
                        echo $this->html->nextMatchStyles($this->style)."\n\n". 
// so they get included once
!                               
$this->html->form($this->show($content,$sel_options,$readonlys,$cname),array(
!                                       'etemplate_exec[name]' => $this->name,
!                                       'etemplate_exec[template]' => 
$this->template,
!                                       'etemplate_exec[lang]' => $this->lang,
!                                       'etemplate_exec[group]' => $this->group,
!                                       'etemplate_exec[readonlys]' => 
$readonlys,
!                                       'etemplate_exec[cname]' => $cname,
!                                       'etemplate_exec[method]' => $method
!                               
)+$preserv,'/index.php?menuaction=etemplate.etemplate.process_exec');
                }
  
***************
*** 144,148 ****
                                return $regs[2] && 
isset($arr[$regs[1]][$regs[2]]);
                        }
- 
                        return isset($arr[$idx]);
                }
--- 144,147 ----
***************
*** 165,175 ****
                @returns the generated HTML
                */
!               function 
show($content,$sel_options='',$readonlys='',$cname='cont',$show_c=0,$show_row=0)
                {
!                       if(!$sel_options)
                        {
                                $sel_options = array();
                        }
!                       if(!$readonlys)
                        {
                                $readonlys = array();
--- 164,175 ----
                @returns the generated HTML
                */
!               function 
show($content,$sel_options='',$readonlys='',$cname='cont',
!                                               $show_c=0,$show_row=0)
                {
!                       if (!$sel_options)
                        {
                                $sel_options = array();
                        }
!                       if (!$readonlys)
                        {
                                $readonlys = array();
***************
*** 183,193 ****
                                $content = array();     // happens if incl. 
template has no content
                        }
!                       $content += array(
!                               '.c'   => $show_c,
                                '.col' => $this->num2chrs($show_c-1),
!                               '.row' => $show_row     // for var-expansion in 
names in show_cell
                        );
! 
!                       reset($this->data);
                        if (isset($this->data[0]))
                        {
--- 183,192 ----
                                $content = array();     // happens if incl. 
template has no content
                        }
!                       $content += array(      // for var-expansion in names 
in show_cell
!                               '.c' => $show_c,
                                '.col' => $this->num2chrs($show_c-1),
!                               '.row' => $show_row
                        );
!                               reset($this->data);
                        if (isset($this->data[0]))
                        {
***************
*** 206,213 ****
                                        list($nul,$cell) = each($cols); 
reset($cols);
                                        if 
(!($this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) && $idx_cname) &&
!                                       
!($this->autorepeat_idx($cols['B'],1,$r,$idx,$idx_cname) && $idx_cname) ||
!                                       !$this->isset_array($idx,$content))
                                        {
!                                               break; // no auto-row-repeat
                                        }
                                }
--- 205,212 ----
                                        list($nul,$cell) = each($cols); 
reset($cols);
                                        if 
(!($this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) && $idx_cname) &&
!                                               
!($this->autorepeat_idx($cols['B'],1,$r,$idx,$idx_cname) && $idx_cname) ||
!                                               
!$this->isset_array($idx,$content))
                                        {
!                                               break;                          
// no auto-row-repeat
                                        }
                                }
***************
*** 221,230 ****
                                {
                                        $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))
                                        {
-                                               // no further cols
                                                $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
!                                               
!$this->isset_array($idx,$content))
                                                {
                                                        break;  // no 
auto-col-repeat
--- 220,228 ----
                                {
                                        $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))  
        // no further cols
                                        {
                                                $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
!                                                       
!$this->isset_array($idx,$content))
                                                {
                                                        break;  // no 
auto-col-repeat
***************
*** 233,237 ****
                                        $col = $this->num2chrs($c);
                                        $row_data[$col] = 
$this->show_cell($cell,$content,$sel_options,$readonlys,$cname,
!                                       $c,$r,$span);
                                        if ($row_data[$col] == '' && 
$this->rows == 1)
                                        {
--- 231,235 ----
                                        $col = $this->num2chrs($c);
                                        $row_data[$col] = 
$this->show_cell($cell,$content,$sel_options,$readonlys,$cname,
!                                               $c,$r,$span);
                                        if ($row_data[$col] == '' && 
$this->rows == 1)
                                        {
***************
*** 273,278 ****
                        }
                        return "\n\n<!-- BEGIN $this->name -->\n$style\n".
!                       
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS')).
!                       "<!-- END $this->name -->\n\n";
                }
  
--- 271,276 ----
                        }
                        return "\n\n<!-- BEGIN $this->name -->\n$style\n".
!                               
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS')).
!                               "<!-- END $this->name -->\n\n";
                }
  
***************
*** 311,324 ****
                                $form_name = $cname.'['.$name.']';
                        }
- 
                        if ($readonly = $cell['readonly'] || $readonlys[$name] 
|| $readonlys['__ALL__'])
                        {
                                $options .= ' READONLY';
                        }
- 
                        if ($cell['disabled'] || $cell['type'] == 'button' && 
$readonly)
                        {
!                               if ($this->rows == 1)
!                               {
                                        return '';      // if only one row omit 
cell
                                }
--- 309,319 ----
                                $form_name = $cname.'['.$name.']';
                        }
                        if ($readonly = $cell['readonly'] || $readonlys[$name] 
|| $readonlys['__ALL__'])
                        {
                                $options .= ' READONLY';
                        }
                        if ($cell['disabled'] || $cell['type'] == 'button' && 
$readonly)
                        {
!                               if ($this->rows == 1) {
                                        return '';      // if only one row omit 
cell
                                }
***************
*** 344,355 ****
                                case 'label':           //  size: 
[[b]old][[i]talic]
                                        $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;
--- 339,344 ----
                                case 'label':           //  size: 
[[b]old][[i]talic]
                                        $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;
***************
*** 357,360 ****
--- 346,357 ----
                                        $html .= $value;
                                        break;
+                               case 'int':             // size: 
[min][,[max][,len]]
+                               case 'float':
+                                       list($min,$max,$cell['size']) = 
explode(',',$cell['size']);
+                                       if ($cell['size'] == '')
+                                       {
+                                               $cell['size'] = $cell['type'] 
== 'int' ? 5 : 8;
+                                       }
+                                       // fall-through
                                case 'text':            // size: 
[length][,maxLength]
                                        if ($readonly)
***************
*** 365,374 ****
                                        {
                                                $html .= 
$this->html->input($form_name,$value,'',
!                                               
$options.$this->html->formatOptions($cell['size'],'SIZE,MAXLENGTH'));
                                        }
                                        break;
                                case 'textarea':        // Multiline Text 
Input, size: [rows][,cols]
                                        $html .= 
$this->html->textarea($form_name,$value,
!                                       
$options.$this->html->formatOptions($cell['size'],'ROWS,COLS'));
                                        break;
                                case 'date':
--- 362,371 ----
                                        {
                                                $html .= 
$this->html->input($form_name,$value,'',
!                                                       
$options.$this->html->formatOptions($cell['size'],'SIZE,MAXLENGTH'));
                                        }
                                        break;
                                case 'textarea':        // Multiline Text 
Input, size: [rows][,cols]
                                        $html .= 
$this->html->textarea($form_name,$value,
!                                               
$options.$this->html->formatOptions($cell['size'],'ROWS,COLS'));
                                        break;
                                case 'date':
***************
*** 416,420 ****
                                case 'button':
                                        $html .= 
$this->html->submit_button($form_name,$cell['label'],'',
!                                       strlen($cell['label']) <= 1 || 
$cell['no_lang'],$options);
                                        break;
                                case 'hrule':
--- 413,417 ----
                                case 'button':
                                        $html .= 
$this->html->submit_button($form_name,$cell['label'],'',
!                                               strlen($cell['label']) <= 1 || 
$cell['no_lang'],$options);
                                        break;
                                case 'hrule':
***************
*** 425,430 ****
                                        {
                                                if ($span == '' && 
isset($content[$idx]['span']))
!                                               {
!                                                       // this allows a 
colspan in autorepeated cells like the editor
                                                        $span = 
explode(',',$content[$idx]['span']); $span = $span[0];
                                                        if ($span == 'all')
--- 422,426 ----
                                        {
                                                if ($span == '' && 
isset($content[$idx]['span']))
!                                               {       // this allows a 
colspan in autorepeated cells like the editor
                                                        $span = 
explode(',',$content[$idx]['span']); $span = $span[0];
                                                        if ($span == 'all')
***************
*** 439,443 ****
                                                        $cname .= $cname == '' 
? $idx_cname : "[$idx_cname]";
                                                }
- 
                                                //echo 
"<p>show_cell-autorepeat($name,$show_c,$show_row,cname='$cname',idx='$idx',idx_cname='$idx_cname',span='$span'):
 readonlys[$idx] ="; _debug_array($readonlys);
                                        }
--- 435,438 ----
***************
*** 457,467 ****
                                        {
                                                $sel_options = 
$sel_options[$org_name];
!                                       }
!                                       elseif 
(isset($content["options-$name"]))
                                        {
                                                $sel_options = 
$content["options-$name"];
                                        }
                                        $html .= 
$this->sbox->getArrayItem($form_name.'[]',$value,$sel_options,$cell['no_lang'],
!                                       $options,$cell['size']);
                                        break;
                                case 'select-percent':
--- 452,461 ----
                                        {
                                                $sel_options = 
$sel_options[$org_name];
!                                       } elseif 
(isset($content["options-$name"]))
                                        {
                                                $sel_options = 
$content["options-$name"];
                                        }
                                        $html .= 
$this->sbox->getArrayItem($form_name.'[]',$value,$sel_options,$cell['no_lang'],
!                                               $options,$cell['size']);
                                        break;
                                case 'select-percent':
***************
*** 494,498 ****
                                case 'image':
                                        $image = 
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
!                                       
$cell['label'],lang($cell['help']),'BORDER=0');
                                        $html .= $name == '' ? $image : 
$this->html->a_href($image,$name);
                                        break;
--- 488,492 ----
                                case 'image':
                                        $image = 
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
!                                               
$cell['label'],lang($cell['help']),'BORDER=0');
                                        $html .= $name == '' ? $image : 
$this->html->a_href($image,$name);
                                        break;
***************
*** 503,511 ****
                        if ($cell['type'] != 'button' && $cell['type'] != 
'image' && (($label = $cell['label']) != '' || $html == ''))
                        {
!                               if (!$cell['no_lang'] && strlen($label) > 1)
                                {
                                        $label = lang($label);
                                }
- 
                                $html_label = $html != '' && $label != '';
  
--- 497,504 ----
                        if ($cell['type'] != 'button' && $cell['type'] != 
'image' && (($label = $cell['label']) != '' || $html == ''))
                        {
!                               if (strlen($label) > 1)
                                {
                                        $label = lang($label);
                                }
                                $html_label = $html != '' && $label != '';
  
***************
*** 518,522 ****
                                        $html = '&nbsp;';
                                }
- 
                                if ($html_label)
                                {
--- 511,514 ----
***************
*** 539,545 ****
                function process_show(&$content,$readonlys='')
                {
!                       if(!$readonlys)
                        {
!                               $readonlys=array();
                        }
                        if (!isset($content) || !is_array($content))
--- 531,537 ----
                function process_show(&$content,$readonlys='')
                {
!                       if (!$readonlys)
                        {
!                               $readonlys = array();
                        }
                        if (!isset($content) || !is_array($content))
***************
*** 547,551 ****
                                return;
                        }
- 
                        if ($this->debug >= 1 || $this->debug == $this->name && 
$this->name)
                        {
--- 539,542 ----
***************
*** 576,582 ****
                                {
                                        $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))
                                        {
-                                               // no further cols
                                                $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
--- 567,572 ----
                                {
                                        $old_cell = $cell;
!                                       if (!(list($nul,$cell) = each($cols)))  
// no further cols
                                        {
                                                $cell = $old_cell;
                                                if 
(!$this->autorepeat_idx($cell,$c,$r,$idx,$idx_cname,True) ||
***************
*** 594,605 ****
                                        $name = 
$this->expand_name($cell['name'],$c,$r);
                                        $readonly = $cell['readonly'] || 
$readonlys[$name] || $readonlys['__ALL__'] ||
!                                       $cell['type'] == 'label' || 
$cell['type'] == 'image' || $cell['type'] == 'raw' ||
!                                       $cell['type'] == 'hrule';
  
                                        if ($idx_cname == '' && $cell['type'] 
== 'template')    // only templates
                                        {
!                                               if ($readonly)
                                                {
-                                                       // can't unset whole 
content!!!
                                                        $readonlys['__ALL__'] = 
True;
                                                }
--- 584,594 ----
                                        $name = 
$this->expand_name($cell['name'],$c,$r);
                                        $readonly = $cell['readonly'] || 
$readonlys[$name] || $readonlys['__ALL__'] ||
!                                               $cell['type'] == 'label' || 
$cell['type'] == 'image' || $cell['type'] == 'raw' ||
!                                               $cell['type'] == 'hrule';
  
                                        if ($idx_cname == '' && $cell['type'] 
== 'template')    // only templates
                                        {
!                                               if ($readonly)                  
// can't unset whole content!!!
                                                {
                                                        $readonlys['__ALL__'] = 
True;
                                                }
***************
*** 620,624 ****
  
                                                if ($readonly || 
!$this->process_show_cell($cell,$name,$c,$r,
!                                                       
$readonlys[$regs[1]][$regs[2]],$content[$regs[1]][$regs[2]]))
                                                {
                                                        if (!$parent_isset)
--- 609,613 ----
  
                                                if ($readonly || 
!$this->process_show_cell($cell,$name,$c,$r,
!                                                               
$readonlys[$regs[1]][$regs[2]],$content[$regs[1]][$regs[2]]))
                                                {
                                                        if (!$parent_isset)
***************
*** 635,639 ****
                                        {
                                                if ($readonly || 
!$this->process_show_cell($cell,$name,$c,$r,
!                                                       
$readonlys[$idx_cname],$content[$idx_cname]))
                                                {
                                                        
unset($content[$idx_cname]);
--- 624,628 ----
                                        {
                                                if ($readonly || 
!$this->process_show_cell($cell,$name,$c,$r,
!                                                               
$readonlys[$idx_cname],$content[$idx_cname]))
                                                {
                                                        
unset($content[$idx_cname]);
***************
*** 666,670 ****
                                $cell['type'] = $cell['type'][0];
                        }
- 
                        if ($this->debug >= 3 || $this->debug == $this->name || 
$this->debug == $cell['type'])
                        {
--- 655,658 ----
***************
*** 681,684 ****
--- 669,679 ----
                        switch ($cell['type'])
                        {
+                               case 'int':
+                               case 'float':
+                                       list($min,$max) = 
explode(',',$cell['size']);
+                                       /*
+                                       * TO DO: number- and range-check, if 
not enshured by java-script
+                                       */
+                                       break;
                                case 'text':
                                case 'textarea':
***************
*** 725,731 ****
                                        break;
                                case 'checkbox':
!                                       if (!isset($value))
                                        {
-                                               // checkbox was not checked
                                                $value = 0;                     
// need to be reported too
                                        }
--- 720,725 ----
                                        break;
                                case 'checkbox':
!                                       if (!isset($value))     // checkbox was 
not checked
                                        {
                                                $value = 0;                     
// need to be reported too
                                        }
***************
*** 759,761 ****
                        return isset($value);
                }
!       }
--- 753,755 ----
                        return isset($value);
                }
!       };
\ No newline at end of file




reply via email to

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