load wz_tooltips only if required: $GLOBALS[egw_info][flags][include_wz_tooltip] set or html::tooltip() called before calling common::egw_header(), calling header again as end of home page to allow apps to load stuff into the header (not only wz_tooltip)

This commit is contained in:
Ralf Becker 2012-04-04 13:58:30 +00:00
parent 44051ca146
commit 3eb021ff20
4 changed files with 11 additions and 21 deletions

View File

@ -225,7 +225,8 @@ class calendar_ui
*/
function do_header()
{
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
// tell egw_framework to include wz_tooltip
$GLOBALS['egw_info']['flags']['include_wz_tooltip'] = true;
common::egw_header();
if ($_GET['msg']) echo '<p class="redItalic" align="center">'.html::htmlspecialchars($_GET['msg'])."</p>\n";

View File

@ -19,13 +19,9 @@
*/
$GLOBALS['egw_info'] = array(
'flags' => array(
'noheader' => true,//False,
'nonavbar' => true,//False,
'noheader' => true,
'nonavbar' => true,
'currentapp' => 'home',
'enable_network_class' => False,
'enable_contacts_class' => False,
'enable_nextmatchs_class' => False,
'include_xajax' => True,
)
);
@ -33,9 +29,6 @@
auth::check_password_age('home','index');
$GLOBALS['egw_info']['flags']['nonavbar']=false;
// Display the header which contains all includes etc.
common::egw_header();
/*
** Initializing the template
*/
@ -237,4 +230,4 @@
}
//_debug_array($GLOBALS['egw_info']['user']['preferences']);
common::egw_footer();
$GLOBALS['egw']->framework->render(ob_get_clean());

View File

@ -322,8 +322,8 @@ abstract class egw_framework
$var['favicon_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['favicon_file']?$GLOBALS['egw_info']['server']['favicon_file']:'favicon.ico');
}
$wz_tooltip = '/phpgwapi/js/wz_tooltip/wz_tooltip.js';
if (file_exists(EGW_SERVER_ROOT.$wz_tooltip))
if ($GLOBALS['egw_info']['flags']['include_wz_tooltip'] &&
file_exists(EGW_SERVER_ROOT.($wz_tooltip = '/phpgwapi/js/wz_tooltip/wz_tooltip.js')))
{
$include_wz_tooltip = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].
$wz_tooltip.'?'.filemtime(EGW_SERVER_ROOT.$wz_tooltip).'" type="text/javascript"></script>';

View File

@ -50,11 +50,6 @@ class html
* @var string
*/
static $api_js_url;
/**
* do we need to set the wz_tooltip class, to be included at the end of the page
* @var boolean
*/
static private $wz_tooltip_included = False;
/**
* initialise our static vars
@ -110,8 +105,6 @@ class html
/**
* Handles tooltips via the wz_tooltip class from Walter Zorn
*
* Note: The wz_tooltip.js file gets automaticaly loaded at the end of the page
*
* @param string $text text or html for the tooltip, all chars allowed, they will be quoted approperiate
* @param boolean $do_lang (default False) should the text be run though lang()
* @param array $options param/value pairs, eg. 'TITLE' => 'I am the title'. Some common parameters:
@ -121,6 +114,9 @@ class html
*/
static function tooltip($text,$do_lang=False,$options=False)
{
// tell egw_framework to include wz_tooltip.js
$GLOBALS['egw_info']['flags']['include_wz_tooltip'] = true;
if ($do_lang) $text = lang($text);
$ttip = ' onmouseover="Tip(\''.str_replace(array("\n","\r","'",'"'),array('','',"\\'",'&quot;'),$text).'\'';