[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] etemplate/inc class.boetemplate.inc.php class.d...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] etemplate/inc class.boetemplate.inc.php class.d... |
Date: |
Tue, 13 Feb 2007 12:59:33 +0000 |
CVSROOT: /sources/phpgroupware
Module name: etemplate
Changes by: Sigurd Nes <sigurdne> 07/02/13 12:59:32
Modified files:
inc : class.boetemplate.inc.php
class.date_widget.inc.php
class.db_tools.inc.php class.editor.inc.php
class.etemplate.inc.php
class.link_widget.inc.php
class.nextmatch_widget.inc.php
class.sbox2.inc.php class.select_widget.inc.php
class.so_sql.inc.php class.soetemplate.inc.php
class.solangfile.inc.php
class.tab_widget.inc.php
class.uietemplate.inc.php
class.uietemplate_gtk.inc.php
class.xmltool.inc.php class.xslt_widget.inc.php
class.xul_io.inc.php
Log message:
notices , merging .16 and head
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.boetemplate.inc.php?cvsroot=phpgroupware&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.date_widget.inc.php?cvsroot=phpgroupware&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.db_tools.inc.php?cvsroot=phpgroupware&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.editor.inc.php?cvsroot=phpgroupware&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.etemplate.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.link_widget.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.nextmatch_widget.inc.php?cvsroot=phpgroupware&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.sbox2.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.select_widget.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.so_sql.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.soetemplate.inc.php?cvsroot=phpgroupware&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.solangfile.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.tab_widget.inc.php?cvsroot=phpgroupware&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.uietemplate.inc.php?cvsroot=phpgroupware&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.uietemplate_gtk.inc.php?cvsroot=phpgroupware&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.xmltool.inc.php?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.xslt_widget.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/etemplate/inc/class.xul_io.inc.php?cvsroot=phpgroupware&r1=1.27&r2=1.28
Patches:
Index: class.boetemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- class.boetemplate.inc.php 12 Feb 2007 14:45:37 -0000 1.43
+++ class.boetemplate.inc.php 13 Feb 2007 12:59:32 -0000 1.44
@@ -1,28 +1,19 @@
<?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.boetemplate.inc.php,v 1.43 2007/02/12 14:45:37 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/lgpl.html GNU Lesser General Public
License
+* @package etemplate
+* @version $Id: class.boetemplate.inc.php,v 1.44 2007/02/13 12:59:32 sigurdne
Exp $
+*/
include_once(PHPGW_INCLUDE_ROOT .
'/etemplate/inc/class.soetemplate.inc.php');
- /*!
- @class boetemplate
- @author ralfbecker
- @abstract Buiseness Objects for eTemplates
- @discussion Not so much so far, as the most logic is still in the
UI-class
- @param $types,$alings converts internal names/values to (more) human
readible ones
+ /**
+ * Buiseness Objects for eTemplates
+ *
+ * Not so much so far, as the most logic is still in the UI-class
+ * @param $types,$alings converts internal names/values to (more) human
readible ones
*/
class boetemplate extends soetemplate
{
@@ -49,12 +40,12 @@
'hbox' => 'HBox', // a
(horizontal) box to contain widgets in cols, size = # of cols
'deck' => 'Deck' // a container
of elements where only one is visible, size = # of elem.
);
- /*!
- @function boetemplate
- @abstract constructor of class
- @param $name name of etemplate or array with name and other
keys
- @param $load_via name/array with keys of other etemplate to
load in order to get $name
- @discussion Calls the constructor of soetemplate
+ /**
+ * constructor of class
+ *
+ * @param $name name of etemplate or array with name and
other keys
+ * @param $load_via name/array with keys of other etemplate to
load in order to get $name
+ * Calls the constructor of soetemplate
*/
function boetemplate($name='',$load_via='')
{
@@ -86,33 +77,30 @@
}
}
- /*!
- @function expand_name
- @syntax expand_name( $name,$c,$row,$c_='',$row_='',$cont='' )
- @author ralfbecker
- @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.
- @discussion You need to be aware of the rules PHP uses to
expand vars in strings, a name
- @discussion of "Row$row[length]" will expand to 'Row' as $row
is scalar, you need to use
- @discussion "Row${row}[length]" instead. Only one indirection
is allowd in a string by php !!!
- @discussion Out of that reason we have now the variable
$row_cont, which is $cont[$row] too.
- @discussion Attention !!!
- @discussion Using only number as index in field-names causes a
lot trouble, as depending
- @discussion on the variable type (which php determines itself)
you used filling and later
- @discussion accessing the array it can by the index or the key
of an array element.
- @discussion To make it short and clear, use "Row$row" or
"$col$row" not "$row" or "$row$col" !!!
- @param $name the name to expand
- @param $c is the column index starting with 0 (if you have
row-headers, data-cells start at 1)
- @param $row is the row number starting with 0 (if you have
col-headers, data-cells start at 1)
- @param $c_, $row_ are the respective values of the previous
template-inclusion,
- @param eg. the column-headers in the
eTemplate-editor are templates itself,
- @param to show the column-name in the header you can
not use $col as it will
- @param be constant as it is always the same col in
the header-template,
- @param what you want is the value of the previous
template-inclusion.
- @param $cont content array of the template, you might use it to
generate button-names with
- @param id values in it: "del[$cont[id]]" expands to
"del[123]" if $cont = array('id' => 123)
+ /**
+ * allows a few variables (eg. row-number) to be used in
field-names
+ *
+ * This is mainly used for autorepeat, but other use is
possible.
+ * You need to be aware of the rules PHP uses to expand vars in
strings, a name
+ * of "Row$row[length]" will expand to 'Row' as $row is scalar,
you need to use
+ * "Row${row}[length]" instead. Only one indirection is allowd
in a string by php !!!
+ * Out of that reason we have now the variable $row_cont, which
is $cont[$row] too.
+ * Attention !!!
+ * Using only number as index in field-names causes a lot
trouble, as depending
+ * on the variable type (which php determines itself) you used
filling and later
+ * accessing the array it can by the index or the key of an
array element.
+ * To make it short and clear, use "Row$row" or "$col$row" not
"$row" or "$row$col" !!!
+ * @param $name the name to expand
+ * @param $c is the column index starting with 0 (if you have
row-headers, data-cells start at 1)
+ * @param $row is the row number starting with 0 (if you have
col-headers, data-cells start at 1)
+ * @param $c_, $row_ are the respective values of the previous
template-inclusion,
+ * @param eg. the column-headers in the
eTemplate-editor are templates itself,
+ * @param to show the column-name in the header you
can not use $col as it will
+ * @param be constant as it is always the same col
in the header-template,
+ * @param what you want is the value of the previous
template-inclusion.
+ * @param $cont content array of the template, you might use it
to generate button-names with
+ * @param id values in it: "del[$cont[id]]" expands to
"del[123]" if $cont = array('id' => 123)
*/
-
function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
{
if(empty($name))
@@ -139,33 +127,32 @@
return $name;
}
- /*!
- @function autorepeat_idx
- @abstract Checks if we have an row- or column autorepeat and
sets the indexes for $content, etc.
- @discussion Autorepeat is important to allow a variable numer
of rows or cols, eg. for a list.
- @discussion The eTemplate has only one (have to be the last)
row or column, which gets
- @discussion automaticaly repeated as long as content is
availible. To check this the content
- @discussion has to be in an sub-array of content. The index /
subscript into content is
- @discussion determined by the content of size for templates or
name for regular fields.
- @discussion An autorepeat is defined by an index which contains
variables to expand.
- @discussion (vor variable expansion in names see expand_names).
Usually I use the keys
- @discussion $row: 0, 1, 2, 3, ... for only rows, $col: '@',
'A', 'B', 'C', ... for only cols or
- @discussion $col$row: '@0','A0',... '@1','A1','B1',...
'@2','A2','B2',... for both rows and cells.
- @discussion In general everything expand_names can generate is
ok - see there.
- @discussion As you usually have col- and row-headers,
data-cells start with '1' or 'A' !!!
- @syntax
autorepeat_idx($cell,$c,$r,&$idx,&$idx_cname,$check_col=False)
- @param $cell array with data of cell: name, type, size, ...
- @param $c,$r col/row index starting from 0
- @param &$idx returns the index in $content and $readonlys (NOT
$sel_options !!!)
- @param &$idx_cname returns the basename for the form-name: is
$idx if only one value
- @param (no ',') is given in size (name (not
template-fields) are always only one value)
- @param $check_col boolean to check for col- or row-autorepeat
- @result true if cell is autorepeat (has index with vars / '$')
or false otherwise
+ /**
+ * Checks if we have an row- or column autorepeat and sets the
indexes for $content, etc.
+ *
+ * Autorepeat is important to allow a variable numer of rows or
cols, eg. for a list.
+ * The eTemplate has only one (have to be the last) row or
column, which gets
+ * automaticaly repeated as long as content is availible. To
check this the content
+ * has to be in an sub-array of content. The index / subscript
into content is
+ * determined by the content of size for templates or name for
regular fields.
+ * An autorepeat is defined by an index which contains
variables to expand.
+ * (vor variable expansion in names see expand_names). Usually
I use the keys
+ * $row: 0, 1, 2, 3, ... for only rows, $col: '@', 'A', 'B',
'C', ... for only cols or
+ * $col$row: '@0','A0',... '@1','A1','B1',...
'@2','A2','B2',... for both rows and cells.
+ * In general everything expand_names can generate is ok - see
there.
+ * As you usually have col- and row-headers, data-cells start
with '1' or 'A' !!!
+ * @param $cell array with data of cell: name, type, size, ...
+ * @param $c,$r col/row index starting from 0
+ * @param &$idx returns the index in $content and $readonlys
(NOT $sel_options !!!)
+ * @param &$idx_cname returns the basename for the form-name:
is $idx if only one value
+ * @param (no ',') is given in size (name (not
template-fields) are always only one value)
+ * @param $check_col boolean to check for col- or row-autorepeat
+ * @return true if cell is autorepeat (has index with vars /
'$') or false otherwise
*/
function
autorepeat_idx($cell,$c,$r,&$idx,&$idx_cname,$check_col=False)
{
$org_idx = $idx = '';
- if($cell['type'] == 'template')
+ if(isset($cell['type']) && $cell['type'] == 'template')
{
if(isset($cell['size']))
{
@@ -214,11 +201,8 @@
return $Ok;
}
- /*!
- @function appsession_id
- @syntax appsession_id( )
- @author ralfbecker
- @abstract creates a new appsession-id via microtime()
+ /**
+ * creates a new appsession-id via microtime()
*/
function appsession_id()
{
@@ -228,11 +212,11 @@
return $id;
}
- /*!
- @functin appsession
- @syntax appsession($location = 'default', $appname = '', $data
= '##NOTHING##')
- @abstract db-sessions appsession function
- @note It is used to overcome the problem with overflowing
php4-sessions
+ /**
+ * appsession
+ * db-sessions appsession function
+ *
+ * It is used to overcome the problem with overflowing
php4-sessions
*/
function appsession($location = 'default', $appname = '', $data
= '##NOTHING##')
{
@@ -309,18 +293,16 @@
return $data;
}
- /*!
- @function save_appsession
- @syntax save_appsession( $data,$id='' )
- @author ralfbecker
- @abstract saves content,readonlys,template-keys, ... via the
appsession function
- @discussion As a user may open several windows with the same
content/template wie generate a location-id from microtime
- @discussion which is used as location for appsession to
descriminate between the different windows. This location-id
- @discussion is then saved as a hidden-var in the form. The
above mentions session-id has nothing to do / is different
- @discussion from the session-id which is constant for all
windows opened in one session.
- @param $data the data to save
- @param $id the id to use or '' to generate a new id
- @result the location-id
+ /**
+ * saves content,readonlys,template-keys, ... via the
appsession function
+ *
+ * As a user may open several windows with the same
content/template wie generate a location-id from microtime
+ * which is used as location for appsession to descriminate
between the different windows. This location-id
+ * is then saved as a hidden-var in the form. The above
mentions session-id has nothing to do / is different
+ * from the session-id which is constant for all windows opened
in one session.
+ * @param $data the data to save
+ * @param $id the id to use or '' to generate a new id
+ * @return the location-id
*/
function save_appsession($data,$id='')
{
@@ -333,13 +315,11 @@
return $id;
}
- /*!
- @function get_appsession
- @syntax get_appsession( $id )
- @author ralfbecker
- @abstract gets content,readonlys,template-keys, ... back from
the appsession function
- @param $id the location-id
- @result the session-data
+ /**
+ * gets content,readonlys,template-keys, ... back from the
appsession function
+ *
+ * @param $id the location-id
+ * @return the session-data
*/
function get_appsession($id)
{
@@ -354,12 +334,10 @@
return $data;
}
- /*!
- @function get_cell_attribute
- @syntax get_cell_attribute( $name,$attr )
- @author ralfbecker
- @abstract gets an attribute in a named cell
- @result the attribute or False if named cell not found
+ /**
+ * gets an attribute in a named cell
+ *
+ * @return the attribute or False if named cell not found
*/
function get_cell_attribute($name,$attr)
{
@@ -380,12 +358,10 @@
return False;
}
- /*!
- @function set_cell_attribute
- @syntax set_cell_attribute( $name,$attr,$val )
- @author ralfbecker
- @abstract set an attribute in a named cell
- @result the number of changed cells
+ /**
+ * set an attribute in a named cell
+ *
+ * @return the number of changed cells
*/
function set_cell_attribute($name,$attr,$val)
{
@@ -401,42 +377,37 @@
$this->data[$row][$col][$attr]
= $val;
++$n;
}
- if ($cell['type'] == 'template' &&
(is_object($cell['obj']) || $cell['name'][0] != '@'))
+ if (isset($cell['type']) &&
$cell['type'] == 'template' && isset($cell['obj']) && (is_object($cell['obj'])
|| $cell['name'][0] != '@'))
{
if (!is_object($cell['obj']))
{
-
$this->data[$row][$col]['obj'] =
CreateObject('etemplate.etemplate',$cell['name']);
+
$this->data[$row][$col]['obj'] =
createObject('etemplate.etemplate',$cell['name']);
}
$n +=
$this->data[$row][$col]['obj']->set_cell_attribute($name,$attr,$val);
}
}
}
-
return $n;
}
- /*!
- @function disable_cells
- @syntax disable_cells( $name )
- @author ralfbecker
- @abstract disables all cells with name == $name
+ /**
+ * disables all cells with name == $name
+ *
*/
function disable_cells($name)
{
return $this->set_cell_attribute($name,'disabled',True);
}
- /*!
- @function set_row_attributes
- @syntax set_row_attibutes(
$n,$height=0,$class=0,$valign=0,$disabled=0 )
- @author ralfbecker
- @abstract set one or more attibutes for row $n
- @param $n is numerical row-number starting with 1 (!)
- @param $height in percent or pixel or '' for no height
- @param $class name of css class (without the leading '.') or ''
for no class
- @param $valign alignment (top,middle,bottom) or '' for none
- @param $disabled True or expression or False to disable or
enable the row
- @param Only the number 0 means dont change the attribute !!!
+ /**
+ * set one or more attibutes for row $n
+ *
+ * @param $n is numerical row-number starting with 1 (!)
+ * @param $height in percent or pixel or '' for no height
+ * @param $class name of css class (without the leading '.') or
'' for no class
+ * @param $valign alignment (top,middle,bottom) or '' for none
+ * @param $disabled True or expression or False to disable or
enable the row
+ * @param Only the number 0 means dont change the attribute !!!
*/
function
set_row_attributes($n,$height=0,$class=0,$valign=0,$disabled=0)
{
@@ -450,28 +421,24 @@
($valign ? ','.$valign : '');
}
- /*!
- @function disable_row
- @syntax disable_row( $n,$enable=False )
- @author ralfbecker
- @abstract disables row $n
- @param $n is numerical row-number starting with 1 (!)
- @param $enable can be used to re-enable a row if set to True
+ /**
+ * disables row $n
+ *
+ * @param $n is numerical row-number starting with 1 (!)
+ * @param $enable can be used to re-enable a row if set to True
*/
function disable_row($n,$enable=False)
{
$this->set_row_attributes($n,0,0,0,!$enable);
}
- /*!
- @function set_column_attributes
- @syntax set_column_attibutes( $n,$width=0,$disabled=0 )
- @author ralfbecker
- @abstract set one or more attibutes for column $c
- @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
- @param $width in percent or pixel or '' for no height
- @param $disabled True or expression or False to disable or
enable the column
- @param Only the number 0 means dont change the attribute !!!
+ /**
+ * set one or more attibutes for column $c
+ *
+ * @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
+ * @param $width in percent or pixel or '' for no height
+ * @param $disabled True or expression or False to disable or
enable the column
+ * @param Only the number 0 means dont change the attribute !!!
*/
function set_column_attributes($c,$width=0,$disabled=0)
{
@@ -485,35 +452,30 @@
($disabled ? ','.$disabled : '');
}
- /*!
- @function disable_column
- @syntax disable_column( $c,$enable=False )
- @author ralfbecker
- @abstract disables column $c
- @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
- @param $enable can be used to re-enable a column if set to True
+ /**
+ * disables column $c
+ *
+ * @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
+ * @param $enable can be used to re-enable a column if set to
True
*/
function disable_column($c,$enable=False)
{
$this->set_column_attributes($c,0,!$enable);
}
- /*!
- @function loadExtension
- @syntax loadExtension( $type )
- @author ralfbecker
- @abstact trys to load the Extension / Widget-class from the app
or etemplate
- @param $name name of the extension, the classname should be
class.${name}_widget.inc.php
- @discussion the $name might be "$name.$app" to give a app-name
(default is the current app,or template-name)
+ /**
+ * trys to load the Extension / Widget-class from the app or
etemplate
+ * @param $name name of the extension, the classname should be
class.${name}_widget.inc.php
+ * the $name might be "$name.$app" to give a app-name (default
is the current app,or template-name)
*/
function loadExtension($type)
{
- list($class,$app) = explode('.',$type);
+ @list($class,$app) = explode('.',$type);
$class .= '_widget';
if ($app == '')
{
- $app =
$GLOBALS['phpgw_info']['flags']['current_app'];
+ $app =
isset($GLOBALS['phpgw_info']['flags']['current_app']) ?
$GLOBALS['phpgw_info']['flags']['current_app'] : '';
}
if
(!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
{
@@ -527,24 +489,22 @@
{
return
$GLOBALS['phpgw_info']['etemplate']['extension'][$type] = False;
}
- $GLOBALS['phpgw_info']['etemplate']['extension'][$type]
= CreateObject($app.'.'.$class,$ui='html');
+ $GLOBALS['phpgw_info']['etemplate']['extension'][$type]
= createObject($app.'.'.$class,$ui='html');
return
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->human_name;
}
- function haveExtension($type,$function='')
/*
@function haveExtension
@syntax haveExtension($type)
- @author ralfbecker
@abstract checks if extension is loaded and load it if it isnt
*/
+ function haveExtension($type,$function='')
{
- return
($GLOBALS['phpgw_info']['etemplate']['extension'][$type] ||
$this->loadExtension($type,$ui)) &&
- ($function == '' ||
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->public_functions[$function]);
+ return (
(isset($GLOBALS['phpgw_info']['etemplate']['extension'][$type]) &&
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]) ||
$this->loadExtension($type)) &&
+ ($function == '' ||
(isset($GLOBALS['phpgw_info']['etemplate']['extension'][$type]->public_functions[$function])
&&
$GLOBALS['phpgw_info']['etemplate']['extension'][$type]->public_functions[$function]));
}
- function
extensionPreProcess($type,$name,&$value,&$cell,&$readonlys)
/*
@function extensionPreProcess
@syntax extensionPreProcess(&$cell,&$value,&$readonlys)
@@ -554,8 +514,8 @@
@param &$value value of the extensions content(-array)
@param &$readonlys value of the extensions
readonly-setting(-array)
@abstract executes the pre_process-function of the extension
$cell[]type]
- @author ralfbecker
*/
+ function
extensionPreProcess($type,$name,&$value,&$cell,&$readonlys)
{
if (!$this->haveExtension($type))
{
@@ -565,7 +525,6 @@
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
}
- function extensionPostProcess($type,$name,&$value,$value_in)
/*
@function extensionPostProcess
@syntax extensionPostProcess(&$cell,&$value)
@@ -573,8 +532,8 @@
@param $name form-name of this widget/field (used as a unique
index into extension_data)
@param &$value value of the extensions content(-array)
@abstract executes the post_process-function of the extension
$cell[type]
- @author ralfbecker
*/
+ function extensionPostProcess($type,$name,&$value,$value_in)
{
if (!$this->haveExtension($type,'post_process'))
{
@@ -585,13 +544,11 @@
$GLOBALS['phpgw_info']['etemplate']['loop'],$this,$value_in);
}
- function extensionRender($type,$name,&$value,&$cell,$readonly)
/*
- @function extensionRender
@syntax extensionRender(&$cell,$form_name,&$value,$readonly)
@abstract executes the render-function of the extension
$cell[type]
- @author ralfbecker
*/
+ function extensionRender($type,$name,&$value,&$cell,$readonly)
{
if (!$this->haveExtension($type,'render'))
{
@@ -601,12 +558,8 @@
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
}
- /*!
- @function isset_array
- @syntax isset_array( $arr,$idx )
- @author ralfbecker
- @abstract checks if idx, which may contain ONE subindex is set
in array
- @author ralfbecker
+ /**
+ * checks if idx, which may contain ONE subindex is set in array
*/
function isset_array($arr,$idx)
{
@@ -617,13 +570,9 @@
return isset($arr[$idx]);
}
- /*!
- @function set_array
- @syntax set_array( &$arr,$idx,$val )
- @author ralfbecker
- @abstract sets $arr[$idx] = $val
- @discussion This works for non-trival indexes like 'a[b][c]'
too: $arr['a']['b']['c'] = $val;
- @author ralfbecker
+ /**
+ * sets $arr[$idx] = $val
+ * This works for non-trival indexes like 'a[b][c]' too:
$arr['a']['b']['c'] = $val;
*/
function set_array(&$arr,$idx,$val)
{
@@ -640,14 +589,11 @@
$pos = $val;
}
- /*!
- @function get_array
- @syntax get_array( &$arr,$idx )
- @author ralfbecker
- @abstract return a var-param to $arr[$idx]
- @example $sub = get_array($arr,'a[b]'); $sub = 'c'; is
equivalent to $arr['a']['b'] = 'c';
- @discussion This works for non-trival indexes like 'a[b][c]'
too: it returns &$arr[a][b][c]
- @author ralfbecker
+ /**
+ * return a var-param to $arr[$idx]
+ *
+ * $sub = get_array($arr,'a[b]'); $sub = 'c'; is equivalent to
$arr['a']['b'] = 'c';
+ * This works for non-trival indexes like 'a[b][c]' too: it
returns &$arr[a][b][c]
*/
function &get_array(&$arr,$idx)
{
@@ -668,14 +614,11 @@
return $pos;
}
- /*!
- @function unset_array
- @syntax unset_array( &$arr,$idx )
- @author ralfbecker
- @abstract unsets $arr[$idx]
- @example unset_array($arr,'a[b]'); is equivalent to
unset($arr['a']['b']);
- @discussion This works for non-trival indexes like 'a[b][c]' too
- @author ralfbecker
+ /**
+ * unsets $arr[$idx]
+ *
+ * unset_array($arr,'a[b]'); is equivalent to
unset($arr['a']['b']);
+ * This works for non-trival indexes like 'a[b][c]' too
*/
function unset_array(&$arr,$idx)
{
@@ -692,12 +635,10 @@
unset($pos[$idx]);
}
- /*!
- @function complete_array_merge
- @syntax complete_array_merge( $old,$new )
- @author ralfbecker
- @abstract merges $old and $new, content of $new has precedence
over $old
- @discussion THIS IS NOT THE SAME AS PHP4: array_merge (as it
calls itself recursive for values which are arrays.
+ /**
+ * merges $old and $new, content of $new has precedence over
$old
+ *
+ * THIS IS NOT THE SAME AS PHP4: array_merge (as it calls
itself recursive for values which are arrays.
*/
function complete_array_merge($old,$new)
{
@@ -741,9 +682,9 @@
return $cname;
}
- /*!
- @function store_in_cache()
- @abstract stores the etemplate in the cache in phpgw_info
+ /**
+ * stores the etemplate in the cache in phpgw_info
+ *
*/
function store_in_cache()
{
@@ -781,12 +722,12 @@
return False;
}
- /*!
- @function read
- @abstract Reads an eTemplate from the cache or database /
filesystem (and updates the cache)
- @param as discripted in soetemplate::read
- @param $load_via name/array of keys of etemplate to load in
order to get $name (only as second try!)
- @result True if a fitting template is found, else False
+ /**
+ * Reads an eTemplate from the cache or database / filesystem
(and updates the cache)
+ *
+ * @param as discripted in soetemplate::read
+ * @param $load_via name/array of keys of etemplate to load in
order to get $name (only as second try!)
+ * @return True if a fitting template is found, else False
*/
function
read($name,$template='default',$lang='default',$group=0,$version='',$load_via='')
{
@@ -823,11 +764,11 @@
return True;
}
- /*!
- @function save
- @abstract saves eTemplate-object to db and update the cache
- @params keys see soetemplate::save
- @result the number of affected rows, 1 should be ok, 0
somethings wrong
+ /**
+ * saves eTemplate-object to db and update the cache
+ *
+ * keys see soetemplate::save
+ * @return the number of affected rows, 1 should be ok, 0
somethings wrong
*/
function
save($name='',$template='.',$lang='.',$group='',$version='.')
{
@@ -837,4 +778,4 @@
}
return $result;
}
- };
+ }
Index: class.date_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.date_widget.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- class.date_widget.inc.php 10 Feb 2007 16:03:46 -0000 1.16
+++ class.date_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.17
@@ -1,29 +1,20 @@
<?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.date_widget.inc.php,v 1.16 2007/02/10 16:03:46 sigurdne Exp $ */
-
- /*!
- @class date_widget
- @author ralfbecker
- @abstract widget that reads a date and/or time
- @param Options/$cell['size'] = $format[,$options],
- @param $format: ''=timestamp or eg. 'Y-m-d H:i' for 2002-12-31 23:59
- @param $options: &1 = year is int-input not selectbox, &2 = show a
[Today] button, \
- &4 = 1min steps for time (default is 5min, with fallback to
1min if value is not in 5min-steps)
- @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.date_widget.inc.php,v 1.17 2007/02/13 12:59:32 sigurdne
Exp $
+*/
+ /**
+ * widget that reads a date and/or time
+ *
+ * @param Options/$cell['size'] = $format[,$options],
+ * @param $format: ''=timestamp or eg. 'Y-m-d H:i' for 2002-12-31 23:59
+ * @param $options: &1 = year is int-input not selectbox, &2 = show a
[Today] button, \
+ * * &4 = 1min steps for time (default is 5min, with fallback to
1min if value is not in 5min-steps)
+ * This widget is independent of the UI as it only uses
etemplate-widgets and has therefor no render-function
*/
class date_widget
{
@@ -42,14 +33,14 @@
$this->timeformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'];
if ($ui == 'html')
{
- $this->jscal =
CreateObject('phpgwapi.jscalendar');
+ $this->jscal =
createObject('phpgwapi.jscalendar');
}
}
function
pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
- list($data_format,$options) =
explode(',',$cell['size']);
+ @list($data_format,$options) =
explode(',',$cell['size']);
$extension_data = $data_format;
$type = $cell['type'];
@@ -110,7 +101,7 @@
{
$format += $timeformat;
}
- if ($cell['readonly'] || $readonlys) // is readonly
+ if ((isset($cell['readonly']) && $cell['readonly']) ||
$readonlys) // is readonly
{
$sep = array(
1 => $sep[1],
@@ -120,8 +111,8 @@
);
for ($str='',$n = $type == 'date-timeonly' ? 3
: 0; $n < count($format); ++$n)
{
- $str .= ($str != '' ? $sep[$n] : '');
- $str .= $value[$format[$n]];
+ $str .= ($str != '' ? (isset($sep[$n])
? $sep[$n] : '') : '');
+ $str .= isset($value[$format[$n]]) ?
$value[$format[$n]] : '';
}
$value = $str;
$cell['type'] = 'label';
Index: class.db_tools.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.db_tools.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- class.db_tools.inc.php 10 Feb 2007 16:03:46 -0000 1.23
+++ class.db_tools.inc.php 13 Feb 2007 12:59:32 -0000 1.24
@@ -1,20 +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.db_tools.inc.php,v 1.23 2007/02/10 16:03:46 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.db_tools.inc.php,v 1.24 2007/02/13 12:59:32 sigurdne Exp
$
+*/
class db_tools
{
var $public_functions = array
@@ -30,7 +22,10 @@
var $data; // Table definitions
var $app; // used app
var $table; // used table
- var $types = array(
+ var $changes;
+
+ var $types = array
+ (
'varchar' => 'varchar',
'int' => 'int',
'auto' => 'auto',
@@ -44,49 +39,47 @@
'timestamp' => 'timestamp',
// 'abstime' => 'abstime (mysql:timestamp)',
);
- var $setup_header = '<?php
- /**************************************************************************\\
- * phpGroupWare - Setup *
- * http://www.phpgroupware.org *
- * Created by eTemplates DB-Tools written by 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. *
- \\**************************************************************************/
+ var $setup_header = '';
- /* $Id: class.db_tools.inc.php,v 1.23 2007/02/10 16:03:46 sigurdne Exp $ */
-';
-
- /*!
- @function db_tools
- @syntax db_tools( )
- @author ralfbecker
- @abstract constructor of class
+ /**
+ * constructor of class
+ *
*/
function db_tools()
{
- $this->editor =
CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
+ @set_time_limit(600); //@ to stop issues on safe_mode
installs
+ $this->editor =
createObject('etemplate.etemplate','etemplate.db-tools.edit');
$this->data = array();
if (!is_array($GLOBALS['phpgw_info']['apps']) ||
!count($GLOBALS['phpgw_info']['apps']))
{
ExecMethod('phpgwapi.applications.read_installed_apps');
}
+
+ //I know this formatting is ugly, but it needs to be
ugly for now - skwashd
+ $this->setup_header = '<?php
+/**
+* ' . $this->app . ' Setup
+*
+* @copyright Copyright (C) 2006 Free Software Foundation, Inc.
http://www.fsf.org/
+* @author Your Name <address@hidden>
+* @license http://www.gnu.org/licenses/gpl.html GNU Lesser General Public
License
+* @package etemplate
+* @version $Id: class.db_tools.inc.php,v 1.24 2007/02/13 12:59:32 sigurdne Exp
$
+*/
+';
+
}
- /*!
- @function edit
- @syntax edit( $content='',$msg='' )
- @author ralfbecker
- @abstract this is the table editor (and the
callback/submit-method too)
+ /**
+ * this is the table editor (and the callback/submit-method too)
+ *
*/
function edit($content='',$msg = '')
{
- if (isset($GLOBALS['HTTP_GET_VARS']['app']))
+ if (isset($_GET['app']))
{
- $this->app = $GLOBALS['HTTP_GET_VARS']['app'];
+ $this->app = $_GET['app'];
}
if (is_array($content))
{
@@ -97,9 +90,9 @@
$this->app = $content['app']; // this is what
the user selected
$this->table = $content['table_name'];
$posted_app = $content['posted_app']; // this
is the old selection
- $posted_table = $content['posted_table'];
+ $posted_table = isset($content['posted_table'])
? $content['posted_table'] : '';
}
- if ($posted_app && $posted_table && // user
changed app or table
+ if (isset($posted_app) && $posted_app && $posted_table
&& // user changed app or table
($posted_app != $this->app || $posted_table !=
$this->table))
{
if
($this->needs_save('',$posted_app,$posted_table,$this->content2table($content)))
@@ -131,7 +124,7 @@
{
$this->data[$posted_table] =
$this->content2table($content);
}
- if ($content['write_tables'])
+ if ( isset($content['write_tables']) &&
$content['write_tables'] )
{
if
($this->needs_save('',$this->app,$this->table,$this->data[$posted_table]))
{
@@ -139,7 +132,7 @@
}
$msg .= lang('Table unchanged, no write
necessary !!!');
}
- elseif ($content['delete'])
+ elseif ( isset($content['delete']) &&
$content['delete'] )
{
list($col) = each($content['delete']);
@@ -149,11 +142,12 @@
unset($this->data[$posted_table]['fd'][$key]);
$this->changes[$posted_table][$key] =
'**deleted**';
}
- elseif ($content['add_column'])
+ elseif ( isset($content['add_column']) &&
$content['add_column'] )
{
$this->data[$posted_table]['fd'][''] = array();
}
- elseif ($content['add_table'] || $content['import'])
+ elseif ( (isset($content['add_table']) &&
$content['add_table'])
+ || (isset($content['import']) &&
$content['import']) )
{
if (!$this->app)
{
@@ -171,8 +165,8 @@
}
else // import
{
- $oProc =
CreateObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
- $oProc->m_odb = $GLOBALS['phpgw']->db;
+ $oProc =
createObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
+ $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))
@@ -190,7 +184,7 @@
);
}
}
- elseif ($content['editor'])
+ elseif (isset($content['editor']) && $content['editor'])
{
ExecMethod('etemplate.editor.edit');
return;
@@ -226,19 +220,18 @@
array('posted_table' =>
$this->table,'posted_app' => $this->app,'changes' => $this->changes));
}
- /*!
- @function needs_save
- @syntax needs_save(
$cont='',$posted_app='',$posted_table='',$edited_table='' )
- @author ralfbecker
- @abstract checks if table was changed and if so offers user to
save changes
- @param $cont the content of the form (if called by process_exec)
- @param $posted_app the app the table is from
- @param $posted_table the table-name
- @param $edited_table the edited table-definitions
- @result only if no changes
+ /**
+ * checks if table was changed and if so offers user to save
changes
+ *
+ * @param $cont the content of the form (if called by
process_exec)
+ * @param $posted_app the app the table is from
+ * @param $posted_table the table-name
+ * @param $edited_table the edited table-definitions
+ * @return only if no changes
*/
function
needs_save($cont='',$posted_app='',$posted_table='',$edited_table='')
{
+ $msg = '';
if (!$posted_app && is_array($cont))
{
if (isset($cont['yes']))
@@ -318,13 +311,11 @@
return True; // dont continue in edit
}
- /*!
- @function table2content
- @syntax table2content( $table )
- @author ralfbecker
- @abstract creates content-array from a $table
- @param $table table-definition, eg. $phpgw_baseline[$table_name]
- @result content-array
+ /**
+ * creates content-array from a $table
+ *
+ * @param $table table-definition, eg.
$phpgw_baseline[$table_name]
+ * @return content-array
*/
function table2content($table)
{
@@ -335,10 +326,10 @@
$col_defs['pk'] =
in_array($col_name,$table['pk']);
$col_defs['uc'] =
in_array($col_name,$table['uc']);
$col_defs['ix'] =
in_array($col_name,$table['ix']);
- $col_defs['fk'] = $table['fk'][$col_name];
+ $col_defs['fk'] =
isset($table['fk'][$col_name]) ? $table['fk'][$col_name] : '';
if (isset($col_defs['default']) &&
$col_defs['default'] == '')
{
- $col_defs['default'] =
is_int($col_defs['default']) ? '0' : "''"; // spezial value for empty,
but set, default
+ $col_defs['default'] =
is_int($col_defs['default']) ? '0' : "''"; // special value for empty,
but set, default
}
$col_defs['n'] = $n;
@@ -351,14 +342,12 @@
return $content;
}
- /*!
- @function content2table
- @syntax content2table( $content )
- @author ralfbecker
- @abstract creates table-definition from posted content
- @param $content posted content-array
- @note It sets some reasonalbe defaults for not set precisions
(else setup will not install)
- @result table-definition
+ /**
+ * creates table-definition from posted content
+ *
+ * @param $content posted content-array
+ * It sets some reasonalbe defaults for not set precisions
(else setup will not install)
+ * @return table-definition
*/
function content2table($content)
{
@@ -366,7 +355,10 @@
{
$this->read($content['posted_app'],$this->data);
}
- $old_cols = $this->data[$posted_table =
$content['posted_table']]['fd'];
+
+ $posted_table = $content['posted_table'];
+ $old_cols = isset($this->data[$posted_table]) ?
$this->data[$posted_table]['fd'] : '';
+
$this->changes = $content['changes'];
$table = array();
@@ -379,12 +371,13 @@
{
$col = $content["Row$n"];
- while ((list($old_name,$old_col) =
@each($old_cols)) &&
- $this->changes[$posted_table][$old_name]
== '**deleted**') ;
+ while ( isset($this->changes[$posted_table])
+ && (list($old_name,$old_col) =
@each($old_cols))
+ &&
isset($this->changes[$posted_table][$old_name]) &&
$this->changes[$posted_table][$old_name] == '**deleted**');
if (($name = $col['name']) != '')
// ignoring lines without column-name
{
- if ($col['name'] != $old_name && $n <=
count($old_cols)) // column renamed --> remeber it
+ if (isset($old_name) && ($col['name']
!= $old_name && $n <= count($old_cols))) // column renamed --> remeber it
{
$this->changes[$posted_table][$old_name] = $col['name'];
//echo "<p>content2table:
$posted_table.$old_name renamed to $col[name]</p>\n";
@@ -439,14 +432,12 @@
return $table;
}
- /*!
- @function read
- @syntax read( $app,&$phpgw_baseline )
- @author ralfbecker
- @abstract includes $app/setup/tables_current.inc.php
- @param $app application name
- @param $phpgw_baseline where to put the data
- @result True if file found, False else
+ /**
+ * includes $app/setup/tables_current.inc.php
+ *
+ * @param $app application name
+ * @param $phpgw_baseline where to put the data
+ * @return True if file found, False else
*/
function read($app,&$phpgw_baseline)
{
@@ -472,12 +463,14 @@
function write_array($arr,$depth,$parent='')
{
+ $only_vals = false;
+ $tabs = '';
if (in_array($parent,array('pk','fk','ix','uc')))
{
$depth = 0;
if ($parent != 'fk')
{
- $only_vals = True;
+ $only_vals = true;
}
}
if ($depth)
@@ -524,14 +517,12 @@
return $def;
}
- /*!
- @function write
- @syntax write( $app,$phpgw_baseline )
- @author ralfbecker
- @abstract writes tabledefinitions $phpgw_baseline to file
/$app/setup/tables_current.inc.php
- @param $app app-name
- @param $phpgw_baseline tabledefinitions
- @return True if file writen else False
+ /**
+ * writes tabledefinitions $phpgw_baseline to file
/$app/setup/tables_current.inc.php
+ *
+ * @param $app app-name
+ * @param $phpgw_baseline tabledefinitions
+ * @return True if file writen else False
*/
function write($app,$phpgw_baseline)
{
@@ -569,7 +560,7 @@
{
return False;
}
- $def .= "\t\$phpgw_baseline = ";
+ $def = "\t\$phpgw_baseline = ";
$def .= $this->write_array($phpgw_baseline,1);
$def .= ";\n";
@@ -579,15 +570,13 @@
return True;
}
- /*!
- @function setup_version
- @syntax setup_version( $app,$new = '',$tables='' )
- @author ralfbecker
- @abstract reads and updates the version and tables info in file
$app/setup/setup.inc.php
- @param $app the app
- @param $new new version number to set, if $new != ''
- @param $tables new tables to include, if $tables != ''
- @return the version or False if the file could not be read or
written
+ /**
+ * reads and updates the version and tables info in file
$app/setup/setup.inc.php
+ *
+ * @param $app the app
+ * @param $new new version number to set, if $new != ''
+ * @param $tables new tables to include, if $tables != ''
+ * @return the version or False if the file could not be read
or written
*/
function setup_version($app,$new = '',$tables='')
{
@@ -688,15 +677,13 @@
return $new;
}
- /*!
- @function update
- @syntax update( $app,$current,$version )
- @author ralfbecker
- @abstract updates file /$app/setup/tables_update.inc.php to
reflect changes in $current
- @param $app app-name
- @param $current new tabledefinitions
- @param $version new version
- @return True if file writen else False
+ /**
+ * updates file /$app/setup/tables_update.inc.php to reflect
changes in $current
+ *
+ * @param $app app-name
+ * @param $current new tabledefinitions
+ * @param $version new version
+ * @return True if file writen else False
*/
function update($app,$current,$version)
{
@@ -738,15 +725,26 @@
$update .= "
\$test[] = '$old_version';
function $app"."_upgrade$old_version_()
- {\n";
+ {";
+ $update .= "
+ \$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();\n";
$update .= $this->update_schema($app,$current,$tables);
-
- $update .= "\n
+ $update .= "
+ if(\$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
\$GLOBALS['setup_info']['$app']['currentver'] = '$version';
+ }
return \$GLOBALS['setup_info']['$app']['currentver'];
}
?".">\n";
+
+ // $update .= "\n
+ // \$GLOBALS['setup_info']['$app']['currentver'] = '$version';
+ // return \$GLOBALS['setup_info']['$app']['currentver'];
+ //}
+//?".">\n";
+
if (!($f = fopen($file_update,'w')))
{
//echo "<p>Cant open '$update' for writing
!!!</p>\n";
@@ -776,6 +774,7 @@
$this->read($app,$old);
$tables = '';
+ $update = '';
foreach($old as $name => $table_def)
{
if (!isset($current[$name])) // table $name
droped
@@ -808,7 +807,8 @@
}
}
}
- if (is_array($this->changes[$name]))
+ if ( isset($this->changes[$name])
+ &&
is_array($this->changes[$name]) )
{
foreach($this->changes[$name]
as $col => $new_col)
{
@@ -852,12 +852,10 @@
return $update;
}
- /*!
- @function normalize
- @syntax normalize( $table )
- @author ralfbecker
- @abstract sets all nullable properties to True or False
- @result the new array
+ /**
+ * sets all nullable properties to True or False
+ *
+ * @return the new array
*/
function normalize($table)
{
@@ -865,15 +863,17 @@
foreach($table['fd'] as $col => $props)
{
- $table['fd'][$col] = array(
- 'type' => ''.$props['type'],
- 'precision' => 0+$props['precision'],
- 'scale' => 0+$props['scale'],
- 'nullable' => !!$props['nullable'],
- 'default' => ''.$props['default']
+ $table['fd'][$col] = array
+ (
+ 'type' =>
strval($props['type']),
+ 'precision' => (int)
(isset($props['precision']) ? $props['precision'] : 0),
+ 'scale' => (int)
(isset($props['scale']) ? $props['scale'] : 0),
+ 'nullable' =>
isset($props['nullable']) ? !!$props['nullable'] : false,
+ 'default' => strval(
isset($props['default']) ? $props['default'] : '' )
);
}
- return array(
+ return array
+ (
'fd' => $table['fd'],
'pk' => $table['pk'],
'fk' => $table['fk'],
@@ -882,12 +882,10 @@
);
}
- /*!
- @function tables_identical
- @syntax tables_identical( $old,$new )
- @author ralfbecker
- @abstract compares two table-definitions
- @result True if they are identical or False else
+ /**
+ * compares two table-definitions
+ *
+ * @return True if they are identical or False else
*/
function tables_identical($a,$b)
{
@@ -899,7 +897,4 @@
return $a == $b;
}
- };
-
-
-
+ }
Index: class.editor.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- class.editor.inc.php 11 Feb 2007 21:58:04 -0000 1.42
+++ class.editor.inc.php 13 Feb 2007 12:59:32 -0000 1.43
@@ -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.editor.inc.php,v 1.42 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.editor.inc.php,v 1.43 2007/02/13 12:59:32 sigurdne Exp $
+*/
class editor
@@ -82,7 +75,7 @@
$GLOBALS['phpgw']->translation->add_app($app);
// load translations for app
}
if ($app && $app != 'etemplate' &&
is_array($this->extensions) &&
- (!is_array($this->extensions['**loaded**']) ||
!$this->extensions['**loaded**'][$app]))
+ (!is_array($this->extensions['**loaded**']) ||
(!isset($this->extensions['**loaded**'][$app]) ||
!$this->extensions['**loaded**'][$app])))
{
$extensions = $this->scan_for_extensions($app);
if (count($extensions))
@@ -189,130 +182,6 @@
$no_button,$cols_spanned +
array('**extensions**' => $this->extensions));
}
-
- function edit_16($msg = '')
- {
- if (isset($_GET['name']) &&
!$this->etemplate->read($_GET))
- {
- $msg .= lang('Error: Template not found !!!');
- }
- if (!is_array($this->extensions))
- {
- $this->extensions =
$this->scan_for_extensions();
- if (count($this->extensions))
- {
- $msg .= lang('Extensions loaded:') . '
' . implode(', ',$this->extensions);
- $msg_ext_loaded = True;
- }
- }
- list($app) = explode('.',$this->etemplate->name);
- if ($app && $app != 'etemplate')
- {
- $GLOBALS['phpgw']->translation->add_app($app);
// load translations for app
- }
- if ($app && $app != 'etemplate' &&
is_array($this->extensions) &&
- (!is_array($this->extensions['**loaded**']) ||
!$this->extensions['**loaded**'][$app]))
- {
- $extensions = $this->scan_for_extensions($app);
- if (count($extensions))
- {
- $msg .=
(!$msg_ext_loaded?lang('Extensions loaded:').' ':', ') . implode(',
',$extensions);
- $this->extensions += $extensions;
- }
- $this->extensions['**loaded**'][$app] = True;
- }
- $content = $this->etemplate->as_array() + array(
- 'cols' => $this->etemplate->cols,
- 'msg' => $msg
- );
- $options = explode(',',$this->etemplate->size);
- reset($this->options);
- while (list($n,$opt) = each($this->options))
- {
- $content['options'][$opt] = $options[$n];
- }
- $cols_spanned = array();
- reset($this->etemplate->data);
- if (isset($this->etemplate->data[0]))
- {
- each($this->etemplate->data);
- }
- $no_button = array();
- while (list($row,$cols) = each($this->etemplate->data))
- {
- if ($this->etemplate->rows <= 1)
- {
- $no_button["Row$row"]['delete_row[1]']
= True;
- }
- if ($row > 1)
- {
- $no_button["Row$row"]['insert_row[0]']
= True;
- }
- $content["Row$row"] = array(
- 'height' => array("h$row" =>
$this->etemplate->data[0]["h$row"]),
- 'class' => array("c$row" =>
$this->etemplate->data[0]["c$row"])
- );
- for ($spanned = $c = 0; $c <
$this->etemplate->cols; ++$c)
- {
- if (!(list($col,$cell) = each($cols)))
- {
- $cell =
$this->etemplate->empty_cell(); // if cell gots lost, create it empty
- $col =
$this->etemplate->num2chrs($c);
- }
- if (--$spanned > 0) // preserv
spanned cells
- {
- while(list($k,$v) =
each($cell)) // so spanned (not shown) cells got
- {
// reported back like regular one
-
$cols_spanned[$col.$row][$k] = $v;
- }
- }
- else
- {
- $span = isset($cell['span']) &&
$cell['span'] ? $cell['span'] : 0;
- $spanned = $span == 'all' ?
$this->etemplate->cols-$c : 0+$span;
- unset($span);
-
- switch($cell['type']) // load
a cell-type-specific tpl
- {
- case 'vbox':
- case 'hbox':
- case 'deck':
-
$cell['cell_tpl'] = '.vbox';
- break;
- }
- $content[$col.$row] = $cell;
- }
- if ($row == 1)
- {
- $content["Col$col"] =
array('width' => array($col => $this->etemplate->data[0][$col]));
- if ($this->etemplate->cols <= 1)
- {
-
$no_button["Col$col"]['delete_col[1]'] = True;
- }
- if ($c > 0)
- {
-
$no_button["Col$col"]['insert_col[0]'] = True;
- }
- }
- }
- }
- $no_button['ColA']['exchange_col[1]'] =
$no_button['Row1']['exchange_row[1]'] = True;
-
- if ($this->debug)
- {
- echo 'editor.edit: content =';
_debug_array($content);
- }
- $types =
array_merge($this->etemplate->types,$this->extensions);
- unset($types['**loaded**']);
-
$this->editor->exec('etemplate.editor.process_edit',$content,
- array(
- 'type' => $types,
- 'align' => $this->aligns,
- 'overflow' => $this->overflows
- ),
- $no_button,$cols_spanned +
array('**extensions**' => $this->extensions));
- }
-
function swap(&$a,&$b)
{
$t = $a; $a = $b; $b = $t;
@@ -346,7 +215,7 @@
}
}
$this->etemplate->data = array($opts);
- $row = 1; $col = 0;
+ $row = 1; $col = 0; $cols = 0;
while (isset($content[$name =
$this->etemplate->num2chrs($col) . $row]))
{
$cell = &$content[$name];
@@ -922,13 +791,11 @@
),'');
}
- /*!
- @function scan_for_extensions
- @syntax scan_for_extensions( $app )
- @author ralfbecker
- @abstract search the inc-dirs of etemplate and the app whichs
template is edited for extensions / custom widgets
- @discussion extensions are class-files in
$app/inc/class.${name}_widget.inc.php
- @result array with name => human_name of the extensions found
+ /**
+ * search the inc-dirs of etemplate and the app whichs template
is edited for extensions / custom widgets
+ *
+ * extensions are class-files in
$app/inc/class.${name}_widget.inc.php
+ * @return array with name => human_name of the extensions found
*/
function scan_for_extensions($app='etemplate')
{
Index: class.etemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.etemplate.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- class.etemplate.inc.php 11 Feb 2007 21:58:04 -0000 1.9
+++ class.etemplate.inc.php 13 Feb 2007 12:59:32 -0000 1.10
@@ -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.etemplate.inc.php,v 1.9 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.etemplate.inc.php,v 1.10 2007/02/13 12:59:32 sigurdne
Exp $
+*/
if (!function_exists('get_var'))
{
Index: class.link_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.link_widget.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- class.link_widget.inc.php 10 Feb 2007 16:03:46 -0000 1.10
+++ class.link_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.11
@@ -1,28 +1,22 @@
<?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.link_widget.inc.php,v 1.10 2007/02/10 16:03:46 sigurdne Exp $ */
-
- /*!
- @class link_widget
- @author ralfbecker
- @abstract link-to: Widget to create links to an other entries of
link-aware apps
- @abstract link-list: Widget to shows the links to an entry and a Unlink
Button for each link
- @abstract link-string: comma-separated list of link-titles with a link
to its view method, value is like get_links()
- @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.link_widget.inc.php,v 1.11 2007/02/13 12:59:32 sigurdne
Exp $
+*/
+
+ /**
+ * link-to: Widget to create links to an other entries of link-aware
apps
+ *
+ * link-list: Widget to shows the links to an entry and a Unlink Button
for each link
+ *
+ * link-string: comma-separated list of link-titles with a link to its
view method, value is like get_links()
+ *
+ * This widget is independent of the UI as it only uses
etemplate-widgets and has therefor no
+ * * render-function.
*/
class link_widget
{
Index: class.nextmatch_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.nextmatch_widget.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- class.nextmatch_widget.inc.php 10 Feb 2007 16:03:46 -0000 1.17
+++ class.nextmatch_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.18
@@ -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.nextmatch_widget.inc.php,v 1.17 2007/02/10 16:03:46 sigurdne
Exp $ */
-
- /*!
- @class nextmatch_widget
- @author ralfbecker
- @abstract Widget that show only a certain number of data-rows and
allows to modifiy the rows shown (scroll).
- @discussion This widget replaces the old nextmatch-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.nextmatch_widget.inc.php,v 1.18 2007/02/13 12:59:32
sigurdne Exp $
+*/
+
+ /**
+ * Widget that show only a certain number of data-rows and allows to
modifiy the rows shown (scroll).
+ *
+ * This widget replaces the old nextmatch-class
+ * This widget is independent of the UI as it only uses
etemplate-widgets and has therefor no render-function
*/
class nextmatch_widget
{
@@ -39,7 +31,7 @@
//echo "<p>nextmatch_widget.pre_process: value = ";
_debug_array($value);
list($app,$class,$method) =
explode('.',$value['get_rows']);
- $obj = CreateObject($app.'.'.$class);
+ $obj = createObject($app.'.'.$class);
if (!is_object($obj))
{
echo "<p>nextmatch_widget::pre_process($name):
'$value[get_rows]' is no valid method !!!</p>\n";
@@ -68,12 +60,13 @@
$value['template']->data[0]['h2'] = ',1';
// disable the data row
}
$max =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $value['no_filter'] = isset($value['no_filter']) ?
$value['no_filter'] : '';
if ($total <= $max && $options && $value['search'] ==
'' &&
- ($value['no_cat'] || !$value['cat_id']) &&
+ (isset($value['no_cat']) && $value['no_cat']
|| !$value['cat_id']) &&
($value['no_filter'] || !$value['filter'] ||
$value['filter'] == 'none') &&
($value['no_filter2'] || !$value['filter2'] ||
$value['filter2'] == 'none'))
{
// disable whole nextmatch line if no scrolling
necessary
- if ($value['header_left'] ||
$value['header_right'])
+ if ((isset($value['header_left']) &&
$value['header_left']) || (isset($value['header_right']) &&
$value['header_right']))
{
$nextmatch = new
etemplate('etemplate.nextmatch_widget.header_only');
$cell['size'] = $cell['name'];
@@ -135,7 +128,7 @@
$loop = False;
$value['start'] = $old_value['start']; // need to be
set, to be reported back
- if (is_array($value['bottom'])) // we
have a second bottom-bar
+ if (isset($value['bottom']) &&
is_array($value['bottom'])) // we have a second bottom-bar
{
$inputs =
array('search','cat_id','filter','filter2');
foreach($inputs as $name)
@@ -155,7 +148,15 @@
}
unset($value['bottom']);
}
- if ($value['start_search'] || $value['search'] !=
$old_value['search'] ||
+
+ $value['search'] = isset($value['search']) ?
$value['search'] : '';
+ $old_value['search'] = isset($old_value['search']) ?
$old_value['search'] : '';
+ $value['filter'] = isset($value['filter']) ?
$value['filter'] : '';
+ $old_value['filter'] = isset($old_value['filter']) ?
$old_value['filter'] : '';
+ $value['filter2'] = isset($value['filter2']) ?
$value['filter2'] : '';
+ $old_value['filter2'] = isset($old_value['filter2']) ?
$old_value['filter2'] : '';
+
+ if ((isset($value['start_search']) &&
$value['start_search']) || ($value['search'] != $old_value['search']) ||
isset($value['cat_id']) && $value['cat_id'] !=
$old_value['cat_id'] ||
$old_value['filter'] != '' &&
isset($value['filter']) && $value['filter'] != $old_value['filter'] ||
$old_value['filter2'] != '' &&
isset($value['filter2']) && $value['filter2'] != $old_value['filter2'])
@@ -166,22 +167,22 @@
//echo "old_value ="; _debug_array($old_value);
$loop = True;
}
- elseif ($value['first'])
+ elseif (isset($value['first']) && $value['first'])
{
$value['start'] = 0;
$loop = True;
}
- elseif ($value['left'])
+ elseif (isset($value['left']) && $value['left'])
{
$value['start'] = $old_value['start'] - $max;
$loop = True;
}
- elseif ($value['right'])
+ elseif (isset($value['right']) && $value['right'])
{
$value['start'] = $old_value['start'] + $max;
$loop = True;
}
- elseif ($value['last'])
+ elseif (isset($value['last']) && $value['last'])
{
$value['start'] = (int)
(($old_value['total']-2) / $max) * $max;
$loop = True;
Index: class.sbox2.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.sbox2.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- class.sbox2.inc.php 10 Feb 2007 16:03:46 -0000 1.9
+++ class.sbox2.inc.php 13 Feb 2007 12:59:32 -0000 1.10
@@ -1,26 +1,15 @@
<?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> *
- * Based on class.sbox2.inc.php from the phpGroupWare API *
- * --------------------------------------------
*
- * 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.sbox2.inc.php,v 1.9 2007/02/10 16:03:46 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
+* @internal based on phpgwapi/sbox2
+* @package etemplate
+* @version $Id: class.sbox2.inc.php,v 1.10 2007/02/13 12:59:32 sigurdne Exp $
+*/
- if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
- {
- include(PHPGW_API_INC . '/class.sbox.inc.php');
- $GLOBALS['phpgw_info']['flags']['included_classes']['sbox'] =
True;
- }
+ include_once(PHPGW_API_INC . '/class.sbox.inc.php');
class sbox2 extends sbox
{
@@ -126,7 +115,7 @@
{
if (!is_object($this->bocal))
{
- $this->bocal =
createobject('calendar.bocalendar');
+ $this->bocal =
createObject('calendar.bocalendar');
}
if (!is_array($event) && (int) $event > 0)
{
@@ -172,7 +161,7 @@
{
if (!is_object($this->bocal))
{
- $this->bocal =
createobject('calendar.bocalendar');
+ $this->bocal =
createObject('calendar.bocalendar');
}
if ($query_name)
{
@@ -237,7 +226,7 @@
// echo
"<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
{
- $contacts = createobject('phpgwapi.contacts');
+ $contacts = createObject('phpgwapi.contacts');
if ($query_name)
{
@@ -269,7 +258,7 @@
if (!is_array($addr))
{
$home = substr($addr,-1) == 'h';
- $contacts = createobject('phpgwapi.contacts');
+ $contacts = createObject('phpgwapi.contacts');
list( $addr ) = $contacts->read_single_entry(
intval($addr) );
}
if ($home)
@@ -303,7 +292,7 @@
// echo
"<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
{
- $contacts = createobject('phpgwapi.contacts');
+ $contacts = createObject('phpgwapi.contacts');
if ($query_name)
{
@@ -360,7 +349,7 @@
}
if ($id_name || $query_name)
{
- $projects = createobject('projects.boprojects');
+ $projects = createObject('projects.boprojects');
if (!is_object($projects))
{
return '';
@@ -492,8 +481,8 @@
if (!is_array($account_data))
{
- $accounts =
createobject('phpgwapi.accounts',$id);
- $accounts->db = $GLOBALS['phpgw']->db;
+ $accounts =
createObject('phpgwapi.accounts',$id);
+ $accounts->db =& $GLOBALS['phpgw']->db;
$accounts->read_repository();
$account_data = $accounts->data;
}
@@ -516,8 +505,8 @@
*/
function
getAccount($name,$id,$longnames=0,$type='accounts',$multiple=0,$options='')
{
- $accounts = createobject('phpgwapi.accounts');
- $accounts->db = $GLOBALS['phpgw']->db;
+ $accounts = createObject('phpgwapi.accounts');
+ $accounts->db =& $GLOBALS['phpgw']->db;
$accs = $accounts->get_list($type);
if ($multiple < 0)
@@ -559,7 +548,7 @@
{
if (!is_object($this->cat))
{
- $this->cat =
CreateObject('phpgwapi.categories');
+ $this->cat =
createObject('phpgwapi.categories');
}
if ($jscript)
{
Index: class.select_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.select_widget.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- class.select_widget.inc.php 12 Feb 2007 14:45:37 -0000 1.12
+++ class.select_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.13
@@ -5,7 +5,7 @@
* @author Ralf Becker <address@hidden>
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
* @package etemplate
-* @version $Id: class.select_widget.inc.php,v 1.12 2007/02/12 14:45:37
sigurdne Exp $
+* @version $Id: class.select_widget.inc.php,v 1.13 2007/02/13 12:59:32
sigurdne Exp $
*/
/**
@@ -511,7 +511,7 @@
$apps = array();
foreach ($GLOBALS['phpgw_info']['apps']
as $app => $data)
{
- if (!$type2 ||
$GLOBALS['phpgw_info']['user']['apps'][$app])
+ if (!$type2 ||
(isset($GLOBALS['phpgw_info']['user']['apps'][$app]) &&
$GLOBALS['phpgw_info']['user']['apps'][$app]))
{
$apps[$app] =
$data['title'] ? $data['title'] : lang($app);
}
Index: class.so_sql.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.so_sql.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- class.so_sql.inc.php 10 Feb 2007 16:03:46 -0000 1.9
+++ class.so_sql.inc.php 13 Feb 2007 12:59:32 -0000 1.10
@@ -1,37 +1,29 @@
<?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.so_sql.inc.php,v 1.9 2007/02/10 16:03:46 sigurdne Exp $ */
-
-/*!
address@hidden so_sql
address@hidden ralfbecker
address@hidden generalized SQL Storage Object
address@hidden the class can be used in following ways:
address@hidden 1) by calling the constructor with an app and table-name or
address@hidden 2) by setting the following class-vars in a class derifed from
this one
address@hidden Of cause can you derife the class and call the constructor with
params.
address@hidden $table_name need to be set in the derived class to the
db-table-name
address@hidden $autoinc_id db-col-name of autoincrement id or ''
address@hidden $db_key_cols array of all primary-key-columns in form dbName =>
internalName
address@hidden the save function does NOT touch any other cols in the table!!!
address@hidden $db_data_cols array of all data-cols
address@hidden $debug turns on debug-messages
address@hidden $empty_on_write string to be written to db if a col-value is '',
eg. "''" or 'NULL' (default)
address@hidden $non_db_cols all cols in data which are not (direct)in the db,
for data_merge
+/**
+* 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.so_sql.inc.php,v 1.10 2007/02/13 12:59:32 sigurdne Exp $
*/
+
+/**
+ * generalized SQL Storage Object
+ *
+ * the class can be used in following ways:
+ * 1) by calling the constructor with an app and table-name or
+ * 2) by setting the following class-vars in a class derifed from this one
+ * Of cause can you derife the class and call the constructor with params.
+ * @param $table_name need to be set in the derived class to the db-table-name
+ * @param $autoinc_id db-col-name of autoincrement id or ''
+ * @param $db_key_cols array of all primary-key-columns in form dbName =>
internalName
+ * the save function does NOT touch any other cols in the table!!!
+ * @param $db_data_cols array of all data-cols
+ * @param $debug turns on debug-messages
+ * @param $empty_on_write string to be written to db if a col-value is '', eg.
"''" or 'NULL' (default)
+ * @param $non_db_cols all cols in data which are not (direct)in the db, for
data_merge
+ */
class so_sql
{
var $public_functions = array(
@@ -53,17 +45,15 @@
var $empty_on_write = 'NULL';
var $non_db_cols = array();
- /*!
- @function so_sql
- @syntax so_sql( $app='',$table='' )
- @author ralfbecker
- @abstract constructor of the class
- @discussion NEED to be called from the constructor of the derived class
- @param $app, $table should be set if table-defs to be read from
<app>/setup/tables_current.inc.php
+ /**
+ * constructor of the class
+ *
+ * NEED to be called from the constructor of the derived class
+ * @param $app, $table should be set if table-defs to be read from
<app>/setup/tables_current.inc.php
*/
function so_sql($app='',$table='')
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db =& $GLOBALS['phpgw']->db;
$this->db_cols = $this->db_key_cols + $this->db_data_cols;
if ($app && $table)
@@ -79,13 +69,11 @@
}
}
- /*!
- @function setup_table
- @syntax setup_table( $app,$table )
- @author ralfbecker
- @abstract reads table-definition from <app>/setup/tables_current.inc.php
- @discussion Does NOT set a different internal-data-name. If you want
this, you have to do so
- @discussion in a derifed class !!!
+ /**
+ * reads table-definition from <app>/setup/tables_current.inc.php
+ *
+ * Does NOT set a different internal-data-name. If you want this, you
have to do so
+ * in a derifed class !!!
*/
function setup_table($app,$table)
{
@@ -124,12 +112,10 @@
}
}
- /*!
- @function so_data_merge
- @syntax so_data_merge( $new )
- @author ralfbecker
- @abstract merges in new values from the given new data-array
- @param $new array in form col => new_value with values to set
+ /**
+ * merges in new values from the given new data-array
+ *
+ * @param $new array in form col => new_value with values to set
*/
function data_merge($new)
{
@@ -153,12 +139,12 @@
}
}
- /*!
- @function db2data
- @abstract changes the data from the db-format to your work-format
- @discussion it gets called everytime when data is read from the db
- @discussion This function needs to be reimplemented in the derived class
- @param $data if given works on that array and returns result, else
works on internal data-array
+ /**
+ * changes the data from the db-format to your work-format
+ *
+ * it gets called everytime when data is read from the db
+ * This function needs to be reimplemented in the derived class
+ * @param $data if given works on that array and returns result, else
works on internal data-array
*/
function db2data($data=0)
{
@@ -175,12 +161,12 @@
return $data;
}
- /*!
- @function data2db
- @abstract changes the data from your work-format to the db-format
- @discussion It gets called everytime when data gets writen into db or
on keys for db-searches
- @discussion this needs to be reimplemented in the derived class
- @param $data if given works on that array and returns result, else
works on internal data-array
+ /**
+ * changes the data from your work-format to the db-format
+ *
+ * It gets called everytime when data gets writen into db or on keys for
db-searches
+ * this needs to be reimplemented in the derived class
+ * @param $data if given works on that array and returns result, else
works on internal data-array
*/
function data2db($data=0)
{
@@ -197,11 +183,11 @@
return $data;
}
- /*!
- @function init
- @abstract initializes data with the content of key
- @param $keys array with keys in form internalName => value
- @result void
+ /**
+ * initializes data with the content of key
+ *
+ * @param $keys array with keys in form internalName => value
+ * @return void
*/
function init($keys=array())
{
@@ -212,11 +198,11 @@
$this->data_merge($keys);
}
- /*!
- @function read
- @abstract reads row matched by key and puts all cols in the data array
- @param $keys array with keys in form internalName => value, may be a
scalar value if only one key
- @result data array if row could be retrived else False and data =
array()
+ /**
+ * reads row matched by key and puts all cols in the data array
+ *
+ * @param $keys array with keys in form internalName => value, may be a
scalar value if only one key
+ * @return data array if row could be retrived else False and data =
array()
*/
function read($keys)
{
@@ -277,11 +263,10 @@
return $this->data;
}
- /*!
- @function save
- @abstracts saves the content of data to the db
- @param $keys if given $keys are copied to data before saveing => allows
a save as
- @result 0 on success and errno != 0 else
+ /**
+ * saves the content of data to the db
+ * @param $keys if given $keys are copied to data before saveing =>
allows a save as
+ * @return 0 on success and errno != 0 else
*/
function save($keys='')
{
@@ -340,11 +325,11 @@
return $this->db->errno;
}
- /*!
- @function delete
- @abstract deletes row representing keys in internal data or the
supplied $keys if != ''
- @param $keys if not '', array with col => value pairs to characterise
the rows to delete
- @result affected rows, should be 1 if ok, 0 if an error
+ /**
+ * deletes row representing keys in internal data or the supplied $keys
if != ''
+ *
+ * @param $keys if not '', array with col => value pairs to characterise
the rows to delete
+ * @return affected rows, should be 1 if ok, 0 if an error
*/
function delete($keys='')
{
@@ -379,18 +364,18 @@
return $this->db->affected_rows();
}
- /*!
- @function search
- @abstract searches db for rows matching searchcriteria
- @discussion '*' and '?' are replaced with sql-wildcards '%' and '_'
- @param $criteria array of key and data cols, OR a SQL query (content
for WHERE), fully quoted (!)
- @param $only_keys True returns only keys, False returns all cols
- @param $order_by fieldnames + {ASC|DESC} separated by colons ','
- @param $extra_cols string to be added to the SELECT, eg. (count(*) as
num)
- @param $wildcard string appended befor and after each criteria
- @param $empty False=empty criteria are ignored in query, True=empty
have to be empty in row
- @param $op defaults to 'AND', can be set to 'OR' too, then criteria's
are OR'ed together
- @result array of matching rows (the row is an array of the cols) or
False
+ /**
+ * searches db for rows matching searchcriteria
+ *
+ * '*' and '?' are replaced with sql-wildcards '%' and '_'
+ * @param $criteria array of key and data cols, OR a SQL query (content
for WHERE), fully quoted (!)
+ * @param $only_keys True returns only keys, False returns all cols
+ * @param $order_by fieldnames + {ASC|DESC} separated by colons ','
+ * @param $extra_cols string to be added to the SELECT, eg. (count(*) as
num)
+ * @param $wildcard string appended befor and after each criteria
+ * @param $empty False=empty criteria are ignored in query, True=empty
have to be empty in row
+ * @param $op defaults to 'AND', can be set to 'OR' too, then criteria's
are OR'ed together
+ * @return array of matching rows (the row is an array of the cols) or
False
*/
function
search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND')
{
@@ -435,13 +420,11 @@
return $n ? $arr : False;
}
- /*!
- @function not_unique
- @syntax not_unique( $data='' )
- @author ralfbecker
- @abstract Check if values for unique keys are unique
- @param $data data-set to check, defaults to $this->data
- @result 0: all keys are unique, 1: first key not unique, 2: ...
+ /**
+ * Check if values for unique keys are unique
+ *
+ * @param $data data-set to check, defaults to $this->data
+ * @return 0: all keys are unique, 1: first key not unique, 2: ...
*/
function not_unique($data='')
{
@@ -470,4 +453,4 @@
}
return 0;
}
-};
+}
Index: class.soetemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- class.soetemplate.inc.php 11 Feb 2007 21:58:04 -0000 1.35
+++ class.soetemplate.inc.php 13 Feb 2007 12:59:32 -0000 1.36
@@ -1,37 +1,29 @@
<?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.soetemplate.inc.php,v 1.35 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.soetemplate.inc.php,v 1.36 2007/02/13 12:59:32 sigurdne
Exp $
+*/
- /*!
- @class soetemplate
- @author ralfbecker
- @abstract Storage Objects: Everything to store and retrive the
eTemplates.
- @discussion eTemplates are stored in the db in table 'phpgw_etemplate'
and gets distributed
- @discussion through the file 'etemplates.inc.php' in the setup dir of
each app. That file gets
- @discussion automatically imported in the db, whenever you show a
eTemplate of the app. For
- @discussion performace reasons the timestamp of the file is stored in
the db, so 'new'
- @discussion eTemplates need to have a newer file. The distribution-file
is generated with the
- @discussion function dump, usually by pressing a button in the editor.
- @discussion writeLangFile writes an lang-file with all Labels,
incorporating an existing one.
- @discussion Beside a name eTemplates use the following keys to find the
most suitable template
- @discussion for an user (in order of precedence):
- @discussion 1) User-/Group-Id (not yet implemented)
- @discussion 2) preferd languages of the user (templates for all langs
have $lang='')
- @discussion 3) selected template: verdilak, ... (the default is called
'' in the db, not default)
- @discussion 4) a version-number of the form, eg: '0.9.13.001' (filled
up with 0 same size)
+ /**
+ * Storage Objects: Everything to store and retrive the eTemplates.
+ *
+ * eTemplates are stored in the db in table 'phpgw_etemplate' and gets
distributed
+ * through the file 'etemplates.inc.php' in the setup dir of each app.
That file gets
+ * automatically imported in the db, whenever you show a eTemplate of
the app. For
+ * performace reasons the timestamp of the file is stored in the db, so
'new'
+ * eTemplates need to have a newer file. The distribution-file is
generated with the
+ * function dump, usually by pressing a button in the editor.
+ * writeLangFile writes an lang-file with all Labels, incorporating an
existing one.
+ * Beside a name eTemplates use the following keys to find the most
suitable template
+ * for an user (in order of precedence):
+ * 1) User-/Group-Id (not yet implemented)
+ * 2) preferd languages of the user (templates for all langs have
$lang='')
+ * 3) selected template: verdilak, ... (the default is called '' in
the db, not default)
+ * 4) a version-number of the form, eg: '0.9.13.001' (filled up with 0
same size)
*/
class soetemplate
{
@@ -71,11 +63,10 @@
);
var $db_cols;
- /*!
- @function soetemplate
- @abstract constructor of the class
- @syntax
soetemplate($name='',$template='',$lang='',$group=0,$version='',$rows=2,$cols=2)
- @param as read
+ /**
+ * constructor of the class
+ *
+ * @param as read
*/
function
soetemplate($name='',$template='',$lang='',$group=0,$version='',$rows=2,$cols=2)
{
@@ -127,16 +118,15 @@
);
}
- /*!
- @function new_cell
- @abstract constructs a new cell in a give row or the last row,
not existing rows will be created
- @syntax new_cell( $row=False )
- @param int $row row-number starting with 1 (!)
- @param string $type type of the cell
- @param string $label label for the cell
- @param string $name name of the cell (index in the
content-array)
- @param array $attributes other attributes for the cell
- @returns a reference to the new cell, use $new_cell =
&$tpl->new_cell(); (!)
+ /**
+ * constructs a new cell in a give row or the last row, not
existing rows will be created
+ *
+ * @param int $row row-number starting with 1 (!)
+ * @param string $type type of the cell
+ * @param string $label label for the cell
+ * @param string $name name of the cell (index in the
content-array)
+ * @param array $attributes other attributes for the cell
+ * @return a reference to the new cell, use $new_cell =
&$tpl->new_cell(); (!)
*/
function
&new_cell($row=False,$type='label',$label='',$name='',$attributes=False)
{
@@ -173,10 +163,9 @@
return $cell;
}
- /*!
- @function set_rows_cols()
- @abstract initialises rows & cols from the size of the
data-array
- @syntax set_rows_cols()
+ /**
+ * initialises rows & cols from the size of the data-array
+ *
*/
function set_rows_cols()
{
@@ -239,58 +228,14 @@
}
}
- /*!
- @function init
- @abstract initialises all internal data-structures of the
eTemplate and sets the keys
- @syntax
init($name='',$template='',$lang='',$group=0,$version='',$rows=1,$cols=1)
- @param $name name of the eTemplate or array with the keys or
all data
- @param $template,$lang,$group,$version see class
- @param $rows,$cols initial size of the template
- */
- function
init_16($name='',$template='',$lang='',$group=0,$version='',$rows=1,$cols=1)
- {
- reset($this->db_cols);
- while (list($db_col,$col) = each($this->db_cols))
- {
- $this->$col = is_array($name) ? $name[$col] :
$$col;
- }
- if ($this->template == 'default')
- {
- $this->template = '';
- }
- if ($this->lang == 'default')
- {
- $this->lang = '';
- }
- $this->tpls_in_file = is_array($name) ?
$name['tpls_in_file'] : 0;
-
- if (is_array($name) && isset($name['data']))
- {
- $this->set_rows_cols();
- return; // data already set
- }
- $this->size = $this->style = '';
- $this->data = array(0 => array());
- $this->rows = $rows < 0 ? 1 : $rows;
- $this->cols = $cols < 0 ? 1 : $cols;
- for ($row = 1; $row <= $rows; ++$row)
- {
- for ($col = 0; $col < $cols; ++$col)
- {
-
$this->data[$row][$this->num2chrs($col)] = $this->empty_cell();
- }
- }
- }
-
- /*!
- @function read
- @abstract Reads an eTemplate from the database
- @syntax
read($name,$template='default',$lang='default',$group=0,$version='')
- @param as discripted with the class, with the following
exeptions
- @param $template as '' loads the prefered template 'default'
loads the default one '' in the db
- @param $lang as '' loads the pref. lang 'default' loads the
default one '' in the db
- @param $group is NOT used / implemented yet
- @result True if a fitting template is found, else False
+ /**
+ * Reads an eTemplate from the database
+ *
+ * @param as discripted with the class, with the following
exeptions
+ * @param $template as '' loads the prefered template 'default'
loads the default one '' in the db
+ * @param $lang as '' loads the pref. lang 'default' loads the
default one '' in the db
+ * @param $group is NOT used / implemented yet
+ * @return True if a fitting template is found, else False
*/
function
read($name,$template='default',$lang='default',$group=0,$version='')
{
@@ -299,9 +244,8 @@
{
echo
"<p>soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
}
- if
(isset($GLOBALS['phpgw_info']['server']['eTemplate-source'])
- &&
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' ||
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt')
- && $this->readfile())
+ if
(isset($GLOBALS['phpgw_info']['server']['eTemplate-source']) &&
($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' ||
+
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt') &&
$this->readfile())
{
return True;
}
@@ -359,16 +303,15 @@
return True;
}
- /*!
- @function readfile
- @abstract Reads an eTemplate from the filesystem, the keys are
already set by init in read
- @syntax readfile()
- @result True if a template is found, else False
+ /**
+ * Reads an eTemplate from the filesystem, the keys are already
set by init in read
+ *
+ * @return True if a template is found, else False
*/
function readfile()
{
list($app,$name) = split("\.",$this->name,2);
- $template = $this->template == '' ? 'default' :
$this->template;
+ $template = $this->template == '' ? 'base' :
$this->template;
if ($this->lang)
{
@@ -377,6 +320,7 @@
$first_try = $ext =
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt' ? '.xsl' :
'.xet';
while ((!$lang || address@hidden($file =
PHPGW_SERVER_ROOT . "/$app/templates/$template/$name$lang$ext") &&
+ address@hidden($file =
PHPGW_SERVER_ROOT . "/$app/templates/base/$name$lang$ext") &&
address@hidden($file =
PHPGW_SERVER_ROOT . "/$app/templates/default/$name$lang$ext")) &&
address@hidden($file = PHPGW_SERVER_ROOT .
"/$app/templates/$template/$name$ext") &&
address@hidden($file = PHPGW_SERVER_ROOT .
"/$app/templates/default/$name$ext"))
@@ -435,16 +379,14 @@
return True;
}
- /*!
- @function search
- @syntax
search($name,$template='default',$lang='default',$group=0,$version='')
- @author ralfbecker
- @abstract Lists the eTemplates matching the given criteria
- @param as discripted with the class, with the following
exeptions
- @param $template as '' loads the prefered template 'default'
loads the default one '' in the db
- @param $lang as '' loads the pref. lang 'default' loads the
default one '' in the db
- @param $group is NOT used / implemented yet
- @result array of arrays with the template-params
+ /**
+ * Lists the eTemplates matching the given criteria
+ *
+ * @param as discripted with the class, with the following
exeptions
+ * @param $template as '' loads the prefered template 'default'
loads the default one '' in the db
+ * @param $lang as '' loads the pref. lang 'default' loads the
default one '' in the db
+ * @param $group is NOT used / implemented yet
+ * @return array of arrays with the template-params
*/
function
search($name,$template='default',$lang='default',$group=0,$version='')
{
@@ -500,10 +442,9 @@
return $result;
}
- /*!
- @function db2obj
- @abstract copies all cols into the obj and unserializes the
data-array
- @syntax db2obj()
+ /**
+ * copies all cols into the obj and unserializes the data-array
+ *
*/
function db2obj()
{
@@ -537,15 +478,13 @@
$this->set_rows_cols();
}
- /*!
- @function compress_array
- @syntax compress_array( $arr )
- @author ralfbecker
- @abstract to save space in the db all empty values in the array
got unset
- @discussion The never-'' type field ensures a cell does not
disapear completely.
- @discussion Calls it self recursivly for arrays / the rows
- @param $arr the array to compress
- @result the compressed array
+ /**
+ * to save space in the db all empty values in the array got
unset
+ *
+ * The never-'' type field ensures a cell does not disapear
completely.
+ * Calls it self recursivly for arrays / the rows
+ * @param $arr the array to compress
+ * @return the compressed array
*/
function compress_array($arr)
{
@@ -567,12 +506,11 @@
return $arr;
}
- /*!
- @function as_array
- @abstract returns obj-data as array
- @syntax as_array($data_too=0)
- @param $data_too 0 = no data array, 1 = data array too, 2 =
serialize data array
- @result the array
+ /**
+ * returns obj-data as array
+ *
+ * @param $data_too 0 = no data array, 1 = data array too, 2 =
serialize data array
+ * @return the array
*/
function as_array($data_too=0)
{
@@ -580,7 +518,7 @@
reset($this->db_cols);
while (list($db_col,$col) = each($this->db_cols))
{
- if ($col != 'data' || $data_too)
+ if (isset($this->$col) && ($col != 'data' ||
$data_too) )
{
$arr[$col] = isset($this->$col) ?
$this->$col : '';
}
@@ -595,12 +533,11 @@
return $arr;
}
- /*!
- @function save
- @abstract saves eTemplate-object to db, can be used as saveAs
by giving keys as params
- @syntax
save($name='',$template='.',$lang='.',$group='',$version='.')
- @params keys see class
- @result the number of affected rows, 1 should be ok, 0
somethings wrong
+ /**
+ * saves eTemplate-object to db, can be used as saveAs by giving
keys as params
+ *
+ * keys see class
+ * @return the number of affected rows, 1 should be ok, 0
somethings wrong
*/
function
save($name='',$template='.',$lang='.',$group='',$version='.')
{
@@ -682,11 +619,10 @@
return $this->db->affected_rows();
}
- /*!
- @function delete
- @abstract Deletes the eTemplate from the db, object itself is
unchanged
- @syntax delete()
- @result the number of affected rows, 1 should be ok, 0
somethings wrong
+ /**
+ * Deletes the eTemplate from the db, object itself is unchanged
+ *
+ * @return the number of affected rows, 1 should be ok, 0
somethings wrong
*/
function delete()
{
@@ -699,12 +635,11 @@
return $this->db->affected_rows();
}
- /*!
- @function dump2setup
- @abstract dumps all eTemplates to
<app>/setup/etemplates.inc.php for distribution
- @syntax dump2setup($app)
- @param $app app- or template-name
- @result the number of templates dumped as message
+ /**
+ * dumps all eTemplates to <app>/setup/etemplates.inc.php for
distribution
+ *
+ * @param $app app- or template-name
+ * @return the number of templates dumped as message
*/
function dump2setup($app)
{
@@ -776,12 +711,11 @@
}
}
- /*!
- @function getToTranslate
- @abstract extracts all texts: labels and helptexts from an
eTemplate-object
- @discussion some extensions use a '|' to squezze multiple texts
in a label or help field
- @syntax getToTranslate()
- @result array with messages as key AND value
+ /**
+ * extracts all texts: labels and helptexts from an
eTemplate-object
+ *
+ * some extensions use a '|' to squezze multiple texts in a
label or help field
+ * @return array with messages as key AND value
*/
function getToTranslate()
{
@@ -806,12 +740,11 @@
return $to_trans;
}
- /*!
- @function getToTranslateApp
- @abstract Read all eTemplates of an app an extracts the texts
to an array
- @syntax getToTranslateApp($app)
- @param $app name of the app
- @result the array with texts
+ /**
+ * Read all eTemplates of an app an extracts the texts to an
array
+ *
+ * @param $app name of the app
+ * @return the array with texts
*/
function getToTranslateApp($app)
{
@@ -835,15 +768,14 @@
return $to_trans;
}
- /*!
- @function writeLangFile
- @abstract Write new lang-file using the existing one and all
text from the eTemplates
- @syntax writeLangFile($app,$lang='en',$additional='')
- @param $app app- or template-name
- @param $lang language the messages in the template are,
defaults to 'en'
- @param $additional extra texts to translate, if you pass here
an array with all messages and
- @param select-options they get writen too (form is
<unique key> => <message>)
- @result message with number of messages written (total and new)
+ /**
+ * Write new lang-file using the existing one and all text from
the eTemplates
+ *
+ * @param $app app- or template-name
+ * @param $lang language the messages in the template are,
defaults to 'en'
+ * @param $additional extra texts to translate, if you pass here
an array with all messages and
+ * @param select-options they get writen too (form is <unique
key> => <message>)
+ * @return message with number of messages written (total and
new)
*/
function writeLangFile($app,$lang='en',$additional='')
{
@@ -918,12 +850,11 @@
return lang("%1 (%2 new) Messages writen for
Application '%3' and Languages '%4'",$n,$new,$app,$lang);
}
- /*!
- @function import_dump
- @abstract Imports the dump-file /$app/setup/etempplates.inc.php
unconditional (!)
- @syntax import_dump($app)
- @param $app app name
- @result message with number of templates imported
+ /**
+ * Imports the dump-file /$app/setup/etempplates.inc.php
unconditional (!)
+ *
+ * @param $app app name
+ * @return message with number of templates imported
*/
function import_dump($app)
{
@@ -946,13 +877,12 @@
return lang("%1 new eTemplates imported for Application
'%2'",$n,$app);
}
- /*!
- @function test_import
- @abstract test if new template-import necessary for app and
does the import
- @discussion Get called on every read of a eTemplate, caches the
result in phpgw_info.
- @discussion The timestamp of the last import for app gets
written into the db.
- @syntax test_import($app)
- @param $app app- or template-name
+ /**
+ * test if new template-import necessary for app and does the
import
+ *
+ * Get called on every read of a eTemplate, caches the result in
phpgw_info.
+ * The timestamp of the last import for app gets written into
the db.
+ * @param $app app- or template-name
*/
function test_import($app) // should be done from the
setup-App
{
@@ -965,8 +895,7 @@
$GLOBALS['phpgw_info']['etemplate']['import_tested'][$app] = True; // need
to be done before new ...
$path =
PHPGW_SERVER_ROOT."/$app/setup/etemplates.inc.php";
-
- $ret = '';
+ $ret = false;
if ($time = @filemtime($path))
{
$templ = new soetemplate(".$app",'','##');
Index: class.solangfile.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.solangfile.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- class.solangfile.inc.php 10 Feb 2007 16:03:46 -0000 1.4
+++ class.solangfile.inc.php 13 Feb 2007 12:59:32 -0000 1.5
@@ -1,18 +1,11 @@
<?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. *
- * --------------------------------------------
*
- * 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.solangfile.inc.php,v 1.4 2007/02/10 16:03:46 sigurdne Exp $ */
-
+/**
+* eTemplate - basic application development environment
+* @copyright Copyright (C) 2002-2006 Free Software Foundation, Inc.
http://www.fsf.org/
+* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+* @package etemplate
+* @version $Id: class.solangfile.inc.php,v 1.5 2007/02/13 12:59:32 sigurdne
Exp $
+*/
class solangfile
{
var $total;
@@ -40,7 +33,7 @@
function solangfile()
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db =& $GLOBALS['phpgw']->db;
}
function parse_php_app($fd,$plist)
@@ -129,10 +122,10 @@
return($plist);
}
- /*!
- @function add_app
- @abstract loads all app phrases into langarray
- @param $lang user lang variable (defaults to en)
+ /**
+ * loads all app phrases into langarray
+ *
+ * @param $lang user lang variable (defaults to en)
*/
function add_app($app,$userlang='en')
{
@@ -180,10 +173,10 @@
return $this->langarray;
}
- /*!
- @function load_app
- @abstract loads all app phrases into langarray
- @param $lang user lang variable (defaults to en)
+ /**
+ * loads all app phrases into langarray
+ *
+ * @param $lang user lang variable (defaults to en)
*/
function load_app($app,$userlang='en')
{
Index: class.tab_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.tab_widget.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- class.tab_widget.inc.php 10 Feb 2007 16:03:46 -0000 1.15
+++ class.tab_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.16
@@ -1,26 +1,17 @@
<?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.tab_widget.inc.php,v 1.15 2007/02/10 16:03:46 sigurdne Exp $ */
-
- /*!
- @class tab_widget
- @author ralfbecker
- @abstract widget that shows one row of tabs and an other row with the
eTemplate of the selected tab
- @discussion see the example in 'etemplate.tab_widget.test' (use show to
view it)
- @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.tab_widget.inc.php,v 1.16 2007/02/13 12:59:32 sigurdne
Exp $
+*/
+ /**
+ * widget that shows one row of tabs and an other row with the
eTemplate of the selected tab
+ *
+ * see the example in 'etemplate.tab_widget.test' (use show to view it)
+ * This widget is independent of the UI as it only uses
etemplate-widgets and has therefor no render-function
*/
class tab_widget
{
@@ -128,7 +119,7 @@
{
$stab = new
etemplate($selected_tab,$tmpl->as_array());
$options =
array_pad(explode(',',$stab->size),3,'');
- $options[3] = ($options[3]!= '' ? $options[3].'
':'') . 'tab_body';
+ $options[3] = (isset($options[3]) &&
$options[3]!= '' ? $options[3].' ':'') . 'tab_body';
$stab->size = implode(',',$options);
$tab_widget->set_cell_attribute('@body','obj',$stab);
}
Index: class.uietemplate.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- class.uietemplate.inc.php 12 Feb 2007 14:45:37 -0000 1.77
+++ class.uietemplate.inc.php 13 Feb 2007 12:59:32 -0000 1.78
@@ -1,35 +1,26 @@
<?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.uietemplate.inc.php,v 1.77 2007/02/12 14:45:37 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.uietemplate.inc.php,v 1.78 2007/02/13 12:59:32 sigurdne
Exp $
+*/
include_once(PHPGW_INCLUDE_ROOT .
'/etemplate/inc/class.boetemplate.inc.php');
- /*!
- @class etemplate
- @author ralfbecker
- @abstract creates dialogs / HTML-forms from eTemplate descriptions
- @discussion etemplate or uietemplate extends boetemplate, all vars and
public functions are inherited
- @example $tmpl =
CreateObject('etemplate.etemplate','app.template.name');
- @example $tmpl->exec('app.class.callback',$content_to_show);
- @example This creates a form from the eTemplate 'app.template.name' and
takes care that
- @example the method / public function 'callback' in (bo)class 'class'
of 'app' gets called
- @example if the user submitts the form. Vor the complete param's see
the description of exec.
- @param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
- @param 3=calls to show_cell OR template-
or cell-type name
- @param $html instances of html class used to generate the html
+ /**
+ * creates dialogs / HTML-forms from eTemplate descriptions
+ *
+ * etemplate or uietemplate extends boetemplate, all vars and public
functions are inherited
+ * $tmpl = createObject('etemplate.etemplate','app.template.name');
+ * $tmpl->exec('app.class.callback',$content_to_show);
+ * This creates a form from the eTemplate 'app.template.name' and takes
care that
+ * the method / public function 'callback' in (bo)class 'class' of
'app' gets called
+ * if the user submitts the form. Vor the complete param's see the
description of exec.
+ * @param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
+ * @param 3=calls to show_cell OR
template- or cell-type name
+ * @param $html instances of html class used to generate the html
*/
class etemplate extends boetemplate
{
@@ -38,11 +29,11 @@
var $html; // instance of html-class
var $class_conf = array('nmh' => 'th','nmr0' => 'row_on','nmr1'
=> 'row_off');
- /*!
- @function etemplate
- @abstract constructor of etemplate class, reads an eTemplate if
$name is given
- @param $name name of etemplate or array with name and other
keys
- @param $load_via name/array with keys of other etemplate to
load in order to get $name
+ /**
+ * constructor of etemplate class, reads an eTemplate if $name
is given
+ *
+ * @param $name name of etemplate or array with name and other
keys
+ * @param $load_via name/array with keys of other etemplate to
load in order to get $name
*/
function etemplate($name='',$load_via='')
{
@@ -190,6 +181,7 @@
if
(address@hidden'phpgw_info']['etemplate']['hooked'] &&
(!isset($_GET['menuaction']) ||
strstr($_SERVER['PHP_SELF'],'process_exec.php')))
{
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false; // this get wrongfullfy
picked up somewhere when writing langfiles
$GLOBALS['phpgw']->common->phpgw_footer();
}
}
@@ -370,7 +362,7 @@
{
$disabled = substr($disabled,1);
}
- list($val,$check_val) = $vals = explode('=',$disabled);
+ @list($val,$check_val) = $vals = explode('=',$disabled);
if ($val[0] == '@')
{
@@ -440,7 +432,7 @@
if (!(list($r_key) = each($this->data)))
// no further row
{
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->autorepeat_idx((isset($cols['B']) ? $cols['B'] :
''),1,$r,$idx,$idx_cname) && $idx_cname) ||
!$this->isset_array($content,$idx))
{
break;
// no auto-row-repeat
@@ -451,7 +443,7 @@
$cols = &$this->data[$r_key];
if(isset($opts["h$row"]))
{
- list($height,$disabled) =
explode(',',$opts["h$row"]);
+ @list($height,$disabled) =
explode(',',$opts["h$row"]);
}
else
{
@@ -1438,7 +1430,8 @@
}
$name = $this->expand_name(isset($cell['name']) ?
$cell['name'] : '',$show_c,$show_row,$content['.c'],$content['.row'],$content);
- $name_parts = explode('[',str_replace(']','',$name));
+ $name_parts = isset($name) && !is_object($name) ?
explode('[',str_replace(']','',$name)) : array();
+
if (!empty($cname))
{
array_unshift($name_parts,$cname);
@@ -1448,7 +1441,8 @@
{
$form_name .= '['.implode('][',$name_parts).']';
}
- $value = $this->get_array($content,$name);
+
+ $value = !is_object($name) ?
$this->get_array($content,$name) : '';
if ((isset($readonly) && $readonly = $cell['readonly'])
|| (@$readonlys[$name] && !is_array($readonlys[$name])) ||
(isset($readonlys['__ALL__']) && $readonlys['__ALL__']))
{
@@ -1661,8 +1655,6 @@
if ($value != '' && strstr($style,'i'))
$value = $this->html->italic($value);
$html .= $value;
break;
-
-
case 'html':
$extra_link = $cell_options;
$html .= $value;
@@ -1723,12 +1715,10 @@
if (!isset($readonly) || !$readonly)
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
break;
-
-
case 'checkbox':
if (!empty($cell_options))
{
-
list($true_val,$false_val,$ro_true,$ro_false) = explode(',',$cell_options);
+
@list($true_val,$false_val,$ro_true,$ro_false) = explode(',',$cell_options);
$value = $value == $true_val;
}
else
@@ -1760,7 +1750,7 @@
{
$options .= ' CHECKED';
}
- if ($readonly)
+ if (isset($readonly) && $readonly)
{
$html .= $value == $set_val ?
$this->html->bold('x') : '';
}
@@ -1803,13 +1793,13 @@
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 ($this->java_script() &&
isset($cell['onchange']) && $cell['onchange'] != '' && (!isset($cell['needed'])
|| !$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>';
+ (strlen($label)
<= 1 || (isset($cell['no_lang']) && $cell['no_lang']) ? $label : lang($label))
. '</a>';
}
else // use custom javascript
{
@@ -1842,8 +1832,6 @@
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
}
break;
-
-
case 'hrule':
$html .= $this->html->hr($cell_options);
break;
@@ -1946,7 +1934,7 @@
}
if (isset($readonly) && $readonly)
{
- $html .= $cell['no_lang'] ?
$sels[$value] : lang($sels[$value]);
+ $html .= $cell['no_lang'] ?
(isset($sels[$value])?$sels[$value]:'') : lang($sels[$value]);
}
else
{
@@ -1958,7 +1946,7 @@
case 'image':
$image = $value != '' ? $value : $name;
$image =
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
- $image,strlen($label) > 1 &&
!$cell['no_lang'] ? lang($label) : $label,'BORDER="0"');
+ $image,strlen($label) > 1 &&
(!isset($cell['no_lang']) || !$cell['no_lang']) ? lang($label) :
$label,'BORDER="0"');
$html .= $image;
$extra_link = $cell_options;
$extra_label = False;
Index: class.uietemplate_gtk.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.uietemplate_gtk.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- class.uietemplate_gtk.inc.php 10 Feb 2007 16:03:46 -0000 1.15
+++ class.uietemplate_gtk.inc.php 13 Feb 2007 12:59:32 -0000 1.16
@@ -1,31 +1,25 @@
<?php
-
/**************************************************************************\
- * phpGroupWare - EditableTemplates - GTK User Interface
*
- * http://www.phpgroupware.org
*
- * 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.uietemplate_gtk.inc.php,v 1.15 2007/02/10 16:03:46
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.uietemplate_gtk.inc.php,v 1.16 2007/02/13 12:59:32
sigurdne Exp $
+*/
include_once(PHPGW_INCLUDE_ROOT .
'/etemplate/inc/class.boetemplate.inc.php');
- /*!
- @class etemplate
- @author ralfbecker
- @abstract creates dialogs / HTML-forms from eTemplate descriptions
- @discussion etemplate or uietemplate extends boetemplate, all vars and
public functions are inherited
- @example $tmpl =
CreateObject('etemplate.etemplate','app.template.name');
- @example $tmpl->exec('app.class.callback',$content_to_show);
- @example This creates a form from the eTemplate 'app.template.name' and
takes care that
- @example the method / public function 'callback' in (bo)class 'class'
of 'app' gets called
- @example if the user submitts the form. Vor the complete param's see
the description of exec.
- @param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
- @param 3=calls to show_cell OR template-
or cell-type name
+ /**
+ * creates dialogs / HTML-forms from eTemplate descriptions
+ *
+ * etemplate or uietemplate extends boetemplate, all vars and public
functions are inherited
+ * $tmpl = createObject('etemplate.etemplate','app.template.name');
+ * $tmpl->exec('app.class.callback',$content_to_show);
+ * This creates a form from the eTemplate 'app.template.name' and takes
care that
+ * the method / public function 'callback' in (bo)class 'class' of
'app' gets called
+ * if the user submitts the form. Vor the complete param's see the
description of exec.
+ * @param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
+ * @param 3=calls to show_cell OR
template- or cell-type name
*/
class etemplate extends boetemplate
{
@@ -41,10 +35,10 @@
);
var $font_width=8;
- /*!
- @function etemplate
- @abstract constructor of etemplate class, reads an eTemplate if
$name is given
- @param as soetemplate.read
+ /**
+ * constructor of etemplate class, reads an eTemplate if $name
is given
+ *
+ * @param as soetemplate.read
*/
function
etemplate($name='',$template='default',$lang='default',$group=0,$version='',$rows=2,$cols=2)
{
@@ -61,24 +55,24 @@
return True;
}
- /*!
- @function exec
- @abstract Generats a Dialog from an eTemplate - abstract the
UI-layer
- @discussion This is the only function an application should
use, all other are INTERNAL and
- @discussion do NOT abstract the UI-layer, because they return
HTML.
- @discussion Generates a webpage with a form from the template
and puts process_exec in the
- @discussion form as submit-url to call process_show for the
template before it
- @discussion ExecuteMethod's the given $methode of the caller.
- @param $methode Methode (e.g. 'etemplate.editor.edit') to be
called if form is submitted
- @param $content Array with content to fill the input-fields of
template, eg. the text-field
- @param with name 'name' gets its content from
$content['name']
- @param $sel_options Array or arrays with the options for each
select-field, keys are the
- @param field-names, eg. array('name' => array(1 =>
'one',2 => 'two')) set the
- @param options for field 'name'.
($content['options-name'] is possible too !!!)
- @param $readonlys Array with field-names as keys for fields
with should be readonly
- @param (eg. to implement ACL grants on field-level
or to remove buttons not applicable)
- @param $preserv Array with vars which should be transported to
the $method-call (eg. an id) array('id' => $id) sets $HTTP_POST_VARS['id'] for
the $method-call
- @result nothing
+ /**
+ * Generats a Dialog from an eTemplate - abstract the UI-layer
+ *
+ * This is the only function an application should use, all
other are INTERNAL and
+ * do NOT abstract the UI-layer, because they return HTML.
+ * Generates a webpage with a form from the template and puts
process_exec in the
+ * form as submit-url to call process_show for the template
before it
+ * ExecuteMethod's the given $methode of the caller.
+ * @param $methode Methode (e.g. 'etemplate.editor.edit') to be
called if form is submitted
+ * @param $content Array with content to fill the input-fields
of template, eg. the text-field
+ * @param with name 'name' gets its content from
$content['name']
+ * @param $sel_options Array or arrays with the options for
each select-field, keys are the
+ * @param field-names, eg. array('name' => array(1
=> 'one',2 => 'two')) set the
+ * @param options for field 'name'.
($content['options-name'] is possible too !!!)
+ * @param $readonlys Array with field-names as keys for fields
with should be readonly
+ * @param (eg. to implement ACL grants on
field-level or to remove buttons not applicable)
+ * @param $preserv Array with vars which should be transported
to the $method-call (eg. an id) array('id' => $id) sets $_POST['id'] for the
$method-call
+ * @return nothing
*/
function
exec($method,$content,$sel_options='',$readonlys='',$preserv='')
{
@@ -152,10 +146,10 @@
ExecMethod($method,array_merge($this->result,$preserv));
}
- /*!
- @function process_show
- @abstract this is only an empty function for the GTK ui
- @result the adjusted content (in the simplest case that would
be $content)
+ /**
+ * this is only an empty function for the GTK ui
+ *
+ * @return the adjusted content (in the simplest case that
would be $content)
*/
function process_show(&$content,$readonlys='')
{
@@ -249,22 +243,22 @@
}
}
- /*!
- @function show
- @abstract creates HTML from an eTemplate
- @discussion This is done by calling show_cell for each cell in
the form. show_cell itself
- @discussion calls show recursivly for each included eTemplate.
- @discussion You can use it in the UI-layer of an app, just make
shure to call process_show !!!
- @discussion This is intended as internal function and should
NOT be called by new app's direct,
- @discussion as it deals with HTML and is so UI-dependent, use
exec instead.
- @param $content array with content for the cells, keys are the
names given in the cells/form elements
- @param $sel_options array with options for the selectboxes,
keys are the name of the selectbox
- @param $readonlys array with names of cells/form-elements to be
not allowed to change
- @param This is to facilitate complex ACL's which
denies access on field-level !!!
- @param $cname basename of names for form-elements, means index
in $HTTP_POST_VARS
- @param eg. $cname='cont', element-name = 'name' returned
content in $HTTP_POST_VARS['cont']['name']
- @param $show_xxx row,col name/index for name expansion
- @result the generated HTML
+ /**
+ * creates HTML from an eTemplate
+ *
+ * This is done by calling show_cell for each cell in the form.
show_cell itself
+ * calls show recursivly for each included eTemplate.
+ * You can use it in the UI-layer of an app, just make shure to
call process_show !!!
+ * This is intended as internal function and should NOT be
called by new app's direct,
+ * as it deals with HTML and is so UI-dependent, use exec
instead.
+ * @param $content array with content for the cells, keys are
the names given in the cells/form elements
+ * @param $sel_options array with options for the selectboxes,
keys are the name of the selectbox
+ * @param $readonlys array with names of cells/form-elements to
be not allowed to change
+ * @param This is to facilitate complex ACL's which
denies access on field-level !!!
+ * @param $cname basename of names for form-elements, means
index in $_POST
+ * @param eg. $cname='cont', element-name = 'name'
returned content in $_POST['cont']['name']
+ * @param $show_xxx row,col name/index for name expansion
+ * @return the generated HTML
*/
function
show(&$result,$content,$sel_options='',$readonlys='',$cname='',$show_c=0,$show_row=0)
{
@@ -428,13 +422,13 @@
$event->area->x, $event->area->y);
}
- /*!
- @function show_cell
- @abstract generates HTML for 1 input-field / cell
- @discussion calls show to generate included eTemplates. Again
only an INTERMAL function.
- @param $cell array with data of the cell: name, type, ...
- @param for rest see show
- @result the generated HTML
+ /**
+ * generates HTML for 1 input-field / cell
+ *
+ * calls show to generate included eTemplates. Again only an
INTERMAL function.
+ * @param $cell array with data of the cell: name, type, ...
+ * @param for rest see show
+ * @return the generated HTML
*/
function
show_cell($cell,$content,$sel_options,$readonlys,$cname,$show_c,$show_row,&$span,&$result)
{
@@ -775,4 +769,4 @@
}
return $hbox ? $hbox : $widget;
}
- };
+ }
Index: class.xmltool.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.xmltool.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- class.xmltool.inc.php 10 Feb 2007 16:03:46 -0000 1.6
+++ class.xmltool.inc.php 13 Feb 2007 12:59:32 -0000 1.7
@@ -1,4 +1,12 @@
<?php
+/**
+* eTemplate - basic application development environment
+* @copyright Assumming Copyright (C) 2002-2006 Free Software Foundation, Inc.
http://www.fsf.org/
+* @author ???
+* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
+* @package etemplate
+* @version $Id: class.xmltool.inc.php,v 1.7 2007/02/13 12:59:32 sigurdne Exp $
+*/
function var2xml($name, $data)
{
$doc = new xmltool('root','','');
Index: class.xslt_widget.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.xslt_widget.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- class.xslt_widget.inc.php 10 Feb 2007 16:03:46 -0000 1.4
+++ class.xslt_widget.inc.php 13 Feb 2007 12:59:32 -0000 1.5
@@ -1,27 +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.xslt_widget.inc.php,v 1.4 2007/02/10 16:03:46 sigurdne Exp $ */
-
- /*!
- @class xslt_widget
- @author ralfbecker
- @abstract widget that generates its html-output via a xslt file with
its in $options and the content as xml
- @discussion The following data is placed in the xml:
value,name,label(translated),statustext(translated),readonly
- @discussion and all widget-attributes as descript in the referenz,
using there xml-names.
- @discussion This widget is generating html, so it does not work
(without an extra implementation) in an other UI
+/**
+* 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.xslt_widget.inc.php,v 1.5 2007/02/13 12:59:32 sigurdne
Exp $
+*/
+ /**
+ * widget that generates its html-output via a xslt file with its in
$options and the content as xml
+ *
+ * The following data is placed in the xml:
value,name,label(translated),statustext(translated),readonly
+ * and all widget-attributes as descript in the referenz, using there
xml-names.
+ * This widget is generating html, so it does not work (without an
extra implementation) in an other UI
*/
class xslt_widget
{
@@ -34,7 +25,7 @@
function xslt_widget($ui='')
{
- $this->xslttemplates =
CreateObject('phpgwapi.xslttemplates',PHPGW_INCLUDE_ROOT);
+ $this->xslttemplates =
createObject('phpgwapi.xslttemplates',PHPGW_INCLUDE_ROOT);
switch($ui)
{
Index: class.xul_io.inc.php
===================================================================
RCS file: /sources/phpgroupware/etemplate/inc/class.xul_io.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- class.xul_io.inc.php 12 Feb 2007 22:39:32 -0000 1.27
+++ class.xul_io.inc.php 13 Feb 2007 12:59:32 -0000 1.28
@@ -1,20 +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.xul_io.inc.php,v 1.27 2007/02/12 22:39:32 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.xul_io.inc.php,v 1.28 2007/02/13 12:59:32 sigurdne Exp $
+*/
if (!function_exists('var2xml'))
{
@@ -117,7 +109,7 @@
{
$spanned = $val
== 'all' ? 999 : $val - 1;
}
- list($attr,$set) =
explode('=',$attr);
+ @list($attr,$set) =
explode('=',$attr);
$widget->set_attribute($attr,$set != '' ? $set : $val);
}
}
- [Phpgroupware-cvs] etemplate/inc class.boetemplate.inc.php class.d...,
Sigurd Nes <=