mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 06:50:35 +01:00
fixed php5.2.6 problem: unknown type ''
This commit is contained in:
parent
ecd3948175
commit
f66e2e4004
File diff suppressed because it is too large
Load Diff
@ -67,7 +67,7 @@ class soetemplate
|
|||||||
/**
|
/**
|
||||||
* widgets that contain other widgets, eg. for tree_walk method
|
* widgets that contain other widgets, eg. for tree_walk method
|
||||||
* widget-type is the key, the value specifys how the children are stored.
|
* widget-type is the key, the value specifys how the children are stored.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
static $widgets_with_children = array(
|
static $widgets_with_children = array(
|
||||||
@ -79,7 +79,7 @@ class soetemplate
|
|||||||
'groupbox' => 'box',
|
'groupbox' => 'box',
|
||||||
'deck' => 'box',
|
'deck' => 'box',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor of the class
|
* constructor of the class
|
||||||
*
|
*
|
||||||
@ -143,7 +143,7 @@ class soetemplate
|
|||||||
{
|
{
|
||||||
$min = ord('A');
|
$min = ord('A');
|
||||||
$max = ord('Z') - $min + 1;
|
$max = ord('Z') - $min + 1;
|
||||||
|
|
||||||
$num = 1+ord($chrs{0})-$min;
|
$num = 1+ord($chrs{0})-$min;
|
||||||
if (strlen($chrs) > 1)
|
if (strlen($chrs) > 1)
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ class soetemplate
|
|||||||
);
|
);
|
||||||
if ($attributes && is_array($attributes))
|
if ($attributes && is_array($attributes))
|
||||||
{
|
{
|
||||||
return array_merge($attributes,$cell);
|
$cell += $attributes;
|
||||||
}
|
}
|
||||||
return $cell;
|
return $cell;
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialises internal vars rows & cols from the data of the first (!) grid
|
* initialises internal vars rows & cols from the data of the first (!) grid
|
||||||
*
|
*
|
||||||
@ -328,7 +328,7 @@ class soetemplate
|
|||||||
{
|
{
|
||||||
// unset children and data as they are referenzes to each other
|
// unset children and data as they are referenzes to each other
|
||||||
unset($this->children); unset($this->data);
|
unset($this->children); unset($this->data);
|
||||||
|
|
||||||
foreach(self::$db_cols as $db_col => $col)
|
foreach(self::$db_cols as $db_col => $col)
|
||||||
{
|
{
|
||||||
if ($col != 'data') $this->$col = is_array($name) ? (string) $name[$col] : $$col;
|
if ($col != 'data') $this->$col = is_array($name) ? (string) $name[$col] : $$col;
|
||||||
@ -342,7 +342,7 @@ class soetemplate
|
|||||||
$this->lang = '';
|
$this->lang = '';
|
||||||
}
|
}
|
||||||
$this->tpls_in_file = is_array($name) ? $name['tpls_in_file'] : 0;
|
$this->tpls_in_file = is_array($name) ? $name['tpls_in_file'] : 0;
|
||||||
|
|
||||||
if (is_array($name) && $name['onclick_handler']) $this->onclick_handler = $name['onclick_handler'];
|
if (is_array($name) && $name['onclick_handler']) $this->onclick_handler = $name['onclick_handler'];
|
||||||
|
|
||||||
if (is_array($name) && isset($name['data']))
|
if (is_array($name) && isset($name['data']))
|
||||||
@ -439,7 +439,7 @@ class soetemplate
|
|||||||
return $this->readfile() && (empty($version) || $version == $this->version);
|
return $this->readfile() && (empty($version) || $version == $this->version);
|
||||||
}
|
}
|
||||||
$this->db2obj($row);
|
$this->db2obj($row);
|
||||||
|
|
||||||
if ($this->debug == $this->name)
|
if ($this->debug == $this->name)
|
||||||
{
|
{
|
||||||
$this->echo_tmpl();
|
$this->echo_tmpl();
|
||||||
@ -595,7 +595,7 @@ class soetemplate
|
|||||||
|
|
||||||
foreach (self::$db_cols as $db_col => $name)
|
foreach (self::$db_cols as $db_col => $name)
|
||||||
{
|
{
|
||||||
if ($name != 'data')
|
if ($name != 'data')
|
||||||
{
|
{
|
||||||
$this->$name = $row[$db_col];
|
$this->$name = $row[$db_col];
|
||||||
}
|
}
|
||||||
@ -606,14 +606,14 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
$this->fix_old_template_format();
|
$this->fix_old_template_format();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test if we have an old/original template-format and fixes it to the new format
|
* test if we have an old/original template-format and fixes it to the new format
|
||||||
*/
|
*/
|
||||||
function fix_old_template_format()
|
function fix_old_template_format()
|
||||||
{
|
{
|
||||||
if (!is_array($this->children)) $this->children = array();
|
if (!is_array($this->children)) $this->children = array();
|
||||||
|
|
||||||
if (!isset($this->children[0]['type']))
|
if (!isset($this->children[0]['type']))
|
||||||
{
|
{
|
||||||
// old templates are treated as having one children of type grid (the original template)
|
// old templates are treated as having one children of type grid (the original template)
|
||||||
@ -717,9 +717,9 @@ class soetemplate
|
|||||||
/**
|
/**
|
||||||
* returns obj-data/-vars as array
|
* returns obj-data/-vars as array
|
||||||
*
|
*
|
||||||
* the returned array ($data_too > 0) can be used with init to recreate the template
|
* the returned array ($data_too > 0) can be used with init to recreate the template
|
||||||
*
|
*
|
||||||
* @param int $data_too -1 = only keys, 0 = no data array, 1 = data array too, 2 = serialize data array,
|
* @param int $data_too -1 = only keys, 0 = no data array, 1 = data array too, 2 = serialize data array,
|
||||||
* 3 = only data values and data serialized
|
* 3 = only data values and data serialized
|
||||||
* @param boolean $db_keys use db-column-names or internal names, default false=internal names
|
* @param boolean $db_keys use db-column-names or internal names, default false=internal names
|
||||||
* @return array with template-data
|
* @return array with template-data
|
||||||
@ -754,11 +754,11 @@ class soetemplate
|
|||||||
$arr[$db_keys ? $db_col : $col] = $this->$col;
|
$arr[$db_keys ? $db_col : $col] = $this->$col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($data_too != -1 && $this->tpls_in_file && !$db_keys)
|
if ($data_too != -1 && $this->tpls_in_file && !$db_keys)
|
||||||
{
|
{
|
||||||
$arr['tpls_in_file'] = $this->tpls_in_file;
|
$arr['tpls_in_file'] = $this->tpls_in_file;
|
||||||
}
|
}
|
||||||
if ($data_too != -1 && $this->onclick_handler && !$db_keys)
|
if ($data_too != -1 && $this->onclick_handler && !$db_keys)
|
||||||
{
|
{
|
||||||
$arr['onclick_handler'] = $this->onclick_handler;
|
$arr['onclick_handler'] = $this->onclick_handler;
|
||||||
}
|
}
|
||||||
@ -893,7 +893,7 @@ class soetemplate
|
|||||||
fwrite($f,'<?php
|
fwrite($f,'<?php
|
||||||
/**
|
/**
|
||||||
* eGroupWare - eTemplates for Application '. $app. '
|
* eGroupWare - eTemplates for Application '. $app. '
|
||||||
* http://www.egroupware.org
|
* http://www.egroupware.org
|
||||||
* generated by soetemplate::dump4setup() '.date('Y-m-d H:i'). '
|
* generated by soetemplate::dump4setup() '.date('Y-m-d H:i'). '
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
@ -932,7 +932,7 @@ class soetemplate
|
|||||||
$to_trans = array();
|
$to_trans = array();
|
||||||
|
|
||||||
$this->widget_tree_walk(array('soetemplate','getToTranslateCell'),$to_trans);
|
$this->widget_tree_walk(array('soetemplate','getToTranslateCell'),$to_trans);
|
||||||
|
|
||||||
//echo '<b>'.$this->name.'</b>'; _debug_array($to_trans);
|
//echo '<b>'.$this->name.'</b>'; _debug_array($to_trans);
|
||||||
return $to_trans;
|
return $to_trans;
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ class soetemplate
|
|||||||
$tpls = $this->search($app);
|
$tpls = $this->search($app);
|
||||||
|
|
||||||
$tpl =& new soetemplate; // to not alter our own data
|
$tpl =& new soetemplate; // to not alter our own data
|
||||||
|
|
||||||
while (list(,$keys) = each($tpls))
|
while (list(,$keys) = each($tpls))
|
||||||
{
|
{
|
||||||
if (($keys['name'] != $last['name'] || // write only newest version
|
if (($keys['name'] != $last['name'] || // write only newest version
|
||||||
@ -1110,7 +1110,7 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prints/echos the template's content, eg. for debuging
|
* prints/echos the template's content, eg. for debuging
|
||||||
*
|
*
|
||||||
@ -1120,7 +1120,7 @@ class soetemplate
|
|||||||
function echo_tmpl($backtrace=true,$no_other_objs=true)
|
function echo_tmpl($backtrace=true,$no_other_objs=true)
|
||||||
{
|
{
|
||||||
static $objs = array('db','html','xul_io');
|
static $objs = array('db','html','xul_io');
|
||||||
|
|
||||||
if ($backtrace) echo "<p>".function_backtrace(1)."</p>\n";
|
if ($backtrace) echo "<p>".function_backtrace(1)."</p>\n";
|
||||||
|
|
||||||
if ($no_other_objs)
|
if ($no_other_objs)
|
||||||
@ -1132,7 +1132,7 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_debug_array($this);
|
_debug_array($this);
|
||||||
|
|
||||||
if ($no_other_objs)
|
if ($no_other_objs)
|
||||||
{
|
{
|
||||||
foreach($objs as $obj)
|
foreach($objs as $obj)
|
||||||
@ -1147,12 +1147,12 @@ class soetemplate
|
|||||||
* applys a function to each widget in the children tree of the template
|
* applys a function to each widget in the children tree of the template
|
||||||
*
|
*
|
||||||
* The function should be defined as [&]func([&]$widget,[&]$extra[,$path])
|
* The function should be defined as [&]func([&]$widget,[&]$extra[,$path])
|
||||||
* If the function returns anything but null or sets $extra['__RETURN__NOW__'] (func has to reference $extra !!!),
|
* If the function returns anything but null or sets $extra['__RETURN__NOW__'] (func has to reference $extra !!!),
|
||||||
* the walk stops imediatly and returns that result
|
* the walk stops imediatly and returns that result
|
||||||
*
|
*
|
||||||
* Only some widgets have a sub-tree of children: *box, grid, template, ...
|
* Only some widgets have a sub-tree of children: *box, grid, template, ...
|
||||||
* For them we call tree_walk($widget,$func,$extra) instead of func direct
|
* For them we call tree_walk($widget,$func,$extra) instead of func direct
|
||||||
*
|
*
|
||||||
* Please note: as call_user_func_array does not return references, methods ($func is an array) can not either!!!
|
* Please note: as call_user_func_array does not return references, methods ($func is an array) can not either!!!
|
||||||
*
|
*
|
||||||
* @param string/array $func function to use or array($obj,'method')
|
* @param string/array $func function to use or array($obj,'method')
|
||||||
@ -1186,16 +1186,16 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* applys a function to each child in the tree of a widget (incl. the widget itself)
|
* applys a function to each child in the tree of a widget (incl. the widget itself)
|
||||||
*
|
*
|
||||||
* The function should be defined as [&]func([&]$widget,[&]$extra[,$path]) [] = optional
|
* The function should be defined as [&]func([&]$widget,[&]$extra[,$path]) [] = optional
|
||||||
* If the function returns anything but null or sets $extra['__RETURN__NOW__'] (func has to reference $extra !!!),
|
* If the function returns anything but null or sets $extra['__RETURN__NOW__'] (func has to reference $extra !!!),
|
||||||
* the walk stops imediatly and returns that result
|
* the walk stops imediatly and returns that result
|
||||||
*
|
*
|
||||||
* Only some widgets have a sub-tree of children: *box, grid, template, ...
|
* Only some widgets have a sub-tree of children: *box, grid, template, ...
|
||||||
* For performance reasons the function use recursion only if a widget with children contains
|
* For performance reasons the function use recursion only if a widget with children contains
|
||||||
* a further widget with children.
|
* a further widget with children.
|
||||||
*
|
*
|
||||||
* @param array $widget the widget(-tree) the function should be applied too
|
* @param array $widget the widget(-tree) the function should be applied too
|
||||||
@ -1219,7 +1219,7 @@ class soetemplate
|
|||||||
{
|
{
|
||||||
$result =& $func($widget,$extra,$path);
|
$result =& $func($widget,$extra,$path);
|
||||||
}
|
}
|
||||||
if (!is_null($result) || is_array($extra) && isset($extra['__RETURN__NOW__']) ||
|
if (!is_null($result) || is_array($extra) && isset($extra['__RETURN__NOW__']) ||
|
||||||
!isset(soetemplate::$widgets_with_children[$widget['type']]))
|
!isset(soetemplate::$widgets_with_children[$widget['type']]))
|
||||||
{
|
{
|
||||||
return $result;
|
return $result;
|
||||||
@ -1278,7 +1278,7 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'template':
|
case 'template':
|
||||||
if (!isset($widget['obj']) && $widget['name'][0] != '@')
|
if (!isset($widget['obj']) && $widget['name'][0] != '@')
|
||||||
{
|
{
|
||||||
@ -1286,13 +1286,13 @@ class soetemplate
|
|||||||
if (!$widget['obj']->read($widget['name'])) $widget['obj'] = false;
|
if (!$widget['obj']->read($widget['name'])) $widget['obj'] = false;
|
||||||
}
|
}
|
||||||
if (!is_object($widget['obj'])) break; // cant descent into template
|
if (!is_object($widget['obj'])) break; // cant descent into template
|
||||||
|
|
||||||
$result =& $widget['obj']->widget_tree_walk($func,$extra,$path.'/');
|
$result =& $widget['obj']->widget_tree_walk($func,$extra,$path.'/');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extracts all translatable labels from a widget
|
* extracts all translatable labels from a widget
|
||||||
*
|
*
|
||||||
@ -1319,14 +1319,14 @@ class soetemplate
|
|||||||
}
|
}
|
||||||
foreach($strings as $str)
|
foreach($strings as $str)
|
||||||
{
|
{
|
||||||
if (strlen($str) > 1 && $str{0} != '@' && $str{0} != '$' &&
|
if (strlen($str) > 1 && $str{0} != '@' && $str{0} != '$' &&
|
||||||
strpos($str,'$row') === false && strpos($str,'$cont') === false)
|
strpos($str,'$row') === false && strpos($str,'$cont') === false)
|
||||||
{
|
{
|
||||||
$to_trans[trim(strtolower($str))] = $str;
|
$to_trans[trim(strtolower($str))] = $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init our static vars
|
* init our static vars
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user