Imported latest version of wz_tooltips (5.31) as they no longer need to

process the whole dom tree to enable the tooltips.
(Also made the changed from r23372 again)
This commit is contained in:
Ralf Becker 2010-01-17 03:20:45 +00:00
parent 33c8e06bf7
commit 4600c7cb38
9 changed files with 1452 additions and 474 deletions

View File

@ -45,6 +45,19 @@ abstract class egw_framework
*/
var $template;
/**
* true if $this->header() was called
*
* @var boolean
*/
static $header_done = false;
/**
* true if $this->navbar() was called
*
* @var boolean
*/
static $navbar_done = false;
/**
* Constructor
*
@ -56,7 +69,7 @@ abstract class egw_framework
{
$this->template = $template;
if (!is_object($GLOBALS['egw']->framework))
if (!isset($GLOBALS['egw']->framework))
{
$GLOBALS['egw']->framework = $this;
}
@ -157,7 +170,6 @@ abstract class egw_framework
$var['page_generation_time'] .= '</span></div>';
}
$var['powered_by'] = lang('Powered by').' <a href="'.$GLOBALS['egw_info']['server']['webserver_url'].'/about.php">eGroupWare</a> '.lang('version').' '.$GLOBALS['egw_info']['server']['versions']['phpgwapi'];
$var['activate_tooltips'] = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/wz_tooltip/wz_tooltip.js" type="text/javascript"></script>';
return $var;
}
@ -250,6 +262,12 @@ 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))
{
$include_wz_tooltip = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].
$wz_tooltip.'?'.filemtime(EGW_SERVER_ROOT.$wz_tooltip).'" type="text/javascript"></script>';
}
return $this->_get_css()+array(
#'img_icon' => EGW_IMAGES_DIR . '/favicon.ico',
'img_icon' => $var['favicon_file'],
@ -265,6 +283,7 @@ abstract class egw_framework
'java_script' => self::_get_js(),
'meta_robots' => $robots,
'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"',
'include_wz_tooltip'=> $include_wz_tooltip,
);
}

View File

@ -100,8 +100,7 @@ class html
*
* Note: The wz_tooltip.js file gets automaticaly loaded at the end of the page
*
* @param string/boolean $text text or html for the tooltip, all chars allowed, they will be quoted approperiate
* Or if False the content (innerHTML) of the element itself is used.
* @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:
* title (string) gives extra title-row, width (int,'auto') , padding (int), above (bool), bgcolor (color), bgimg (URL)
@ -110,28 +109,20 @@ class html
*/
static function tooltip($text,$do_lang=False,$options=False)
{
if (!self::$wz_tooltip_included)
{
if (strpos($GLOBALS['egw_info']['flags']['need_footer'],'wz_tooltip')===false)
{
$GLOBALS['egw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript" src="'.self::$api_js_url.'/wz_tooltip/wz_tooltip.js"></script>'."\n";
}
self::$wz_tooltip_included = True;
}
if ($do_lang) $text = lang($text);
$opt_out = 'this.T_WIDTH = 200;';
$ttip = ' onmouseover="Tip(\''.str_replace(array("\n","\r","'",'"'),array('','',"\\'",'&quot;'),$text).'\'';
if (is_array($options))
{
foreach($options as $option => $value)
{
$opt_out .= 'this.T_'.strtoupper($option).'='.(is_bool($value)?($value?'true':'false'):
(is_numeric($value)?$value:"'".str_replace(array("'",'"'),array("\\'",'&quot;'),$value)."'")).'; ';
$ttip .= ','.strtoupper($option).','.$value;
}
}
if ($text === False) return ' onmouseover="'.$opt_out.'return escape(this.innerHTML);"';
return ' onmouseover="'.$opt_out.'return escape(\''.str_replace(array("\n","\r","'",'"'),array('','',"\\'",'&quot;'),$text).'\')"';
$ttip .= ')" onmouseout="UnTip()"';
return $ttip;
}
/**

View File

@ -0,0 +1,104 @@
/*
tip_centerwindow.js v. 1.21
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de
Initial author: Walter Zorn
Last modified: 3.6.2008
Extension for the tooltip library wz_tooltip.js.
Centers a sticky tooltip in the window's visible clientarea,
optionally even if the window is being scrolled or resized.
*/
// Make sure that the core file wz_tooltip.js is included first
if(typeof config == "undefined")
alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!");
// Here we define new global configuration variable(s) (as members of the
// predefined "config." class).
// From each of these config variables, wz_tooltip.js will automatically derive
// a command which can be passed to Tip() or TagToTip() in order to customize
// tooltips individually. These command names are just the config variable
// name(s) translated to uppercase,
// e.g. from config. CenterWindow a command CENTERWINDOW will automatically be
// created.
//=================== GLOBAL TOOLTIP CONFIGURATION =========================//
config. CenterWindow = false // true or false - set to true if you want this to be the default behaviour
config. CenterAlways = false // true or false - recenter if window is resized or scrolled
//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============//
// Create a new tt_Extension object (make sure that the name of that object,
// here ctrwnd, is unique amongst the extensions available for
// wz_tooltips.js):
var ctrwnd = new tt_Extension();
// Implement extension eventhandlers on which our extension should react
ctrwnd.OnLoadConfig = function()
{
if(tt_aV[CENTERWINDOW])
{
// Permit CENTERWINDOW only if the tooltip is sticky
if(tt_aV[STICKY])
{
if(tt_aV[CENTERALWAYS])
{
// IE doesn't support style.position "fixed"
if(tt_ie)
tt_AddEvtFnc(window, "scroll", Ctrwnd_DoCenter);
else
tt_aElt[0].style.position = "fixed";
tt_AddEvtFnc(window, "resize", Ctrwnd_DoCenter);
}
return true;
}
tt_aV[CENTERWINDOW] = false;
}
return false;
};
// We react on the first OnMouseMove event to center the tip on that occasion
ctrwnd.OnMoveBefore = Ctrwnd_DoCenter;
ctrwnd.OnKill = function()
{
if(tt_aV[CENTERWINDOW] && tt_aV[CENTERALWAYS])
{
tt_RemEvtFnc(window, "resize", Ctrwnd_DoCenter);
if(tt_ie)
tt_RemEvtFnc(window, "scroll", Ctrwnd_DoCenter);
else
tt_aElt[0].style.position = "absolute";
}
return false;
};
// Helper function
function Ctrwnd_DoCenter()
{
if(tt_aV[CENTERWINDOW])
{
var x, y, dx, dy;
// Here we use some functions and variables (tt_w, tt_h) which the
// extension API of wz_tooltip.js provides for us
if(tt_ie || !tt_aV[CENTERALWAYS])
{
dx = tt_GetScrollX();
dy = tt_GetScrollY();
}
else
{
dx = 0;
dy = 0;
}
// Position the tip, offset from the center by OFFSETX and OFFSETY
x = (tt_GetClientW() - tt_w) / 2 + dx + tt_aV[OFFSETX];
y = (tt_GetClientH() - tt_h) / 2 + dy + tt_aV[OFFSETY];
tt_SetTipPos(x, y);
return true;
}
return false;
}

View File

@ -0,0 +1,88 @@
/*
tip_followscroll.js v. 1.11
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de
Initial author: Walter Zorn
Last modified: 3.6.2008
Extension for the tooltip library wz_tooltip.js.
Lets a "sticky" tooltip keep its position inside the clientarea if the window
is scrolled.
*/
// Make sure that the core file wz_tooltip.js is included first
if(typeof config == "undefined")
alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!");
// Here we define new global configuration variable(s) (as members of the
// predefined "config." class).
// From each of these config variables, wz_tooltip.js will automatically derive
// a command which can be passed to Tip() or TagToTip() in order to customize
// tooltips individually. These command names are just the config variable
// name(s) translated to uppercase,
// e.g. from config. FollowScroll a command FOLLOWSCROLL will automatically be
// created.
//=================== GLOBAL TOOLTIP CONFIGURATION ======================//
config. FollowScroll = false // true or false - set to true if you want this to be the default behaviour
//======= END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW ==============//
// Create a new tt_Extension object (make sure that the name of that object,
// here fscrl, is unique amongst the extensions available for
// wz_tooltips.js):
var fscrl = new tt_Extension();
// Implement extension eventhandlers on which our extension should react
fscrl.OnShow = function()
{
if(tt_aV[FOLLOWSCROLL])
{
// Permit FOLLOWSCROLL only if the tooltip is sticky
if(tt_aV[STICKY])
{
var x = tt_x - tt_GetScrollX(), y = tt_y - tt_GetScrollY();
if(tt_ie)
{
fscrl.MoveOnScrl.offX = x;
fscrl.MoveOnScrl.offY = y;
fscrl.AddRemEvtFncs(tt_AddEvtFnc);
}
else
{
tt_SetTipPos(x, y);
tt_aElt[0].style.position = "fixed";
}
return true;
}
tt_aV[FOLLOWSCROLL] = false;
}
return false;
};
fscrl.OnHide = function()
{
if(tt_aV[FOLLOWSCROLL])
{
if(tt_ie)
fscrl.AddRemEvtFncs(tt_RemEvtFnc);
else
tt_aElt[0].style.position = "absolute";
}
};
// Helper functions (encapsulate in the class to avoid conflicts with other
// extensions)
fscrl.MoveOnScrl = function()
{
tt_SetTipPos(fscrl.MoveOnScrl.offX + tt_GetScrollX(), fscrl.MoveOnScrl.offY + tt_GetScrollY());
};
fscrl.AddRemEvtFncs = function(PAddRem)
{
PAddRem(window, "resize", fscrl.MoveOnScrl);
PAddRem(window, "scroll", fscrl.MoveOnScrl);
};

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,5 @@
</div>
{page_generation_time}
<div id="divPoweredBy">{powered_by}</div>
<!-- enable wz_tooltips -->
{activate_tooltips}
</body>
</html>

View File

@ -23,6 +23,6 @@
{css_file}
{java_script}
</head>
<!-- we don't need body tags anymore, do we?) we do!!! onload!! LK -->
<body {body_tags}>
{include_wz_tooltip}
<!-- END head -->

View File

@ -39,18 +39,6 @@ class idots_framework extends egw_framework
* @var tplsavant2
*/
var $tplsav2;
/**
* true if $this->header() was called
*
* @var boolean
*/
static $header_done = false;
/**
* true if $this->navbar() was called
*
* @var boolean
*/
static $navbar_done = false;
/**
* Contains array with linked icons in the topmenu
@ -160,7 +148,7 @@ class idots_framework extends egw_framework
if($GLOBALS['egw_info']['user']['preferences']['common']['show_general_menu'] != 'sidebox')
{
$GLOBALS['egw']->hooks->process('topmenu_info');
$GLOBALS['egw']->hooks->process('topmenu_info',array(),true);
$content = $this->topmenu($vars,$apps);
$vars['current_users'] = $vars['quick_add'] = $vars['user_info']='';
}

View File

@ -24,7 +24,5 @@
</div>
{page_generation_time}
<div id="divPoweredBy"><br/><span>{powered_by}</span></div>
<!-- enable wz_tooltips -->
{activate_tooltips}
</body>
</html>