123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- /****************************************************************
- ** Licensed Materials - Property of IBM
- **
- ** BI and PM: qs
- **
- ** (C) Copyright IBM Corp. 2001, 2015
- **
- ** US Government Users Restricted Rights - Use, duplication or
- ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *****************************************************************/
- // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
- // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
- var DIALOG_FEATURE_IS_UNAVAILABLE = -1;
- var DIALOG_EMPTY_STRING = "";
- function CDialogManager(sFeatureName)
- {
- this.m_sFeatureName = sFeatureName;
- this.m_aSystemParams = new Array();
- this.m_aEnvParams = new Array();
- this.m_aSessionParams = new Array();
- this.m_aHttpParams = new Array();
- this.m_aUserParams = new Array();
- this.m_aCredentialParams = new Array();
- this.m_aCookies = new Array();
- this.m_oFormMgr = null;
- this.m_oWindowMgr = null;
- this.m_oApplicationMgr = null;
- this.m_oFeatureMgr = null;
- this.m_oFeatureRegistry = null;
- this.m_oMiniQueryMgr = null;
- this.m_oReportMgr = null;
- this.m_oThisFeatureObject = null;
- };
- CDialogManager.prototype.addHttpParam = function (sName, sVal)
- {
- this.m_aHttpParams[sName] = sVal;
- };
- CDialogManager.prototype.addEnvParam = function (sName, sVal)
- {
- this.m_aEnvParams[sName] = sVal;
- };
- CDialogManager.prototype.addSessionParam = function (sName, sVal)
- {
- this.m_aSessionParams[sName] = sVal;
- };
- CDialogManager.prototype.addSystemParam = function (sName, sVal)
- {
- this.m_aSystemParams[sName] = sVal;
- };
- CDialogManager.prototype.addUserParam = function (sName, sVal)
- {
- this.m_aUserParams[sName] = sVal;
- };
- CDialogManager.prototype.addCookie = function (sName, sVal)
- {
- this.m_aCookies[sName] = sVal;
- };
- CDialogManager.prototype.addCredentialParam = function (sName, sVal)
- {
- this.m_aCredentialParams[sName] = sVal;
- };
- CDialogManager.prototype.getHttpParam = function (sName)
- {
- return this.m_aHttpParams[sName];
- };
- CDialogManager.prototype.getEnvParam = function (sName)
- {
- return this.m_aEnvParams[sName];
- };
- CDialogManager.prototype.getSessionParam = function (sName)
- {
- return this.m_aSessionParams[sName];
- };
- CDialogManager.prototype.getSystemParam = function (sName)
- {
- return this.m_aSystemParams[sName];
- };
- CDialogManager.prototype.getUserParam = function (sName)
- {
- return this.m_aUserParams[sName];
- };
- CDialogManager.prototype.getCookie = function (sName)
- {
- return this.m_aCookies[sName];
- };
- CDialogManager.prototype.getCredentialParam = function (sName)
- {
- return this.m_aCredentialParams[sName];
- };
- CDialogManager.prototype.getFormManager = function ()
- {
- if (this.m_oFormMgr === null && typeof CFormManager == "function")
- {
- this.m_oFormMgr = new CFormManager();
- }
- return this.m_oFormMgr;
- };
- CDialogManager.prototype.getWindowManager = function ()
- {
- if (this.m_oWindowMgr === null && typeof CWindowManager == "function")
- {
- this.m_oWindowMgr = new CWindowManager();
- }
- return this.m_oWindowMgr;
- };
- CDialogManager.prototype.getApplicationManager = function ()
- {
- if (this.m_oApplicationMgr === null)
- {
- this.m_oApplicationMgr = this.getApplicationFrame().goApplicationManager;
- }
- return this.m_oApplicationMgr;
- };
- CDialogManager.prototype.getFeatureManager = function ()
- {
- if (this.m_oFeatureMgr === null)
- {
- this.m_oFeatureMgr = this.getApplicationManager().getFeatureManager();
- }
- return this.m_oFeatureMgr;
- };
- CDialogManager.prototype.getFeatureRegistry = function ()
- {
- if (this.m_oFeatureRegistry === null)
- {
- this.m_oFeatureRegistry = this.getFeatureManager().getFeatureRegistry();
- }
- return this.m_oFeatureRegistry;
- };
- CDialogManager.prototype.getMiniQueryManager = function ()
- {
- if (this.m_oMiniQueryMgr === null)
- {
- this.m_oMiniQueryMgr = this.getApplicationManager().getMiniQueryManager();
- }
- return this.m_oMiniQueryMgr;
- };
- CDialogManager.prototype.getReportManager = function ()
- {
- if (this.m_oReportMgr === null)
- {
- this.m_oReportMgr = this.getApplicationManager().getReportManager();
- }
- return this.m_oReportMgr;
- };
- CDialogManager.prototype.getSelectionController = function ()
- {
- return this.getWindowManager().getReportManager().getCVSelectionController();
- };
- CDialogManager.prototype.getApplicationFrame = function ()
- {
- return this.getWindowManager().getApplicationFrame();
- };
- CDialogManager.prototype.getDialogFrame = function ()
- {
- return this.getWindowManager().getDialogFrame();
- };
- CDialogManager.prototype.getReportFrame = function ()
- {
- return this.getWindowManager().getReportFrame();
- };
- CDialogManager.prototype.executeDialog = function (aParams)
- {
- if (typeof self.execute == 'function')
- {
- self.execute(aParams);
- }
- else
- {
-
- if ((aParams === null || typeof aParams === "undefined") && document.forms && document.forms.length)
- {
- aParams = new Array();
- var iFormIndex = 0;
-
- for (iFormIndex = 0; iFormIndex < document.forms.length; iFormIndex++)
- {
-
-
- aParams[document.forms[iFormIndex].name] = document.forms[iFormIndex];
- }
- }
- this.getFeatureManager().executeFeature(this.m_sFeatureName, aParams);
- }
- };
- CDialogManager.prototype.cancelDialog = function (aParams)
- {
- if (typeof self.cancelDialog == 'function')
- {
- self.cancelDialog(aParams);
- }
- else
- {
- this.getWindowManager().hideDialogFrame(aParams);
- }
- };
- CDialogManager.prototype.getThisFeatureObject = function ()
- {
- if (this.m_oThisFeatureObject === null)
- {
- var oFeatureObj = this.getFeatureRegistry().getRegisteredFeature(this.m_sFeatureName);
- if (oFeatureObj !== this.getApplicationFrame().FEATURE_NOT_REGISTERED && oFeatureObj !== this.getApplicationFrame().FEATURE_FAILED_REGISTRATION)
- {
- this.m_oThisFeatureObject = oFeatureObj;
- }
- else
- {
- return DIALOG_FEATURE_IS_UNAVAILABLE;
- }
- }
- return this.m_oThisFeatureObject;
- };
- CDialogManager.prototype.executeOk = function (evt)
- {
- if(this.isSpaceOrEnterKeyEvent(evt))
- {
- this.executeDialog();
- }
- };
- CDialogManager.prototype.executeCancel = function (evt)
- {
- if(this.isSpaceOrEnterKeyEvent(evt))
- {
- this.cancelDialog();
- }
- };
- CDialogManager.prototype.executeYes = function (evt)
- {
- if(this.isSpaceOrEnterKeyEvent(evt))
- {
- this.executeDialog(new Array(true));
- }
- };
- CDialogManager.prototype.executeNo = function (evt)
- {
- if(this.isSpaceOrEnterKeyEvent(evt))
- {
- this.executeDialog(new Array(false));
- }
- };
- CDialogManager.prototype.isSpaceOrEnterKeyEvent = function (evt)
- {
- if(evt != null)
- {
- var evtObj = window.event ? event : evt;
- var iKeyCode = evtObj.charCode ? evtObj.charCode : evtObj.keyCode;
-
- if(iKeyCode == 13 || iKeyCode == 32)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- };
|