phpgw --> egw

from this revision eTemplate requires a 1.0.1/1.2 API, the last working version for 1.0.0 has been taged "last_working_1_0_0"
This commit is contained in:
Ralf Becker 2005-11-09 20:50:45 +00:00
parent 7116559eed
commit 7a4a18ec0a
27 changed files with 585 additions and 526 deletions

View File

@ -12,8 +12,7 @@
/* $Id$ */
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.so_sql.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['so_sql'] = True; // for 0.9.14
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.so_sql.inc.php');
class et_media extends so_sql
{
@ -27,7 +26,7 @@
function et_media()
{
$this->tmpl = CreateObject('etemplate.etemplate','et_media.edit');
$this->tmpl =& CreateObject('etemplate.etemplate','et_media.edit');
$this->so_sql('et_media','phpgw_et_media'); // sets up our storage layer using the table 'phpgw_et_media'
$this->empty_on_write = "''"; // that means if a column is empty how to write in the db, the default is NULL
@ -129,11 +128,11 @@
$this->tmpl->exec('et_media.et_media.edit',$content);
}
/*!
@function writeLangFile
@abstract writes langfile with all templates and types here
@discussion can be called via [write Langfile] in the eTemplate editor or
@discussion http://domain/egroupware/index.php?et_media.et_media.writeLangFile
/**
* writes langfile with all templates and types here
*
* can be called via [write Langfile] in the eTemplate editor or
* http://domain/egroupware/index.php?et_media.et_media.writeLangFile
*/
function writeLangFile()
{

View File

@ -12,13 +12,13 @@
/* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array(
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'et_media',
'noheader' => True,
'nonavbar' => True
'nonavbar' => True,
),
);
include('../header.inc.php');
header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction=et_media.et_media.edit'));
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
exit;
$GLOBALS['egw']->redirect_link('/index.php','menuaction=et_media.et_media.edit');

View File

@ -14,9 +14,9 @@
$setup_info['et_media']['name'] = 'et_media';
$setup_info['et_media']['title'] = 'eT-Media';
$setup_info['et_media']['version'] = '1.0.0';
$setup_info['et_media']['version'] = '1.2';
$setup_info['et_media']['app_order'] = 100; // at the end
$setup_info['et_media']['tables'] = array('phpgw_et_media');
$setup_info['et_media']['tables'] = array('egw_et_media');
$setup_info['et_media']['enable'] = 1;
$setup_info['et_media']['author'] =
$setup_info['et_media']['maintainer'] = array(
@ -34,9 +34,9 @@
/* Dependencies for this app to work */
$setup_info['et_media']['depends'][] = array(
'appname' => 'phpgwapi',
'versions' => Array('0.9.13','0.9.14','0.9.15','1.0.0','1.0.1')
'versions' => Array('1.0.0','1.0.1','1.2')
);
$setup_info['et_media']['depends'][] = array( // this is only necessary as long the etemplate-class is not in the api
$setup_info['et_media']['depends'][] = array(
'appname' => 'etemplate',
'versions' => Array('0.9.13','0.9.14','0.9.15','1.0.0')
'versions' => Array('1.0.0','1.0.1','1.2')
);

View File

@ -1,7 +1,19 @@
<?php
/**************************************************************************\
* eGroupWare - Editable Templates: Example App of the tutorial *
* http://www.egroupware.org *
" Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* -------------------------------------------- *
* 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$ */
$phpgw_baseline = array(
'phpgw_et_media' => array(
'egw_et_media' => array(
'fd' => array(
'id' => array('type' => 'auto','nullable' => False),
'name' => array('type' => 'varchar','precision' => '100','nullable' => False),

View File

@ -12,7 +12,7 @@
/* $Id$ */
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.soetemplate.inc.php');
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.soetemplate.inc.php');
/**
* Business Object for eTemplates, extending the Storage Object
@ -79,7 +79,7 @@
{
$this->init($name);
}
$this->garbage_collection_done =& $GLOBALS['phpgw_info']['etemplate']['garbage_collection_done'];
$this->garbage_collection_done =& $GLOBALS['egw_info']['etemplate']['garbage_collection_done'];
}
/**
@ -238,7 +238,7 @@
{
list($msec,$sec) = explode(' ',microtime());
$time = 100 * $sec + (int)(100 * $msec); // gives precision of 1/100 sec
$id = $GLOBALS['phpgw_info']['flags']['currentapp'] .':'. $time;
$id = $GLOBALS['egw_info']['flags']['currentapp'] .':'. $time;
//echo "<p>microtime()=".microtime().", sec=$sec, msec=$msec, id=$id</p>\n";
return $id;
}
@ -261,9 +261,9 @@
{
$id = $this->appsession_id();
}
$GLOBALS['phpgw']->session->appsession($id,'etemplate',$data);
$GLOBALS['egw']->session->appsession($id,'etemplate',$data);
if (substr($GLOBALS['phpgw_info']['server']['sessions_type'],0,4) == 'php4' && !$this->garbage_collection_done)
if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4' && !$this->garbage_collection_done)
{
return $this->php4_session_garbage_collection();
}
@ -278,10 +278,10 @@
*/
function get_appsession($id)
{
$data = $GLOBALS['phpgw']->session->appsession($id,'etemplate');
$data = $GLOBALS['egw']->session->appsession($id,'etemplate');
//echo "boetemplate::get_appsession('$id')"; _debug_array($data);
if (substr($GLOBALS['phpgw_info']['server']['sessions_type'],0,4) == 'php4')
if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4')
{
$this->php4_session_garbage_collection($id);
}
@ -461,29 +461,29 @@
list($class,$app) = explode('.',$type);
$class .= '_widget';
if (!$app) $app = $GLOBALS['phpgw_info']['flags']['current_app'];
if (!$app) $app = $GLOBALS['egw_info']['flags']['current_app'];
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
if (!file_exists(EGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
{
list($app) = explode('_',$type);
}
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
if (!file_exists(EGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
{
list($app) = explode('.',$this->name);
}
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
if (!file_exists(EGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
{
$app = 'etemplate';
}
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
if (!file_exists(EGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
{
//echo "<p>boetemplate::loadExtension($type) extension not found</p>\n";
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type] = False;
return $GLOBALS['egw_info']['etemplate']['extension'][$type] = False;
}
$GLOBALS['phpgw_info']['etemplate']['extension'][$type] =& CreateObject($app.'.'.$class,$ui='html');
$GLOBALS['egw_info']['etemplate']['extension'][$type] =& CreateObject($app.'.'.$class,$ui='html');
//echo "<p>boetemplate::loadExtension($type) extension found in App. $app</p>\n";
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->human_name;
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->human_name;
}
/**
@ -496,8 +496,8 @@
*/
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 ($GLOBALS['egw_info']['etemplate']['extension'][$type] || $this->loadExtension($type,$ui)) &&
($function == '' || $GLOBALS['egw_info']['etemplate']['extension'][$type]->public_functions[$function]);
}
/**
@ -516,8 +516,8 @@
{
return False;
}
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->pre_process($name,$value,$cell,$readonlys,
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->pre_process($name,$value,$cell,$readonlys,
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],$this);
}
/**
@ -535,9 +535,9 @@
{
return True;
}
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->post_process($name,$value,
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],
$GLOBALS['phpgw_info']['etemplate']['loop'],$this,$value_in);
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->post_process($name,$value,
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],
$GLOBALS['egw_info']['etemplate']['loop'],$this,$value_in);
}
/**
@ -556,8 +556,8 @@
{
return False;
}
return $GLOBALS['phpgw_info']['etemplate']['extension'][$type]->render($cell,$name,$value,$readonly,
$GLOBALS['phpgw_info']['etemplate']['extension_data'][$name],$this);
return $GLOBALS['egw_info']['etemplate']['extension'][$type]->render($cell,$name,$value,$readonly,
$GLOBALS['egw_info']['etemplate']['extension_data'][$name],$this);
}
/**
@ -776,7 +776,7 @@
function store_in_cache()
{
//echo "<p>store_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
$GLOBALS['phpgw_info']['etemplate']['cache'][$this->cache_name()] = $this->as_array(1);
$GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()] = $this->as_array(1);
}
/**
@ -785,7 +785,7 @@
function delete_in_cache()
{
//echo "<p>delete_in_cache('$this->name','$this->template','$this->lang','$this->version')</p>\n";
unset($GLOBALS['phpgw_info']['etemplate']['cache'][$this->cache_name()]);
unset($GLOBALS['egw_info']['etemplate']['cache'][$this->cache_name()]);
}
/*
@ -806,8 +806,8 @@
$version = $name['version'];
$name = $name['name'];
}
if (!isset($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]) ||
!empty($version) && $GLOBALS['phpgw_info']['etemplate']['cache'][$cname]['version'] != $version)
if (!isset($GLOBALS['egw_info']['etemplate']['cache'][$cname]) ||
!empty($version) && $GLOBALS['egw_info']['etemplate']['cache'][$cname]['version'] != $version)
{
//echo " NOT found in cache</p>\n";
return False;
@ -833,7 +833,7 @@
//if (is_array($name)) $version = $name['version']; echo "<p>read_from_cache(,,,version='$version'): ";
if ($cname = $this->in_cache($name,$template,$lang,$group))
{
$this->init($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]);
$this->init($GLOBALS['egw_info']['etemplate']['cache'][$cname]);
return True;
}

View File

@ -65,14 +65,14 @@
{
if ($ui == 'html')
{
if (!is_object($GLOBALS['phpgw']->jscalendar))
if (!is_object($GLOBALS['egw']->jscalendar))
{
$GLOBALS['phpgw']->jscalendar =& CreateObject('phpgwapi.jscalendar');
$GLOBALS['egw']->jscalendar =& CreateObject('phpgwapi.jscalendar');
}
$this->jscal =& $GLOBALS['phpgw']->jscalendar;
$this->jscal =& $GLOBALS['egw']->jscalendar;
}
$this->timeformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'];
$this->dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$this->timeformat = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'];
$this->dateformat = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
}
/**
@ -447,7 +447,7 @@
}
elseif (!preg_match('/^-?[0-9]*[,.]?[0-9]*'.($extension_data['percent_allowed'] ? '%?' : '').'$/',$value_in))
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$name] = lang("'%1' is not a valid floatingpoint number !!!",$value_in);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$name] = lang("'%1' is not a valid floatingpoint number !!!",$value_in);
return false;
}
else
@ -528,8 +528,8 @@
// checking the date is a correct one
if (!checkdate($value['m'],$value['d'],$value['Y']))
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$name] .= lang("'%1' is not a valid date !!!",
$GLOBALS['phpgw']->common->dateformatorder($value['Y'],$value['m'],$value['d'],true));
$GLOBALS['egw_info']['etemplate']['validation_errors'][$name] .= lang("'%1' is not a valid date !!!",
$GLOBALS['egw']->common->dateformatorder($value['Y'],$value['m'],$value['d'],true));
}
$data_format = $extension_data['data_format'];
if (empty($data_format))

View File

@ -45,6 +45,7 @@
'longtext' => 'longtext',
'text' => 'text',
'timestamp' => 'timestamp',
'bool' => 'boolean',
// 'abstime' => 'abstime (mysql:timestamp)',
);
var $setup_header = '<?php
@ -67,15 +68,15 @@
*/
function db_tools()
{
$this->editor = CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
$this->editor =& CreateObject('etemplate.etemplate','etemplate.db-tools.edit');
$this->data = array();
if (!is_array($GLOBALS['phpgw_info']['apps']) || !count($GLOBALS['phpgw_info']['apps']))
if (!is_array($GLOBALS['egw_info']['apps']) || !count($GLOBALS['egw_info']['apps']))
{
ExecMethod('phpgwapi.applications.read_installed_apps');
}
$GLOBALS['phpgw_info']['flags']['app_header'] =
$GLOBALS['phpgw_info']['apps']['etemplate']['title'].' - '.lang('DB-Tools');
$GLOBALS['egw_info']['flags']['app_header'] =
$GLOBALS['egw_info']['apps']['etemplate']['title'].' - '.lang('DB-Tools');
}
/**
@ -170,14 +171,14 @@
}
else // import
{
$oProc = CreateObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
$oProc =& CreateObject('phpgwapi.schema_proc',$GLOBALS['egw_info']['server']['db_type']);
if (method_exists($oProc,'GetTableDefinition'))
{
$this->data[$this->table = $content['new_table_name']] = $oProc->GetTableDefinition($content['new_table_name']);
}
else // to support eGW 1.0
{
$oProc->m_odb = $GLOBALS['phpgw']->db;
$oProc->m_odb = clone($GLOBALS['egw']->db);
$oProc->m_oTranslator->_GetColumns($oProc,$content['new_table_name'],$nul);
while (list($key,$tbldata) = each ($oProc->m_oTranslator->sCol))
@ -321,9 +322,9 @@
$new_version[$minor] = sprintf('%03d',1+$new_version[$minor]);
$content['new_version'] = implode('.',$new_version);
$tmpl = new etemplate('etemplate.db-tools.ask_save');
$tmpl =& new etemplate('etemplate.db-tools.ask_save');
if (!file_exists(PHPGW_SERVER_ROOT."/$posted_app/setup/tables_current.inc.php"))
if (!file_exists(EGW_SERVER_ROOT."/$posted_app/setup/tables_current.inc.php"))
{
$tmpl->disable_cells('version');
$tmpl->disable_cells('new_version');
@ -560,7 +561,7 @@
*/
function read($app,&$phpgw_baseline)
{
$file = PHPGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
$file = EGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
$phpgw_baseline = array();
@ -647,7 +648,7 @@
*/
function write($app,$phpgw_baseline)
{
$file = PHPGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
$file = EGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
if (file_exists($file) && ($f = fopen($file,'r')))
{
@ -659,9 +660,9 @@
$header = substr($header,0,strpos($header,'$phpgw_baseline'));
fclose($f);
if (is_writable(PHPGW_SERVER_ROOT."/$app/setup"))
if (is_writable(EGW_SERVER_ROOT."/$app/setup"))
{
$old_file = PHPGW_SERVER_ROOT . "/$app/setup/tables_current.old.inc.php";
$old_file = EGW_SERVER_ROOT . "/$app/setup/tables_current.old.inc.php";
if (file_exists($old_file))
{
unlink($old_file);
@ -677,7 +678,7 @@
{
$header = $this->setup_header . "\n\n";
}
if (!is_writeable(PHPGW_SERVER_ROOT."/$app/setup") || !($f = fopen($file,'w')))
if (!is_writeable(EGW_SERVER_ROOT."/$app/setup") || !($f = fopen($file,'w')))
{
return False;
}
@ -702,7 +703,7 @@
{
//echo "<p>etemplate.db_tools.setup_version('$app','$new','$tables')</p>\n";
$file = PHPGW_SERVER_ROOT."/$app/setup/setup.inc.php";
$file = EGW_SERVER_ROOT."/$app/setup/setup.inc.php";
if (file_exists($file))
{
include($file);
@ -727,9 +728,9 @@
$fcontent = fread($f,filesize($file));
fclose ($f);
if (is_writable(PHPGW_SERVER_ROOT."/$app/setup"))
if (is_writable(EGW_SERVER_ROOT."/$app/setup"))
{
$old_file = PHPGW_SERVER_ROOT . "/$app/setup/setup.old.inc.php";
$old_file = EGW_SERVER_ROOT . "/$app/setup/setup.old.inc.php";
if (file_exists($old_file))
{
unlink($old_file);
@ -787,7 +788,7 @@
$fnew .= "\t\$setup_info['$app']['tables'] = array($tables);\n";
}
}
if (!is_writeable(PHPGW_SERVER_ROOT."/$app/setup") || !($f = fopen($file,'w')))
if (!is_writeable(EGW_SERVER_ROOT."/$app/setup") || !($f = fopen($file,'w')))
{
return False;
}
@ -808,13 +809,13 @@
function update($app,$current,$version)
{
//echo "<p>etemplate.db_tools.update('$app',...,'$version')</p>\n";
if (!is_writable(PHPGW_SERVER_ROOT."/$app/setup"))
if (!is_writable(EGW_SERVER_ROOT."/$app/setup"))
{
return False;
}
$file_baseline = PHPGW_SERVER_ROOT."/$app/setup/tables_baseline.inc.php";
$file_current = PHPGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
$file_update = PHPGW_SERVER_ROOT."/$app/setup/tables_update.inc.php";
$file_baseline = EGW_SERVER_ROOT."/$app/setup/tables_baseline.inc.php";
$file_current = EGW_SERVER_ROOT."/$app/setup/tables_current.inc.php";
$file_update = EGW_SERVER_ROOT."/$app/setup/tables_update.inc.php";
if (!file_exists($file_baseline) && !copy($file_current,$file_baseline))
{
@ -830,7 +831,7 @@
$update = fread($f,filesize($file_update));
$update = str_replace('?>','',$update);
fclose($f);
$old_file = PHPGW_SERVER_ROOT . "/$app/setup/tables_update.old.inc.php";
$old_file = EGW_SERVER_ROOT . "/$app/setup/tables_update.old.inc.php";
if (file_exists($old_file))
{
unlink($old_file);

View File

@ -94,7 +94,7 @@
{
$this->etemplate =& CreateObject('etemplate.etemplate');
$this->extensions = $GLOBALS['phpgw']->session->appsession('extensions','etemplate');
$this->extensions = $GLOBALS['egw']->session->appsession('extensions','etemplate');
}
function export_xml(&$xml,&$xml_label)
@ -110,10 +110,10 @@
}
$xml = $this->etemplate->xul_io->export($this->etemplate);
$dir = PHPGW_SERVER_ROOT . "/$app/templates/$template";
$dir = EGW_SERVER_ROOT . "/$app/templates/$template";
if (($create_it = !is_dir($dir)))
{
$dir = PHPGW_SERVER_ROOT . "/$app/templates";
$dir = EGW_SERVER_ROOT . "/$app/templates";
}
if (!is_writeable($dir))
{
@ -262,8 +262,8 @@
{
$content[$row] = $param;
}
$list_result = new etemplate('etemplate.editor.list_result');
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Editable Templates - Search');
$list_result =& new etemplate('etemplate.editor.list_result');
$GLOBALS['egw_info']['flags']['app_header'] = lang('Editable Templates - Search');
$list_result->exec('etemplate.editor.list_result',$content,'','',array(
'result' => $result,
),'');
@ -374,7 +374,7 @@
list($app) = explode('.',$this->etemplate->name);
if ($app && $app != 'etemplate')
{
$GLOBALS['phpgw']->translation->add_app($app); // load translations for app
$GLOBALS['egw']->translation->add_app($app); // load translations for app
if (($extensions = $this->scan_for_extensions($app)))
{
@ -393,7 +393,7 @@
}
elseif ($content['dump'])
{
if (empty($app) || !@is_dir(PHPGW_SERVER_ROOT.'/'.$app))
if (empty($app) || !@is_dir(EGW_SERVER_ROOT.'/'.$app))
{
$msg .= lang('Application name needed to write a langfile or dump the eTemplates !!!');
}
@ -404,7 +404,7 @@
}
elseif ($content['langfile'])
{
if (empty($app) || !@is_dir(PHPGW_SERVER_ROOT.'/'.$app))
if (empty($app) || !@is_dir(EGW_SERVER_ROOT.'/'.$app))
{
$msg = lang('Application name needed to write a langfile or dump the eTemplates !!!');
}
@ -471,16 +471,16 @@
<script language="javascript">
function edit_widget(path)
{
var url = "'.$GLOBALS['phpgw']->link('/index.php',$this->etemplate->as_array(-1)+array(
var url = "'.$GLOBALS['egw']->link('/index.php',$this->etemplate->as_array(-1)+array(
'menuaction' => 'etemplate.editor.widget',
)).'";
url = url.replace(/index.php\\?/,"index.php?path="+path+"&");
window.open(url,"etemplate_editor_widget","dependent=yes,width=600,height=450,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes");
}
</script>';
if ($app != 'etemplate' && file_exists(PHPGW_SERVER_ROOT.'/'.$app.'/templates/default/app.css'))
if ($app != 'etemplate' && file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates/default/app.css'))
{
$new_content['onclick'] .= $editor->html->style('@import url('.$GLOBALS['phpgw_info']['server']['webserver_url'].'/'.$app.'/templates/default/app.css);');
$new_content['onclick'] .= $editor->html->style('@import url('.$GLOBALS['egw_info']['server']['webserver_url'].'/'.$app.'/templates/default/app.css);');
}
$editor->data[$editor->rows]['A']['obj'] = &$this->etemplate;
$vals = $content['vals'];
@ -495,7 +495,7 @@
$preserv['olds'] = $vals;
$preserv['old_keys'] = $this->etemplate->as_array(-1); // in case we do a save as
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Editable Templates - Show Template');
$GLOBALS['egw_info']['flags']['app_header'] = lang('Editable Templates - Show Template');
$editor->exec('etemplate.editor.edit',$new_content,array(),'',$preserv,0,'/^cont/');
}
@ -696,21 +696,21 @@
{
case 'paste':
case 'swap':
$clipboard = $GLOBALS['phpgw']->session->appsession('clipboard','etemplate');
$clipboard = $GLOBALS['egw']->session->appsession('clipboard','etemplate');
if (!is_array($clipboard))
{
return lang('nothing in clipboard to paste !!!');
}
if ($action == 'swap')
{
$GLOBALS['phpgw']->session->appsession('clipboard','etemplate',$content['cell']);
$GLOBALS['egw']->session->appsession('clipboard','etemplate',$content['cell']);
}
$content['cell'] = $clipboard;
break;
case 'copy':
case 'cut':
$GLOBALS['phpgw']->session->appsession('clipboard','etemplate',$content['cell']);
$GLOBALS['egw']->session->appsession('clipboard','etemplate',$content['cell']);
if ($action != 'cut')
{
return lang('widget copied into clipboard');
@ -1198,7 +1198,7 @@
{
$content['opener']['version'] = $content['version'];
}
$js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',array(
$js = "opener.location.href='".$GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'etemplate.editor.edit',
)+$content['opener'])."';";
if ($action == 'apply' || $action == 'apply-no-merge') break;
@ -1206,7 +1206,7 @@
case 'cancel':
$js .= 'window.close();';
echo "<html><body><script>$js</script></body></html>\n";
$GLOBALS['phpgw']->common->phpgw_exit();
$GLOBALS['egw']->common->egw_exit();
break;
}
if ($js)
@ -1280,8 +1280,8 @@
);
unset($preserv['cell']['options']); // otherwise we never know if content is returned via options array or size
$GLOBALS['phpgw_info']['flags']['java_script'] = "<script>window.focus();</script>\n";
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Editable Templates - Editor');
$GLOBALS['egw_info']['flags']['java_script'] = "<script>window.focus();</script>\n";
$GLOBALS['egw_info']['flags']['app_header'] = lang('Editable Templates - Editor');
$editor->exec('etemplate.editor.widget',$content,array(
'type' => array_merge($this->etemplate->types,$this->extensions),
'align' => &$this->aligns,
@ -1324,7 +1324,7 @@
{
if ($content['from'])
{
$path = PHPGW_SERVER_ROOT.'/'.$content['from'];
$path = EGW_SERVER_ROOT.'/'.$content['from'];
if (is_writable(dirname($path)) && file_exists($path))
{
rename($path,str_replace('.css','.old.css',$path));
@ -1349,7 +1349,7 @@
$ok = $this->etemplate->save();
$msg = $ok ? lang('Template saved') : lang('Error: while saving !!!');
}
$js = "opener.location.href='".$GLOBALS['phpgw']->link('/index.php',array(
$js = "opener.location.href='".$GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'etemplate.editor.edit',
)+$this->etemplate->as_array(-1))."';";
}
@ -1357,7 +1357,7 @@
{
$js .= 'window.close();';
echo "<html><body><script>$js</script></body></html>\n";
$GLOBALS['phpgw']->common->phpgw_exit();
$GLOBALS['egw']->common->egw_exit();
}
$content = array(
'from' => $content['from'],
@ -1368,7 +1368,7 @@
if ($content['from'])
{
$path = PHPGW_SERVER_ROOT.'/'.$content['from'];
$path = EGW_SERVER_ROOT.'/'.$content['from'];
$content['styles'] = file_exists($path) && is_readable($path) ? implode('',file($path)) : '';
if (!is_writable(dirname($path)) && (!file_exists($path) || !is_writable($path)))
{
@ -1383,10 +1383,10 @@
$keys = $this->etemplate->as_array(-1); unset($keys['group']);
$sources[''] = lang('eTemplate').': '.implode(':',$keys);
list($app) = explode('.',$this->etemplate->name);
$app_templates = @opendir(PHPGW_SERVER_ROOT.'/'.$app.'/templates');
$app_templates = @opendir(EGW_SERVER_ROOT.'/'.$app.'/templates');
while (($template = @readdir($app_templates)) !== false)
{
$dir = PHPGW_SERVER_ROOT.'/'.$app.'/templates/'.$template;
$dir = EGW_SERVER_ROOT.'/'.$app.'/templates/'.$template;
if ($template[0] == '.' || $template == 'CVS' || !is_dir($dir.'/images')) continue; // not a template-dir
$exists = file_exists($dir.'/app.css');
$writable = is_writable($dir) || $exists && is_writable($dir.'/app.css');
@ -1394,8 +1394,8 @@
$rel_path = $app.'/templates/'.$template.'/app.css';
$sources[$rel_path] = lang('file').': '.$rel_path.($exists && !$writable ? ' ('.lang('readonly').')' : '');
}
$GLOBALS['phpgw_info']['flags']['java_script'] = "<script>window.focus();</script>\n";
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('etemplate').' - '.lang('CSS-styles');
$GLOBALS['egw_info']['flags']['java_script'] = "<script>window.focus();</script>\n";
$GLOBALS['egw_info']['flags']['app_header'] = lang('etemplate').' - '.lang('CSS-styles');
$tmpl->exec('etemplate.editor.styles',$content,array('from'=>$sources),'',$keys,2);
}
@ -1415,7 +1415,7 @@
if (isset($this->extensions['**loaded**'][$app])) return ''; // already loaded
$labels = array();
$dir = @opendir(PHPGW_SERVER_ROOT.'/'.$app.'/inc');
$dir = @opendir(EGW_SERVER_ROOT.'/'.$app.'/inc');
while ($dir && ($file = readdir($dir)))
{
if (ereg('class\\.([a-zA-Z0-9_]*)_widget.inc.php',$file,$regs) &&
@ -1435,10 +1435,10 @@
}
}
// store the information in the session, our constructor loads it from there
$GLOBALS['phpgw']->session->appsession('extensions','etemplate',$this->extensions);
$apps_loaded = $GLOBALS['phpgw']->session->appsession('apps_loaded','etemplate');
$GLOBALS['egw']->session->appsession('extensions','etemplate',$this->extensions);
$apps_loaded = $GLOBALS['egw']->session->appsession('apps_loaded','etemplate');
$apps_loaded[$app] = true;
$GLOBALS['phpgw']->session->appsession('apps_loaded','etemplate',$apps_loaded);
$GLOBALS['egw']->session->appsession('apps_loaded','etemplate',$apps_loaded);
//_debug_array($this->extensions); _debug_array($apps_loaded);
return implode(', ',$labels);

View File

@ -12,9 +12,9 @@
/* $Id$ */
$ui = ''; // html UI, which UI to use, should come from api and be in $GLOBALS['phpgw']???
$ui = ''; // html UI, which UI to use, should come from api and be in $GLOBALS['egw']???
if ($_ENV['DISPLAY'] && isset($_SERVER['_']))
{
$ui = '_gtk';
}
include_once(PHPGW_INCLUDE_ROOT . "/etemplate/inc/class.uietemplate$ui.inc.php");
include_once(EGW_INCLUDE_ROOT . "/etemplate/inc/class.uietemplate$ui.inc.php");

View File

@ -124,7 +124,7 @@
{
$value = array(
'to_id' => $value,
'to_app' => $GLOBALS['phpgw_info']['flags']['currentapp']
'to_app' => $GLOBALS['egw_info']['flags']['currentapp']
);
}
if ($this->debug)

View File

@ -104,7 +104,7 @@
*/
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
$nm_global = &$GLOBALS['phpgw_info']['etemplate']['nextmatch'];
$nm_global = &$GLOBALS['egw_info']['etemplate']['nextmatch'];
//echo "<p>nextmatch_widget.pre_process(name='$name',type='$cell[type]'): value = "; _debug_array($value);
//echo "<p>nextmatch_widget.pre_process(name='$name',type='$cell[type]'): nm_global = "; _debug_array($nm_global);
@ -179,7 +179,7 @@
}
if (!is_object($obj) || !method_exists($obj,$method))
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$name] = "nextmatch_widget::pre_process($cell[name]): '$value[get_rows]' is no valid method !!!";
$GLOBALS['egw_info']['etemplate']['validation_errors'][$name] = "nextmatch_widget::pre_process($cell[name]): '$value[get_rows]' is no valid method !!!";
}
else
{
@ -214,7 +214,7 @@
{
$value['template']->data[0]['h'.$value['template']->rows] .= ',1'; // disable the last data row
}
$max = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$max = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
if (!$value['never_hide'] && $total <= $max && $options && $value['search'] == '' &&
($value['no_cat'] || !$value['cat_id']) &&
($value['no_filter'] || !$value['filter'] || $value['filter'] == 'none') &&
@ -222,7 +222,7 @@
{ // disable whole nextmatch line if no scrolling necessary
if ($value['header_left'] || $value['header_right'])
{
$nextmatch = new etemplate('etemplate.nextmatch_widget.header_only');
$nextmatch =& new etemplate('etemplate.nextmatch_widget.header_only');
$cell['size'] = $cell['name'];
$cell['obj'] = &$nextmatch;
$cell['name'] = $nextmatch->name;
@ -299,7 +299,7 @@
*/
function post_process($name,&$value,&$extension_data,&$loop,&$tmpl,$value_in)
{
$nm_global = &$GLOBALS['phpgw_info']['etemplate']['nextmatch'];
$nm_global = &$GLOBALS['egw_info']['etemplate']['nextmatch'];
//echo "<p>nextmatch_widget.post_process(type='$extension_data[type]', name='$name',value_in='$value_in',order='$nm_global[order]'): value = "; _debug_array($value);
switch($extension_data['type'])
{
@ -322,7 +322,7 @@
}
$old_value = $extension_data;
$max = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$max = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
$value['start'] = $old_value['start']; // need to be set, to be reported back
if (is_array($value['bottom'])) // we have a second bottom-bar

View File

@ -197,7 +197,7 @@
case 'select-country':
if (!$this->countrys)
{
$country = CreateObject('phpgwapi.country');
$country =& CreateObject('phpgwapi.country');
$this->countrys = &$country->country_array;
unset($country);
unset($this->countrys[' ']);
@ -222,11 +222,11 @@
break;
case 'select-cat': // !$type == globals cats too
if (!is_object($GLOBALS['phpgw']->categories))
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories');
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
}
foreach((array)$GLOBALS['phpgw']->categories->return_sorted_array(0,False,'','','',!$type) as $cat)
foreach((array)$GLOBALS['egw']->categories->return_sorted_array(0,False,'','','',!$type) as $cat)
{
$s = str_repeat('&nbsp;',$cat['level']) . $GLOBALS['egw']->strip_html($cat['name']);
@ -264,24 +264,24 @@
}
if ($this->ui == 'html' && $type != 'groups') // use eGW's new account-selection (html only)
{
if (!is_object($GLOBALS['phpgw']->uiaccountsel))
if (!is_object($GLOBALS['egw']->uiaccountsel))
{
$GLOBALS['phpgw']->uiaccountsel =& CreateObject('phpgwapi.uiaccountsel');
$GLOBALS['egw']->uiaccountsel =& CreateObject('phpgwapi.uiaccountsel');
}
$help = (int)$cell['no_lang'] < 2 ? lang($cell['help']) : $cell['help'];
$onFocus = "self.status='".addslashes(htmlspecialchars($help))."'; return true;";
$onBlur = "self.status=''; return true;";
$value = $GLOBALS['phpgw']->uiaccountsel->selection($name,'eT_accountsel_'.str_replace(array('[','][',']'),array('_','_',''),$name),
$value = $GLOBALS['egw']->uiaccountsel->selection($name,'eT_accountsel_'.str_replace(array('[','][',']'),array('_','_',''),$name),
$value,$type,$rows > 0 ? $rows : 0,False,' onfocus="'.$onFocus.'" onblur="'.$onBlur.'"',
$cell['onchange'] == '1' ? 'this.form.submit();' : $cell['onchange'],
!empty($rows) && 0+$rows <= 0 ? lang($rows < 0 ? 'all' : $rows) : False);
$cell['type'] = 'html';
$cell['size'] = ''; // is interpreted as link otherwise
$GLOBALS['phpgw_info']['etemplate']['to_process'][$name] = 'select';
$GLOBALS['egw_info']['etemplate']['to_process'][$name] = 'select';
break;
}
$cell['no_lang'] = True;
$accs = $GLOBALS['phpgw']->accounts->get_list(empty($type) ? 'accounts' : $type); // default is accounts
$accs = $GLOBALS['egw']->accounts->get_list(empty($type) ? 'accounts' : $type); // default is accounts
foreach($accs as $acc)
{
if ($acc['account_type'] == 'u')
@ -334,7 +334,7 @@
define('MCAL_M_WEEKEND',65);
define('MCAL_M_ALLDAYS',127);
}
$weekstart = $GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'];
$weekstart = $GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts'];
$cell['sel_options'] = array();
if ($rows >= 2 && !$type)
{
@ -382,7 +382,7 @@
}
if (!$readonly)
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$name] = 'ext-select-dow';
$GLOBALS['egw_info']['etemplate']['to_process'][$name] = 'ext-select-dow';
}
break;
@ -414,19 +414,19 @@
case 'select-app': // type2: ''=users enabled apps, 'installed', 'all' = not installed ones too
$apps = array();
foreach ($GLOBALS['phpgw_info']['apps'] as $app => $data)
foreach ($GLOBALS['egw_info']['apps'] as $app => $data)
{
if (!$type2 || $GLOBALS['phpgw_info']['user']['apps'][$app])
if (!$type2 || $GLOBALS['egw_info']['user']['apps'][$app])
{
$apps[$app] = $data['title'] ? $data['title'] : lang($app);
}
}
if ($type2 == 'all')
{
$dir = opendir(PHPGW_SERVER_ROOT);
$dir = opendir(EGW_SERVER_ROOT);
while ($file = readdir($dir))
{
if (@is_dir(PHPGW_SERVER_ROOT."/$file/setup") && $file[0] != '.' &&
if (@is_dir(EGW_SERVER_ROOT."/$file/setup") && $file[0] != '.' &&
!isset($apps[$app = basename($file)]))
{
$apps[$app] = $app . ' (*)';
@ -465,7 +465,7 @@
if (!is_array($acc))
{
$data = $GLOBALS['phpgw']->accounts->get_account_data($id);
$data = $GLOBALS['egw']->accounts->get_account_data($id);
foreach(array('type','lid','firstname','lastname') as $name)
{
$acc['account_'.$name] = $data[$id][$name];
@ -490,7 +490,7 @@
$info .= $acc['account_lid'];
break;
default: // use the phpgw default
$info = $GLOBALS['phpgw']->common->display_fullname($acc['account_lid'],
$info = $GLOBALS['egw']->common->display_fullname($acc['account_lid'],
$acc['account_firstname'],$acc['account_lastname']);
break;
}

View File

@ -46,7 +46,7 @@
var $children; // array with children
var $data; // depricated: first grid of the children
var $size; // depricated: witdh,height,border of first grid
var $db,$table_name = 'phpgw_etemplate'; // name of table
var $db,$table_name = 'egw_etemplate'; // name of table
var $db_key_cols = array(
'et_name' => 'name',
'et_template' => 'template',
@ -90,7 +90,7 @@
*/
function soetemplate($name='',$template='',$lang='',$group=0,$version='',$rows=1,$cols=1)
{
$this->db = clone($GLOBALS['phpgw']->db);
$this->db = clone($GLOBALS['egw']->db);
$this->db->set_app('etemplate');
$this->db_cols = $this->db_key_cols + $this->db_data_cols;
@ -364,8 +364,8 @@
{
echo "<p>soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')</p>\n";
}
if (($GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'files' ||
$GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt') && $this->readfile())
if (($GLOBALS['egw_info']['server']['eTemplate-source'] == 'files' ||
$GLOBALS['egw_info']['server']['eTemplate-source'] == 'xslt') && $this->readfile())
{
return True;
}
@ -373,8 +373,8 @@
{
$this->test_import($this->name); // import updates in setup-dir
}
$pref_lang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
$pref_templ = $GLOBALS['phpgw_info']['server']['template_set'];
$pref_lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
$pref_templ = $GLOBALS['egw_info']['server']['template_set'];
$where = array(
'et_name' => $this->name,
@ -436,12 +436,12 @@
{
$lang = '.' . $this->lang;
}
$first_try = $ext = $GLOBALS['phpgw_info']['server']['eTemplate-source'] == 'xslt' ? '.xsl' : '.xet';
$first_try = $ext = $GLOBALS['egw_info']['server']['eTemplate-source'] == 'xslt' ? '.xsl' : '.xet';
while ((!$lang || !@file_exists($file = PHPGW_SERVER_ROOT . "/$app/templates/$template/$name$lang$ext") &&
!@file_exists($file = PHPGW_SERVER_ROOT . "/$app/templates/default/$name$lang$ext")) &&
!@file_exists($file = PHPGW_SERVER_ROOT . "/$app/templates/$template/$name$ext") &&
!@file_exists($file = PHPGW_SERVER_ROOT . "/$app/templates/default/$name$ext"))
while ((!$lang || !@file_exists($file = EGW_SERVER_ROOT . "/$app/templates/$template/$name$lang$ext") &&
!@file_exists($file = EGW_SERVER_ROOT . "/$app/templates/default/$name$lang$ext")) &&
!@file_exists($file = EGW_SERVER_ROOT . "/$app/templates/$template/$name$ext") &&
!@file_exists($file = EGW_SERVER_ROOT . "/$app/templates/default/$name$ext"))
{
if ($ext == $first_try)
{
@ -482,7 +482,7 @@
{
if (!is_object($this->xul_io))
{
$this->xul_io = CreateObject('etemplate.xul_io');
$this->xul_io =& CreateObject('etemplate.xul_io');
}
$loaded = $this->xul_io->import($this,$xml);
@ -668,13 +668,17 @@
}
foreach($arr as $key => $val)
{
if (is_array($val))
if ($remove_objs && $key === 'obj') // it can be an array too
{
unset($arr[$key]);
}
elseif (is_array($val))
{
$arr[$key] = $this->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
$GLOBALS['phpgw_info']['etemplate']['as_array'][$this->name]++ < 2)
$GLOBALS['egw_info']['etemplate']['as_array'][$this->name]++ < 2)
{
$arr['obj'] = $val->as_array(2);
}
@ -846,7 +850,7 @@
$this->db->query("SELECT * FROM $this->table_name WHERE et_name LIKE '$app%'");
$dir = PHPGW_SERVER_ROOT . "/$app/setup";
$dir = EGW_SERVER_ROOT . "/$app/setup";
if (!is_writeable($dir))
{
return lang("Error: webserver is not allowed to write into '%1' !!!",$dir);
@ -914,7 +918,7 @@
$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))
{
@ -947,13 +951,13 @@
}
list($app) = explode('.',$app);
if (!file_exists(PHPGW_SERVER_ROOT.'/developer_tools/inc/class.solangfile.inc.php'))
if (!file_exists(EGW_SERVER_ROOT.'/developer_tools/inc/class.solangfile.inc.php'))
{
$solangfile = CreateObject('etemplate.solangfile');
$solangfile =& CreateObject('etemplate.solangfile');
}
else
{
$solangfile = CreateObject('developer_tools.solangfile');
$solangfile =& CreateObject('developer_tools.solangfile');
}
$langarr = $solangfile->load_app($app,$lang);
if (!is_array($langarr))
@ -991,7 +995,7 @@
}
ksort($langarr);
$dir = PHPGW_SERVER_ROOT . "/$app/setup";
$dir = EGW_SERVER_ROOT . "/$app/setup";
if (!is_writeable($dir))
{
return lang("Error: webserver is not allowed to write into '%1' !!!",$dir);
@ -1022,8 +1026,8 @@
{
$templ_version=0;
include($path = PHPGW_SERVER_ROOT."/$app/setup/etemplates.inc.php");
$templ = new etemplate($app);
include($path = EGW_SERVER_ROOT."/$app/setup/etemplates.inc.php");
$templ =& new etemplate($app);
foreach($templ_data as $data)
{
@ -1055,17 +1059,17 @@
{
list($app) = explode('.',$app);
if (!$app || $GLOBALS['phpgw_info']['etemplate']['import_tested'][$app])
if (!$app || $GLOBALS['egw_info']['etemplate']['import_tested'][$app])
{
return ''; // ensure test is done only once per call and app
}
$GLOBALS['phpgw_info']['etemplate']['import_tested'][$app] = True; // need to be done before new ...
$GLOBALS['egw_info']['etemplate']['import_tested'][$app] = True; // need to be done before new ...
$path = PHPGW_SERVER_ROOT."/$app/setup/etemplates.inc.php";
$path = EGW_SERVER_ROOT."/$app/setup/etemplates.inc.php";
if ($time = @filemtime($path))
{
$templ = new soetemplate(".$app",'','##');
$templ =& new soetemplate(".$app",'','##');
if ($templ->lang != '##' || $templ->modified < $time) // need to import
{
$ret = $this->import_dump($app);
@ -1226,7 +1230,7 @@
case 'template':
if (!isset($widget['obj']) && $widget['name'][0] != '@')
{
$widget['obj'] = new etemplate;
$widget['obj'] =& new etemplate;
if (!$widget['obj']->read($widget['name'])) $widget['obj'] = false;
}
if (!is_object($widget['obj'])) break; // cant descent into template

View File

@ -36,6 +36,7 @@
'config.tpl' => 'config',
'hook_admin.inc.php' => 'file_admin',
'hook_preferences.inc.php' => 'file_preferences',
'hook_settings.inc.php' => 'file',
'hook_sidebox_menu.inc.php' => 'file',
'hook_acl_manager.inc.php' => 'acl_manager'
);
@ -46,7 +47,7 @@
function solangfile()
{
$this->db = $GLOBALS['phpgw']->db;
$this->db = $GLOBALS['egw']->db;
}
function fetch_keys($app,$arr)
@ -98,25 +99,12 @@
$app = 'common';
break;
}
if (!function_exists('display_sidebox'))
{
function display_sidebox($appname,$menu_title,$file) // hook_sidebox_menu
{
unset($file['_NewLine_']);
$GLOBALS['file'] += $file;
}
function display_section($appname,$file,$file2='') // hook_preferences, hook_admin
{
if (is_array($file2))
{
$file = $file2;
}
$GLOBALS['file'] += $file;
}
}
$GLOBALS['file'] = array();
$GLOBALS['file'] = $GLOBALS['settings'] = array();
unset($GLOBALS['acl_manager']);
ob_start(); // suppress all output
include($fname);
ob_end_clean();
if (isset($GLOBALS['acl_manager'])) // hook_acl_manager
{
@ -149,6 +137,16 @@
$this->plist[$lang] = $app;
}
}
foreach($GLOBALS['settings'] as $data)
{
foreach(array('label','help') as $key)
{
if (isset($data[$key]) && !empty($data[$key]))
{
$this->plist[$data[$key]] = $app;
}
}
}
}
function parse_php_app($app,$fd)
@ -188,7 +186,7 @@
for($i = 1; $i <= $args[0]; ++$i)
{
$next = 1;
if (!$rest || strpos($rest,$del,1) === False)
if (!$rest || empty($del) || strpos($rest,$del,1) === False)
{
$rest .= trim($lines[++$n]);
}
@ -236,7 +234,7 @@
{
$cur_lang=$this->load_app($app,$userlang);
define('SEP',filesystem_separator());
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP;
$fd = EGW_SERVER_ROOT . SEP . $app . SEP;
$this->plist = array();
$this->parse_php_app($app == 'phpgwapi' ? 'common' : $app,$fd);
@ -244,25 +242,26 @@
return($this->plist);
}
/*!
@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',$target=True)
{
define('SEP',filesystem_separator());
$langarray = array();
$fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . ($app == 'setup' ? 'lang' : 'setup');
$fd = EGW_SERVER_ROOT . SEP . $app . SEP . ($app == 'setup' ? 'lang' : 'setup');
$fn = $fd . SEP . 'phpgw_' . $userlang . '.lang';
if (@is_writeable($fn) || is_writeable($fd))
{
$wr = True;
}
if (!$target) $this->src_apps = array();
$from = $GLOBALS['phpgw']->translation->charset($userlang);
$to = $GLOBALS['phpgw']->translation->system_charset;
$from = $GLOBALS['egw']->translation->charset($userlang);
$to = $GLOBALS['egw']->translation->charset();
//echo "<p>solangfile::load_app('$app','$userlang') converting from charset('$userlang')='$from' to '$to'</p>\n";
if (file_exists($fn))
@ -271,17 +270,26 @@
{
while ($data = fgets($fp,8000))
{
list($message_id,$app_name,$null,$content) = explode("\t",$data);
list($message_id,$app_name,,$content) = explode("\t",$data);
if(!$message_id)
{
continue;
}
//echo '<br>load_app(): adding phrase: $this->langarray["'.$message_id.'"]=' . trim($content);
if (empty($app_name))
{
$app_name = $app; // fix missing app_name
}
//echo '<br>load_app(): adding phrase: $this->langarray["'.$message_id.'"]=' . trim($content)."' for $app_name";
$_mess_id = strtolower(trim($message_id));
$langarray[$_mess_id]['message_id'] = $_mess_id;
$langarray[$_mess_id]['app_name'] = trim($app_name);
$app_name = trim($app_name);
$langarray[$_mess_id]['app_name'] = $app_name;
if (!$target)
{
$this->src_apps[$app_name] = $app_name;
}
$langarray[$_mess_id]['content'] =
$GLOBALS['phpgw']->translation->convert(trim($content),$from,$to);
$GLOBALS['egw']->translation->convert(trim($content),$from,$to);
}
fclose($fp);
}
@ -301,42 +309,21 @@
// stuff class array listing apps that are included already
$this->loaded_apps[$userlang]['filename'] = $fn;
$this->loaded_apps[$userlang]['writeable'] = $wr;
if (!$target) ksort($this->src_apps);
if($this->debug) { _debug_array($langarray); }
@ksort($langarray);
return $langarray;
}
function list_langs()
{
$this->db->query("SELECT DISTINCT lang FROM phpgw_lang");
while($this->db->next_record())
{
$lang = $this->db->f('lang');
$installed[] = $lang;
}
$installed = "('".implode("','",$installed)."')";
// this shows first the installed, then the available and then the rest
$this->db->query("SELECT lang_id,lang_name,lang_id IN $installed as installed FROM phpgw_languages ORDER BY installed DESC,available DESC,lang_name");
$i = 0;
while ($this->db->next_record())
{
$languages[$i]['lang_id'] = $this->db->f('lang_id');
$languages[$i]['lang_name'] = $this->db->f('lang_name');
$i++;
}
@reset($languages);
if($this->debug) { _debug_array($languages); }
return $languages;
}
function write_file($app_name,$langarray,$userlang,$which='target')
{
$to = $GLOBALS['phpgw']->translation->charset($userlang);
$from = $GLOBALS['phpgw']->translation->system_charset;
$to = $GLOBALS['egw']->translation->charset($userlang);
$from = $GLOBALS['egw']->translation->charset();
//echo "<p>solangfile::write_file('$app_name',,'$userlang') converting from '$from' to charset('$userlang')='$to'</p>\n";
$fn = PHPGW_SERVER_ROOT . SEP . $app_name . SEP . ($app_name == 'setup' ? 'lang' : 'setup') . SEP . 'phpgw_' . $userlang . '.lang';
$fn = EGW_SERVER_ROOT . SEP . $app_name . SEP . ($app_name == 'setup' ? 'lang' : 'setup') . SEP . 'phpgw_' . $userlang . '.lang';
if (file_exists($fn))
{
$backup = $fn . '.old';
@ -346,10 +333,14 @@
$fp = fopen($fn,'wb');
while(list($mess_id,$data) = @each($langarray))
{
$data['content'] = $GLOBALS['phpgw']->translation->convert(trim($data['content']),$from,$to);
$data['content'] = $GLOBALS['egw']->translation->convert(trim($data['content']),$from,$to);
// dont write empty content
if (!empty($data['content']))
{
fwrite($fp,$mess_id . "\t" . $data['app_name'] . "\t" . $userlang . "\t" . $data['content'] . "\n");
}
}
fclose($fp);
if ($which == 'source')
@ -369,9 +360,47 @@
{
$userlangs = array($userslangs => $userlangs);
}
$GLOBALS['phpgw']->translation->install_langs($userlangs,'addmissing',$app_name);
$GLOBALS['egw']->translation->install_langs($userlangs,'addmissing',$app_name);
return lang('done');
}
}
/*
* Helper functions for searching new phrases in sidebox, preferences or admin menus
*/
if (!function_exists('display_sidebox') && $_GET['menuaction'] == 'developer_tools.uilangfile.missingphrase')
{
function display_sidebox($appname,$menu_title,$file) // hook_sidebox_menu
{
if (!is_array($file)) return;
unset($file['_NewLine_']);
if (is_array($GLOBALS['file']))
{
$GLOBALS['file'] = $file;
}
else
{
$GLOBALS['file'] += $file;
}
}
function display_section($appname,$file,$file2='') // hook_preferences, hook_admin
{
if (is_array($file2))
{
$file = $file2;
}
if (!is_array($file)) return;
if (is_array($GLOBALS['file']))
{
$GLOBALS['file'] = $file;
}
else
{
$GLOBALS['file'] += $file;
}
}
}
?>

View File

@ -68,7 +68,7 @@
if (!$cell['onchange']) // onchange allows to use the old behavior (submit for each new tab)
{
$dom_enabled = isset($GLOBALS['phpgw_info']['etemplate']['dom_enabled']) ? $GLOBALS['phpgw_info']['etemplate']['dom_enabled'] : true;
$dom_enabled = isset($GLOBALS['egw_info']['etemplate']['dom_enabled']) ? $GLOBALS['egw_info']['etemplate']['dom_enabled'] : true;
}
$labels = explode('|',$cell['label']);
$helps = explode('|',$cell['help']);
@ -89,7 +89,7 @@
}
$all_names = implode('|',$names);
$tab_widget = new etemplate('etemplate.tab_widget');
$tab_widget =& new etemplate('etemplate.tab_widget');
$tab_widget->no_onclick = true;
if ($value && !strstr($value,'.'))
@ -153,7 +153,7 @@
foreach($names as $n => $name)
{
$bcell = $tab_widget->empty_cell('template',$name);
$bcell['obj'] = new etemplate($name,$tmpl->as_array());
$bcell['obj'] =& new etemplate($name,$tmpl->as_array());
$tab_widget->set_cell_attribute('body',$n+1,$bcell);
}
$tab_widget->set_cell_attribute('body','type','deck');
@ -163,7 +163,7 @@
}
else
{
$stab = new etemplate($selected_tab,$tmpl->as_array());
$stab =& new etemplate($selected_tab,$tmpl->as_array());
$tab_widget->set_cell_attribute('body','type','template');
$tab_widget->set_cell_attribute('body','size',''); // the deck has a '1' there
$tab_widget->set_cell_attribute('body','obj',$stab);

View File

@ -12,7 +12,7 @@
/* $Id$ */
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.boetemplate.inc.php');
include_once(EGW_INCLUDE_ROOT . '/etemplate/inc/class.boetemplate.inc.php');
/**
* creates dialogs / HTML-forms from eTemplate descriptions
@ -55,23 +55,23 @@
*/
function etemplate($name='',$load_via='')
{
if (!is_object($GLOBALS['phpgw']->html))
if (!is_object($GLOBALS['egw']->html))
{
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
$GLOBALS['egw']->html =& CreateObject('phpgwapi.html');
}
$this->html = &$GLOBALS['phpgw']->html;
$this->html = &$GLOBALS['egw']->html;
$this->boetemplate($name,$load_via);
$this->xslt = is_object($GLOBALS['phpgw']->xslttpl);
$this->xslt = is_object($GLOBALS['egw']->xslttpl);
$this->sitemgr = is_object($GLOBALS['Common_BO']);
if (($this->innerWidth = (int) $_POST['innerWidth']))
{
$GLOBALS['phpgw']->session->appsession('innerWidth','etemplate',$this->innerWidth);
$GLOBALS['egw']->session->appsession('innerWidth','etemplate',$this->innerWidth);
}
elseif (!($this->innerWidth = (int) $GLOBALS['phpgw']->session->appsession('innerWidth','etemplate')))
elseif (!($this->innerWidth = (int) $GLOBALS['egw']->session->appsession('innerWidth','etemplate')))
{
$this->innerWidth = 1018; // default width for an assumed screen-resolution of 1024x768
}
@ -88,7 +88,7 @@
*/
function location($params='')
{
$GLOBALS['phpgw']->redirect_link(is_array($params) ? '/index.php' : $params,
$GLOBALS['egw']->redirect_link(is_array($params) ? '/index.php' : $params,
is_array($params) ? $params : '');
}
@ -118,7 +118,7 @@
*/
function exec($method,$content,$sel_options='',$readonlys='',$preserv='',$output_mode=0,$ignore_validation='',$changes='')
{
//echo "<br>globals[java_script] = '".$GLOBALS['phpgw_info']['etemplate']['java_script']."', this->java_script() = '".$this->java_script()."'\n";
//echo "<br>globals[java_script] = '".$GLOBALS['egw_info']['etemplate']['java_script']."', this->java_script() = '".$this->java_script()."'\n";
if (!$sel_options)
{
$sel_options = array();
@ -137,17 +137,17 @@
}
if (isset($content['app_header']))
{
$GLOBALS['phpgw_info']['flags']['app_header'] = $content['app_header'];
$GLOBALS['egw_info']['flags']['app_header'] = $content['app_header'];
}
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'etemplate')
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'etemplate')
{
$GLOBALS['phpgw']->translation->add_app('etemplate'); // some extensions have own texts
$GLOBALS['egw']->translation->add_app('etemplate'); // some extensions have own texts
}
$id = $this->appsession_id();
$GLOBALS['phpgw_info']['etemplate']['loop'] = False;
$GLOBALS['phpgw_info']['etemplate']['form_options'] = ''; // might be set in show
$GLOBALS['phpgw_info']['etemplate']['to_process'] = array();
$GLOBALS['egw_info']['etemplate']['loop'] = False;
$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(
'submit_button' => '',
@ -156,21 +156,21 @@
$this->show($this->complete_array_merge($content,$changes),$sel_options,$readonlys,'exec'),array(
'etemplate_exec_id' => $id
),$this->sitemgr ? '' : '/etemplate/process_exec.php?menuaction='.$method,
'','eTemplate',$GLOBALS['phpgw_info']['etemplate']['form_options'].
'','eTemplate',$GLOBALS['egw_info']['etemplate']['form_options'].
// dont set the width of popups!
($output_mode != 0 ? '' : ' onsubmit="this.innerWidth.value=window.innerWidth ? window.innerWidth : document.body.clientWidth;"'));
//echo "to_process="; _debug_array($GLOBALS['phpgw_info']['etemplate']['to_process']);
//echo "to_process="; _debug_array($GLOBALS['egw_info']['etemplate']['to_process']);
if ($this->sitemgr)
{
}
elseif (!$this->xslt)
{
$hooked = $GLOBALS['phpgw']->template->get_var('phpgw_body');
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'] && (int) $output_mode != 1 && (int) $output_mode != -1) // not just returning the html
$hooked = $GLOBALS['egw']->template->get_var('phpgw_body');
if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && (int) $output_mode != 1 && (int) $output_mode != -1) // not just returning the html
{
$GLOBALS['phpgw_info']['flags']['java_script'] .= $this->include_java_script(2);
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw_info']['flags']['java_script'] .= $this->include_java_script(2);
$GLOBALS['egw']->common->egw_header();
}
else
{
@ -179,9 +179,9 @@
}
else
{
$hooked = $GLOBALS['phpgw']->xslttpl->get_var('phpgw');
$hooked = $GLOBALS['egw']->xslttpl->get_var('phpgw');
$hooked = $hooked['body_data'];
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('java_script' => $GLOBALS['phpgw_info']['flags']['java_script'].$this->include_java_script(2)));
$GLOBALS['egw']->xslttpl->set_var('phpgw',array('java_script' => $GLOBALS['egw_info']['flags']['java_script'].$this->include_java_script(2)));
}
//echo "<p>uietemplate::exec($method,...) after show: sitemgr=$this->sitemgr, xslt=$this->xslt, hooked=$hooked, output_mode=$output_mode</p>\n";
@ -189,7 +189,7 @@
{
if (!$this->xslt)
{
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'])
if (!@$GLOBALS['egw_info']['etemplate']['hooked'])
{
if((int) $output_mode != 2)
{
@ -206,22 +206,22 @@
}
}
}
echo $GLOBALS['phpgw_info']['etemplate']['hook_content'].$html;
echo $GLOBALS['egw_info']['etemplate']['hook_content'].$html;
if (!@$GLOBALS['phpgw_info']['etemplate']['hooked'] &&
if (!@$GLOBALS['egw_info']['etemplate']['hooked'] &&
(!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php')))
{
if((int) $output_mode == 2)
{
echo "</div>\n";
}
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['egw']->common->egw_footer();
}
}
else
{
// need to add some logic here to support popups (output_mode==2) for xslt, but who cares ...
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('body_data' => $html));
$GLOBALS['egw']->xslttpl->set_var('phpgw',array('body_data' => $html));
}
}
$this->save_appsession($this->as_array(2) + array(
@ -230,12 +230,12 @@
'changes' => $changes,
'sel_options' => $sel_options,
'preserv' => $preserv,
'extension_data' => $GLOBALS['phpgw_info']['etemplate']['extension_data'],
'to_process' => $GLOBALS['phpgw_info']['etemplate']['to_process'],
'java_script' => $GLOBALS['phpgw_info']['etemplate']['java_script'],
'dom_enabled' => $GLOBALS['phpgw_info']['etemplate']['dom_enabled'],
'hooked' => $hooked != '' ? $hooked : $GLOBALS['phpgw_info']['etemplate']['hook_content'],
'app_header' => $GLOBALS['phpgw_info']['flags']['app_header'],
'extension_data' => $GLOBALS['egw_info']['etemplate']['extension_data'],
'to_process' => $GLOBALS['egw_info']['etemplate']['to_process'],
'java_script' => $GLOBALS['egw_info']['etemplate']['java_script'],
'dom_enabled' => $GLOBALS['egw_info']['etemplate']['dom_enabled'],
'hooked' => $hooked != '' ? $hooked : $GLOBALS['egw_info']['etemplate']['hook_content'],
'app_header' => $GLOBALS['egw_info']['flags']['app_header'],
'output_mode' => $output_mode != -1 ? $output_mode : 0,
'session_used' => 0,
'ignore_validation' => $ignore_validation,
@ -257,10 +257,10 @@
*/
function validation_errors($ignore_validation,$cname='exec')
{
//echo "<p>uietemplate::validation_errors('$ignore_validation','$cname') validation_error="; _debug_array($GLOBALS['phpgw_info']['etemplate']['validation_errors']);
if (!$ignore_validation) return count($GLOBALS['phpgw_info']['etemplate']['validation_errors']) > 0;
//echo "<p>uietemplate::validation_errors('$ignore_validation','$cname') validation_error="; _debug_array($GLOBALS['egw_info']['etemplate']['validation_errors']);
if (!$ignore_validation) return count($GLOBALS['egw_info']['etemplate']['validation_errors']) > 0;
foreach($GLOBALS['phpgw_info']['etemplate']['validation_errors'] as $name => $error)
foreach($GLOBALS['egw_info']['etemplate']['validation_errors'] as $name => $error)
{
if ($cname) $name = preg_replace('/^'.$cname.'\[([^\]]+)\](.*)$/','\\1\\2',$name);
@ -309,18 +309,18 @@
$content = array();
}
$this->init($session_data);
$GLOBALS['phpgw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
$GLOBALS['phpgw_info']['etemplate']['java_script'] = $session_data['java_script'] || $_POST['java_script'];
$GLOBALS['phpgw_info']['etemplate']['dom_enabled'] = $session_data['dom_enabled'] || $_POST['dom_enabled'];
//echo "globals[java_script] = '".$GLOBALS['phpgw_info']['etemplate']['java_script']."', session_data[java_script] = '".$session_data['java_script']."', _POST[java_script] = '".$_POST['java_script']."'\n";
$GLOBALS['egw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
$GLOBALS['egw_info']['etemplate']['java_script'] = $session_data['java_script'] || $_POST['java_script'];
$GLOBALS['egw_info']['etemplate']['dom_enabled'] = $session_data['dom_enabled'] || $_POST['dom_enabled'];
//echo "globals[java_script] = '".$GLOBALS['egw_info']['etemplate']['java_script']."', session_data[java_script] = '".$session_data['java_script']."', _POST[java_script] = '".$_POST['java_script']."'\n";
//echo "process_exec($this->name) content ="; _debug_array($content);
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'etemplate')
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'etemplate')
{
$GLOBALS['phpgw']->translation->add_app('etemplate'); // some extensions have own texts
$GLOBALS['egw']->translation->add_app('etemplate'); // some extensions have own texts
}
$this->process_show($content,$session_data['to_process'],'exec');
$GLOBALS['phpgw_info']['etemplate']['loop'] |= !$this->canceled && $this->button_pressed &&
$GLOBALS['egw_info']['etemplate']['loop'] |= !$this->canceled && $this->button_pressed &&
$this->validation_errors($session_data['ignore_validation']); // set by process_show
//echo "process_exec($this->name) process_show(content) ="; _debug_array($content);
@ -328,23 +328,23 @@
$content = $this->complete_array_merge($session_data['changes'],$content);
//echo "process_exec($this->name) merge(changes,content) ="; _debug_array($content);
if ($GLOBALS['phpgw_info']['etemplate']['loop'])
if ($GLOBALS['egw_info']['etemplate']['loop'])
{
if ($session_data['hooked'] != '') // set previous phpgw_body if we are called as hook
{
if (!$this->xslt)
{
//echo "<p>process_exec: hook_content set</p>\n";
$GLOBALS['phpgw_info']['etemplate']['hook_content'] = $session_data['hooked'];
$GLOBALS['egw_info']['etemplate']['hook_content'] = $session_data['hooked'];
}
else
{
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('body_data' => $session_data['hooked']));
$GLOBALS['egw']->xslttpl->set_var('phpgw',array('body_data' => $session_data['hooked']));
}
}
if (!empty($session_data['app_header']))
{
$GLOBALS['phpgw_info']['flags']['app_header'] = $session_data['app_header'];
$GLOBALS['egw_info']['flags']['app_header'] = $session_data['app_header'];
}
//echo "<p>process_exec($this->name): <font color=red>loop is set</font>, content=</p>\n"; _debug_array($content);
return $this->exec($session_data['method'],$session_data['content'],$session_data['sel_options'],
@ -374,7 +374,7 @@
{
return false;
}
$GLOBALS['phpgw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
$GLOBALS['egw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
$content = $_GET['exec'];
if (!is_array($content))
@ -431,9 +431,9 @@
$content = array(); // happens if incl. template has no content
}
$html = "\n\n<!-- BEGIN eTemplate $this->name -->\n\n";
if (!$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name])
if (!$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name])
{
$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True;
$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name] = True;
$html .= $this->html->style($this->style)."\n\n";
}
$path = '/';
@ -869,7 +869,7 @@
$html .= $this->html->input($form_name,$value,'',
$options.$this->html->formatOptions($cell_options,'SIZE,MAXLENGTH'));
$cell_options = explode(',',$cell_options,3);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'maxlength' => $cell_options[1],
'needed' => $cell['needed'],
@ -884,7 +884,7 @@
$options.$this->html->formatOptions($cell_options,'ROWS,COLS'));
if (!$readonly)
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'needed' => $cell['needed'],
);
@ -897,7 +897,7 @@
{
$html .= $this->html->tinymce($form_name,$value,$styles,$plugins);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'needed' => $cell['needed'],
);
@ -939,15 +939,15 @@
if ($multiple) $form_name = $this->form_name($cname,substr($cell['name'],0,-2));
if (!isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'unset_value' => $unset_val,
'multiple' => $multiple,
);
}
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]['values'][] = $set_val;
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name]['values'][] = $set_val;
if (!$multiple) unset($set_val); // otherwise it will be added to the label
}
break;
@ -968,7 +968,7 @@
else
{
$html .= $this->html->input($form_name,$set_val,'RADIO',$options);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
}
break;
case 'button':
@ -982,7 +982,7 @@
if (preg_match("/egw::link\\('([^']+)','([^']+)'\\)/",$onclick,$matches))
{
$url = $GLOBALS['phpgw']->link($matches[1],$matches[2]);
$url = $GLOBALS['egw']->link($matches[1],$matches[2]);
$onclick = preg_replace('/egw::link\(\'([^\']+)\',\'([^\']+)\'\)/','\''.$url.'\'',$onclick);
}
elseif (preg_match("/form::name\\('([^']+)'\\)/",$onclick,$matches))
@ -1027,10 +1027,10 @@
$extra_label = False;
if (!$readonly)
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
if (strtolower($name) == 'cancel')
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = 'cancel';
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = 'cancel';
}
}
break;
@ -1074,12 +1074,12 @@
$obj_read = is_object($cell['obj']) ? 'obj from content' : 'obj read, obj-name from content';
if (!is_object($cell['obj']))
{
$cell['obj'] = new etemplate($cell['obj'],$this->as_array());
$cell['obj'] =& new etemplate($cell['obj'],$this->as_array());
}
}
else
{ $obj_read = 'obj read';
$cell['obj'] = new etemplate($name,$this->as_array());
$cell['obj'] =& new etemplate($name,$this->as_array());
}
}
if (is_int($this->debug) && $this->debug >= 3 || $this->debug == $cell['type'])
@ -1220,16 +1220,16 @@
$html .= $this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sels,
$cell['no_lang'],$options,$multiple);
}
if (!isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
}
}
break;
case 'image':
$image = $value != '' ? $value : $name;
list($app,$img) = explode('/',$image,2);
if (!$app || !$img || !is_dir(PHPGW_SERVER_ROOT.'/'.$app) || strstr($img,'/'))
if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strstr($img,'/'))
{
$img = $image;
list($app) = explode('.',$this->name);
@ -1247,9 +1247,9 @@
{
$html .= $this->html->input_hidden($path_name = str_replace($name,$name.'_path',$form_name),'.');
$html .= $this->html->input($form_name,'','file',$options);
$GLOBALS['phpgw_info']['etemplate']['form_options'] =
$GLOBALS['egw_info']['etemplate']['form_options'] =
"enctype=\"multipart/form-data\" onsubmit=\"set_element2(this,'$path_name','$form_name')\"";
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
}
break;
case 'vbox':
@ -1360,7 +1360,7 @@
$s_height = "height: $s_height".(substr($s_height,-1) != '%' ? 'px' : '').';';
}
$html = $this->html->input_hidden($form_name,$value);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
for ($n = 1; $n <= $cell_options; ++$n)
{
@ -1386,24 +1386,24 @@
if ($ext_type && !$readonly && $this->haveExtension($ext_type,'post_process'))
{ // unset it first, if it is already set, to be after the other widgets of the ext.
$to_process = 'ext-'.$ext_type;
if (is_array($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
if (is_array($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
$to_process = $GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name];
$to_process = $GLOBALS['egw_info']['etemplate']['to_process'][$form_name];
$to_process['type'] = 'ext-'.$ext_type;
}
unset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $to_process;
unset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]);
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = $to_process;
}
// save blur-value to strip it in process_exec
if (!empty($blur) && isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
if (!empty($blur) && isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
if (!is_array($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
if (!is_array($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $GLOBALS['egw_info']['etemplate']['to_process'][$form_name]
);
}
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]['blur'] = $blur;
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name]['blur'] = $blur;
}
if ($extra_label && ($label != '' || $html == ''))
{
@ -1455,9 +1455,9 @@
}
}
// if necessary show validation-error behind field
if (isset($GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name]))
if (isset($GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name]))
{
$html .= ' <font color="red">'.$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name].'</font>';
$html .= ' <font color="red">'.$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name].'</font>';
}
// generate an extra div, if we have an onclick handler and NO children or it's an extension
//echo "<p>$this->name($this->onclick_handler:$this->no_onclick:$this->onclick_proxy): $cell[type]/$cell[name]</p>\n";
@ -1521,7 +1521,7 @@
{
$content_in = $this->array_stripslashes($content_in);
}
$GLOBALS['phpgw_info']['etemplate']['validation_errors'] = array();
$GLOBALS['egw_info']['etemplate']['validation_errors'] = array();
$this->canceled = $this->button_pressed = False;
foreach($to_process as $form_name => $type)
@ -1563,7 +1563,7 @@
}
if ($_cont === '' && $attr['needed'])
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang('Field must not be empty !!!',$value);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang('Field must not be empty !!!',$value);
}
break;
case 'htmlarea':
@ -1575,7 +1575,7 @@
case 'textarea':
if ($value === '' && $attr['needed'])
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang('Field must not be empty !!!',$value);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang('Field must not be empty !!!',$value);
}
if ((int) $attr['maxlength'] > 0 && strlen($value) > (int) $attr['maxlength'])
{
@ -1586,13 +1586,13 @@
switch($type)
{
case 'int':
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' is not a valid integer !!!",$value);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' is not a valid integer !!!",$value);
break;
case 'float':
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' is not a valid floatingpoint number !!!",$value);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' is not a valid floatingpoint number !!!",$value);
break;
default:
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' has an invalid format !!!",$value);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang("'%1' has an invalid format !!!",$value);
break;
}
}
@ -1604,12 +1604,12 @@
if (!empty($attr['min']) && $value < $attr['min'])
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang("Value has to be at least '%1' !!!",$attr['min']);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang("Value has to be at least '%1' !!!",$attr['min']);
$value = $type == 'int' ? (int) $attr['min'] : (float) $attr['min'];
}
if (!empty($attr['max']) && $value > $attr['max'])
{
$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name] = lang("Value has to be at maximum '%1' !!!",$attr['max']);
$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name] = lang("Value has to be at maximum '%1' !!!",$attr['max']);
$value = $type == 'int' ? (int) $attr['max'] : (float) $attr['max'];
}
}
@ -1673,12 +1673,12 @@
if (is_int($this->debug) && $this->debug >= 2 || $this->debug == $this->name && $this->name)
{
echo "<p>process_show($this->name) end: content ="; _debug_array($content);
if (count($GLOBALS['phpgw_info']['etemplate']['validation_errors']))
if (count($GLOBALS['egw_info']['etemplate']['validation_errors']))
{
echo "<p>validation_errors = "; _debug_array($GLOBALS['phpgw_info']['etemplate']['validation_errors']);
echo "<p>validation_errors = "; _debug_array($GLOBALS['egw_info']['etemplate']['validation_errors']);
}
}
return count($GLOBALS['phpgw_info']['etemplate']['validation_errors']);
return count($GLOBALS['egw_info']['etemplate']['validation_errors']);
}
/**
@ -1690,15 +1690,15 @@
*/
function java_script($consider_not_tested_as_enabled = True)
{
$ret = !!$GLOBALS['phpgw_info']['etemplate']['java_script'] ||
$consider_not_tested_as_enabled && !isset($GLOBALS['phpgw_info']['etemplate']['java_script']);
//echo "<p>java_script($consider_not_tested_as_enabled)='$ret', java_script='".$GLOBALS['phpgw_info']['etemplate']['java_script']."', isset(java_script)=".isset($GLOBALS['phpgw_info']['etemplate']['java_script'])."</p>\n";
$ret = !!$GLOBALS['egw_info']['etemplate']['java_script'] ||
$consider_not_tested_as_enabled && !isset($GLOBALS['egw_info']['etemplate']['java_script']);
//echo "<p>java_script($consider_not_tested_as_enabled)='$ret', java_script='".$GLOBALS['egw_info']['etemplate']['java_script']."', isset(java_script)=".isset($GLOBALS['egw_info']['etemplate']['java_script'])."</p>\n";
return $ret;
return !!$GLOBALS['phpgw_info']['etemplate']['java_script'] ||
return !!$GLOBALS['egw_info']['etemplate']['java_script'] ||
$consider_not_tested_as_enabled &&
(!isset($GLOBALS['phpgw_info']['etemplate']['java_script']) ||
$GLOBALS['phpgw_info']['etemplate']['java_script'].'' == '');
(!isset($GLOBALS['egw_info']['etemplate']['java_script']) ||
$GLOBALS['egw_info']['etemplate']['java_script'].'' == '');
}
/**
@ -1711,7 +1711,7 @@
function include_java_script($what = 3)
{
// this is to test if javascript is enabled
if ($what & 1 && !isset($GLOBALS['phpgw_info']['etemplate']['java_script']))
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')).'\');
@ -1725,7 +1725,7 @@ if (document.getElementById) {
if ($what & 2 && $this->java_script(True))
{
$js .= '<script type="text/javascript" src="'.
$GLOBALS['phpgw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js"></script>'."\n";
$GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js"></script>'."\n";
}
return $js;
}

View File

@ -12,20 +12,20 @@
/* $Id$ */
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.boetemplate.inc.php');
include_once(EGW_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
/**
* @author ralfbecker
* 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 +41,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 +61,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='')
{
@ -109,19 +109,19 @@
* Create a new top-level window and connect the signals to the appropriate
* functions if the window not already exists.
*/
if (!$GLOBALS['phpgw_info']['etemplate']['window'])
if (!$GLOBALS['egw_info']['etemplate']['window'])
{
$window = &new GtkWindow();
$window->connect('destroy',array('etemplate','destroy'));
$window->connect('delete-event',array('etemplate','delete_event'));
$window->set_title('eGroupWareGTK: '.$GLOBALS['phpgw_info']['server']['site_title']);
$window->set_title('eGroupWareGTK: '.$GLOBALS['egw_info']['server']['site_title']);
$window->set_default_size(1024,600);
$GLOBALS['phpgw_info']['etemplate']['window'] = &$window;
$GLOBALS['egw_info']['etemplate']['window'] = &$window;
}
else
{
$window = &$GLOBALS['phpgw_info']['etemplate']['window'];
$window = &$GLOBALS['egw_info']['etemplate']['window'];
}
$this->result = array('test' => 'test');
$table = &$this->show($this->result,$content,$sel_options,$readonlys);
@ -147,15 +147,15 @@
unset($this->widgets);
// set application name so that lang, etc. works
list($GLOBALS['phpgw_info']['flags']['currentapp']) = explode('.',$method);
list($GLOBALS['egw_info']['flags']['currentapp']) = explode('.',$method);
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='')
{
@ -176,8 +176,8 @@
function destroy()
{
Gtk::main_quit();
$GLOBALS['phpgw']->session->destroy($GLOBALS['phpgw_info']['user']['sessionid'],$GLOBALS['phpgw_info']['user']['kp3']);
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
$GLOBALS['egw']->session->destroy($GLOBALS['egw_info']['user']['sessionid'],$GLOBALS['egw_info']['user']['kp3']);
$GLOBALS['egw_info']['flags']['nodisplay'] = True;
exit;
}
@ -249,22 +249,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)
{
@ -409,10 +409,10 @@
// $rows[".$row"] .= $this->html->formatOptions($cl,'CLASS');
// $rows[".$row"] .= $this->html->formatOptions($class,',VALIGN');
}
if (!$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name])
if (!$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name])
{
// $style = $this->html->style($this->style);
$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True;
$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name] = True;
}
return $table;
}
@ -428,13 +428,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)
{
@ -562,7 +562,7 @@
}
if ($readonly)
{
$html .= $GLOBALS['phpgw']->common->dateformatorder($value[0],$value[1],$value[2]);
$html .= $GLOBALS['egw']->common->dateformatorder($value[0],$value[1],$value[2]);
}
else
{
@ -703,13 +703,13 @@
$html .= $this->sbox->getAccount($form_name.'[]',$value,2,$type,0+$cell['size'],$options);
break;
*/ case 'image':
if (!($path = $GLOBALS['phpgw']->common->image(substr($this->name,0,strpos($this->name,'.')),$cell['label'])))
if (!($path = $GLOBALS['egw']->common->image(substr($this->name,0,strpos($this->name,'.')),$cell['label'])))
$path = $cell['label']; // name may already contain absolut path
if (!isset($GLOBALS['phpgw_info']['etemplate']['pixbufs'][$path]))
if (!isset($GLOBALS['egw_info']['etemplate']['pixbufs'][$path]))
{
$GLOBALS['phpgw_info']['etemplate']['pixbufs'][$path] = GdkPixbuf::new_from_file('../..'.$path);
$GLOBALS['egw_info']['etemplate']['pixbufs'][$path] = GdkPixbuf::new_from_file('../..'.$path);
}
$pixbuf = &$GLOBALS['phpgw_info']['etemplate']['pixbufs'][$path];
$pixbuf = &$GLOBALS['egw_info']['etemplate']['pixbufs'][$path];
if ($pixbuf)
{
$widget = &new GtkDrawingArea();

View File

@ -15,7 +15,7 @@
function var2xml($name, $data)
{
$doc = new xmltool('root','','');
$doc =& new xmltool('root','','');
return $doc->import_var($name,$data,True,True);
}
@ -170,7 +170,7 @@
function import_var($name, $value,$is_root=False,$export_xml=False)
{
echo "<p>import_var: this->indentstring='$this->indentstring'</p>\n";
$node = new xmltool('node',$name,$this->indentstring);
$node =& new xmltool('node',$name,$this->indentstring);
switch (gettype($value))
{
case 'string':
@ -223,12 +223,12 @@
case 'integer':
case 'double':
case 'NULL':
$subnode = new xmltool('node', $nextkey,$this->indentstring);
$subnode =& new xmltool('node', $nextkey,$this->indentstring);
$subnode->set_value($val);
$node->add_node($subnode);
break;
case 'boolean':
$subnode = new xmltool('node', $nextkey,$this->indentstring);
$subnode =& new xmltool('node', $nextkey,$this->indentstring);
if($val == True)
{
$subnode->set_value('1');
@ -254,7 +254,7 @@
}
break;
case 'object':
$subnode = new xmltool('node', $nextkey,$this->indentstring);
$subnode =& new xmltool('node', $nextkey,$this->indentstring);
$subnode->set_value('PHP_SERIALIZED_OBJECT&:'.serialize($val));
$node->add_node($subnode);
break;
@ -393,7 +393,7 @@
{
case 'cdata':
case 'complete':
$node = new xmltool('node',$data[$i]['tag'],$this->indentstring);
$node =& new xmltool('node',$data[$i]['tag'],$this->indentstring);
if(is_array($data[$i]['attributes']) && count($data[$i]['attributes']) > 0)
{
while(list($k,$v)=each($data[$i]['attributes']))
@ -405,7 +405,7 @@
$parent_node->add_node($node);
break;
case 'open':
$node = new xmltool('node',$data[$i]['tag'],$this->indentstring);
$node =& new xmltool('node',$data[$i]['tag'],$this->indentstring);
if(is_array($data[$i]['attributes']) && count($data[$i]['attributes']) > 0)
{
while(list($k,$v)=each($data[$i]['attributes']))
@ -431,7 +431,7 @@
xml_parse_into_struct($parser, $xmldata, $vals, $index);
xml_parser_free($parser);
unset($index);
$node = new xmltool('node',$vals[0]['tag'],$this->indentstring);
$node =& new xmltool('node',$vals[0]['tag'],$this->indentstring);
if(isset($vals[0]['attributes']))
{
while(list($key,$value) = each($vals[0]['attributes']))

View File

@ -12,13 +12,13 @@
/* $Id$ */
/*!
@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
/**
* @author ralfbecker
* 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
{
@ -31,7 +31,7 @@
function xslt_widget($ui='')
{
$this->xslttemplates = CreateObject('phpgwapi.xslttemplates',PHPGW_INCLUDE_ROOT);
$this->xslttemplates =& CreateObject('phpgwapi.xslttemplates',EGW_INCLUDE_ROOT);
switch($ui)
{
@ -64,9 +64,9 @@
function render_html($cell,$form_name,$value,$readonly,&$tmpl)
{
list($app,$file) = split('\\.',$cell['size'],2);
$pref_templ = $GLOBALS['phpgw_info']['server']['template_set'];
$pref_templ = $GLOBALS['egw_info']['server']['template_set'];
$path = "$app/templates/$pref_templ/$file";
if (!file_exists(PHPGW_SERVER_ROOT.'/'.$path.'.xsl'))
if (!file_exists(EGW_SERVER_ROOT.'/'.$path.'.xsl'))
{
$path = "$app/templates/default/$file";
}

View File

@ -14,9 +14,9 @@
if (!function_exists('var2xml'))
{
if (file_exists(PHPGW_API_INC.'class.xmltool.inc.php'))
if (file_exists(EGW_API_INC.'class.xmltool.inc.php'))
{
include_once(PHPGW_API_INC.'class.xmltool.inc.php');
include_once(EGW_API_INC.'class.xmltool.inc.php');
}
else
{
@ -169,16 +169,16 @@
$widgetattr2xul = isset($this->widget2xul[$type]) ? $this->widget2xul[$type] : array();
$type = isset($widgetattr2xul['.name']) ? $widgetattr2xul['.name'] : $type;
list($type,$child,$child2) = explode(',',$type);
$widget = new xmlnode($type);
$widget =& new xmlnode($type);
$attr_widget = &$widget;
if ($child)
{
$child = new xmlnode($child);
$child =& new xmlnode($child);
if ($type != 'tabbox') $attr_widget = &$child;
}
if ($child2)
{
$child2 = new xmlnode($child2);
$child2 =& new xmlnode($child2);
}
if (isset($widgetattr2xul['.set'])) // set default-attr for type
{
@ -193,7 +193,7 @@
{
case 'nextmatch':
list($tpl) = explode(',',$cell['size']);
$embeded = new etemplate($tpl,$this->load_via);
$embeded =& new etemplate($tpl,$this->load_via);
if ($embeded_too)
{
$this->add_etempl($embeded,$embeded_too);
@ -207,17 +207,17 @@
$names = explode('|',$cell['name']); unset($cell['name']);
for ($n = 0; $n < count($labels); ++$n)
{
$tab = new xmlnode('tab');
$tab =& new xmlnode('tab');
$tab->set_attribute('label',$labels[$n]);
$tab->set_attribute('statustext',$helps[$n]);
$child->add_node($tab);
$embeded = new etemplate($names[$n],$this->load_via);
$embeded =& new etemplate($names[$n],$this->load_via);
if ($embeded_too)
{
$this->add_etempl($embeded,$embeded_too);
}
$template = new xmlnode('template');
$template =& new xmlnode('template');
$template->set_attribute('id',$embeded->name);
$child2->add_node($template);
unset($embeded);
@ -240,7 +240,7 @@
case 'groupbox':
if ($cell['label'])
{
$caption = new xmlnode('caption');
$caption =& new xmlnode('caption');
$caption->set_attribute('label',$cell['label']);
$widget->add_node($caption);
unset($cell['label']);
@ -263,7 +263,7 @@
case 'template':
if ($cell['name'][0] != '@' && $embeded_too)
{
$templ = new etemplate();
$templ =& new etemplate();
if ($templ->read(boetemplate::expand_name($cell['name'],0,0),'default','default',0,'',$this->load_via))
{
$this->add_etempl($templ,$embeded_too);
@ -313,17 +313,17 @@
*/
function add_grid(&$parent,$grid,&$embeded_too)
{
$xul_grid = new xmlnode('grid');
$xul_grid =& new xmlnode('grid');
$this->set_attributes($xul_grid,'width,height,border,class,spacing,padding,overflow',$grid['size']);
$xul_columns = new xmlnode('columns');
$xul_rows = new xmlnode('rows');
$xul_columns =& new xmlnode('columns');
$xul_rows =& new xmlnode('rows');
reset($grid['data']);
list(,$opts) = each ($grid['data']); // read over options-row
while (list($r,$row) = each ($grid['data']))
{
$xul_row = new xmlnode('row');
$xul_row =& new xmlnode('row');
$this->set_attributes($xul_row,'class,valign',$opts["c$r"]);
$this->set_attributes($xul_row,'height,disabled',$opts["h$r"]);
@ -332,7 +332,7 @@
{
if ($r == '1') // write columns only once in the first row
{
$xul_column = new xmlnode('column');
$xul_column =& new xmlnode('column');
$this->set_attributes($xul_column,'width,disabled',$opts[$c]);
$xul_columns->add_node($xul_column);
}
@ -373,7 +373,7 @@
}
$embeded_too[$etempl->name] = True;
$template = new xmlnode('template');
$template =& new xmlnode('template');
$template->set_attribute('id',$etempl->name);
$template->set_attribute('template',$etempl->template);
$template->set_attribute('lang',$etempl->lang);
@ -386,7 +386,7 @@
}
if ($etempl->style != '')
{
$styles = new xmlnode('styles');
$styles =& new xmlnode('styles');
$styles->set_value($etempl->style);
$template->add_node($styles);
}
@ -405,10 +405,10 @@
{
echo "<p>etempl->data = "; _debug_array($etempl->data);
}
$doc = new xmldoc();
$doc =& new xmldoc();
$doc->add_comment('$'.'Id$');
$this->xul_overlay = new xmlnode('overlay'); // global for all add_etempl calls
$this->xul_overlay =& new xmlnode('overlay'); // global for all add_etempl calls
$this->load_via = $etempl->as_array();
$embeded_too = True;
@ -507,7 +507,7 @@
// save tmpl to the cache, as the file may contain more then one tmpl
$cname = ($etempl->template == '' ? 'default' : $etempl->template).'/'.$etempl->name.
($etempl->lang == '' ? '' : '.'.$etempl->lang);
$GLOBALS['phpgw_info']['etemplate']['cache'][$cname] = $etempl->as_array(1);
$GLOBALS['egw_info']['etemplate']['cache'][$cname] = $etempl->as_array(1);
if ($this->debug)
{
$etempl->echo_tmpl();
@ -572,7 +572,7 @@
{
break;
}
$nul = null; soetemplate::add_child($parent,$nul); // null = new row
$nul = null; soetemplate::add_child($parent,$nul); // null =& new row
$parent['data'][0]['c'.$parent['rows']] = $attr['class'] . ($attr['valign'] ? ','.$attr['valign'] : '');
$parent['data'][0]['h'.$parent['rows']] = $attr['height'] .
($attr['disabled'] ? ','.$attr['disabled'] : '');

View File

@ -12,22 +12,22 @@
/* $Id$ */
$menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$file = Array(
'eTemplate Editor' => $GLOBALS['phpgw']->link('/index.php','menuaction=etemplate.editor.edit'),
'DB-Tools' => $GLOBALS['phpgw']->link('/index.php','menuaction=etemplate.db_tools.edit'),
'eTemplate Editor' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.editor.edit'),
'DB-Tools' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.db_tools.edit'),
);
if (@$GLOBALS['phpgw_info']['user']['apps']['developer_tools'])
if (@$GLOBALS['egw_info']['user']['apps']['developer_tools'])
{
$file += array(
'_NewLine_', // give a newline
'developer_tools' => $GLOBALS['phpgw']->link('/index.php','menuaction=developer_tools.uilangfile.index'),
'developer_tools' => $GLOBALS['egw']->link('/index.php','menuaction=developer_tools.uilangfile.index'),
);
}
display_sidebox($appname,$menu_title,$file);
$menu_title = lang('Documentation');
$docs = $GLOBALS['phpgw_info']['server']['webserver_url'].'/etemplate/doc/';
$docs = $GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/doc/';
$file = Array(
array(
'text' => 'eTemplate Tutorial',

View File

@ -12,11 +12,13 @@
/* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array(
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'etemplate',
'noheader' => True,
'nonavbar' => True
'nonavbar' => True,
),
);
include('../header.inc.php');
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=etemplate.editor.edit');
$GLOBALS['egw']->redirect_link('/index.php','menuaction=etemplate.editor.edit');

View File

@ -28,18 +28,18 @@ if ($argv[1] == '' || $argv[2] == '')
echo "Usage: $argv[0] <login> <passwd>\n";
exit;
}
$GLOBALS['phpgw_info']['flags'] = array(
$GLOBALS['egw_info']['flags'] = array(
'currentapp' => 'login',
'noheader' => True,
'nonavbar' => True
);
include('../header.inc.php');
$GLOBALS['phpgw']->session->create($argv[1],$argv[2],'text') || die("Can't create session !!!\n");
$GLOBALS['egw']->session->create($argv[1],$argv[2],'text') || die("Can't create session !!!\n");
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'etemplate';
$GLOBALS['egw_info']['flags']['currentapp'] = 'etemplate';
ExecMethod('etemplate.db_tools.edit');
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
$GLOBALS['egw_info']['flags']['nodisplay'] = True;
exit;

View File

@ -14,10 +14,12 @@
list($app) = explode('.',$_GET['menuaction']);
$GLOBALS['phpgw_info']['flags'] = array(
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => $app,
'noheader' => True,
'nonavbar' => True
'nonavbar' => True,
),
);
include('../header.inc.php');

View File

@ -13,9 +13,9 @@
/* $Id$ */
$setup_info['etemplate']['name'] = 'etemplate';
$setup_info['etemplate']['version'] = '1.0.0';
$setup_info['etemplate']['version'] = '1.2';
$setup_info['etemplate']['app_order'] = 60; // just behind the developers-tools
$setup_info['etemplate']['tables'] = array('phpgw_etemplate');
$setup_info['etemplate']['tables'] = array('egw_etemplate');
$setup_info['etemplate']['enable'] = 1;
$setup_info['etemplate']['author'] =
@ -39,6 +39,6 @@
/* Dependencies for this app to work */
$setup_info['etemplate']['depends'][] = array(
'appname' => 'phpgwapi',
'versions' => Array('0.9.14','0.9.15','0.9.16','1.0.0','1.0.1')
'versions' => Array('1.0.0','1.0.1','1.2')
);
?>

View File

@ -13,7 +13,7 @@
/* $Id$ */
$phpgw_baseline = array(
'phpgw_etemplate' => array(
'egw_etemplate' => array(
'fd' => array(
'et_name' => array('type' => 'varchar','precision' => '80','nullable' => False),
'et_template' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => ''),

View File

@ -14,20 +14,20 @@
$test[] = '0.9.13.001';
function etemplate_upgrade0_9_13_001()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_data',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_data',array(
'type' => 'text',
'nullable' => True
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array(
'type' => 'char',
'precision' => '128',
'nullable' => True
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_style',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_style',array(
'type' => 'text',
'nullable' => True
));
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_etemplate','et_modified',array(
$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_etemplate','et_modified',array(
'type' => 'int',
'precision' => '4',
'default' => '0',
@ -42,30 +42,30 @@
$test[] = '0.9.15.001';
function etemplate_upgrade0_9_15_001()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_name',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_name',array(
'type' => 'varchar',
'precision' => '80',
'nullable' => False
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_template',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_template',array(
'type' => 'varchar',
'precision' => '20',
'nullable' => False,
'default' => ''
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_lang',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_lang',array(
'type' => 'varchar',
'precision' => '5',
'nullable' => False,
'default' => ''
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_version',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_version',array(
'type' => 'varchar',
'precision' => '20',
'nullable' => False,
'default' => ''
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array(
$GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array(
'type' => 'varchar',
'precision' => '128',
'nullable' => True
@ -82,4 +82,14 @@
$GLOBALS['setup_info']['etemplate']['currentver'] = '1.0.0';
return $GLOBALS['setup_info']['etemplate']['currentver'];
}
$test[] = '1.0.0';
function etemplate_upgrade1_0_0()
{
$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_etemplate','egw_etemplate');
$GLOBALS['setup_info']['etemplate']['currentver'] = '1.2';
return $GLOBALS['setup_info']['etemplate']['currentver'];
}
?>