"fixed topmenu to not query every info again"

This commit is contained in:
Ralf Becker 2008-08-06 07:33:36 +00:00
parent 7beddb6e3b
commit 38bb1c75ca

View File

@ -105,12 +105,6 @@ class idots_framework extends egw_framework
*/
function navbar()
{
if($GLOBALS['egw_info']['user']['preferences']['common']['show_general_menu'] != 'sidebox')
{
$GLOBALS['egw']->hooks->process('topmenu_info');
$content = $this->topmenu();
}
$this->navbar_done = true;
// the navbar
@ -139,6 +133,13 @@ class idots_framework extends egw_framework
$apps = $this->_get_navbar_apps();
$vars = $this->_get_navbar($apps);
if($GLOBALS['egw_info']['user']['preferences']['common']['show_general_menu'] != 'sidebox')
{
$GLOBALS['egw']->hooks->process('topmenu_info');
$content = $this->topmenu($vars,$apps);
$vars['current_users'] = $vars['quick_add'] = $vars['user_info']='';
}
$this->tpl->set_var($vars);
$content .= $this->tpl->fp('out','navbar_header');
@ -436,13 +437,6 @@ class idots_framework extends egw_framework
{
$var = parent::_get_navbar($apps);
if($GLOBALS['egw_info']['user']['preferences']['common']['show_general_menu'] != 'sidebox')
{
$var['current_users'] = '';
$var['quick_add'] = '';
$var['user_info']='';
}
if($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover'] == 'onmouseover')
{
$var['show_menu_event'] = 'onMouseOver';
@ -547,18 +541,18 @@ class idots_framework extends egw_framework
/**
* Add menu items to the topmenu template class to be displayed
*
* @param string $app application name
* @param array $app application data
* @param mixed $alt_label string with alternative menu item label default value = null
* @param string $urlextra string with alternate additional code inside <a>-tag
* @access protected
* @return void
*/
function _add_topmenu_item($app,$alt_label=null)
function _add_topmenu_item(array $app_data,$alt_label=null)
{
$_item['url'] = $this->apps[$app]['url'];
$_item['urlextra'] = $this->apps[$app]['target'];
$_item['label'] = ($alt_label?$alt_label:$this->apps[$app]['title']);
$this->tplsav2->menuitems[$app] = $_item;
$_item['url'] = $app_data['url'];
$_item['urlextra'] = $app_data['target'];
$_item['label'] = ($alt_label?$alt_label:$app_data['title']);
$this->tplsav2->menuitems[$app_data['name']] = $_item;
$this->tplsav2->icon_or_star = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images'.'/orange-ball.png';
}
@ -577,29 +571,29 @@ class idots_framework extends egw_framework
/**
* Display the string with html of the topmenu if its enabled
*
* @return void
* @param array $vars
* @param array $apps
* @return string
*/
function topmenu()
function topmenu(array &$vars,array &$apps)
{
$this->tplsav2->menuitems = array();
$this->tplsav2->menuinfoitems = array();
$this->apps = $this->_get_navbar_apps();
$this->_add_topmenu_item('home');
$this->_add_topmenu_item($apps['home']);
if($GLOBALS['egw_info']['user']['apps']['preferences'])
{
$this->_add_topmenu_item('preferences');
$this->_add_topmenu_item($apps['preferences']);
}
if($GLOBALS['egw_info']['user']['apps']['manual'] && $this->apps['manual'])
if($GLOBALS['egw_info']['user']['apps']['manual'] && isset($apps['manual']))
{
$this->_add_topmenu_item('manual');
$this->_add_topmenu_item($apps['manual']);
}
//$this->_add_topmenu_item('about',lang('About %1',$GLOBALS['egw_info']['apps'][$GLOBALS['egw_info']['flags']['currentapp']]['title']));
$this->_add_topmenu_item('logout');
//$this->_add_topmenu_item($apps['about'],lang('About %1',$GLOBALS['egw_info']['apps'][$GLOBALS['egw_info']['flags']['currentapp']]['title']));
$this->_add_topmenu_item($apps['logout']);
$this->tplsav2->assign('info_icons',$this->topmenu_icon_arr);
@ -607,9 +601,9 @@ class idots_framework extends egw_framework
{
$this->_add_topmenu_info_item($this->_get_notification_bell());
}
$this->_add_topmenu_info_item($this->_user_time_info());
$this->_add_topmenu_info_item($this->_current_users());
$this->_add_topmenu_info_item($this->_get_quick_add());
$this->_add_topmenu_info_item($vars['user_info']);
$this->_add_topmenu_info_item($vars['current_users']);
$this->_add_topmenu_info_item($vars['quick_add']);
return $this->tplsav2->fetch('topmenu.tpl.php');
}