CWindowManager.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. var CR1_TOP_FRAME = "CR1_TopFrame";
  14. var REPORT_IFRAME = "reportIFrame";
  15. function CWindowManager()
  16. {
  17. this.DIALOG_IFRAME = "dialogIFrame";
  18. this.m_oApplicationFrame = this.setupApplicationFrame();
  19. this.m_oDialogFrame = this.setupDialogFrame();
  20. this.m_oReportFrame = this.setupReportFrame();
  21. this.m_oApplicationMgr = null;
  22. this.m_oFeatureMgr = null;
  23. this.m_oFeatureRegistry = null;
  24. this.m_oMiniQueryMgr = null;
  25. this.m_oReportMgr = null;
  26. };
  27. CWindowManager.prototype.getApplicationFrame = function ()
  28. {
  29. return this.m_oApplicationFrame;
  30. };
  31. CWindowManager.prototype.getDialogFrame = function ()
  32. {
  33. return this.m_oDialogFrame;
  34. };
  35. CWindowManager.prototype.getReportFrame = function ()
  36. {
  37. return this.m_oReportFrame;
  38. };
  39. CWindowManager.prototype.getFrame = function (sId)
  40. {
  41. var oFrameWindow = null;
  42. if (this.m_oApplicationFrame)
  43. {
  44. var oFrame = this.getApplicationFrame().document.getElementById(sId);
  45. if (oFrame && oFrame.contentWindow)
  46. {
  47. oFrameWindow = oFrame.contentWindow;
  48. }
  49. }
  50. return oFrameWindow;
  51. };
  52. CWindowManager.prototype.setupApplicationFrame = function (oFrame)
  53. {
  54. if (typeof oFrame == "undefined")
  55. {
  56. oFrame = self;
  57. }
  58. if (typeof oFrame.id !== "undefined" && typeof oFrame.id !== "unknown" && oFrame.id == CR1_TOP_FRAME)
  59. {
  60. return oFrame;
  61. }
  62. if (typeof oFrame.parent !== "undefined" && oFrame.parent != oFrame)
  63. {
  64. return this.setupApplicationFrame(oFrame.parent);
  65. }
  66. if (typeof oFrame.opener !== "undefined" && oFrame.opener !== null)
  67. {
  68. return this.setupApplicationFrame(oFrame.opener);
  69. }
  70. if (top.id == CR1_TOP_FRAME)
  71. {
  72. return top;
  73. }
  74. return null;
  75. };
  76. CWindowManager.prototype.setupDialogFrame = function ()
  77. {
  78. return this.getFrame(this.DIALOG_IFRAME);
  79. };
  80. CWindowManager.prototype.setupReportFrame = function ()
  81. {
  82. return this.getFrame(REPORT_IFRAME);
  83. };
  84. CWindowManager.prototype.showDialogFrame = function (iDlgSize)
  85. {
  86. if (typeof iDlgSize == "undefined" || isNaN(parseInt(iDlgSize)))
  87. {
  88. iDlgSize = 325;
  89. }
  90. else
  91. {
  92. iDlgSize = parseInt(iDlgSize);
  93. }
  94. this.getApplicationFrame().cfgSet("DialogSize", iDlgSize);
  95. if (iDlgSize === 0)
  96. {
  97. this.getApplicationFrame().document.getElementById("dialogFrame").style.height = "0px";
  98. this.getApplicationFrame().document.getElementById(this.DIALOG_IFRAME).style.borderTop = "0px";
  99. this.getApplicationFrame().document.getElementById("dialogResizeBar").style.display = "none";
  100. }
  101. else
  102. {
  103. this.getApplicationFrame().document.getElementById("dialogFrame").style.height = iDlgSize + "px";
  104. this.getApplicationFrame().document.getElementById(this.DIALOG_IFRAME).style.borderTop = "1px solid #999999";
  105. this.getApplicationFrame().document.getElementById("dialogResizeBar").style.display = "block";
  106. }
  107. if (typeof hideCModal == "function")
  108. {
  109. hideCModal();
  110. }
  111. };
  112. CWindowManager.prototype.isDialogFrameOpen = function ()
  113. {
  114. var oDialogFrame = this.getApplicationFrame().document.getElementById("dialogFrame");
  115. var bReturn = false;
  116. if (oDialogFrame !== null)
  117. {
  118. bReturn = (oDialogFrame.style.height === "0px" ? false : true);
  119. }
  120. return bReturn;
  121. };
  122. CWindowManager.prototype.hideDialogFrame = function ()
  123. {
  124. this.getApplicationFrame().cfgRemove("LAST_DIALOG");
  125. if (typeof this.getDialogFrame().document == "object" && typeof this.getDialogFrame().dialogIsClosed == "undefined")
  126. {
  127. this.getDialogFrame().document.location.replace(this.getReportFrame().oCVQS.getWebContentRoot() + "/" + this.getApplicationFrame().qs_dir + "/closedialog.html");
  128. }
  129. this.showDialogFrame(0);
  130. this.getReportFrame().window.focus();
  131. };
  132. CWindowManager.prototype.attachMouseEventsToDialog = function ()
  133. {
  134. if (typeof this.getDialogFrame().document == "object" && this.getDialogFrame().document.all)
  135. {
  136. document.body.attachEvent("onmouseup", this.getApplicationFrame().mainMouseUp);
  137. document.body.attachEvent("onmousemove", this.getApplicationFrame().mainMouseMove);
  138. }
  139. else
  140. {
  141. document.body.addEventListener("mouseup", this.getApplicationFrame().mainMouseUp, true);
  142. document.body.addEventListener("mousemove", this.getApplicationFrame().mainMouseMove, true);
  143. }
  144. };
  145. CWindowManager.prototype.getApplicationManager = function ()
  146. {
  147. if (this.m_oApplicationMgr === null)
  148. {
  149. this.m_oApplicationMgr = this.getApplicationFrame().goApplicationManager;
  150. }
  151. return this.m_oApplicationMgr;
  152. };
  153. CWindowManager.prototype.getFeatureManager = function ()
  154. {
  155. if (this.m_oFeatureMgr === null)
  156. {
  157. this.m_oFeatureMgr = this.getApplicationManager().getFeatureManager();
  158. }
  159. return this.m_oFeatureMgr;
  160. };
  161. CWindowManager.prototype.getFeatureRegistry = function ()
  162. {
  163. if (this.m_oFeatureRegistry === null)
  164. {
  165. this.m_oFeatureRegistry = this.getFeatureManager().getFeatureRegistry();
  166. }
  167. return this.m_oFeatureRegistry;
  168. };
  169. CWindowManager.prototype.getMiniQueryManager = function ()
  170. {
  171. if (this.m_oMiniQueryMgr === null)
  172. {
  173. this.m_oMiniQueryMgr = this.getApplicationManager().getMiniQueryManager();
  174. }
  175. return this.m_oMiniQueryMgr;
  176. };
  177. CWindowManager.prototype.getReportManager = function ()
  178. {
  179. if (this.m_oReportMgr === null)
  180. {
  181. this.m_oReportMgr = this.getApplicationManager().getReportManager();
  182. }
  183. return this.m_oReportMgr;
  184. };
  185. CWindowManager.prototype.getSelectionController = function ()
  186. {
  187. return this.getReportManager().getCVSelectionController();
  188. };