forked from extern/egroupware
reworked etemplate to have static methods and use the new features of egw_db- & html-class
This commit is contained in:
parent
b16e63fd6f
commit
e90a3d3a83
@ -1,30 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* eGroupWare EditableTemplates - Business Objects
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @copyright 2002-8 by RalfBecker@outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.soetemplate.inc.php');
|
||||
|
||||
/**
|
||||
/**
|
||||
* Business Object for eTemplates, extending the Storage Object
|
||||
*
|
||||
* Not so much so far, as the most logic is still in the UI-class
|
||||
*
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @author RalfBecker-AT-outdoor-training.de
|
||||
* @license GPL
|
||||
*/
|
||||
class boetemplate extends soetemplate
|
||||
{
|
||||
var $extensions = array();
|
||||
|
||||
class boetemplate extends soetemplate
|
||||
{
|
||||
var $types = array(
|
||||
'label' => 'Label', // Label $cell['label'] is (to be translated) textual content
|
||||
'text' => 'Text', // Textfield 1 Line (size = [length][,maxlength])
|
||||
@ -52,7 +45,7 @@
|
||||
'deck' => 'Deck', // a container of elements where only one is visible, size = # of elem.
|
||||
'passwd' => 'Password' // a text of type password
|
||||
);
|
||||
var $garbage_collection_done;
|
||||
private static $garbage_collection_done;
|
||||
|
||||
/**
|
||||
* constructor of class
|
||||
@ -78,7 +71,6 @@
|
||||
{
|
||||
$this->init($name);
|
||||
}
|
||||
$this->garbage_collection_done =& $GLOBALS['egw_info']['etemplate']['garbage_collection_done'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +84,7 @@
|
||||
* @param array $content the content-array in the context of the grid
|
||||
* @return boolean true if the row/col is disabled or false if not
|
||||
*/
|
||||
function check_disabled($disabled,$content)
|
||||
protected function check_disabled($disabled,$content)
|
||||
{
|
||||
if ($this->onclick_handler && !$this->no_onclick)
|
||||
{
|
||||
@ -133,7 +125,6 @@
|
||||
* 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" !!!
|
||||
*
|
||||
* @static
|
||||
* @param sring $name the name to expand
|
||||
* @param int $c is the column index starting with 0 (if you have row-headers, data-cells start at 1)
|
||||
* @param int $row is the row number starting with 0 (if you have col-headers, data-cells start at 1)
|
||||
@ -147,7 +138,7 @@
|
||||
* "del[$cont[id]]" expands to "del[123]" if $cont = array('id' => 123)
|
||||
* @return string the expanded name
|
||||
*/
|
||||
function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
|
||||
static function expand_name($name,$c,$row,$c_='',$row_='',$cont='')
|
||||
{
|
||||
$is_index_in_content = $name[0] == '@';
|
||||
if (strpos($name,'$') !== false)
|
||||
@ -234,8 +225,9 @@
|
||||
|
||||
/**
|
||||
* creates a new appsession-id via microtime()
|
||||
* @return string
|
||||
*/
|
||||
function appsession_id()
|
||||
protected static function appsession_id()
|
||||
{
|
||||
list($msec,$sec) = explode(' ',microtime());
|
||||
$time = 100 * $sec + (int)(100 * $msec); // gives precision of 1/100 sec
|
||||
@ -256,17 +248,17 @@
|
||||
* @param string $id the id to use or '' to generate a new id
|
||||
* @return string location-id
|
||||
*/
|
||||
function save_appsession($data,$id='')
|
||||
protected static function save_appsession($data,$id='')
|
||||
{
|
||||
if (!$id)
|
||||
{
|
||||
$id = $this->appsession_id();
|
||||
$id = self::appsession_id();
|
||||
}
|
||||
$GLOBALS['egw']->session->appsession($id,'etemplate',$data);
|
||||
|
||||
if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4' && !$this->garbage_collection_done)
|
||||
if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4' && !self::$garbage_collection_done)
|
||||
{
|
||||
return $this->php4_session_garbage_collection();
|
||||
return self::php_session_garbage_collection();
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
@ -277,14 +269,14 @@
|
||||
* @param string $id the location-id
|
||||
* @return array with session-data
|
||||
*/
|
||||
function get_appsession($id)
|
||||
protected function get_appsession($id)
|
||||
{
|
||||
$data = $GLOBALS['egw']->session->appsession($id,'etemplate');
|
||||
//echo "boetemplate::get_appsession('$id')"; _debug_array($data);
|
||||
|
||||
if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4')
|
||||
{
|
||||
$this->php4_session_garbage_collection($id);
|
||||
self::php_session_garbage_collection($id);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@ -298,7 +290,7 @@
|
||||
*
|
||||
* @param string $id_used id of session just read by get_appsession to increment the usage counter
|
||||
*/
|
||||
function php4_session_garbage_collection($id_used='')
|
||||
static private function php_session_garbage_collection($id_used='')
|
||||
{
|
||||
if (!defined('EGW_SESSION_VAR')) return; // for 1.0.0 compatibility
|
||||
|
||||
@ -311,7 +303,7 @@
|
||||
//echo "session_used[$id_used]='".$session_used[$id_used]."'<br/>\n";
|
||||
++$session_used[$id_used]; // count the number of times a session got used
|
||||
}
|
||||
$this->garbage_collection_done = true;
|
||||
self::$garbage_collection_done = true;
|
||||
|
||||
if (count($app_sessions) < 20) return $data; // we dont need to care
|
||||
|
||||
@ -329,7 +321,7 @@
|
||||
if ($session_used[$id] == 1 && $time < $now - 10*6000 || // session used and older then 10min
|
||||
$time < $now - 60*6000) // session not used and older then 1h
|
||||
{
|
||||
//echo "<p>boetemplate::php4_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)</p>\n";
|
||||
//echo "<p>boetemplate::php_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)</p>\n";
|
||||
unset($app_sessions[$id]);
|
||||
unset($session_used[$id]);
|
||||
}
|
||||
@ -339,7 +331,6 @@
|
||||
/**
|
||||
* gets an attribute in a named cell
|
||||
*
|
||||
* @static
|
||||
* @param string $name cell-name
|
||||
* @param string $attr attribute-name
|
||||
* @return mixed the attribute or False if named cell not found
|
||||
@ -352,7 +343,6 @@
|
||||
/**
|
||||
* set an attribute in a named cell if val is not NULL else return the attribute
|
||||
*
|
||||
* @static
|
||||
* @param string $name cell-name
|
||||
* @param string $attr attribute-name
|
||||
* @param mixed $val if not NULL sets attribute else returns it
|
||||
@ -474,7 +464,7 @@
|
||||
* the $name might be "$name.$app" to give a app-name (default is the current app,or template-name)
|
||||
* @return string/boolean human readable name or false if not found/loadable
|
||||
*/
|
||||
function loadExtension($type)
|
||||
protected function loadExtension($type)
|
||||
{
|
||||
list($class,$app) = explode('.',$type);
|
||||
$class .= '_widget';
|
||||
@ -512,7 +502,7 @@
|
||||
* @param string $function 'pre_process', 'post_process' or 'render'
|
||||
* @return boolean true if the extension (incl. method) exists, else false
|
||||
*/
|
||||
function haveExtension($type,$function='')
|
||||
protected function haveExtension($type,$function='')
|
||||
{
|
||||
return ($GLOBALS['egw_info']['etemplate']['extension'][$type] || $this->loadExtension($type,$ui)) &&
|
||||
($function == '' || $GLOBALS['egw_info']['etemplate']['extension'][$type]->public_functions[$function]);
|
||||
@ -528,7 +518,7 @@
|
||||
* @param array &$readonlys value of the extensions readonly-setting(-array)
|
||||
* @return mixed the return-value of the extensions preprocess function
|
||||
*/
|
||||
function extensionPreProcess($type,$name,&$value,&$cell,&$readonlys)
|
||||
protected function extensionPreProcess($type,$name,&$value,&$cell,&$readonlys)
|
||||
{
|
||||
if (!$this->haveExtension($type))
|
||||
{
|
||||
@ -547,7 +537,7 @@
|
||||
* @param mixed $value_in unprocessed value, eg. as posted by the browser
|
||||
* @return boolean True if a value should be returned (default for no postprocess fkt.), else False
|
||||
*/
|
||||
function extensionPostProcess($type,$name,&$value,$value_in)
|
||||
protected function extensionPostProcess($type,$name,&$value,$value_in)
|
||||
{
|
||||
if (!$this->haveExtension($type,'post_process'))
|
||||
{
|
||||
@ -568,7 +558,7 @@
|
||||
* @param array &$readonlys value of the extensions readonly-setting(-array)
|
||||
* @return mixed return-value of the render function
|
||||
*/
|
||||
function extensionRender($type,$name,&$value,&$cell,$readonly)
|
||||
protected function extensionRender($type,$name,&$value,&$cell,$readonly)
|
||||
{
|
||||
if (!$this->haveExtension($type,'render'))
|
||||
{
|
||||
@ -583,12 +573,11 @@
|
||||
*
|
||||
* for one level of subindes identical to isset($arr[$idx])
|
||||
*
|
||||
* @static
|
||||
* @param array $arr array to check
|
||||
* @param string $idx may contain multiple subindex (eg.'x[y][z]')
|
||||
* @return boolean true if set, else false
|
||||
*/
|
||||
function isset_array($arr,$idx)
|
||||
static function isset_array($arr,$idx)
|
||||
{
|
||||
$idxs = explode('[',str_replace(']','',$idx));
|
||||
$last_idx = array_pop($idxs);
|
||||
@ -611,12 +600,11 @@
|
||||
*
|
||||
* This works for non-trival indexes like 'a[b][c]' too: $arr['a']['b']['c'] = $val;
|
||||
*
|
||||
* @static
|
||||
* @param array &$arr the array to search
|
||||
* @param string $idx the index, may contain sub-indices like a[b], see example below
|
||||
* @param mixed $val value to set
|
||||
*/
|
||||
function set_array(&$arr,$idx,$val)
|
||||
static function set_array(&$arr,$idx,$val)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
@ -637,14 +625,13 @@
|
||||
* This works for non-trival indexes like 'a[b][c]' too: it returns &$arr[a][b][c]
|
||||
* $sub = get_array($arr,'a[b]'); $sub = 'c'; is equivalent to $arr['a']['b'] = 'c';
|
||||
*
|
||||
* @static
|
||||
* @param array $arr the array to search, referenz as a referenz gets returned
|
||||
* @param string $idx the index, may contain sub-indices like a[b], see example below
|
||||
* @param boolean $reference_into default False, if True none-existing sub-arrays/-indices get created to be returned as referenz, else False is returned
|
||||
* @param bool $skip_empty returns false if $idx is not present in $arr
|
||||
* @return mixed reference to $arr[$idx] or false if $idx is not set and not $reference_into
|
||||
*/
|
||||
function &get_array(&$arr,$idx,$reference_into=False,$skip_empty=False)
|
||||
static function &get_array(&$arr,$idx,$reference_into=False,$skip_empty=False)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
@ -672,11 +659,10 @@
|
||||
* This works for non-trival indexes like 'a[b][c]' too
|
||||
* unset_array($arr,'a[b]'); is equivalent to unset($arr['a']['b']);
|
||||
*
|
||||
* @static
|
||||
* @param array $arr the array to search, referenz as a referenz gets returned
|
||||
* @param string $idx the index, may contain sub-indices like a[b], see example below
|
||||
*/
|
||||
function unset_array(&$arr,$idx)
|
||||
static function unset_array(&$arr,$idx)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
@ -695,16 +681,15 @@
|
||||
/**
|
||||
* merges $old and $new, content of $new has precedence over $old
|
||||
*
|
||||
* THIS IS NOT THE SAME AS PHP4's functions:
|
||||
* THIS IS NOT THE SAME AS PHP's functions:
|
||||
* - array_merge, as it calls itself recursive for values which are arrays.
|
||||
* - array_merge_recursive accumulates values with the same index and $new does NOT overwrite $old
|
||||
*
|
||||
* @static
|
||||
* @param array $old
|
||||
* @param array $new
|
||||
* @return array the merged array
|
||||
*/
|
||||
function complete_array_merge($old,$new)
|
||||
static function complete_array_merge($old,$new)
|
||||
{
|
||||
if (is_array($new))
|
||||
{
|
||||
@ -719,7 +704,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$old[$k] = $this->complete_array_merge($old[$k],$v);
|
||||
$old[$k] = self::complete_array_merge($old[$k],$v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -765,8 +750,10 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array of references to widgets of the specified tipe
|
||||
* returns an array of references to widgets of the specified type
|
||||
*
|
||||
* @param type String
|
||||
* @return array
|
||||
*/
|
||||
function &get_widgets_by_type($type) {
|
||||
$extra = array(
|
||||
@ -785,7 +772,7 @@
|
||||
* @param string $lang language to use
|
||||
* @return string
|
||||
*/
|
||||
function cache_name($name='',$template='default',$lang='default')
|
||||
private function cache_name($name='',$template='default',$lang='default')
|
||||
{
|
||||
if (empty($name))
|
||||
{
|
||||
@ -812,7 +799,7 @@
|
||||
/**
|
||||
* stores the etemplate in the cache in phpgw_info
|
||||
*/
|
||||
function store_in_cache()
|
||||
private function store_in_cache()
|
||||
{
|
||||
//echo "<p>store_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
|
||||
$GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()] = $this->as_array(1);
|
||||
@ -821,13 +808,13 @@
|
||||
/**
|
||||
* deletes the etemplate in the cache in phpgw_info
|
||||
*/
|
||||
function delete_in_cache()
|
||||
private function delete_in_cache()
|
||||
{
|
||||
//echo "<p>delete_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
|
||||
unset($GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()]);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns true if a given eTemplate is in the cache
|
||||
*
|
||||
* @param string/array $name name of template or array('name'=>$name,'template'=>$template,'lang'=>$lang)
|
||||
@ -837,7 +824,7 @@
|
||||
* @param string $version of the template
|
||||
* @return boolean
|
||||
*/
|
||||
function in_cache($name,$template='default',$lang='default',$group=0,$version='')
|
||||
private function in_cache($name,$template='default',$lang='default',$group=0,$version='')
|
||||
{
|
||||
$cname = $this->cache_name($name,$template,$lang);
|
||||
if (is_array($name))
|
||||
@ -855,7 +842,7 @@
|
||||
return $cname;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* reads the content of an eTemplate from the cache into the current object
|
||||
*
|
||||
* same as read but only via the cache
|
||||
@ -867,7 +854,7 @@
|
||||
* @param string $version of the template
|
||||
* @return boolean true if the eTemplate was found in the cache
|
||||
*/
|
||||
function read_from_cache($name,$template='default',$lang='default',$group=0,$version='')
|
||||
private function read_from_cache($name,$template='default',$lang='default',$group=0,$version='')
|
||||
{
|
||||
//if (is_array($name)) $version = $name['version']; echo "<p>read_from_cache(,,,version='$version'): ";
|
||||
if ($cname = $this->in_cache($name,$template,$lang,$group))
|
||||
@ -963,10 +950,18 @@
|
||||
return soetemplate::delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('set_cell_attribute_helper'))
|
||||
/**
|
||||
* initialise our static vars
|
||||
*/
|
||||
static function _init_static()
|
||||
{
|
||||
self::$garbage_collection_done =& $GLOBALS['egw_info']['etemplate']['garbage_collection_done'];
|
||||
}
|
||||
}
|
||||
boetemplate::_init_static();
|
||||
|
||||
if (!function_exists('set_cell_attribute_helper'))
|
||||
{
|
||||
function &set_cell_attribute_helper(&$widget,&$extra)
|
||||
{
|
||||
// extra = array(0=>n,1=>name,2=>attr,3=>value)
|
||||
@ -1000,4 +995,4 @@
|
||||
$extra['widgets'][] =& $widget;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +363,7 @@
|
||||
}
|
||||
list($span,$class) = explode(',',$cell['span']); // msie (at least 5.5) shows nothing with div overflow=auto
|
||||
// we dont want to use up the full space for the table created, so we skip the line below
|
||||
//$cell['size'] = '100%,100%,0,'.$class.','.(in_array($type,array('customfields-list','customfields-no-label'))?'0,0':',').($tmpl->html->user_agent != 'msie' ? ',auto' : '');
|
||||
//$cell['size'] = '100%,100%,0,'.$class.','.(in_array($type,array('customfields-list','customfields-no-label'))?'0,0':',').(html::$user_agent != 'msie' ? ',auto' : '');
|
||||
|
||||
return True; // extra Label is ok
|
||||
}
|
||||
|
@ -202,7 +202,7 @@
|
||||
{
|
||||
foreach ($value as $link)
|
||||
{
|
||||
$options .= " onMouseOver=\"self.status='".addslashes($tmpl->html->htmlspecialchars($help))."'; return true;\"";
|
||||
$options .= " onMouseOver=\"self.status='".addslashes(html::htmlspecialchars($help))."'; return true;\"";
|
||||
$options .= " onMouseOut=\"self.status=''; return true;\"";
|
||||
if (($popup = egw_link::is_popup($link['app'],'view')))
|
||||
{
|
||||
@ -213,8 +213,8 @@
|
||||
{
|
||||
$options = ' target="_blank"';
|
||||
}
|
||||
$str .= ($str !== '' ? ', ' : '') . $tmpl->html->a_href(
|
||||
$tmpl->html->htmlspecialchars(egw_link::title($link['app'],$link['id'])),
|
||||
$str .= ($str !== '' ? ', ' : '') . html::a_href(
|
||||
html::htmlspecialchars(egw_link::title($link['app'],$link['id'])),
|
||||
'/index.php',egw_link::view($link['app'],$link['id'],$link),$options);
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,7 @@
|
||||
$value[$row]['target'] = '_blank'; // we create a new window as the linked page is no popup
|
||||
}
|
||||
}
|
||||
if ($link['app'] == egw_link::vfs_appname)
|
||||
if ($link['app'] == egw_link::VFS_APPNAME)
|
||||
{
|
||||
$value[$row]['label'] = 'Delete';
|
||||
$value[$row]['help'] = lang('Delete this file');
|
||||
@ -360,7 +360,7 @@
|
||||
{
|
||||
if(in_array($GLOBALS['egw_info']['user']['preferences']['common']['link_list_format'], array('icons', 'icons_and_text') )) {
|
||||
// Hardcoded sizes to match the mimetype icons. Uses the navbar image and CSS to resize.
|
||||
$value[$row]['mime_icon'] = $tmpl->html->image($value[$row]['app'], 'navbar', $value[$row]['app'], 'style="width: 16px; height: 16px;"');
|
||||
$value[$row]['mime_icon'] = html::image($value[$row]['app'], 'navbar', $value[$row]['app'], 'style="width: 16px; height: 16px;"');
|
||||
}
|
||||
$value[$row]['label'] = 'Unlink';
|
||||
$value[$row]['help'] = lang('Remove this link (not the entry itself)');
|
||||
@ -557,7 +557,7 @@
|
||||
$value['file']['tmp_name'] .= '+';
|
||||
}
|
||||
$link_id = egw_link::link($value['to_app'],$value['to_id'],
|
||||
egw_link::vfs_appname,$value['file'],$value['remark']);
|
||||
egw_link::VFS_APPNAME,$value['file'],$value['remark']);
|
||||
$value['remark'] = '';
|
||||
|
||||
if (isset($value['primary']) && !$value['anz_links'] )
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* eGroupWare EditableTemplates - Storage Objects
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
@ -9,7 +9,7 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Storage Objects: Everything to store and retrive and eTemplate.
|
||||
*
|
||||
* eTemplates are stored in the db in table 'phpgw_etemplate' and gets distributed
|
||||
@ -31,8 +31,8 @@
|
||||
* @author RalfBecker-AT-outdoor-training.de
|
||||
* @license GPL
|
||||
*/
|
||||
class soetemplate
|
||||
{
|
||||
class soetemplate
|
||||
{
|
||||
var $debug; // =1 show some debug-messages, = 'app.name' show messages only for eTemplate 'app.name'
|
||||
var $name; // name of the template, e.g. 'infolog.edit'
|
||||
var $template; // '' = default (not 'default')
|
||||
@ -44,38 +44,36 @@
|
||||
var $data; // depricated: first grid of the children
|
||||
var $size; // depricated: witdh,height,border of first grid
|
||||
/**
|
||||
* private instance of the db-object
|
||||
* private reference to the global db-object
|
||||
*
|
||||
* @var egw_db
|
||||
*/
|
||||
var $db;
|
||||
private $db;
|
||||
/**
|
||||
* name of table
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $table_name = 'egw_etemplate';
|
||||
var $db_key_cols = array(
|
||||
const TABLE = 'egw_etemplate';
|
||||
static $db_key_cols = array(
|
||||
'et_name' => 'name',
|
||||
'et_template' => 'template',
|
||||
'et_lang' => 'lang',
|
||||
'et_group' => 'group',
|
||||
'et_version' => 'version'
|
||||
);
|
||||
var $db_data_cols = array(
|
||||
static $db_data_cols = array(
|
||||
'et_data' => 'data',
|
||||
'et_size' => 'size',
|
||||
'et_style' => 'style',
|
||||
'et_modified' => 'modified'
|
||||
);
|
||||
var $db_cols;
|
||||
static $db_cols;
|
||||
/**
|
||||
* widgets that contain other widgets, eg. for tree_walk method
|
||||
* widget-type is the key, the value specifys how the children are stored.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $widgets_with_children = array(
|
||||
static $widgets_with_children = array(
|
||||
'template' => 'template',
|
||||
'grid' => 'grid',
|
||||
'box' => 'box',
|
||||
@ -103,15 +101,12 @@
|
||||
{
|
||||
if (is_object($GLOBALS['egw']->db))
|
||||
{
|
||||
$this->db = clone($GLOBALS['egw']->db);
|
||||
$this->db->set_app('etemplate');
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['eTemplate-source'] = 'files';
|
||||
}
|
||||
$this->db_cols = $this->db_key_cols + $this->db_data_cols;
|
||||
|
||||
if (empty($name))
|
||||
{
|
||||
$this->init($name,$template,$lang,$group,$version,$rows,$cols);
|
||||
@ -125,11 +120,10 @@
|
||||
/**
|
||||
* generates column-names from index: 'A', 'B', ..., 'AA', 'AB', ..., 'ZZ' (not more!)
|
||||
*
|
||||
* @static
|
||||
* @param int $num numerical index to generate name from 1 => 'A'
|
||||
* @return string the name
|
||||
*/
|
||||
function num2chrs($num)
|
||||
static function num2chrs($num)
|
||||
{
|
||||
$min = ord('A');
|
||||
$max = ord('Z') - $min + 1;
|
||||
@ -145,11 +139,10 @@
|
||||
/**
|
||||
* generates column-names from index: 'A', 'B', ..., 'AA', 'AB', ..., 'ZZ' (not more!)
|
||||
*
|
||||
* @static
|
||||
* @param string $chrs column letter to generate name from 'A' => 1
|
||||
* @return int the index
|
||||
*/
|
||||
function chrs2num($chrs)
|
||||
static function chrs2num($chrs)
|
||||
{
|
||||
$min = ord('A');
|
||||
$max = ord('Z') - $min + 1;
|
||||
@ -168,13 +161,12 @@
|
||||
*
|
||||
* nothing fancy so far
|
||||
*
|
||||
* @static
|
||||
* @param string $type type of the widget
|
||||
* @param string $name name of widget
|
||||
* @param array $attributes=null array with further attributes
|
||||
* @return array the cell
|
||||
*/
|
||||
function empty_cell($type='label',$name='',$attributes=null)
|
||||
static function empty_cell($type='label',$name='',$attributes=null)
|
||||
{
|
||||
$cell = array(
|
||||
'type' => $type,
|
||||
@ -236,11 +228,10 @@
|
||||
/**
|
||||
* adds $cell to it's parent at the parent-type spezific location for childs
|
||||
*
|
||||
* @static
|
||||
* @param array &$parent referenc to the parent
|
||||
* @param array &$cell cell to add (need to be unset after the call to add_child, as it's a referenc !)
|
||||
*/
|
||||
function add_child(&$parent,&$cell)
|
||||
static function add_child(&$parent,&$cell)
|
||||
{
|
||||
if (is_object($parent)) // parent is the template itself
|
||||
{
|
||||
@ -288,10 +279,9 @@
|
||||
/**
|
||||
* initialises internal vars rows & cols from the data of a grid
|
||||
*
|
||||
* @static
|
||||
* @param array &$grid to calc rows and cols
|
||||
*/
|
||||
function set_grid_rows_cols(&$grid)
|
||||
static function set_grid_rows_cols(&$grid)
|
||||
{
|
||||
$grid['rows'] = count($grid['data']) - 1;
|
||||
$grid['cols'] = 0;
|
||||
@ -342,7 +332,7 @@
|
||||
// unset children and data as they are referenzes to each other
|
||||
unset($this->children); unset($this->data);
|
||||
|
||||
foreach($this->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;
|
||||
}
|
||||
@ -446,13 +436,12 @@
|
||||
{
|
||||
$where['et_version'] = $this->version;
|
||||
}
|
||||
$this->db->select($this->table_name,'*',$where,__LINE__,__FILE__,false,'ORDER BY et_lang DESC,et_template DESC,et_version DESC');
|
||||
if (!$this->db->next_record())
|
||||
if (!($row = $this->db->select(self::TABLE,'*',$where,__LINE__,__FILE__,false,'ORDER BY et_lang DESC,et_template DESC,et_version DESC','etemplate')->fetch()))
|
||||
{
|
||||
$version = $this->version;
|
||||
return $this->readfile() && (empty($version) || $version == $this->version);
|
||||
}
|
||||
$this->db2obj();
|
||||
$this->db2obj($row);
|
||||
|
||||
if ($this->debug == $this->name)
|
||||
{
|
||||
@ -542,7 +531,7 @@
|
||||
* @param string $pattern
|
||||
* @return string
|
||||
*/
|
||||
function sql_wildcards($pattern)
|
||||
static function sql_wildcards($pattern)
|
||||
{
|
||||
return str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$pattern);
|
||||
}
|
||||
@ -584,13 +573,12 @@
|
||||
{
|
||||
$where[] = 'et_version LIKE '.$this->db->quote($this->sql_wildcards($version).'%');
|
||||
}
|
||||
$this->db->select($this->table_name,'et_name,et_template,et_lang,et_group,et_version',$where,__LINE__,__FILE__,false,'ORDER BY et_name DESC,et_lang DESC,et_template DESC,et_version DESC');
|
||||
$result = array();
|
||||
while (($row = $this->db->row(true,'et_')))
|
||||
foreach($this->db->select(self::TABLE,'et_name,et_template,et_lang,et_group,et_version',$where,__LINE__,__FILE__,false,'ORDER BY et_name DESC,et_lang DESC,et_template DESC,et_version DESC','etemplate') as $row)
|
||||
{
|
||||
if ($row['lang'] != '##') // exclude or import-time-stamps
|
||||
if ($row['et_lang'] != '##') // exclude or import-time-stamps
|
||||
{
|
||||
$result[] = $row;
|
||||
$result[] = egw_db::strip_array_keys($row,'et_');
|
||||
}
|
||||
}
|
||||
if ($this->debug)
|
||||
@ -603,20 +591,20 @@
|
||||
/**
|
||||
* copies all cols into the obj and unserializes the data-array
|
||||
*/
|
||||
function db2obj()
|
||||
function db2obj(array $row)
|
||||
{
|
||||
// unset children and data as they are referenzes to each other
|
||||
unset($this->children); unset($this->data);
|
||||
|
||||
foreach ($this->db_cols as $db_col => $name)
|
||||
foreach (self::$db_cols as $db_col => $name)
|
||||
{
|
||||
if ($name != 'data')
|
||||
{
|
||||
$this->$name = $this->db->f($db_col);
|
||||
$this->$name = $row[$db_col];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->children = unserialize($this->db->f($db_col));
|
||||
$this->children = unserialize($row[$db_col]);
|
||||
}
|
||||
}
|
||||
$this->fix_old_template_format();
|
||||
@ -625,7 +613,7 @@
|
||||
/**
|
||||
* test if we have an old/original template-format and fixes it to the new format
|
||||
*/
|
||||
function fix_old_template_format()
|
||||
private function fix_old_template_format()
|
||||
{
|
||||
if (!is_array($this->children)) $this->children = array();
|
||||
|
||||
@ -699,7 +687,7 @@
|
||||
* @param boolean $remove_all_objs if true unset all objs, on false use as_array to save only the data of objs
|
||||
* @return array
|
||||
*/
|
||||
function compress_array($arr,$remove_objs=false)
|
||||
static function compress_array($arr,$remove_objs=false)
|
||||
{
|
||||
if (!is_array($arr))
|
||||
{
|
||||
@ -713,7 +701,7 @@
|
||||
}
|
||||
elseif (is_array($val))
|
||||
{
|
||||
$arr[$key] = $this->compress_array($val,$remove_objs);
|
||||
$arr[$key] = self::compress_array($val,$remove_objs);
|
||||
}
|
||||
elseif (!$remove_objs && $key == 'obj' && is_object($val) && method_exists($val,'as_array') &&
|
||||
// this test prevents an infinit recursion of templates calling itself, atm. etemplate.editor.new
|
||||
@ -746,13 +734,13 @@
|
||||
switch($data_too)
|
||||
{
|
||||
case -1:
|
||||
$cols = $this->db_key_cols;
|
||||
$cols = self::$db_key_cols;
|
||||
break;
|
||||
case 3:
|
||||
$cols = $this->db_data_cols;
|
||||
$cols = self::$db_data_cols;
|
||||
break;
|
||||
default:
|
||||
$cols = $this->db_cols;
|
||||
$cols = self::$db_cols;
|
||||
}
|
||||
foreach($cols as $db_col => $col)
|
||||
{
|
||||
@ -852,11 +840,9 @@
|
||||
}
|
||||
if (is_null($this->group) && !is_int($this->group)) $this->group = 0;
|
||||
|
||||
$this->db->insert($this->table_name,$this->as_array(3,true),$this->as_array(-1,true),__LINE__,__FILE__);
|
||||
$this->db->insert(self::TABLE,$this->as_array(3,true),$this->as_array(-1,true),__LINE__,__FILE__,'etemplate');
|
||||
|
||||
$rows = $this->db->affected_rows();
|
||||
|
||||
if (!$rows)
|
||||
if (!($rows = $this->db->affected_rows()))
|
||||
{
|
||||
echo "<p>soetemplate::save('$this->name','$this->template','$this->lang',$this->group,'$this->version') <b>nothing written!!!</b></p>\n";
|
||||
function_backtrace();
|
||||
@ -872,7 +858,7 @@
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$this->db->delete($this->table_name,$this->as_array(-1,true),__LINE__,__FILE__);
|
||||
$this->db->delete(self::TABLE,$this->as_array(-1,true),__LINE__,__FILE__,'etemplate');
|
||||
|
||||
return $this->db->affected_rows();
|
||||
}
|
||||
@ -887,8 +873,6 @@
|
||||
{
|
||||
list($app) = explode('.',$app);
|
||||
|
||||
$this->db->query("SELECT * FROM $this->table_name WHERE et_name LIKE '$app%'");
|
||||
|
||||
$dir = EGW_SERVER_ROOT . "/$app/setup";
|
||||
if (!is_writeable($dir))
|
||||
{
|
||||
@ -910,7 +894,7 @@
|
||||
return 0;
|
||||
}
|
||||
fwrite($f,'<?php
|
||||
/**
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application '. $app. '
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() '.date('Y-m-d H:i'). '
|
||||
@ -921,16 +905,18 @@
|
||||
* @version $Id$
|
||||
*/'."\n\n\$templ_version=1;\n\n");
|
||||
|
||||
for ($n = 0; $this->db->next_record(); ++$n)
|
||||
$n = 0;
|
||||
foreach($this->db->select(self::TABLE,'*','et_name LIKE '.$this->db->quote($app.'%'),__LINE__, __FILE__,false,'',egw_db::FETCH_ASSOC) as $row)
|
||||
{
|
||||
$str = '$templ_data[] = array(';
|
||||
foreach ($this->db_cols as $db_col => $name)
|
||||
foreach (self::$db_cols as $db_col => $name)
|
||||
{
|
||||
// escape only backslashes and single quotes (in that order)
|
||||
$str .= "'$name' => '".str_replace(array('\\','\'',"\r"),array('\\\\','\\\'',''),$this->db->f($db_col))."',";
|
||||
$str .= "'$name' => '".str_replace(array('\\','\'',"\r"),array('\\\\','\\\'',''),$row[$db_col])."',";
|
||||
}
|
||||
$str .= ");\n\n";
|
||||
fwrite($f,$str);
|
||||
++$n;
|
||||
}
|
||||
fclose($f);
|
||||
|
||||
@ -948,7 +934,7 @@
|
||||
{
|
||||
$to_trans = array();
|
||||
|
||||
$this->widget_tree_walk('getToTranslateCell',$to_trans);
|
||||
$this->widget_tree_walk(array('soetemplate','getToTranslateCell'),$to_trans);
|
||||
|
||||
//echo '<b>'.$this->name.'</b>'; _debug_array($to_trans);
|
||||
return $to_trans;
|
||||
@ -1070,7 +1056,7 @@
|
||||
* @param string $app app name
|
||||
* @return string translated message with number of templates imported
|
||||
*/
|
||||
function import_dump($app)
|
||||
static function import_dump($app)
|
||||
{
|
||||
$templ_version=0;
|
||||
|
||||
@ -1103,7 +1089,7 @@
|
||||
* @param string $app app- or template-name
|
||||
* @return string translated message with number of templates imported
|
||||
*/
|
||||
function test_import($app) // should be done from the setup-App
|
||||
static function test_import($app) // should be done from the setup-App
|
||||
{
|
||||
list($app) = explode('.',$app);
|
||||
|
||||
@ -1184,10 +1170,10 @@
|
||||
echo "<p><b>boetemplate($this->name)::widget_tree_walk</b>(".print_r($func,true).", ".print_r($extra,true).", ".print_r($opts,true).") func is not callable !!!<br>".function_backtrace()."</p>";
|
||||
return false;
|
||||
}
|
||||
foreach($this->children as $c => $nul)
|
||||
foreach($this->children as $c => &$child)
|
||||
{
|
||||
$child = &$this->children[$c];
|
||||
if (isset($this->widgets_with_children[$child['type']]))
|
||||
if (isset(soetemplate::$widgets_with_children[$child['type']]))
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.$c);
|
||||
}
|
||||
@ -1237,7 +1223,7 @@
|
||||
$result =& $func($widget,$extra,$path);
|
||||
}
|
||||
if (!is_null($result) || is_array($extra) && isset($extra['__RETURN__NOW__']) ||
|
||||
!isset($this->widgets_with_children[$widget['type']]))
|
||||
!isset(soetemplate::$widgets_with_children[$widget['type']]))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
@ -1251,7 +1237,7 @@
|
||||
for($n = 1; is_array($widget[$n]); ++$n)
|
||||
{
|
||||
$child = &$widget[$n];
|
||||
if (isset($this->widgets_with_children[$child['type']]))
|
||||
if (isset(soetemplate::$widgets_with_children[$child['type']]))
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.'/'.$n);
|
||||
}
|
||||
@ -1278,7 +1264,7 @@
|
||||
foreach($row as $c => $col)
|
||||
{
|
||||
$child = &$data[$r][$c];
|
||||
if (isset($this->widgets_with_children[$child['type']]))
|
||||
if (isset(soetemplate::$widgets_with_children[$child['type']]))
|
||||
{
|
||||
$result =& $this->tree_walk($child,$func,$extra,$path.'/'.$r.$c);
|
||||
}
|
||||
@ -1309,17 +1295,14 @@
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getToTranslateCell'))
|
||||
{
|
||||
/**
|
||||
* extracts all translatable labels from a widget
|
||||
*
|
||||
* @param array $cell the widget
|
||||
* @param array &$to_trans array with (lowercased) label => translation pairs
|
||||
*/
|
||||
function getToTranslateCell($cell,&$to_trans)
|
||||
static function getToTranslateCell($cell,&$to_trans)
|
||||
{
|
||||
//echo $cell['name']; _debug_array($cell);
|
||||
$strings = explode('|',$cell['help']);
|
||||
@ -1346,5 +1329,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* init our static vars
|
||||
*/
|
||||
static function _init_static()
|
||||
{
|
||||
self::$db_cols = self::$db_key_cols + self::$db_data_cols;
|
||||
}
|
||||
}
|
||||
soetemplate::_init_static();
|
@ -123,7 +123,7 @@ class tree_widget
|
||||
// creating a div-id and var-name for the tree-object by replacing brackets with underscores and removing exec or evtl. cont parts
|
||||
$tree_id = str_replace(array('exec[cont][','exec[','[',']'),array('','','_',''),$name);
|
||||
$onNodeSelect = 'onNodeSelect_'.$tree_id;
|
||||
$script = $tmpl->html->input_hidden($name,$value,false)."<script type='text/javascript'>";
|
||||
$script = html::input_hidden($name,$value,false)."<script type='text/javascript'>";
|
||||
if (($onclick = $cell['onclick']))
|
||||
{
|
||||
if (strpos($onclick,'$') !== false || $onclick{0} == '@')
|
||||
@ -159,7 +159,7 @@ class tree_widget
|
||||
$script .= "</script>\n";
|
||||
|
||||
list(,$class) = explode(',',$cell['span']);
|
||||
$value = $script.$tmpl->html->tree($tmpl->_sel_options($cell,$name),$value,false,$onNodeSelect,$tree_id,$class,'',$onCheck);
|
||||
$value = $script.html::tree($tmpl->_sel_options($cell,$name),$value,false,$onNodeSelect,$tree_id,$class,'',$onCheck);
|
||||
|
||||
$cell = etemplate::empty_cell('html',$cell['name']);
|
||||
|
||||
|
@ -1,37 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - EditableTemplates - HTML User Interface
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
/**
|
||||
* eGroupWare - EditableTemplates - HTML User Interface
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @copyright 2002-8 by RalfBecker@outdoor-training.de
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.boetemplate.inc.php');
|
||||
|
||||
/**
|
||||
* creates dialogs / HTML-forms from eTemplate descriptions
|
||||
*
|
||||
* Usage example:
|
||||
*<code>
|
||||
* $tmpl =& CreateObject('etemplate.etemplate','app.template.name');
|
||||
* $tmpl->exec('app.class.callback',$content_to_show);
|
||||
*</code>
|
||||
* This creates a form from the eTemplate 'app.template.name' and takes care that
|
||||
* the method / public function 'callback' in class 'class' of 'app' gets called
|
||||
* if the user submits the form. For the complete param's see the description of exec.
|
||||
*
|
||||
* etemplate or uietemplate extends boetemplate, all vars and public functions are inherited
|
||||
*
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
class etemplate extends boetemplate
|
||||
{
|
||||
/**
|
||||
* creates dialogs / HTML-forms from eTemplate descriptions
|
||||
*
|
||||
* Usage example:
|
||||
*<code>
|
||||
* $tmpl = new etemplate('app.template.name');
|
||||
* $tmpl->exec('app.class.callback',$content_to_show);
|
||||
*</code>
|
||||
* This creates a form from the eTemplate 'app.template.name' and takes care that
|
||||
* the method / public function 'callback' in class 'class' of 'app' gets called
|
||||
* if the user submits the form. For the complete param's see the description of exec.
|
||||
*
|
||||
* etemplate or uietemplate extends boetemplate, all vars and public functions are inherited
|
||||
*/
|
||||
class etemplate extends boetemplate
|
||||
{
|
||||
/**
|
||||
* integer debug-level or template-name or cell-type or '' = off
|
||||
* 1=calls to show and process_show, 2=content after process_show,
|
||||
@ -40,12 +35,6 @@
|
||||
* @var int/string
|
||||
*/
|
||||
var $debug;
|
||||
/**
|
||||
* Instance of the html class
|
||||
*
|
||||
* @var html
|
||||
*/
|
||||
var $html;
|
||||
var $xslt = false; /* do we run in the xslt framework (true) or the regular eGW one (false) */
|
||||
var $class_conf = array('nmh' => 'th','nmr0' => 'row_on','nmr1' => 'row_off');
|
||||
var $public_functions = array('process_exec' => True);
|
||||
@ -101,12 +90,6 @@
|
||||
*/
|
||||
function etemplate($name='',$load_via='')
|
||||
{
|
||||
if (!is_object($GLOBALS['egw']->html))
|
||||
{
|
||||
$GLOBALS['egw']->html =& CreateObject('phpgwapi.html');
|
||||
}
|
||||
$this->html = &$GLOBALS['egw']->html;
|
||||
|
||||
if (!is_object($GLOBALS['egw']->template))
|
||||
{
|
||||
$GLOBALS['egw']->template =& CreateObject('phpgwapi.Template');
|
||||
@ -139,7 +122,7 @@
|
||||
*
|
||||
* @param string/array $params url or array with get-params incl. menuaction
|
||||
*/
|
||||
function location($params='')
|
||||
static function location($params='')
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link(is_array($params) ? '/index.php' : $params,
|
||||
is_array($params) ? $params : '');
|
||||
@ -197,7 +180,7 @@
|
||||
$GLOBALS['egw']->translation->add_app('etemplate'); // some extensions have own texts
|
||||
}
|
||||
$id = $this->appsession_id();
|
||||
//echo "<p>unsetting existing egw_info[etemplate] which had keys=".implode(',',array_keys($GLOBALS['egw_info']['etemplate']))."</p>\n";
|
||||
//echo "<p>unsetting existing egw_info[etemplate] which had keys=".implode(',',array_keys($GLOBALS['egw_info']['etemplate']))."</p>\n";
|
||||
// initialise $GLOBALS['egw_info']['etemplate'], in case there are multiple eTemplates on a page
|
||||
$GLOBALS['egw_info']['etemplate'] = array(
|
||||
'name_forms' => $GLOBALS['egw_info']['etemplate']['name_forms'],
|
||||
@ -206,9 +189,9 @@
|
||||
'content' => $GLOBALS['egw_info']['etemplate']['content'],
|
||||
'hook_content' => $GLOBALS['egw_info']['etemplate']['hook_content'],
|
||||
'hook_app' => $GLOBALS['egw_info']['etemplate']['hook_app'],
|
||||
'extension_data' => $GLOBALS['egw_info']['etemplate']['extension_data']
|
||||
'extension_data' => $GLOBALS['egw_info']['etemplate']['extension_data'],
|
||||
);
|
||||
//echo "<p>hooked=".(int)!!$GLOBALS['egw_info']['etemplate']['hooked'].", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}</p>\n";
|
||||
//echo "<p>hooked=".(int)!!$GLOBALS['egw_info']['etemplate']['hooked'].", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}</p>\n";
|
||||
$this->name_form =& $GLOBALS['egw_info']['etemplate']['name_form'];
|
||||
$this->name_forms =& $GLOBALS['egw_info']['etemplate']['name_forms'];
|
||||
if (!is_array($this->name_forms)) $this->name_forms = array();
|
||||
@ -226,8 +209,8 @@
|
||||
$GLOBALS['egw_info']['etemplate']['form_options'] = ''; // might be set in show
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'] = array();
|
||||
|
||||
$html = $this->html->form($this->include_java_script(1).
|
||||
$this->html->input_hidden(array(
|
||||
$html = html::form($this->include_java_script(1).
|
||||
html::input_hidden(array(
|
||||
'submit_button' => '',
|
||||
'innerWidth' => '',
|
||||
),'',False).
|
||||
@ -299,7 +282,7 @@
|
||||
echo $manual->show(array());
|
||||
unset($manual);
|
||||
echo '<style type="text/css">.ajax-loader { position: absolute; right: 27px; top: 24px; display: none; }</style>'."\n";
|
||||
echo '<div class="ajax-loader">'.$this->html->image('phpgwapi','ajax-loader') . '</div>';
|
||||
echo '<div class="ajax-loader">'.html::image('phpgwapi','ajax-loader') . '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,13 +328,13 @@
|
||||
'method' => $method,
|
||||
'name_vars' => $this->name_vars,
|
||||
),$id);
|
||||
//echo "<p>hooked=".(int)!!$hooked.", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}</p>\n";
|
||||
//echo "<p>session: "; foreach($sess as $key => $val) echo "$key=$val, "; echo "</p>\n";
|
||||
/*
|
||||
echo "<p><b>total size session data = ".($total=strlen(serialize($sess)))."</b></p>\n";
|
||||
echo "<p>shares bigger then 1.0% percent of it:</p>\n";
|
||||
foreach($sess as $key => $val)
|
||||
{
|
||||
//echo "<p>hooked=".(int)!!$hooked.", content=".(int)!!$GLOBALS['egw_info']['etemplate']['content'].", hook_content=".(int)!!$GLOBALS['egw_info']['etemplate']['hook_content'].", hook_app={$GLOBALS['egw_info']['etemplate']['hook_app']}</p>\n";
|
||||
//echo "<p>session: "; foreach($sess as $key => $val) echo "$key=$val, "; echo "</p>\n";
|
||||
/*
|
||||
echo "<p><b>total size session data = ".($total=strlen(serialize($sess)))."</b></p>\n";
|
||||
echo "<p>shares bigger then 1.0% percent of it:</p>\n";
|
||||
foreach($sess as $key => $val)
|
||||
{
|
||||
$len = strlen(is_array($val) ? serialize($val) : $val);
|
||||
$len .= ' ('.sprintf('%2.1lf',($percent = 100.0 * $len / $total)).'%)';
|
||||
if ($percent < 1.0) continue;
|
||||
@ -366,8 +349,8 @@ foreach($sess as $key => $val)
|
||||
echo "<p> - {$key}[$k]: strlen(\$v)=$l</p>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
if ($this->sitemgr || (int) $output_mode == 1 || (int) $output_mode == -1) // return html
|
||||
{
|
||||
return $html;
|
||||
@ -621,13 +604,13 @@ foreach($sess as $key => $val)
|
||||
if (!$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name])
|
||||
{
|
||||
$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name] = True;
|
||||
$html .= $this->html->style($this->style)."\n\n";
|
||||
$html .= html::style($this->style)."\n\n";
|
||||
}
|
||||
$path = '/';
|
||||
foreach ($this->children as $n => $child)
|
||||
{
|
||||
$h = $this->show_cell($child,$content,$readonlys,$cname,$show_c,$show_row,$nul,$class,$path.$n);
|
||||
$html .= $class || $child['align'] ? $this->html->div($h,$this->html->formatOptions(array(
|
||||
$html .= $class || $child['align'] ? html::div($h,html::formatOptions(array(
|
||||
$class,
|
||||
$child['align'],
|
||||
),'class,align')) : $h;
|
||||
@ -643,7 +626,7 @@ foreach($sess as $key => $val)
|
||||
* @param int/string $cats multiple comma-separated cat_id's
|
||||
* @return string
|
||||
*/
|
||||
function cats2color($cats)
|
||||
static function cats2color($cats)
|
||||
{
|
||||
static $cat2color;
|
||||
|
||||
@ -696,7 +679,7 @@ foreach($sess as $key => $val)
|
||||
* @param string $path path in the widget tree
|
||||
* @return string the generated HTML
|
||||
*/
|
||||
function show_grid(&$grid,$content,$readonlys='',$cname='',$show_c=0,$show_row=0,$path='')
|
||||
private function show_grid(&$grid,$content,$readonlys='',$cname='',$show_c=0,$show_row=0,$path='')
|
||||
{
|
||||
if (!$readonlys)
|
||||
{
|
||||
@ -751,7 +734,7 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
continue; // row is disabled
|
||||
}
|
||||
$rows[".$row"] .= $this->html->formatOptions($height,'height');
|
||||
$rows[".$row"] .= html::formatOptions($height,'height');
|
||||
list($cl) = explode(',',$class);
|
||||
if ($cl == '@' || $cl && strpos($cl,'$') !== false)
|
||||
{
|
||||
@ -771,8 +754,8 @@ foreach($sess as $key => $val)
|
||||
$cl = 'row_'.($nmr_alternate++ & 1 ? 'off' : 'on').substr($cl,3); // alternate color
|
||||
}
|
||||
$cl = isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl;
|
||||
$rows[".$row"] .= $this->html->formatOptions($cl,'class');
|
||||
$rows[".$row"] .= $this->html->formatOptions($class,',valign');
|
||||
$rows[".$row"] .= html::formatOptions($cl,'class');
|
||||
$rows[".$row"] .= html::formatOptions($class,',valign');
|
||||
reset ($cols);
|
||||
$row_data = array();
|
||||
for ($c = 0; True /*list($col,$cell) = each($cols)*/; ++$c)
|
||||
@ -858,7 +841,7 @@ foreach($sess as $key => $val)
|
||||
$opts[$col] = "0,$disable";
|
||||
}
|
||||
}
|
||||
$row_data[".$col"] .= $this->html->formatOptions($cell['align']?$cell['align']:'left','align');
|
||||
$row_data[".$col"] .= html::formatOptions($cell['align']?$cell['align']:'left','align');
|
||||
// allow to set further attributes in the tablecell, beside the class
|
||||
if (is_array($cl))
|
||||
{
|
||||
@ -876,7 +859,7 @@ foreach($sess as $key => $val)
|
||||
// else the class is set twice, in the table and the table-cell, which is not good for borders
|
||||
if ($cl && $cell['type'] != 'template' && $cell['type'] != 'grid')
|
||||
{
|
||||
$row_data[".$col"] .= $this->html->formatOptions($cl,'class');
|
||||
$row_data[".$col"] .= html::formatOptions($cl,'class');
|
||||
}
|
||||
}
|
||||
$rows[$row] = $row_data;
|
||||
@ -888,15 +871,15 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$options[1] = ''; // set height in div only
|
||||
}
|
||||
$html = $this->html->table($rows,$this->html->formatOptions($options,'width,height,border,class,cellspacing,cellpadding').
|
||||
$this->html->formatOptions($grid['span'],',class').
|
||||
$this->html->formatOptions($grid['name']?$this->form_name($cname,$grid['name']):'','id'));
|
||||
$html = html::table($rows,html::formatOptions($options,'width,height,border,class,cellspacing,cellpadding').
|
||||
html::formatOptions($grid['span'],',class').
|
||||
html::formatOptions($grid['name']?$this->form_name($cname,$grid['name']):'','id'));
|
||||
|
||||
if (!empty($overflow)) {
|
||||
if (is_numeric($height)) $height .= 'px';
|
||||
if (is_numeric($width)) $width .= 'px';
|
||||
$div_style=' style="'.($width?"width: $width; ":'').($height ? "height: $height; ":'')."overflow: $overflow;\"";
|
||||
$html = $this->html->div($html,$div_style);
|
||||
$html = html::div($html,$div_style);
|
||||
}
|
||||
return "\n\n<!-- BEGIN grid $grid[name] -->\n$html<!-- END grid $grid[name] -->\n\n";
|
||||
}
|
||||
@ -911,7 +894,7 @@ foreach($sess as $key => $val)
|
||||
* @param string $name name
|
||||
* @return string complete form-name
|
||||
*/
|
||||
function form_name($cname,$name)
|
||||
static function form_name($cname,$name)
|
||||
{
|
||||
if(is_object($name)) return '';
|
||||
|
||||
@ -936,7 +919,7 @@ foreach($sess as $key => $val)
|
||||
* @param string form_name
|
||||
* @return string name without prefix
|
||||
*/
|
||||
function template_name($form_name)
|
||||
static private function template_name($form_name)
|
||||
{
|
||||
$parts = explode('[',str_replace(']','',$form_name));
|
||||
|
||||
@ -968,7 +951,7 @@ foreach($sess as $key => $val)
|
||||
* @param string $path path in the widget tree
|
||||
* @return string the generated HTML
|
||||
*/
|
||||
function show_cell(&$cell,$content,$readonlys,$cname,$show_c,$show_row,&$span,&$class,$path='')
|
||||
private function show_cell(&$cell,$content,$readonlys,$cname,$show_c,$show_row,&$span,&$class,$path='')
|
||||
{
|
||||
if ($this->debug && (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type']))
|
||||
{
|
||||
@ -993,7 +976,7 @@ foreach($sess as $key => $val)
|
||||
$options .= ' readonly="readonly"';
|
||||
}
|
||||
if ((int) $cell['tabindex']) $options .= ' tabindex="'.(int)$cell['tabindex'].'"';
|
||||
if ($cell['accesskey']) $options .= ' accesskey="'.$this->html->htmlspecialchars($cell['accesskey']).'"';
|
||||
if ($cell['accesskey']) $options .= ' accesskey="'.html::htmlspecialchars($cell['accesskey']).'"';
|
||||
|
||||
if (strchr($cell['size'],'$') || $cell['size']{0} == '@') // expand cell['size'] for the button-disabled-check now
|
||||
{
|
||||
@ -1065,8 +1048,8 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$value = $blur;
|
||||
}
|
||||
$onFocus .= "if(this.value=='".addslashes($this->html->htmlspecialchars($blur))."') this.value='';";
|
||||
$onBlur .= "if(this.value=='') this.value='".addslashes($this->html->htmlspecialchars($blur))."';";
|
||||
$onFocus .= "if(this.value=='".addslashes(html::htmlspecialchars($blur))."') this.value='';";
|
||||
$onBlur .= "if(this.value=='') this.value='".addslashes(html::htmlspecialchars($blur))."';";
|
||||
}
|
||||
if ($help)
|
||||
{
|
||||
@ -1076,15 +1059,15 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if (($use_tooltip_for_help = strpos($help,'<') !== false && strip_tags($help) != $help)) // helptext is html => use a tooltip
|
||||
{
|
||||
$options .= $this->html->tooltip($help);
|
||||
$options .= html::tooltip($help);
|
||||
}
|
||||
else // "regular" help-text in the statusline
|
||||
{
|
||||
$onFocus .= "self.status='".addslashes($this->html->htmlspecialchars($help))."'; return true;";
|
||||
$onFocus .= "self.status='".addslashes(html::htmlspecialchars($help))."'; return true;";
|
||||
$onBlur .= "self.status=''; return true;";
|
||||
if (in_array($cell['type'],array('button','buttononly','file'))) // for button additionally when mouse over button
|
||||
{
|
||||
$options .= " onMouseOver=\"self.status='".addslashes($this->html->htmlspecialchars($help))."'; return true;\"";
|
||||
$options .= " onMouseOver=\"self.status='".addslashes(html::htmlspecialchars($help))."'; return true;\"";
|
||||
$options .= " onMouseOut=\"self.status=''; return true;\"";
|
||||
}
|
||||
}
|
||||
@ -1114,24 +1097,24 @@ foreach($sess as $key => $val)
|
||||
break;
|
||||
list($style,$extra_link,$activate_links,$label_for,$extra_link_target,$extra_link_popup,$extra_link_title) = explode(',',$cell_options,7);
|
||||
$value = strlen($value) > 1 && !$cell['no_lang'] ? lang($value) : $value;
|
||||
$value = nl2br($this->html->htmlspecialchars($value));
|
||||
if ($activate_links) $value = $this->html->activate_links($value);
|
||||
if ($value != '' && $style && strpos($style,'b')!==false) $value = $this->html->bold($value);
|
||||
if ($value != '' && $style && strpos($style,'i')!==false) $value = $this->html->italic($value);
|
||||
$value = nl2br(html::htmlspecialchars($value));
|
||||
if ($activate_links) $value = html::activate_links($value);
|
||||
if ($value != '' && $style && strpos($style,'b')!==false) $value = html::bold($value);
|
||||
if ($value != '' && $style && strpos($style,'i')!==false) $value = html::italic($value);
|
||||
// if the label has a name, use it as id in a span, to allow addressing it via javascript
|
||||
$html .= ($name ? '<span id="'.($cell['id']?$cell['id']:$name).'">' : '').$value.($name ? '</span>' : '');
|
||||
if ($help)
|
||||
{
|
||||
$class = array(
|
||||
'class' => $class,
|
||||
'onmouseover' => "self.status='".addslashes($this->html->htmlspecialchars($help))."'; return true;",
|
||||
'onmouseover' => "self.status='".addslashes(html::htmlspecialchars($help))."'; return true;",
|
||||
'onmouseout' => "self.status=''; return true;",
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'html': // size: [link],[link_target],[link_popup_size],[link_title],[activate_links]
|
||||
list($extra_link,$extra_link_target,$extra_link_popup,$extra_link_title,$activate_links) = explode(',',$cell_options);
|
||||
if ($activate_links) $value = $this->html->activate_links($value);
|
||||
if ($activate_links) $value = html::activate_links($value);
|
||||
$html .= $value;
|
||||
break;
|
||||
case 'int': // size: [min],[max],[len],[precission/sprint format]
|
||||
@ -1153,13 +1136,13 @@ foreach($sess as $key => $val)
|
||||
$cell_opts = explode(',',$cell_options,3);
|
||||
if ($readonly && (int)$cell_opts[0] >= 0)
|
||||
{
|
||||
$html .= strlen($value) ? $this->html->bold($this->html->htmlspecialchars($value)) : '';
|
||||
$html .= strlen($value) ? html::bold(html::htmlspecialchars($value)) : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cell_opts[0] < 0) $cell_opts[0] = abs($cell_opts[0]);
|
||||
$html .= $this->html->input($form_name,$value,$type == 'passwd' ? 'password' : '',
|
||||
$options.$this->html->formatOptions($cell_opts,'SIZE,MAXLENGTH'));
|
||||
$html .= html::input($form_name,$value,$type == 'passwd' ? 'password' : '',
|
||||
$options.html::formatOptions($cell_opts,'SIZE,MAXLENGTH'));
|
||||
|
||||
if (!$readonly)
|
||||
{
|
||||
@ -1178,12 +1161,12 @@ foreach($sess as $key => $val)
|
||||
case 'textarea': // Multiline Text Input, size: [rows][,cols]
|
||||
if ($readonly && !$cell_options)
|
||||
{
|
||||
$html .= '<div>'.nl2br($this->html->htmlspecialchars($value))."</div>\n";
|
||||
$html .= '<div>'.nl2br(html::htmlspecialchars($value))."</div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $this->html->textarea($form_name,$value,
|
||||
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
|
||||
$html .= html::textarea($form_name,$value,
|
||||
$options.html::formatOptions($cell_options,'ROWS,COLS'));
|
||||
}
|
||||
if (!$readonly)
|
||||
{
|
||||
@ -1206,7 +1189,7 @@ foreach($sess as $key => $val)
|
||||
$fckoptions = array(
|
||||
'toolbar_expanded' => $toolbar,
|
||||
);
|
||||
$html .= $this->html->fckEditor($form_name,$value,$mode,$fckoptions,$height,$width,$baseref);
|
||||
$html .= html::fckEditor($form_name,$value,$mode,$fckoptions,$height,$width,$baseref);
|
||||
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
|
||||
'type' => $cell['type'],
|
||||
@ -1215,7 +1198,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $this->html->div($this->html->activate_links($value),'style="overflow: auto; width='. $width. '; height='. $height. '"');
|
||||
$html .= html::div(html::activate_links($value),'style="overflow: auto; width='. $width. '; height='. $height. '"');
|
||||
}
|
||||
break;
|
||||
case 'checkbox':
|
||||
@ -1235,7 +1218,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if (!$value && $ro_false == 'disable') return '';
|
||||
|
||||
$html .= $value ? $this->html->bold($ro_true) : $ro_false;
|
||||
$html .= $value ? html::bold($ro_true) : $ro_false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1246,7 +1229,7 @@ foreach($sess as $key => $val)
|
||||
// add the set_val to the id to make it unique
|
||||
$options = str_replace('id="'.$form_name,'id="'.substr($form_name,0,-2)."[$set_val]",$options);
|
||||
}
|
||||
$html .= $this->html->input($form_name,$set_val,'checkbox',$options);
|
||||
$html .= html::input($form_name,$set_val,'checkbox',$options);
|
||||
|
||||
if ($multiple) $form_name = $this->form_name($cname,substr($cell['name'],0,-2));
|
||||
|
||||
@ -1276,11 +1259,11 @@ foreach($sess as $key => $val)
|
||||
if ($readonly)
|
||||
{
|
||||
if (!$ro_true && !$ro_false) $ro_true = 'x';
|
||||
$html .= $value == $set_val ? $this->html->bold($ro_true) : $ro_false;
|
||||
$html .= $value == $set_val ? html::bold($ro_true) : $ro_false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $this->html->input($form_name,$set_val,'RADIO',$options);
|
||||
$html .= html::input($form_name,$set_val,'RADIO',$options);
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
|
||||
}
|
||||
break;
|
||||
@ -1302,14 +1285,14 @@ foreach($sess as $key => $val)
|
||||
(((string)$cell['onchange'] === '1' || $img) ?
|
||||
"return submitit($this->name_form,'".addslashes($form_name)."');" : $cell['onchange']).'; return false;';
|
||||
|
||||
if (!$this->html->netscape4 && substr($img,-1) == '%' && is_numeric($percent = substr($img,0,-1)))
|
||||
if (!html::$netscape4 && substr($img,-1) == '%' && is_numeric($percent = substr($img,0,-1)))
|
||||
{
|
||||
$html .= $this->html->progressbar($percent,$title,'onclick="'.$onclick.'" '.$options);
|
||||
$html .= html::progressbar($percent,$title,'onclick="'.$onclick.'" '.$options);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= '<a href="" onClick="'.$onclick.'" '.$options.'>' .
|
||||
($img ? $this->html->image($app,$img,$title,'border="0"') : $title) . '</a>';
|
||||
($img ? html::image($app,$img,$title,'border="0"') : $title) . '</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1322,9 +1305,9 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$onclick = ($onclick ? preg_replace('/^return(.*);$/','if (\\1) ',$onclick) : '').$cell['onchange'];
|
||||
}
|
||||
$html .= !$readonly ? $this->html->submit_button($form_name,$label,$onclick,
|
||||
$html .= !$readonly ? html::submit_button($form_name,$label,$onclick,
|
||||
strlen($label) <= 1 || $cell['no_lang'],$options,$img,$app,$type == 'buttononly' ? 'button' : 'submit') :
|
||||
$this->html->image($app,$ro_img);
|
||||
html::image($app,$ro_img);
|
||||
}
|
||||
$extra_label = False;
|
||||
if (!$readonly && $type != 'buttononly') // input button, are never submitted back!
|
||||
@ -1339,7 +1322,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
break;
|
||||
case 'hrule':
|
||||
$html .= $this->html->hr($cell_options);
|
||||
$html .= html::hr($cell_options);
|
||||
break;
|
||||
case 'grid':
|
||||
if ($readonly && !$readonlys['__ALL__'])
|
||||
@ -1466,11 +1449,11 @@ foreach($sess as $key => $val)
|
||||
|
||||
if ($option_title)
|
||||
{
|
||||
$html .= '<span title="'.$this->html->htmlspecialchars($option_title).'">'.$this->html->htmlspecialchars($option_label).'</span>';
|
||||
$html .= '<span title="'.html::htmlspecialchars($option_title).'">'.html::htmlspecialchars($option_label).'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $this->html->htmlspecialchars($option_label);
|
||||
$html .= html::htmlspecialchars($option_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1483,12 +1466,12 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if ($multiple && is_numeric($multiple)) // eg. "3+" would give a regular multiselectbox
|
||||
{
|
||||
$html .= $this->html->checkbox_multiselect($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$html .= html::checkbox_multiselect($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$cell['no_lang'],$options,$multiple,$multiple{0}!=='0',$extraStyleMultiselect);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$html .= html::select($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
|
||||
$cell['no_lang'],$options,$multiple);
|
||||
}
|
||||
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
|
||||
@ -1529,8 +1512,8 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
list($extra_link,$extra_link_target,$imagemap,$extra_link_popup,$id) = explode(',',$cell['size']);
|
||||
}
|
||||
$html .= $this->html->image($app,$img,strlen($label) > 1 && !$cell['no_lang'] ? lang($label) : $label,
|
||||
'border="0"'.($imagemap?' usemap="'.$this->html->htmlspecialchars($imagemap).'"':'').
|
||||
$html .= html::image($app,$img,strlen($label) > 1 && !$cell['no_lang'] ? lang($label) : $label,
|
||||
'border="0"'.($imagemap?' usemap="'.html::htmlspecialchars($imagemap).'"':'').
|
||||
($id || $value ? ' id="'.($id ? $id : $name).'"' : ''));
|
||||
$extra_label = False;
|
||||
break;
|
||||
@ -1538,8 +1521,8 @@ foreach($sess as $key => $val)
|
||||
if (!$readonly)
|
||||
{
|
||||
if ((int) $cell_options) $options .= ' size="'.(int)$cell_options.'"';
|
||||
$html .= $this->html->input_hidden($path_name = str_replace($name,$name.'_path',$form_name),'.');
|
||||
$html .= $this->html->input($form_name,'','file',$options);
|
||||
$html .= html::input_hidden($path_name = str_replace($name,$name.'_path',$form_name),'.');
|
||||
$html .= html::input($form_name,'','file',$options);
|
||||
$GLOBALS['egw_info']['etemplate']['form_options'] =
|
||||
"enctype=\"multipart/form-data\" onsubmit=\"set_element2(this,'$path_name','$form_name')\"";
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
|
||||
@ -1571,7 +1554,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if (!$orient)
|
||||
{
|
||||
$html .= $cl ? $this->html->div($h," class=\"$cl\"") : $h;
|
||||
$html .= $cl ? html::div($h," class=\"$cl\"") : $h;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1580,7 +1563,7 @@ foreach($sess as $key => $val)
|
||||
$box_anz++;
|
||||
if ($cell[$n]['align'])
|
||||
{
|
||||
$rows[$box_row]['.'.$box_col] = $this->html->formatOptions($child['align'],'align');
|
||||
$rows[$box_row]['.'.$box_col] = html::formatOptions($child['align'],'align');
|
||||
$sub_cell_has_align = true;
|
||||
}
|
||||
if (strlen($child['onclick']) > 1)
|
||||
@ -1602,13 +1585,13 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
$box_item_class = $this->expand_name(isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl,
|
||||
$show_c,$show_row,$content['.c'],$content['.row'],$content);
|
||||
$rows[$box_row]['.'.$box_col] .= $this->html->formatOptions($box_item_class,'class');
|
||||
$rows[$box_row]['.'.$box_col] .= html::formatOptions($box_item_class,'class');
|
||||
}
|
||||
}
|
||||
if ($box_anz > 1 && $orient) // a single cell is NOT placed into a table
|
||||
{
|
||||
$html = $this->html->table($rows,$this->html->formatOptions($cell_options,',,cellpadding,cellspacing').
|
||||
($type != 'groupbox' ? $this->html->formatOptions($class,'class').
|
||||
$html = html::table($rows,html::formatOptions($cell_options,',,cellpadding,cellspacing').
|
||||
($type != 'groupbox' ? html::formatOptions($class,'class').
|
||||
($cell['name'] ? ' id="'.$form_name.'"' : '') : '').
|
||||
($cell['align'] && $orient != 'horizontal' || $sub_cell_has_align ? ' width="100%"' : '')); // alignment only works if table has full width
|
||||
if ($type != 'groupbox') $class = ''; // otherwise we create an extra div
|
||||
@ -1624,13 +1607,13 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$label = lang($label);
|
||||
}
|
||||
$html = $this->html->fieldset($html,$label,($cell['name'] ? ' id="'.$form_name.'"' : '').
|
||||
$html = html::fieldset($html,$label,($cell['name'] ? ' id="'.$form_name.'"' : '').
|
||||
($class ? ' class="'.$class.'"' : ''));
|
||||
$class = ''; // otherwise we create an extra div
|
||||
}
|
||||
elseif (!$orient)
|
||||
{
|
||||
$html = $this->html->div($html,$this->html->formatOptions(array(
|
||||
$html = html::div($html,html::formatOptions(array(
|
||||
$cell['height'],
|
||||
$cell['width'],
|
||||
$class,
|
||||
@ -1658,14 +1641,14 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$s_height = "height: $s_height".(substr($s_height,-1) != '%' ? 'px' : '').';';
|
||||
}
|
||||
$html = $this->html->input_hidden($form_name,$value);
|
||||
$html = html::input_hidden($form_name,$value);
|
||||
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
|
||||
|
||||
for ($n = 1; $n <= $cell_options; ++$n)
|
||||
{
|
||||
$child = $cell[$n]; // first param is a var_param now!
|
||||
$html .= $this->html->div($this->show_cell($child,$content,$readonlys,$cname,$show_c,
|
||||
$show_row,$nul,$cl,$path.'/'.$n),$this->html->formatOptions(array(
|
||||
$html .= html::div($this->show_cell($child,$content,$readonlys,$cname,$show_c,
|
||||
$show_row,$nul,$cl,$path.'/'.$n),html::formatOptions(array(
|
||||
'display: '.($value == $child['name'] ? 'inline' : 'none').';',
|
||||
$child['name']
|
||||
),'style,id'));
|
||||
@ -1720,7 +1703,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if ($label && !$readonly && ($accesskey || $label_for || $type != 'label' && $cell['name']))
|
||||
{
|
||||
$label = $this->html->label($label,$label_for ? $this->form_name($cname,$label_for) :
|
||||
$label = html::label($label,$label_for ? $this->form_name($cname,$label_for) :
|
||||
$form_name.($set_val?"[$set_val]":''),$accesskey);
|
||||
}
|
||||
if ($type == 'radio' || $type == 'checkbox' || $label && strpos($label,'%s')!==false) // default for radio is label after the button
|
||||
@ -1734,7 +1717,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
if ($extra_link && (($extra_link = $this->expand_name($extra_link,$show_c,$show_row,$content['.c'],$content['.row'],$content))))
|
||||
{
|
||||
$options = $help ? ' onmouseover="self.status=\''.addslashes($this->html->htmlspecialchars($help)).'\'; return true;"' .
|
||||
$options = $help ? ' onmouseover="self.status=\''.addslashes(html::htmlspecialchars($help)).'\'; return true;"' .
|
||||
' onmouseout="self.status=\'\'; return true;"' : '';
|
||||
|
||||
if ($extra_link_target && (($extra_link_target = $this->expand_name($extra_link_target,$show_c,$show_row,$content['.c'],$content['.row'],$content))))
|
||||
@ -1750,7 +1733,7 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$options .= ' title="'.addslashes($extra_link_title).'"';
|
||||
}
|
||||
return $this->html->a_href($html,$extra_link,'',$options);
|
||||
return html::a_href($html,$extra_link,'',$options);
|
||||
}
|
||||
// if necessary show validation-error behind field
|
||||
if (isset($GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name]))
|
||||
@ -1767,7 +1750,7 @@ foreach($sess as $key => $val)
|
||||
{
|
||||
$html = (substr($html,-1) == "\n" ? substr($html,0,-1) : $html).' ';
|
||||
}
|
||||
return $this->html->div($html,' ondblclick="'.$handler.'"','clickWidgetToEdit');
|
||||
return html::div($html,' ondblclick="'.$handler.'"','clickWidgetToEdit');
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
@ -1780,7 +1763,7 @@ foreach($sess as $key => $val)
|
||||
* @param array $content=array();
|
||||
* @return array
|
||||
*/
|
||||
function _sel_options($cell,$name,$content=array())
|
||||
private function _sel_options($cell,$name,$content=array())
|
||||
{
|
||||
$sels = array();
|
||||
|
||||
@ -1894,7 +1877,7 @@ foreach($sess as $key => $val)
|
||||
* @param array &$var
|
||||
* @return array
|
||||
*/
|
||||
function array_stripslashes($var)
|
||||
static function array_stripslashes($var)
|
||||
{
|
||||
if (!is_array($var))
|
||||
{
|
||||
@ -1902,7 +1885,7 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
foreach($var as $key => $val)
|
||||
{
|
||||
$var[$key] = is_array($val) ? etemplate::array_stripslashes($val) : stripslashes($val);
|
||||
$var[$key] = is_array($val) ? self::array_stripslashes($val) : stripslashes($val);
|
||||
}
|
||||
return $var;
|
||||
}
|
||||
@ -1920,7 +1903,7 @@ foreach($sess as $key => $val)
|
||||
* @param string $type type of request
|
||||
* @return int number of validation errors (the adjusted content is returned by the var-param &$content !)
|
||||
*/
|
||||
function process_show(&$content,$to_process,$cname='', $type = 'regular')
|
||||
private function process_show(&$content,$to_process,$cname='', $type = 'regular')
|
||||
{
|
||||
if (!isset($content) || !is_array($content) || !is_array($to_process))
|
||||
{
|
||||
@ -2164,15 +2147,15 @@ foreach($sess as $key => $val)
|
||||
* &2 = returns the common functions, best to be included in the header
|
||||
* @return string javascript
|
||||
*/
|
||||
function include_java_script($what = 3)
|
||||
private function include_java_script($what = 3)
|
||||
{
|
||||
// this is to test if javascript is enabled
|
||||
if ($what & 1 && !isset($GLOBALS['egw_info']['etemplate']['java_script']))
|
||||
{
|
||||
$js = '<script language="javascript">
|
||||
document.write(\''.str_replace("\n",'',$this->html->input_hidden('java_script','1')).'\');
|
||||
document.write(\''.str_replace("\n",'',html::input_hidden('java_script','1')).'\');
|
||||
if (document.getElementById) {
|
||||
document.write(\''.str_replace("\n",'',$this->html->input_hidden('dom_enabled','1')).'\');
|
||||
document.write(\''.str_replace("\n",'',html::input_hidden('dom_enabled','1')).'\');
|
||||
}
|
||||
</script>
|
||||
';
|
||||
@ -2186,4 +2169,4 @@ if (document.getElementById) {
|
||||
}
|
||||
return $js;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - eTemplates
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Nathan Gray
|
||||
* @package etemplate
|
||||
* @version $Id$
|
||||
*/
|
||||
$GLOBALS['egw_info']['flags'] = array(
|
||||
'currentapp' => 'infolog',
|
||||
'noheader' => true,
|
||||
@ -177,4 +186,3 @@
|
||||
$gd_ver = $match[0];
|
||||
return $match[0];
|
||||
}
|
||||
?>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<hbox>
|
||||
<link-apps id="app" statustext="Select application to search" label="@search_label"/>
|
||||
<textbox id="query" blur="Search"/>
|
||||
<button id="query" label=">" statustext="Click here to start the search" onclick="xajax_doXMLHTTP('etemplate.link_widget.ajax_search',document.getElementById(form::name('app')).value,document.getElementById(form::name('query')).value,form::name('id'),form::name('search_line'),form::name('remark')+','+form::name('select_line'),form::name('query')); return false;"/>
|
||||
<button id="start_search" label=">" statustext="Click here to start the search" onclick="xajax_doXMLHTTP('etemplate.link_widget.ajax_search',document.getElementById(form::name('app')).value,document.getElementById(form::name('query')).value,form::name('id'),form::name('search_line'),form::name('remark')+','+form::name('select_line'),form::name('query')); return false;"/>
|
||||
</hbox>
|
||||
<grid>
|
||||
<columns>
|
||||
|
Loading…
Reference in New Issue
Block a user