From 7a4a18ec0aa375f08f34e6e8487cb1ff2a3229d2 Mon Sep 17 00:00:00 2001
From: Ralf Becker microtime()=".microtime().", sec=$sec, msec=$msec, id=$id boetemplate::loadExtension($type) extension not found boetemplate::loadExtension($type) extension found in App. $app store_in_cache('$this->name','$this->template','$this->lang','$this->version') delete_in_cache('$this->name','$this->template','$this->lang','$this->version')
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; } @@ -868,7 +868,7 @@ } $parent = is_array($load_via) ? $load_via['name'] : $load_via; - if (strstr($pname,'.') === False && !empty($parent)) + if (strstr($pname,'.') === False && !empty($parent)) { $pname = $parent . '.' . $pname; } @@ -877,7 +877,7 @@ if (!soetemplate::read($name,$template,$lang,$group,$version)) { if ($load_via && (is_string($load_via) || - !isset($load_via['tpls_in_file']) || $load_via['tpls_in_file'] > 1)) + !isset($load_via['tpls_in_file']) || $load_via['tpls_in_file'] > 1)) { soetemplate::read($load_via); return $this->read_from_cache($name,$template,$lang,$group,$version); diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index ba0c030d87..3ada24ae84 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -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)) diff --git a/etemplate/inc/class.db_tools.inc.php b/etemplate/inc/class.db_tools.inc.php index 180a15b4ef..2872f24f4a 100644 --- a/etemplate/inc/class.db_tools.inc.php +++ b/etemplate/inc/class.db_tools.inc.php @@ -45,6 +45,7 @@ 'longtext' => 'longtext', 'text' => 'text', 'timestamp' => 'timestamp', + 'bool' => 'boolean', // 'abstime' => 'abstime (mysql:timestamp)', ); var $setup_header = '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'); @@ -448,7 +449,7 @@ $col = $content["Row$n"]; while ((list($old_name,$old_col) = @each($old_cols)) && - $this->changes[$posted_table][$old_name] == '**deleted**') ; + $this->changes[$posted_table][$old_name] == '**deleted**') ; if (($name = $col['name']) != '') // ignoring lines without column-name { @@ -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 "
etemplate.db_tools.setup_version('$app','$new','$tables')
\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); @@ -712,7 +713,7 @@ return False; } if (($new == '' || $setup_info[$app]['version'] == $new) && - (!$tables || $setup_info[$app]['tables'] && "'".implode("','",$setup_info[$app]['tables'])."'" == $tables)) + (!$tables || $setup_info[$app]['tables'] && "'".implode("','",$setup_info[$app]['tables'])."'" == $tables)) { return $setup_info[$app]['version']; // no change requested or not necessary } @@ -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 "etemplate.db_tools.update('$app',...,'$version')
\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); diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 7373f09a8c..0fef53c5cb 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -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 @@ '; - 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 "\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'] = "\n"; - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Editable Templates - Editor'); + $GLOBALS['egw_info']['flags']['java_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 "\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'] = "\n"; - $GLOBALS['phpgw_info']['flags']['app_header'] = lang('etemplate').' - '.lang('CSS-styles'); + $GLOBALS['egw_info']['flags']['java_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); diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index 33de85da41..8f3d635195 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -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"); diff --git a/etemplate/inc/class.link_widget.inc.php b/etemplate/inc/class.link_widget.inc.php index 2b61d04a27..bcf3d22029 100644 --- a/etemplate/inc/class.link_widget.inc.php +++ b/etemplate/inc/class.link_widget.inc.php @@ -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) @@ -307,7 +307,7 @@ case 'upload': // need to rename file, as php deletes it otherwise if (is_array($value['file']) && !empty($value['file']['tmp_name']) && - $value['file']['tmp_name'] != 'none') + $value['file']['tmp_name'] != 'none') { move_uploaded_file($value['file']['tmp_name'],$value['file']['tmp_name'].'+'); $value['file']['tmp_name'] .= '+'; diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index bce4fc4be0..a70a8e4a5b 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -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 "nextmatch_widget.pre_process(name='$name',type='$cell[type]'): value = "; _debug_array($value); //echo "
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 "
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 @@ -347,9 +347,9 @@ unset($value['bottom']); } if ($value['start_search'] || $value['search'] != $old_value['search'] || - isset($value['cat_id']) && $value['cat_id'] != $old_value['cat_id'] || - isset($value['filter']) && $value['filter'] != $old_value['filter'] || - isset($value['filter2']) && $value['filter2'] != $old_value['filter2']) + isset($value['cat_id']) && $value['cat_id'] != $old_value['cat_id'] || + isset($value['filter']) && $value['filter'] != $old_value['filter'] || + isset($value['filter2']) && $value['filter2'] != $old_value['filter2']) { //echo "
search='$old_value[search]'->'$value[search]', filter='$old_value[filter]'->'$value[filter]', filter2='$old_value[filter2]'->'$value[filter2]'
";
//echo "new filter --> loop
soetemplate::read('$this->name','$this->template','$this->lang',$this->group,'$this->version')
\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); } @@ -808,7 +812,7 @@ $this->modified = time(); } if (is_null($this->group) && !is_int($this->group)) $this->group = 0; - + $this->db->insert($this->table_name,$this->as_array(3,true),$this->as_array(-1,true),__LINE__,__FILE__); $rows = $this->db->affected_rows(); @@ -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 diff --git a/etemplate/inc/class.solangfile.inc.php b/etemplate/inc/class.solangfile.inc.php index 40ae57c5b0..70118a1a09 100644 --- a/etemplate/inc/class.solangfile.inc.php +++ b/etemplate/inc/class.solangfile.inc.php @@ -1,15 +1,15 @@ '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,26 +99,13 @@ $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 { foreach($GLOBALS['acl_manager'] as $app => $data) @@ -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,46 +242,56 @@ 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 "solangfile::load_app('$app','$userlang') converting from charset('$userlang')='$from' to '$to'
\n"; if (file_exists($fn)) { if ($fp = @fopen($fn,'rb')) { - while ($data = fgets($fp,8000)) - { - list($message_id,$app_name,$null,$content) = explode("\t",$data); + while ($data = fgets($fp,8000)) + { + list($message_id,$app_name,,$content) = explode("\t",$data); if(!$message_id) { continue; } - //echo 'solangfile::write_file('$app_name',,'$userlang') converting from '$from' to charset('$userlang')='$to'
\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,9 +333,13 @@ $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); - fwrite($fp,$mess_id . "\t" . $data['app_name'] . "\t" . $userlang . "\t" . $data['content'] . "\n"); + // dont write empty content + if (!empty($data['content'])) + { + fwrite($fp,$mess_id . "\t" . $data['app_name'] . "\t" . $userlang . "\t" . $data['content'] . "\n"); + } } fclose($fp); @@ -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; + } + } + } ?> diff --git a/etemplate/inc/class.tab_widget.inc.php b/etemplate/inc/class.tab_widget.inc.php index 64dcffc371..01a1431166 100644 --- a/etemplate/inc/class.tab_widget.inc.php +++ b/etemplate/inc/class.tab_widget.inc.php @@ -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); diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 63c7b342bd..3ec1af4713 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -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 "uietemplate::exec($method,...) after show: sitemgr=$this->sitemgr, xslt=$this->xslt, hooked=$hooked, output_mode=$output_mode
\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'] && - (!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php'))) + if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && + (!isset($_GET['menuaction']) || strstr($_SERVER['PHP_SELF'],'process_exec.php'))) { if((int) $output_mode == 2) { echo "\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 "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 "
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 "
process_exec: hook_content set
\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 "process_exec($this->name): loop is set, content=
\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\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 = '/'; @@ -507,7 +507,7 @@ if (!(list($r_key) = each($data))) // no further row { if (!(($this->autorepeat_idx($cols['A'],0,$r,$idx,$idx_cname) && $idx_cname) || - (substr($cols['A']['type'],1) == 'box' && $this->autorepeat_idx($cols['A'][1],0,$r,$idx,$idx_cname) && $idx_cname) || + (substr($cols['A']['type'],1) == 'box' && $this->autorepeat_idx($cols['A'][1],0,$r,$idx,$idx_cname) && $idx_cname) || ($this->autorepeat_idx($cols['B'],1,$r,$idx,$idx_cname) && $idx_cname)) || !$this->isset_array($content,$idx_cname)) { @@ -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 == '')) { @@ -1413,7 +1413,7 @@ } $accesskey = false; if (($accesskey = strstr($label,'&')) && $accesskey[1] != ' ' && $form_name != '' && - (($pos = strpos($accesskey,';')) === False || $pos > 5)) + (($pos = strpos($accesskey,';')) === False || $pos > 5)) { $label = str_replace('&'.$accesskey[1],''.$accesskey[1].'',$label); $accesskey = $accesskey[1]; @@ -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 .= ' '.$GLOBALS['phpgw_info']['etemplate']['validation_errors'][$form_name].''; + $html .= ' '.$GLOBALS['egw_info']['etemplate']['validation_errors'][$form_name].''; } // generate an extra div, if we have an onclick handler and NO children or it's an extension //echo "$this->name($this->onclick_handler:$this->no_onclick:$this->onclick_proxy): $cell[type]/$cell[name]
\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 "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 "
validation_errors = "; _debug_array($GLOBALS['phpgw_info']['etemplate']['validation_errors']); + echo "
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 "
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'])."
\n"; + $ret = !!$GLOBALS['egw_info']['etemplate']['java_script'] || + $consider_not_tested_as_enabled && !isset($GLOBALS['egw_info']['etemplate']['java_script']); + //echo "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'])."
\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 = ''."\n"; + $GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js">'."\n"; } return $js; } diff --git a/etemplate/inc/class.uietemplate_gtk.inc.php b/etemplate/inc/class.uietemplate_gtk.inc.php index 92405bd65e..59565294ab 100644 --- a/etemplate/inc/class.uietemplate_gtk.inc.php +++ b/etemplate/inc/class.uietemplate_gtk.inc.php @@ -12,21 +12,21 @@ /* $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 { var $debug;//='etemplate.editor.edit'; // 1=calls to show and process_show, 2=content after process_show, @@ -41,11 +41,11 @@ ); 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) { $this->public_functions += array( @@ -61,25 +61,25 @@ 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='') { if (!$sel_options) @@ -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,16 +147,16 @@ 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,23 +249,23 @@ } } - /*! - @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) { if (!$sel_options) @@ -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,14 +428,14 @@ $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) { if ($this->debug >= 3 || $this->debug == $cell['type']) @@ -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(); diff --git a/etemplate/inc/class.xmltool.inc.php b/etemplate/inc/class.xmltool.inc.php index 1b7491abeb..0fa6ae43fa 100644 --- a/etemplate/inc/class.xmltool.inc.php +++ b/etemplate/inc/class.xmltool.inc.php @@ -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 "import_var: this->indentstring='$this->indentstring'
\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'])) diff --git a/etemplate/inc/class.xslt_widget.inc.php b/etemplate/inc/class.xslt_widget.inc.php index 0cf313b20b..8bb0be87dd 100644 --- a/etemplate/inc/class.xslt_widget.inc.php +++ b/etemplate/inc/class.xslt_widget.inc.php @@ -12,14 +12,14 @@ /* $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 { var $public_functions = array( @@ -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"; } diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index bf17d56e44..3225d44dd7 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -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 "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;
@@ -446,7 +446,7 @@
if (!$ok || !is_array($vals))
{
$err = 'Error Line '.xml_get_current_line_number($parser).', Column '.xml_get_current_column_number($parser).
- ': '.xml_error_string(xml_get_error_code($parser));
+ ': '.xml_error_string(xml_get_error_code($parser));
}
xml_parser_free($parser);
@@ -506,8 +506,8 @@
$etempl->fix_old_template_format(); // set the depricated compat vars
// 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);
+ ($etempl->lang == '' ? '' : '.'.$etempl->lang);
+ $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'] : '');
diff --git a/etemplate/inc/hook_sidebox_menu.inc.php b/etemplate/inc/hook_sidebox_menu.inc.php
index f26e973860..577c0187d3 100644
--- a/etemplate/inc/hook_sidebox_menu.inc.php
+++ b/etemplate/inc/hook_sidebox_menu.inc.php
@@ -1,33 +1,33 @@
$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',
diff --git a/etemplate/index.php b/etemplate/index.php
index 12d7dede1c..31b9ac438d 100644
--- a/etemplate/index.php
+++ b/etemplate/index.php
@@ -12,11 +12,13 @@
/* $Id$ */
- $GLOBALS['phpgw_info']['flags'] = array(
- 'currentapp' => 'etemplate',
- 'noheader' => True,
- 'nonavbar' => True
+ $GLOBALS['egw_info'] = array(
+ 'flags' => array(
+ 'currentapp' => 'etemplate',
+ 'noheader' => 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');
diff --git a/etemplate/phpGtk_test.php b/etemplate/phpGtk_test.php
index eedb51b623..40e13a2712 100755
--- a/etemplate/phpGtk_test.php
+++ b/etemplate/phpGtk_test.php
@@ -28,18 +28,18 @@ if ($argv[1] == '' || $argv[2] == '')
echo "Usage: $argv[0]