mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
backport of Ralfs tooltip improvement: rev28980, rev29034, rev29035,rev29036,rev29071
This commit is contained in:
commit
0d9ceff493
@ -145,6 +145,7 @@ class calendar_uiviews extends calendar_ui
|
||||
(count(explode(',',$this->owner)) == 1 ? ': '.$this->bo->participant_name($this->owner) : '');
|
||||
|
||||
// standard params for calling bocal::search for all views
|
||||
$this->owner = str_replace('%2C',',',$this->owner);
|
||||
$this->search_params = array(
|
||||
'start' => $this->date,
|
||||
'cat_id' => $this->cat_id,
|
||||
@ -1279,7 +1280,6 @@ class calendar_uiviews extends calendar_ui
|
||||
}
|
||||
*/
|
||||
$tooltip = $tpl->fp('tooltip','event_tooltip');
|
||||
$tpl->set_var('tooltip',html::tooltip($tooltip,False,array('BorderWidth'=>0,'Padding'=>0)));
|
||||
$html = $tpl->fp('out',$block);
|
||||
|
||||
$view_link = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'calendar.calendar_uiforms.edit','cal_id'=>$event['id'],'date'=>$this->bo->date2string($event['start'])));
|
||||
@ -1306,11 +1306,25 @@ class calendar_uiviews extends calendar_ui
|
||||
'color' => $color,
|
||||
);
|
||||
}
|
||||
|
||||
$draggableID = 'drag_'.$event['id'].'_O'.$event['owner'].'_C'.$owner;
|
||||
|
||||
$ttip_options = array(
|
||||
'BorderWidth' => 0, // as we use our round borders
|
||||
'Padding' => 0,
|
||||
'Sticky' => true, // make long tooltips scrollable
|
||||
'ClickClose' => true,
|
||||
'FOLLOWMOUSE' => false,
|
||||
'DELAY' => 600,
|
||||
//'FIX' => "['".$draggableID."',10,-5]",
|
||||
'SHADOW' => false,
|
||||
'WIDTH' => -400,
|
||||
);
|
||||
$ie_fix = '';
|
||||
if (html::$user_agent == 'msie') // add a transparent image to make the event "opaque" to mouse events
|
||||
{
|
||||
$ie_fix = $indent."\t".html::image('calendar','transparent.gif','',
|
||||
html::tooltip($tooltip,False,array('BorderWidth'=>0,'Padding'=>0)).
|
||||
html::tooltip($tooltip,False,$ttip_options).
|
||||
' style="top:0px; left:0px; position:absolute; height:100%; width:100%; z-index:1"') . "\n";
|
||||
}
|
||||
if ($this->use_time_grid)
|
||||
@ -1330,11 +1344,9 @@ class calendar_uiviews extends calendar_ui
|
||||
$style = 'position: relative; margin-top: 3px;';
|
||||
}
|
||||
|
||||
$draggableID = 'drag_'.$event['id'].'_O'.$event['owner'].'_C'.$owner;
|
||||
|
||||
$html = $indent.'<div id="'.$draggableID.'" class="calEvent'.($is_private ? 'Private' : '').' '.$status_class.
|
||||
'" style="'.$style.' border-color: '.$headerbgcolor.'; background: '.$background.'; z-index: 20;"'.
|
||||
$popup.' '.html::tooltip($tooltip,False,array('BorderWidth'=>0,'Padding'=>0)).
|
||||
$popup.' '.html::tooltip($tooltip,False,$ttip_options).
|
||||
'>'."\n".$ie_fix.$html."\n".
|
||||
$indent."</div>"."\n";
|
||||
|
||||
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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,35 @@ 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('','',"\\'",'"'),$text).'\'';
|
||||
|
||||
$sticky = false;
|
||||
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("\\'",'"'),$value)."'")).'; ';
|
||||
$option = strtoupper($option);
|
||||
if ($option == 'STICKY') $sticky = (bool)$value;
|
||||
|
||||
switch(gettype($value))
|
||||
{
|
||||
case 'boolean':
|
||||
$value = $value ? 'true' : 'false';
|
||||
break;
|
||||
case 'string':
|
||||
if (stripos($value,"'")===false) $value = "'$value'";
|
||||
break;
|
||||
}
|
||||
$ttip .= ','.$option.','.$value;
|
||||
}
|
||||
}
|
||||
if ($text === False) return ' onmouseover="'.$opt_out.'return escape(this.innerHTML);"';
|
||||
$ttip .= ')"';
|
||||
|
||||
return ' onmouseover="'.$opt_out.'return escape(\''.str_replace(array("\n","\r","'",'"'),array('','',"\\'",'"'),$text).'\')"';
|
||||
$ttip .= ' onmouseout="UnTip()"';
|
||||
|
||||
return $ttip;
|
||||
}
|
||||
|
||||
/**
|
||||
|
104
phpgwapi/js/wz_tooltip/tip_centerwindow.js
Normal file
104
phpgwapi/js/wz_tooltip/tip_centerwindow.js
Normal 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;
|
||||
}
|
88
phpgwapi/js/wz_tooltip/tip_followscroll.js
Normal file
88
phpgwapi/js/wz_tooltip/tip_followscroll.js
Normal 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
@ -8,7 +8,5 @@
|
||||
</div>
|
||||
{page_generation_time}
|
||||
<div id="divPoweredBy">{powered_by}</div>
|
||||
<!-- enable wz_tooltips -->
|
||||
{activate_tooltips}
|
||||
</body>
|
||||
</html>
|
||||
|
@ -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 -->
|
||||
|
@ -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
|
||||
@ -154,7 +142,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']='';
|
||||
}
|
||||
|
@ -24,7 +24,5 @@
|
||||
</div>
|
||||
{page_generation_time}
|
||||
<div id="divPoweredBy"><br/><span>{powered_by}</span></div>
|
||||
<!-- enable wz_tooltips -->
|
||||
{activate_tooltips}
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user