// Licensed Materials - Property of IBM // // IBM Cognos Products: pps // // (C) Copyright IBM Corp. 2009, 2017 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. /*****************************************************/ /************* Dashboard (BUX) Support *************/ /*****************************************************/ // Determines if we are running inside a Dashboard "iWidget". function isDashboard() { var isdsh = getGlobal("is_dashboard"); if ( isdsh != null && typeof isdsh != "undefined") { return isdsh; } else { if (window.frameElement != null && window.frameElement.id != null && window.frameElement.id.indexOf("_pps_iframe") != -1) { setGlobal("is_dashboard", true); return true; } else { setGlobal("is_dashboard", false); return false; } } } function getIContext() { if(typeof window.name != "undefined" && /^[a-zA-Z][a-zA-Z0-9]*$/.test(window.name) ) { var str = "window.parent." + window.name + "iContext"; var icontext = eval(str); if (icontext != null && typeof icontext != "undefined" && icontext.iEvents != null && icontext.iEvents.fireEvent != null) { return icontext; } } return null; } function updateToolbar() { var icontext = getIContext(); if (icontext != null && icontext.scope && icontext.scope.initOnDemandToolbar) { icontext.scope.initOnDemandToolbar(); } } function enableDrill() { var icontext = getIContext(); if (icontext != null && icontext.scope && icontext.scope.enableDrill) { icontext.scope.enableDrill(); } } function disableDrill() { var icontext = getIContext(); if (icontext != null && icontext.scope && icontext.scope.disableDrill) { icontext.scope.disableDrill(); } } function fireEvent(evt, params, payload) { var icontext = getIContext(); if (icontext != null) { icontext.iEvents.fireEvent(evt, params, payload); } } function handleSaveDone() { setGlobal('is_save', false); getIContext().getiWidgetAttributes().setItemValue('savedReport', getGlobal('bux_report')); setGlobal("treeVisible", false); // in BUX, tree is not visible by default. getMainFrameset().cols = '0,*'; // make sure the dimtree is closed... fireEvent('com.ibm.bux.widget.save.done', null, {'status':true}); fireEvent('com.ibm.bux.widget.modified', null, { 'modified': false }); } function handleInitialOpen() { setGlobal("initial_open", false); setGlobal("is_save", false); setGlobal("treeVisible", false); // in BUX, tree is not visible by default. getMainFrameset().cols = '0,*'; // make sure the dimtree is closed... fireEvent('com.ibm.bux.widget.render.done', { noAutoResize: getGlobal('no_auto_resize') }); } // On an initial open of a report in BUX, we want to fire // an autoResize event when all content has been loaded. function doneLoadingFrameset( framesetName ) { if (isDashboard()) { // If this is a split-view report, we want to perform the action when the inner frameset loads. if ( getGlobal("isSplitView") && framesetName == 'Data' ) { return; } if (getGlobal("initial_open")) { if (getGlobal('is_save')) { handleSaveDone(); } else { handleInitialOpen(); // only do AutoResize on the initial open. } } else { fireEvent('com.ibm.bux.widget.modified', null, { 'modified': true }); } updateToolbar(); } }