Index: lams_central/web/includes/javascript/common.js =================================================================== diff -u -rf04cfe28c0e223b4feca038d911fcb6ce2f40032 -rbad4616b65a3efb06c6626a79772d4a6d7705daa --- lams_central/web/includes/javascript/common.js (.../common.js) (revision f04cfe28c0e223b4feca038d911fcb6ce2f40032) +++ lams_central/web/includes/javascript/common.js (.../common.js) (revision bad4616b65a3efb06c6626a79772d4a6d7705daa) @@ -74,7 +74,6 @@ } function isEmpty( strValue ) { - var strTemp = strValue; strTemp = trimAll(strTemp); if (strTemp.length > 0) { @@ -85,22 +84,25 @@ // refresh the parent window if the parent window is a tool monitoring window function refreshParentMonitoringWindow() { - if ( window.opener && ! window.opener.closed && window.opener.name.indexOf("MonitorActivity") >= 0 ) { - var monitoringURL = String(window.opener.location); - var currentTab = window.opener.selectedTabID; + let opener = window.opener; + if ( opener && ! opener.closed && String(opener.location).indexOf("tool") >= 0 && String(opener.location).indexOf("monitoring") >= 0 ) { + let monitoringURL = String(opener.location), + currentTab = opener.$("#tabs button.nav-link.active"); + if ( currentTab ) { - var indexStart = monitoringURL.indexOf("¤tTab="); + let indexStart = monitoringURL.indexOf("¤tTab="), + currentTabId = currentTab.attr("id").substring(4); if ( indexStart != -1 ) { - var indexEnd = monitoringURL.indexOf("&",indexStart+1); + let indexEnd = monitoringURL.indexOf("&",indexStart+1); if ( indexEnd == -1 ) { monitoringURL = monitoringURL.substring(0,indexStart); } else { monitoringURL = monitoringURL.substring(0,indexStart)+monitoringURL.substring(indexEnd); } } - monitoringURL = monitoringURL+"¤tTab="+currentTab; + monitoringURL = monitoringURL+"¤tTab="+currentTabId; } - window.opener.location.href = monitoringURL; + opener.location.href = monitoringURL; } } Index: lams_monitoring/web/includes/javascript/monitor-activity.js =================================================================== diff -u --- lams_monitoring/web/includes/javascript/monitor-activity.js (revision 0) +++ lams_monitoring/web/includes/javascript/monitor-activity.js (revision bad4616b65a3efb06c6626a79772d4a6d7705daa) @@ -0,0 +1,37 @@ +function init() { + if (INITIAL_TAB_ID) { + selectTab(INITIAL_TAB_ID); + } else { + //selectTab(1); //select the default tab; + } +} + +function onSelectTab(tabId) { + var tag = document.getElementById("currentTab"); + tag.value = tabId; + + //for statistic page change: + if (tabId == 3) { + doStatistic(); + } +} + +function doStatistic() { + $("#statisticArea_Busy").show(); + $.ajaxSetup({ cache: true }); + $("#statisticArea").load( + MONITORING_STATISTIC_URL, + { + toolContentID: TOOL_CONTENT_ID, + reqID: (new Date()).getTime() + }, + function() { + $("#statisticArea_Busy").hide(); + } + ); +} + +function selectTab(tabID) { + const triggerEl = document.querySelector('#tabs button#tab-' + tabID) + bootstrap.Tab.getOrCreateInstance(triggerEl).show() +}