123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /*
- *+------------------------------------------------------------------------+
- *| 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: <tt>onBeforeSubmit</tt>
- @param {String} evt Can be <ul>
- <li><tt>onBeforeSubmit</tt>, before the request is set. Returning <tt>false</tt> will prevent the request to be sent.</li>
- <li><tt>onUpdate</tt>, triggered after a page is refreshed by the viewer.</li></ul>
- @param {function} fct The Javascript function used as callback.
- @return {void}
- @example Shows a message when the page is submittted: <br/>
- rprt.addEvent( "<tt>onBeforeSubmit</tt>", <tt>function() { alert("Sending your request. Please wait..."); return true; }</tt> );
- */
- 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 <ul>
- <li>var oCR = cognos.Report.getReport( );</li>
- <li>var oCR = cognos.Report.getReport( "_THIS_" );</li>
- </ul>
- */
- 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 <code>cognos.Report.Action</code> enumeration values only.
- @return {void}
- */
- cognos.Report.prototype.sendRequest = function(eAction)
- {
- this.m_oCV.promptAction( eAction );
- };
|