// 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. dojo.provide("bux.powerplay_report"); dojo.declare("bux.powerplay_report", null, { getDisplayName: function() { return this.getAttributeValue("widgetTitle"); }, getSavedOutput: function() { return this.savedOutput; }, getAttributeValue: function(name) { return this.iContext.getiWidgetAttributes().getItemValue(name); }, setAttributeValue: function(name, value) { this.iContext.getiWidgetAttributes().setItemValue(name, value); }, getPowerPlayDiv: function() { return dojo.byId("_" + this.iContext.widgetId + "_pps_report"); }, getPowerPlayIFrame: function() { return dojo.byId("_" + this.iContext.widgetId + "_pps_report_iframe"); }, onLoad: function() { var iframe = this.getPowerPlayIFrame(); var doc = iframe.contentWindow.document; var form = doc.createElement("FORM"); form.method = "POST"; form.target = iframe.name; form.action = this.getAttributeValue("gateway"); this.appendToForm( doc, form, "b_action", "xts.run"); this.appendToForm( doc, form, "m", "portal/launch.xts"); this.appendToForm( doc, form, "ui.action", "run"); this.appendToForm( doc, form, "ui.crnfrm", "PDF"); this.appendToForm( doc, form, "ui.crnp", "true"); this.appendToForm( doc, form, "ui.tool", "PowerplayStudio"); this.appendToForm( doc, form, "ddo", "true"); this.appendToForm( doc, form, "ui.gateway", this.getAttributeValue("gateway")); this.appendToForm( doc, form, "ui.object", this.getAttributeValue("originalReport")); this.appendToForm( doc, form, "launch.openJSStudioInFrame", "true"); if (!doc.body) // IE6 - is null by default. doc.appendChild(doc.createElement("body")); //Submit the form doc.body.appendChild(form); form.submit(); }, appendToForm: function( doc, form, fname, fvalue ) { var input = doc.createElement("INPUT"); input.setAttribute("type", "hidden"); input.setAttribute("name", fname); input.setAttribute("value", fvalue); form.appendChild(input); }, onWidgetSave: function(evt) { this.fireEvent( "com.ibm.bux.widget.save.done", null, {'status':true}); }, onWidgetRefresh: function ( evt ){ this.onLoad(); this.fireEvent('com.ibm.bux.widget.refresh.done'); }, onWidgetResize: function(evt) { var iframe = this.getPowerPlayIFrame(); var width = evt.payload.resize.w; var height = evt.payload.resize.h; iframe.style.width = eval(width - 5) + "px"; iframe.style.height = eval(height - 5) + "px"; }, isSaveNecessary: function (prompt) { return false; }, fireEvent: function( eventName, arg, payload) { this.iContext.iEvents.fireEvent( eventName, arg, payload ); } });