diff --git a/www/include/monitoring/status/Common/commonJS.php b/www/include/monitoring/status/Common/commonJS.php index d61dfca9156..bf1afec29f1 100644 --- a/www/include/monitoring/status/Common/commonJS.php +++ b/www/include/monitoring/status/Common/commonJS.php @@ -1,7 +1,7 @@ &limit="+limit+"&url="; xhrM.send(_var); - jQuery('input[name=limit]').val(limit); + jQuery('input[name=limit]').val(limit); } function set_search(search) { @@ -886,11 +887,21 @@ function set_page(page) { var func_displayIMG = function(event) { var self = event.currentTarget; + var windowHeight = jQuery(window).height(); - jQuery('.img_volante').css('left', event.pageX + 20); - jQuery('.img_volante').css('top', (jQuery(window).height() / 2) - (jQuery('.img_volante').height() / 2)); + //getting the absolute cursor position, when scrolling in the iFrame + var positionY = self + .getBoundingClientRect() + .top; + + //is the popup out the displayed screen ? Graphs are 224 pixels height + if ((positionY + 224) >= windowHeight) { + positionY = windowHeight - 224; + } + jQuery('.img_volante').css('top', positionY); + jQuery('.img_volante').css('left', event.pageX + 15); jQuery('.img_volante').show(); - + var chartElem = jQuery('
') .addClass('chart') .data('graphType', 'service') @@ -910,20 +921,41 @@ function set_page(page) { var func_popupXsltCallback = function(trans_obj) { var target_element = trans_obj.getTargetElement(); if (popup_counter[target_element] == 0) { - return ; + return ; } jQuery('.popup_volante .container-load').empty(); user->get_js_effects() > 0) { ?> - jQuery('.popup_volante').stop(true, true).animate({width: jQuery('#' + target_element).width(), height: jQuery('#' + target_element).height(), - top: (jQuery(window).height() / 2) - (jQuery('#' + target_element).height() / 2)}, 25); + jQuery('.popup_volante').stop(true, true).animate( + { + width: jQuery('#' + target_element).width(), + height: jQuery('#' + target_element).height(), + top: (jQuery(window).height() / 2) - (jQuery('#' + target_element).height() / 2) + }, 25); jQuery('#' + target_element).stop(true, true).fadeIn(1000); + jQuery('.popup_volante').css('left', jQuery('#' + target_element).attr('left')); - jQuery('.popup_volante').css('top', (jQuery(window).height() / 2) - (jQuery('#' + target_element).height() / 2)); + + //item's Id from where the popin was called + var eventCalledFrom = target_element.substr(24); //removing "popup-container-display-" + + var windowHeight = jQuery(window).height(); + var popupHeight = jQuery('#' + target_element).height(); + + //getting the absolute cursor position, when scrolling in the iFrame + var positionY = document + .querySelector('#' + eventCalledFrom) + .getBoundingClientRect() + .top; + + //is the popup out the displayed screen ? + if ((positionY + popupHeight) >= windowHeight) { + positionY = windowHeight - popupHeight; + } + jQuery('.popup_volante').css('top', positionY); jQuery('#' + target_element).show(); - formatDateMoment(); }; @@ -933,25 +965,25 @@ function set_page(page) { elementId = $(self).attr('id'); if ($('#popup-container-display-' + elementId).length == 0) { - popup_counter['popup-container-display-' + elementId] = 1; - jQuery('.popup_volante').append(''); + popup_counter['popup-container-display-' + elementId] = 1; + jQuery('.popup_volante'). + append(''); } else { - popup_counter['popup-container-display-' + elementId] += 1; + popup_counter['popup-container-display-' + elementId] += 1; } jQuery('.popup_volante .container-load').html(''); jQuery('.popup_volante').css('left', position.left + $('#' + elementId).width() + 10); - jQuery('.popup_volante').css('top', ($(window).height() / 2) - ($('.img_volante').height() / 2)); jQuery('.popup_volante').show(); var elements = elementId.split('-'); var proc_popup = new Transformation(); proc_popup.setCallback(func_popupXsltCallback); if (elements[0] == "host") { - proc_popup.setXml(_addrXMLSpanHost+"?"+'&host_id=' + elements[1]); - proc_popup.setXslt(_addrXSLSpanhost); + proc_popup.setXml(_addrXMLSpanHost+"?"+'&host_id=' + elements[1]); + proc_popup.setXslt(_addrXSLSpanhost); } else { - proc_popup.setXml(_addrXMLSpanSvc+"?"+'&svc_id=' + elements[1] + '_' + elements[2]); - proc_popup.setXslt(_addrXSLSpanSvc); + proc_popup.setXml(_addrXMLSpanSvc+"?"+'&svc_id=' + elements[1] + '_' + elements[2]); + proc_popup.setXslt(_addrXSLSpanSvc); } proc_popup.transform('popup-container-display-' + elementId); }; @@ -967,21 +999,22 @@ function set_page(page) { jQuery('.popup_volante').css('height', 'auto'); }; -/* Use 'id' attribute to get element */ -/* Use 'name' attribute to get xml/xsl infos */ +// Use 'id' attribute to get element +// Use 'name' attribute to get xml/xsl infos var func_displayGenericInfo = function(event) { var self = event.currentTarget, position = jQuery('#' + $(self).attr('id')).offset(), $self = $(self); if (jQuery('#popup-container-display-' + $self.attr('id')).length == 0) { - popup_counter['popup-container-display-' + $self.attr('id')] = 1; - jQuery('.popup_volante').append(''); + popup_counter['popup-container-display-' + $self.attr('id')] = 1; + jQuery('.popup_volante'). + append(''); } else { - popup_counter['popup-container-display-' + $self.attr('id')] += 1; + popup_counter['popup-container-display-' + $self.attr('id')] += 1; } jQuery('.popup_volante .container-load').html(''); - jQuery('.popup_volante').css('left', position.left + jQuery('#' + $self.attr('id')).width() + 10); + jQuery('.popup_volante').css('left', position.left + jQuery('#' + $self.attr('id')).width() + 3); jQuery('.popup_volante').css('top', (jQuery(window).height() / 2) - (jQuery('.img_volante').height() / 2)); jQuery('.popup_volante').show(); @@ -994,7 +1027,6 @@ function set_page(page) { }; // Monitoring Refresh management Options - function monitoring_play() { document.getElementById('JS_monitoring_play').style.display = 'none'; document.getElementById('JS_monitoring_pause').style.display = 'block'; @@ -1018,7 +1050,7 @@ function monitoring_pause() { } function monitoring_refresh() { - _tmp_on = _on; + _tmp_on = _on; _time_live = _time_reload; _on = 1;