From e5b1c6504539eb5b64ee4136d1764993b4a26a1d Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 3 Mar 2014 17:45:18 +0000 Subject: [PATCH] Fix broken onmouseover|click prefs for extraApp and sidebox menus --- .../idots/class.idots_framework.inc.php | 9 ++++++++ phpgwapi/templates/idots/js/idots.js | 21 ++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/phpgwapi/templates/idots/class.idots_framework.inc.php b/phpgwapi/templates/idots/class.idots_framework.inc.php index 640155ec49..a64d7f21d4 100644 --- a/phpgwapi/templates/idots/class.idots_framework.inc.php +++ b/phpgwapi/templates/idots/class.idots_framework.inc.php @@ -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)); diff --git a/phpgwapi/templates/idots/js/idots.js b/phpgwapi/templates/idots/js/idots.js index 03051b4e6a..1535fe8334 100644 --- a/phpgwapi/templates/idots/js/idots.js +++ b/phpgwapi/templates/idots/js/idots.js @@ -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