Fix broken onmouseover|click prefs for extraApp and sidebox menus

This commit is contained in:
Hadi Nategh 2014-03-03 17:45:18 +00:00
parent 11d77f3dab
commit e5b1c65045
2 changed files with 22 additions and 8 deletions

View File

@ -123,6 +123,15 @@ class idots_framework extends egw_framework
}
self::validate_file('/phpgwapi/templates/idots/js/idots.js');
}
if ($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover'] == 'onmouseover' && !html::$ua_mobile)
{
$show_menu_event = 'mouseover';
}
else
{
$show_menu_event = 'click';
}
$extra['slide-out'] = $show_menu_event;
$this->tpl->set_var($this->_get_header($extra));

View File

@ -18,7 +18,14 @@ egw_LAB.wait(function() {
var quick_add = document.getElementById('quick_add');
if (quick_add) egw.link_quick_add(quick_add);
// instanciate slideout menus via "data-slide-out" of egw.js script tag
// Handle sliding menues of extra apps and sidebox
var egw_script = document.getElementById('egw_script_id');
var mouseHandler = 'click';
if (egw_script)
{
var data_slide_out = egw_script.getAttribute('data-slide-out');
mouseHandler = data_slide_out == 'mouseover'?'mouseover':'click';
}
var extra_icons_show = jQuery('#extra_icons_show');
var menu1Container = jQuery('#menu1Container')
.width(180)
@ -26,10 +33,9 @@ egw_LAB.wait(function() {
var menu2show = jQuery('#menu2show');
var menu2Container = jQuery('#menu2Container');
//Click handler for extra apps menu
extra_icons_show.on({
click:function (event){
extra_icons_show.on(mouseHandler,function (event){
var extraIcon = event;
$j('html').on('click',function(event) {
$j('html').on(mouseHandler,function(event) {
if ($j(event.target).parents('#menu1Container').length==0 && event.target !== extraIcon.target)
{
menu1Container.slideUp();
@ -38,10 +44,9 @@ egw_LAB.wait(function() {
});
menu1Container.slideToggle();
}
});
);
// Click handler for sidebox menu
menu2show.on({
click:function (event){
menu2show.on(mouseHandler,function (event){
var m2showIcon = event;
var options = {
direction: "left"
@ -55,7 +60,7 @@ egw_LAB.wait(function() {
});
menu2Container.toggle("slide",options);
}
});
);
/**
* Initialisation, when DOM is ready