/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| BI and PM: prmt *| (C) Copyright IBM Corp. 2002, 2014 *| *| US Government Users Restricted Rights - Use, duplication or *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *| *+------------------------------------------------------------------------+ */ /** @fileOverview Managing Reports. @constructor */ cognos.Report = new Class({}); /** @private @param {String} v_sNamespace? Current namespace @return {void} */ cognos.Report.prototype.f_initialize = function( v_sNamespace ) { var v_oPrompt = this.f_checkForGlobalObject( "G_PM", v_sNamespace ); /** Reference to cognos.Prompt for this instance. @member */ this.prompt = (v_oPrompt ? v_oPrompt : new cognos.Prompt()); // use a new cognos.Prompt as default var v_oCV = this.f_checkForGlobalObject( "oCV", v_sNamespace ); /** Reference to global CognosViewer @member @private */ this.m_oCV = ( v_oCV ? v_oCV : window.gCognosViewer ); // use window.gCognosViewer as default if (this.m_oCV) { this.m_oCV['CognosReport'] = this; } }; /** @private @param {String} v_sPrefix Prefix for the object we are looking for in the 'window' scope. @param {String} v_sNamespace current namespace. @return {Object} Null if not found. */ cognos.Report.prototype.f_checkForGlobalObject = function( v_sPrefix, v_sNamespace ) { var v_oRef = null; // v_sNamespace is the fragment ID passed in. if ( window[v_sPrefix + v_sNamespace] ) { v_oRef = window[v_sPrefix + v_sNamespace]; } // Default Namespace is _NS_ else if ( window[v_sPrefix + "_NS_"] ) { v_oRef = window[v_sPrefix + "_NS_"]; } // RS is the default namespace from ReportStudio else if ( window[v_sPrefix + "RS"] ) { v_oRef = window[v_sPrefix + "RS"]; } // _THIS_ is the namespace holder else if ( window[v_sPrefix + "_THIS_"] ) { v_oRef = window[v_sPrefix + "_THIS_"]; } // Maybe we don't have a namespace at all, use the global Viewer object else if ( window[v_sPrefix] ) { v_oRef = window[v_sPrefix]; } return v_oRef; } /** Set up event callbacks for this report. Supported events: onBeforeSubmit @param {String} evt Can be @param {function} fct The Javascript function used as callback. @return {void} @example Shows a message when the page is submittted:
rprt.addEvent( "onBeforeSubmit", function() { alert("Sending your request. Please wait..."); return true; } ); */ cognos.Report.prototype.addEvent = function(eAction) {}; /** Getter for a cognos.Report object. Namespaces are used to support fragments. You should always use this call to get a cognos.Report object with a proper namespace. @static @return {cognos.Report} The instance of cognos.Report for this namespace. @type cognos.Report @param {String} [sNamespace] @example */ cognos.Report.getReport = function(sNamespace) { return (new cognos.Report(sNamespace)); }; /** Sends a requests with the current parameters and values. @param {cognos.Report.Action} eAction One of the cognos.Report.Action enumeration values only. @return {void} */ cognos.Report.prototype.sendRequest = function(eAction) { this.m_oCV.promptAction( eAction ); };