CAdvancedRunTimeOptions.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // 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.
  13. function CAdvancedRunTimeOptions()
  14. {
  15. this.m_bRequiresDialog = true;
  16. this.m_bFeatureRequiresQualityOfService = true;
  17. };
  18. CAdvancedRunTimeOptions.prototype = new AFeatureObject();
  19. CAdvancedRunTimeOptions.prototype.setup = function (aFeatureParams)
  20. {
  21. this.m_iErrorState = FEATURE_OBJECT_NO_ERROR;
  22. this.m_aParams = new Array();
  23. this.m_aParams["m"] = "/" + qs_dir + "/advancedRunTimeOptions.xts";
  24. if (typeof goApplicationManager === "object" && goApplicationManager !== null)
  25. {
  26. this.m_oUserPreferenceManager = goApplicationManager.getUserPreferenceManager();
  27. }
  28. else
  29. {
  30. this.m_oUserPreferenceManager = new CUserPreferenceManager();
  31. }
  32. var oAutoFooterSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoFooterSummary");
  33. var oAutoSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoSummary");
  34. var oEnableDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableDrill");
  35. var oEnableModelDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableModelDrill");
  36. if (typeof oAutoFooterSummaryUserPreference === "object" && oAutoFooterSummaryUserPreference.getValue() === "false")
  37. {
  38. this.m_aParams["autoFooterSummary"] = false;
  39. }
  40. if (typeof oAutoSummaryUserPreference === "object" && oAutoSummaryUserPreference.getValue() === "false")
  41. {
  42. this.m_aParams["autoSummary"] = false;
  43. }
  44. if (typeof oEnableDrillUserPreference === "object" && oEnableDrillUserPreference.getValue() === "true")
  45. {
  46. this.m_aParams["enableDrill"] = true;
  47. }
  48. if (typeof oEnableModelDrillUserPreference === "object" && oEnableModelDrillUserPreference.getValue() === "true")
  49. {
  50. this.m_aParams["enableModelDrill"] = true;
  51. }
  52. };
  53. CAdvancedRunTimeOptions.prototype.execute = function (aParameters)
  54. {
  55. if (aParameters && typeof aParameters['f'] === "object" && aParameters['f'] !== null)
  56. {
  57. var oDlgFrameDocForm = aParameters['f'];
  58. var oAutoFooterSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoFooterSummary");
  59. var oAutoSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoSummary");
  60. var oEnableDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableDrill");
  61. var oEnableModelDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableModelDrill");
  62. var sFormInputName;
  63. var sValue;
  64. cfgSet("updateMiniQueryWithUserPreference", "true");
  65. cfgSet("overwriteSetting", "false");
  66. sFormInputName = oAutoFooterSummaryUserPreference.getFormInputName();
  67. if (typeof oDlgFrameDocForm[sFormInputName] !== "undefined")
  68. {
  69. sValue = this.getInputValue(oDlgFrameDocForm[sFormInputName]);
  70. oAutoFooterSummaryUserPreference.setCookie(sValue);
  71. }
  72. sFormInputName = oAutoSummaryUserPreference.getFormInputName();
  73. if (typeof oDlgFrameDocForm[sFormInputName] !== "undefined")
  74. {
  75. sValue = this.getInputValue(oDlgFrameDocForm[sFormInputName]);
  76. oAutoSummaryUserPreference.setCookie(sValue);
  77. }
  78. sFormInputName = oEnableDrillUserPreference.getFormInputName();
  79. if (typeof oDlgFrameDocForm[sFormInputName] !== "undefined")
  80. {
  81. sValue = this.getInputValue(oDlgFrameDocForm[sFormInputName]);
  82. oEnableDrillUserPreference.setCookie(sValue);
  83. }
  84. sFormInputName = oEnableModelDrillUserPreference.getFormInputName();
  85. if (typeof oDlgFrameDocForm[sFormInputName] !== "undefined")
  86. {
  87. sValue = this.getInputValue(oDlgFrameDocForm[sFormInputName]);
  88. oEnableModelDrillUserPreference.setCookie(sValue);
  89. }
  90. }
  91. var oAutoSummDetailVal = null;
  92. if (! isDetailFilterEnabled())
  93. {
  94. oAutoSummDetailVal = true;
  95. }
  96. else
  97. {
  98. oAutoSummDetailVal = oDlgFrameDocForm.autoSummary.checked;
  99. }
  100. var sCommand = createCommand("P", "A", new Array(oAutoSummDetailVal, oDlgFrameDocForm.autoFooterSummary.checked, oDlgFrameDocForm.enableDrill.checked, oDlgFrameDocForm.enableModelDrill.checked));
  101. addColumnsForReselection();
  102. sendCmd(sCommand, "", true);
  103. };
  104. CAdvancedRunTimeOptions.prototype.setFormFieldValues = function (oForm)
  105. {
  106. if (typeof oForm === "object" && oForm !== null)
  107. {
  108. var sFormInputName;
  109. var sValue;
  110. var oAutoFooterSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoFooterSummary");
  111. sValue = oAutoFooterSummaryUserPreference.getValue();
  112. sFormInputName = oAutoFooterSummaryUserPreference.getFormInputName();
  113. if (typeof oForm[sFormInputName] !== "undefined")
  114. {
  115. this.setInputValue(oForm[sFormInputName], sValue);
  116. }
  117. var oAutoSummaryUserPreference = this.m_oUserPreferenceManager.getPreference("autoSummary");
  118. sValue = oAutoSummaryUserPreference.getValue();
  119. sFormInputName = oAutoSummaryUserPreference.getFormInputName();
  120. if (typeof oForm[sFormInputName] !== "undefined")
  121. {
  122. this.setInputValue(oForm[sFormInputName], sValue);
  123. }
  124. var oEnableDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableDrill");
  125. sValue = oEnableDrillUserPreference.getValue();
  126. sFormInputName = oEnableDrillUserPreference.getFormInputName();
  127. if (typeof oForm[sFormInputName] !== "undefined")
  128. {
  129. this.setInputValue(oForm[sFormInputName], sValue);
  130. }
  131. var oEnableModelDrillUserPreference = this.m_oUserPreferenceManager.getPreference("enableModelDrill");
  132. sValue = oEnableModelDrillUserPreference.getValue();
  133. sFormInputName = oEnableModelDrillUserPreference.getFormInputName();
  134. if (typeof oForm[sFormInputName] !== "undefined")
  135. {
  136. this.setInputValue(oForm[sFormInputName], sValue);
  137. }
  138. }
  139. };
  140. CAdvancedRunTimeOptions.prototype.getInputValue = function (oFormElement)
  141. {
  142. if (typeof oFormElement === "undefined")
  143. {
  144. return null;
  145. }
  146. var sElementValue = "";
  147. if (oFormElement.length > 0)
  148. {
  149. for (var iIndex = 0; iIndex < oFormElement.length; iIndex++)
  150. {
  151. if (oFormElement[iIndex].checked)
  152. {
  153. sElementValue = oFormElement[iIndex].value;
  154. break;
  155. }
  156. }
  157. }
  158. else
  159. {
  160. switch (oFormElement.type)
  161. {
  162. case "checkbox":
  163. sElementValue = oFormElement.checked;
  164. break;
  165. default:
  166. sElementValue = oFormElement.value;
  167. break;
  168. }
  169. }
  170. return sElementValue;
  171. };
  172. CAdvancedRunTimeOptions.prototype.setInputValue = function(oFormElement, sValue)
  173. {
  174. var sElementValue = "";
  175. if (oFormElement.length > 0)
  176. {
  177. for (var iIndex = 0; iIndex < oFormElement.length; iIndex++)
  178. {
  179. if (oFormElement[iIndex].value === sValue)
  180. {
  181. oFormElement[iIndex].checked = true;
  182. }
  183. else
  184. {
  185. oFormElement[iIndex].checked = false;
  186. }
  187. }
  188. }
  189. else
  190. {
  191. switch (oFormElement.type)
  192. {
  193. case "checkbox":
  194. var bSetValue = false;
  195. if (sValue === true || sValue === "true")
  196. {
  197. sValue = "true";
  198. bSetValue = true;
  199. } else sValue = "false";
  200. oFormElement.checked = bSetValue;
  201. break;
  202. default:
  203. oFormElement.value = sValue;
  204. break;
  205. }
  206. }
  207. return sElementValue;
  208. };