123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- /****************************************************************
- ** 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.
- function CUserPreferenceDialog()
- {
- this.m_aParams = new Array();
- this.m_aParams["m"] = "/" + qs_dir + "/userPreferences.xts";
- this.m_bRequiresDialog = true;
- this.m_iErrorState = FEATURE_OBJECT_NO_ERROR;
- this.m_bFeatureRequiresQualityOfService = true;
- this.m_oCF = getConfigFrame();
-
-
-
- if (typeof goApplicationManager === "object" && goApplicationManager !== null)
- {
- this.m_oUserPreferenceManager = goApplicationManager.getUserPreferenceManager();
- }
- else
- {
- this.m_oUserPreferenceManager = new CUserPreferenceManager();
- }
- };
- CUserPreferenceDialog.prototype = new AFeatureObject();
- CUserPreferenceDialog.prototype.setup = function (aFeatureParams)
- {
- this.showDialog();
- };
- CUserPreferenceDialog.prototype.showDialog = function ()
- {
- cfgSet("LAST_DIALOG", "userPreferenceDialog");
-
-
-
-
-
- this.m_oUserPreferenceManager.clearAllDialogValues();
-
-
- var aPreferences = this.m_oUserPreferenceManager.getPreferences();
- for (var sPreferenceName in aPreferences)
- {
- var oUserPreference = aPreferences[sPreferenceName];
-
- var sValue = oUserPreference.getValue();
- this.m_aParams[sPreferenceName] = sValue;
- }
-
-
-
- if (cf.checkCalcFunctionAgainstDB("FLEXIBLE_FILTERS"))
- {
- this.m_aParams["flexibleFiltersAllowed"] = "true";
- }
- else
- {
- if (this.m_aParams["defaultFilterDialogType"] === "typein")
- {
-
- this.m_aParams["defaultFilterDialogType"] = "default";
-
-
- var oUserPreference = this.m_oUserPreferenceManager.getPreference("defaultFilterDialogType");
- oUserPreference.setDialogValue("default");
- }
- }
- };
- CUserPreferenceDialog.prototype.execute = function (aParams)
- {
-
- if (aParams && typeof aParams['f'] === "object" && aParams['f'] !== null)
- {
- var oForm = aParams['f'];
-
-
- var aPreferences = this.m_oUserPreferenceManager.getPreferences();
- for (var sPreferenceName in aPreferences)
- {
- var oUserPreference = aPreferences[sPreferenceName];
- var sFormInputName = oUserPreference.getFormInputName();
-
-
- if (typeof oForm[sFormInputName] !== "undefined")
- {
- var sValue = this.getInputValue(oForm[sFormInputName]);
- oUserPreference.setCookie(sValue);
- }
- }
- }
-
- goApplicationManager.getWindowManager().hideDialogFrame();
- };
- CUserPreferenceDialog.prototype.setFormFieldValues = function (oForm)
- {
- if (typeof oForm === "object" && oForm !== null)
- {
-
-
- var aPreferences = this.m_oUserPreferenceManager.getPreferences();
- for (var sPreferenceName in aPreferences)
- {
- var oUserPreference = aPreferences[sPreferenceName];
- var sValue = oUserPreference.getValue();
-
- var sFormInputName = oUserPreference.getFormInputName();
-
-
- if (typeof oForm[sFormInputName] !== "undefined")
- {
- this.setInputValue(oForm[sFormInputName], sValue);
- }
- }
- }
- };
- CUserPreferenceDialog.prototype.getInputValue = function (oFormElement)
- {
- if (typeof oFormElement === "undefined")
- {
- return null;
- }
-
- var sElementValue = "";
- if (oFormElement.length > 0)
- {
- for (var iIndex = 0; iIndex < oFormElement.length; iIndex++)
- {
- if (oFormElement[iIndex].checked)
- {
- sElementValue = oFormElement[iIndex].value;
- break;
- }
- }
- }
- else
- {
-
- switch (oFormElement.type)
- {
- case "checkbox":
- sElementValue = oFormElement.checked;
- break;
- default:
- sElementValue = oFormElement.value;
- break;
- }
- }
- return sElementValue;
- };
- CUserPreferenceDialog.prototype.setInputValue = function(oFormElement, sValue)
- {
- var sElementValue = "";
- if (oFormElement.length > 0)
- {
-
- for (var iIndex = 0; iIndex < oFormElement.length; iIndex++)
- {
- if (oFormElement[iIndex].value === sValue)
- {
- oFormElement[iIndex].checked = true;
- }
- else
- {
- oFormElement[iIndex].checked = false;
- }
- }
- }
- else
- {
-
- switch (oFormElement.type)
- {
- case "checkbox":
-
- var bSetValue = false;
- if (sValue === true || sValue === "true")
- {
- sValue = "true";
- bSetValue = true;
- } else sValue = "false";
-
- oFormElement.checked = bSetValue;
- break;
- default:
- oFormElement.value = sValue;
- break;
- }
- }
- return sElementValue;
- };
|