removed unnecessary instancations and using static methods of html and egw_link class

This commit is contained in:
Ralf Becker 2008-03-25 15:33:10 +00:00
parent f9abc6fa2a
commit ae735c80af
6 changed files with 10 additions and 50 deletions

View File

@ -99,10 +99,6 @@
} }
else else
{ {
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories','','calendar');
}
if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--') if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--')
{ {
$cat2id[$cat] = $ids[$cat] = $cat; $cat2id[$cat] = $ids[$cat] = $cat;
@ -121,11 +117,6 @@
return implode( ',',$ids ); return implode( ',',$ids );
} }
if (!is_object($GLOBALS['egw']->html))
{
$GLOBALS['egw']->html =& CreateObject('phpgwapi.html');
}
if ($_POST['next']) $_POST['action'] = 'next'; if ($_POST['next']) $_POST['action'] = 'next';
switch ($_POST['action']) switch ($_POST['action'])
{ {
@ -135,7 +126,7 @@
$GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file')); $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('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']->template->set_var('select_charset',
$GLOBALS['egw']->html->select('charset','', html::select('charset','',
$GLOBALS['egw']->translation->get_installed_charsets()+ $GLOBALS['egw']->translation->get_installed_charsets()+
array('utf-8' => 'utf-8 (Unicode)'),True)); array('utf-8' => 'utf-8 (Unicode)'),True));
$GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); $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_info_fieldname',lang('calendar-Fieldname'));
$GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>'); $GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>');
$GLOBALS['egw']->template->set_var('submit', $GLOBALS['egw']->template->set_var('submit',
$GLOBALS['egw']->html->submit_button('convert','Import') . '&nbsp;'. html::submit_button('convert','Import') . '&nbsp;'.
$GLOBALS['egw']->html->submit_button('cancel','Cancel')); html::submit_button('cancel','Cancel'));
$GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)')); $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)'));
$GLOBALS['egw']->template->parse('rows','fheader'); $GLOBALS['egw']->template->parse('rows','fheader');
@ -227,7 +218,7 @@
$GLOBALS['egw']->template->parse('rows','ffooter',True); $GLOBALS['egw']->template->parse('rows','ffooter',True);
fclose($fp); fclose($fp);
$hiddenvars = $GLOBALS['egw']->html->input_hidden(array( $hiddenvars = html::input_hidden(array(
'action' => 'import', 'action' => 'import',
'fieldsep'=> $_POST['fieldsep'], 'fieldsep'=> $_POST['fieldsep'],
'charset' => $_POST['charset'] 'charset' => $_POST['charset']
@ -272,7 +263,7 @@
$_POST['trans'] = unserialize(stripslashes($_POST['trans'])); $_POST['trans'] = unserialize(stripslashes($_POST['trans']));
// fall-through // fall-through
case 'import': case 'import':
$hiddenvars = $GLOBALS['egw']->html->input_hidden(array( $hiddenvars = html::input_hidden(array(
'action' => 'continue', 'action' => 'continue',
'fieldsep'=> $_POST['fieldsep'], 'fieldsep'=> $_POST['fieldsep'],
'charset' => $_POST['charset'], 'charset' => $_POST['charset'],
@ -495,9 +486,9 @@
lang('%1 records read (not yet imported, you may go back and uncheck Test Import)', lang('%1 records read (not yet imported, you may go back and uncheck Test Import)',
$anz,'','') : $anz,'','') :
lang('%1 records imported',$anz)). '&nbsp;'. lang('%1 records imported',$anz)). '&nbsp;'.
(!$_POST['debug'] && $fields ? $GLOBALS['egw']->html->submit_button('next','Import next set') . '&nbsp;':''). (!$_POST['debug'] && $fields ? html::submit_button('next','Import next set') . '&nbsp;':'').
$GLOBALS['egw']->html->submit_button('continue','Back') . '&nbsp;'. html::submit_button('continue','Back') . '&nbsp;'.
$GLOBALS['egw']->html->submit_button('cancel','Cancel')); html::submit_button('cancel','Cancel'));
$GLOBALS['egw']->template->set_var('log',$log); $GLOBALS['egw']->template->set_var('log',$log);
$GLOBALS['egw']->template->parse('rows','imported'); $GLOBALS['egw']->template->parse('rows','imported');
break; break;

View File

@ -66,12 +66,6 @@ class bocalupdate extends bocal
$this->bocal(); // calling the parent constructor $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); 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 // 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; return $cal_id;
} }
@ -824,7 +818,7 @@ class bocalupdate extends bocal
$GLOBALS['egw']->contenthistory->updateTimeStamp('calendar',$cal_id,'delete',time()); $GLOBALS['egw']->contenthistory->updateTimeStamp('calendar',$cal_id,'delete',time());
// delete all links to the event // delete all links to the event
$this->link->unlink(0,'calendar',$cal_id); egw_link::unlink(0,'calendar',$cal_id);
} }
else else
{ {
@ -908,10 +902,6 @@ class bocalupdate extends bocal
'data' => $event['description'] 'data' => $event['description']
); );
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
}
foreach(explode(',',$event['category']) as $cat_id) foreach(explode(',',$event['category']) as $cat_id)
{ {
list($cat) = $GLOBALS['egw']->categories->return_single($cat_id); list($cat) = $GLOBALS['egw']->categories->return_single($cat_id);

View File

@ -468,10 +468,6 @@ class uiforms extends uical
break; break;
case 'freetime': 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 // 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();"); $GLOBALS['egw']->js->set_onload("document.getElementsByName('exec[freetime]')[0].click();");
break; break;
@ -1290,7 +1286,6 @@ class uiforms extends uical
} }
else else
{ {
$GLOBALS['egw']->browser =& CreateObject('phpgwapi.browser');
$GLOBALS['egw']->browser->content_header('event.ics','text/calendar',bytes($ical)); $GLOBALS['egw']->browser->content_header('event.ics','text/calendar',bytes($ical));
echo $ical; echo $ical;
$GLOBALS['egw']->common->egw_exit(); $GLOBALS['egw']->common->egw_exit();
@ -1313,7 +1308,6 @@ class uiforms extends uical
else else
{ {
$ical =& ExecMethod2('calendar.boical.exportVCal',$events,'2.0'/*$content['version']*/); $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)); $GLOBALS['egw']->browser->content_header($content['file'] ? $content['file'] : 'event.ics','text/calendar',bytes($ical));
echo $ical; echo $ical;
$GLOBALS['egw']->common->egw_exit(); $GLOBALS['egw']->common->egw_exit();

View File

@ -42,19 +42,12 @@
function uiholiday() function uiholiday()
{ {
$GLOBALS['egw']->nextmatchs =& CreateObject('phpgwapi.nextmatchs');
$this->bo =& CreateObject('calendar.boholiday'); $this->bo =& CreateObject('calendar.boholiday');
$this->bo->check_admin(); $this->bo->check_admin();
$this->base_url = $this->bo->base_url; $this->base_url = $this->bo->base_url;
$this->template_dir = $GLOBALS['egw']->common->get_tpl_dir('calendar'); $this->template_dir = $GLOBALS['egw']->common->get_tpl_dir('calendar');
$this->sb =& CreateObject('calendar.sbox'); $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. // calendar does not work with hidden sidebox atm.
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);

View File

@ -231,10 +231,6 @@ class uilist extends uical
$label = lang('Before %1',$this->bo->long_date($this->date)); $label = lang('Before %1',$this->bo->long_date($this->date));
break; break;
case 'custom': 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');"); $GLOBALS['egw']->js->set_onload("set_style_by_class('*','custom_hide','visibility','visible');");
$this->first = $search_params['start'] = $params['startdate']; $this->first = $search_params['start'] = $params['startdate'];
$this->last = $search_params['end'] = $params['enddate']; $this->last = $search_params['end'] = $params['enddate'];

View File

@ -23,10 +23,6 @@ class module_calendar extends Module
function get_content(&$arguments,$properties) function get_content(&$arguments,$properties)
{ {
if (!is_object($GLOBALS['egw']->jscalendar))
{
$GLOBALS['egw']->jscalendar =& CreateObject('phpgwapi.jscalendar');
}
return $GLOBALS['egw']->jscalendar->flat('#'); return $GLOBALS['egw']->jscalendar->flat('#');
} }
} }