From 3e4ef810803e7276f8a5d97eaaf139e36e7f19fc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 4 Apr 2012 13:05:58 +0000 Subject: [PATCH] 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) --- calendar/inc/class.calendar_ui.inc.php | 3 ++- home/index.php | 13 +++---------- phpgwapi/inc/class.egw_framework.inc.php | 4 ++-- phpgwapi/inc/class.html.inc.php | 12 ++++-------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 43d82ede3b..02c377b304 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -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 '

'.html::htmlspecialchars($_GET['msg'])."

\n"; diff --git a/home/index.php b/home/index.php index d9eea0d9fd..ac56f73014 100755 --- a/home/index.php +++ b/home/index.php @@ -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()); diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 3efb77d0df..dd14df5546 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -347,8 +347,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 = ''; diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 464db5eac3..d78cacb005 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -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('','',"\\'",'"'),$text).'\''; @@ -566,7 +562,7 @@ class html // this one is for testing how it will turn out, if you do not have the device or agent ready at your fingertips // if (stripos($_SERVER[HTTP_USER_AGENT],'mozilla') !== false) return false; - // CKeditor3 will doublecheck availability for us, but its fallback does not look nice, and you will get + // CKeditor3 will doublecheck availability for us, but its fallback does not look nice, and you will get // no conversion of html content to plain text, so we provide a check for known USER_AGENTS to fail the test return true; }