From ae735c80af5352cb2adea8050f43b07e8e872294 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 25 Mar 2008 15:33:10 +0000 Subject: [PATCH] removed unnecessary instancations and using static methods of html and egw_link class --- calendar/csv_import.php | 25 ++++++------------- calendar/inc/class.bocalupdate.inc.php | 14 ++--------- calendar/inc/class.uiforms.inc.php | 6 ----- calendar/inc/class.uiholiday.inc.php | 7 ------ calendar/inc/class.uilist.inc.php | 4 --- .../sitemgr/class.module_calendar.inc.php | 4 --- 6 files changed, 10 insertions(+), 50 deletions(-) diff --git a/calendar/csv_import.php b/calendar/csv_import.php index 84d7285f5e..3d81db889b 100644 --- a/calendar/csv_import.php +++ b/calendar/csv_import.php @@ -99,10 +99,6 @@ } else { - if (!is_object($GLOBALS['egw']->categories)) - { - $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories','','calendar'); - } if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--') { $cat2id[$cat] = $ids[$cat] = $cat; @@ -121,11 +117,6 @@ return implode( ',',$ids ); } - if (!is_object($GLOBALS['egw']->html)) - { - $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); - } - if ($_POST['next']) $_POST['action'] = 'next'; switch ($_POST['action']) { @@ -135,7 +126,7 @@ $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); $GLOBALS['egw']->template->set_var('lang_help',lang('Please note: You can configure the field assignments AFTER you uploaded the file.')); $GLOBALS['egw']->template->set_var('select_charset', - $GLOBALS['egw']->html->select('charset','', + html::select('charset','', $GLOBALS['egw']->translation->get_installed_charsets()+ array('utf-8' => 'utf-8 (Unicode)'),True)); $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); @@ -157,8 +148,8 @@ $GLOBALS['egw']->template->set_var('lang_info_fieldname',lang('calendar-Fieldname')); $GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' '.lang('help').''); $GLOBALS['egw']->template->set_var('submit', - $GLOBALS['egw']->html->submit_button('convert','Import') . ' '. - $GLOBALS['egw']->html->submit_button('cancel','Cancel')); + html::submit_button('convert','Import') . ' '. + html::submit_button('cancel','Cancel')); $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); $GLOBALS['egw']->template->parse('rows','fheader'); @@ -227,7 +218,7 @@ $GLOBALS['egw']->template->parse('rows','ffooter',True); fclose($fp); - $hiddenvars = $GLOBALS['egw']->html->input_hidden(array( + $hiddenvars = html::input_hidden(array( 'action' => 'import', 'fieldsep'=> $_POST['fieldsep'], 'charset' => $_POST['charset'] @@ -272,7 +263,7 @@ $_POST['trans'] = unserialize(stripslashes($_POST['trans'])); // fall-through case 'import': - $hiddenvars = $GLOBALS['egw']->html->input_hidden(array( + $hiddenvars = html::input_hidden(array( 'action' => 'continue', 'fieldsep'=> $_POST['fieldsep'], 'charset' => $_POST['charset'], @@ -495,9 +486,9 @@ lang('%1 records read (not yet imported, you may go back and uncheck Test Import)', $anz,'','') : lang('%1 records imported',$anz)). ' '. - (!$_POST['debug'] && $fields ? $GLOBALS['egw']->html->submit_button('next','Import next set') . ' ':''). - $GLOBALS['egw']->html->submit_button('continue','Back') . ' '. - $GLOBALS['egw']->html->submit_button('cancel','Cancel')); + (!$_POST['debug'] && $fields ? html::submit_button('next','Import next set') . ' ':''). + html::submit_button('continue','Back') . ' '. + html::submit_button('cancel','Cancel')); $GLOBALS['egw']->template->set_var('log',$log); $GLOBALS['egw']->template->parse('rows','imported'); break; diff --git a/calendar/inc/class.bocalupdate.inc.php b/calendar/inc/class.bocalupdate.inc.php index a9540afc48..ef6bca50e2 100644 --- a/calendar/inc/class.bocalupdate.inc.php +++ b/calendar/inc/class.bocalupdate.inc.php @@ -66,12 +66,6 @@ class bocalupdate extends bocal $this->bocal(); // calling the parent constructor - if (!is_object($GLOBALS['egw']->link)) - { - $GLOBALS['egw']->link =& CreateObject('phpgwapi.bolink'); - } - $this->link =& $GLOBALS['egw']->link; - if ($this->debug > 0) $this->debug_message('bocalupdate::bocalupdate() finished',True); } @@ -300,7 +294,7 @@ class bocalupdate extends bocal } // notify the link-class about the update, as other apps may be subscribt to it - $this->link->notify_update('calendar',$cal_id,$event); + egw_link::notify_update('calendar',$cal_id,$event); return $cal_id; } @@ -824,7 +818,7 @@ class bocalupdate extends bocal $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar',$cal_id,'delete',time()); // delete all links to the event - $this->link->unlink(0,'calendar',$cal_id); + egw_link::unlink(0,'calendar',$cal_id); } else { @@ -908,10 +902,6 @@ class bocalupdate extends bocal 'data' => $event['description'] ); - if (!is_object($GLOBALS['egw']->categories)) - { - $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories'); - } foreach(explode(',',$event['category']) as $cat_id) { list($cat) = $GLOBALS['egw']->categories->return_single($cat_id); diff --git a/calendar/inc/class.uiforms.inc.php b/calendar/inc/class.uiforms.inc.php index c980f3467c..74d77b4057 100644 --- a/calendar/inc/class.uiforms.inc.php +++ b/calendar/inc/class.uiforms.inc.php @@ -468,10 +468,6 @@ class uiforms extends uical break; case 'freetime': - if (!is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } // the "click" has to be in onload, to make sure the button is already created $GLOBALS['egw']->js->set_onload("document.getElementsByName('exec[freetime]')[0].click();"); break; @@ -1290,7 +1286,6 @@ class uiforms extends uical } else { - $GLOBALS['egw']->browser =& CreateObject('phpgwapi.browser'); $GLOBALS['egw']->browser->content_header('event.ics','text/calendar',bytes($ical)); echo $ical; $GLOBALS['egw']->common->egw_exit(); @@ -1313,7 +1308,6 @@ class uiforms extends uical else { $ical =& ExecMethod2('calendar.boical.exportVCal',$events,'2.0'/*$content['version']*/); - $GLOBALS['egw']->browser =& CreateObject('phpgwapi.browser'); $GLOBALS['egw']->browser->content_header($content['file'] ? $content['file'] : 'event.ics','text/calendar',bytes($ical)); echo $ical; $GLOBALS['egw']->common->egw_exit(); diff --git a/calendar/inc/class.uiholiday.inc.php b/calendar/inc/class.uiholiday.inc.php index 29c72841d6..85fa4ebe94 100755 --- a/calendar/inc/class.uiholiday.inc.php +++ b/calendar/inc/class.uiholiday.inc.php @@ -42,19 +42,12 @@ function uiholiday() { - $GLOBALS['egw']->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); - $this->bo =& CreateObject('calendar.boholiday'); $this->bo->check_admin(); $this->base_url = $this->bo->base_url; $this->template_dir = $GLOBALS['egw']->common->get_tpl_dir('calendar'); $this->sb =& CreateObject('calendar.sbox'); - // jscalendar is needed by the new navigation-menu AND it need to be loaded befor the header !!! - if (!is_object($GLOBALS['egw']->jscalendar)) - { - $GLOBALS['egw']->jscalendar =& CreateObject('phpgwapi.jscalendar'); - } // calendar does not work with hidden sidebox atm. unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); diff --git a/calendar/inc/class.uilist.inc.php b/calendar/inc/class.uilist.inc.php index 9b0e8581af..9b43b241e6 100644 --- a/calendar/inc/class.uilist.inc.php +++ b/calendar/inc/class.uilist.inc.php @@ -231,10 +231,6 @@ class uilist extends uical $label = lang('Before %1',$this->bo->long_date($this->date)); break; case 'custom': - if (!is_object($GLOBALS['egw']->js)) - { - $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); - } $GLOBALS['egw']->js->set_onload("set_style_by_class('*','custom_hide','visibility','visible');"); $this->first = $search_params['start'] = $params['startdate']; $this->last = $search_params['end'] = $params['enddate']; diff --git a/calendar/sitemgr/class.module_calendar.inc.php b/calendar/sitemgr/class.module_calendar.inc.php index 9293d1f31e..246c601f3e 100644 --- a/calendar/sitemgr/class.module_calendar.inc.php +++ b/calendar/sitemgr/class.module_calendar.inc.php @@ -23,10 +23,6 @@ class module_calendar extends Module function get_content(&$arguments,$properties) { - if (!is_object($GLOBALS['egw']->jscalendar)) - { - $GLOBALS['egw']->jscalendar =& CreateObject('phpgwapi.jscalendar'); - } return $GLOBALS['egw']->jscalendar->flat('#'); } }