layout.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 gsMODALDLG_ID = "modalDlg";
  14. var giMIN_DIALOG_SIZE = 50;
  15. function getConfigFrame()
  16. {
  17. if (this.id == 'CR1_TopFrame')
  18. return this;
  19. else if (parent != null && parent.id == 'CR1_TopFrame')
  20. return parent;
  21. else if (opener != null && opener.id == 'CR1_TopFrame')
  22. return opener;
  23. else if (top.id == 'CR1_TopFrame')
  24. return top;
  25. else
  26. return null;
  27. };
  28. function getReportFrame()
  29. {
  30. return getFrame('reportIFrame');
  31. };
  32. function getDialogFrame()
  33. {
  34. return getFrame('dialogIFrame');
  35. };
  36. function getFrame(sId)
  37. {
  38. var oConfigFrame = getConfigFrame();
  39. var oFrameWindow = null;
  40. if (oConfigFrame && oConfigFrame.document)
  41. {
  42. var oFrame = oConfigFrame.document.getElementById(sId);
  43. if (oFrame && oFrame.contentWindow)
  44. {
  45. oFrameWindow = oFrame.contentWindow;
  46. }
  47. }
  48. return oFrameWindow;
  49. };
  50. function showDialogFrame(size)
  51. {
  52. var dlgSize = (size == null) ? 325 : size;
  53. cfgSet("DialogSize", dlgSize);
  54. if (typeof dlgSize == "undefined" || dlgSize == 0)
  55. {
  56. document.getElementById("dialogFrame").style.height = "0px";
  57. document.getElementById("dialogIFrame").style.borderTop = "0px";
  58. document.getElementById("dialogResizeBar").style.display = "none";
  59. }
  60. else
  61. {
  62. document.getElementById("dialogFrame").style.height = dlgSize + "px";
  63. document.getElementById("dialogIFrame").style.borderTop = "1px solid #999999";
  64. document.getElementById("dialogResizeBar").style.display = "block";
  65. }
  66. if (typeof hideModal == "function")
  67. hideModal();
  68. };
  69. function hideDialogFrame()
  70. {
  71. cfgRemove("LAST_DIALOG");
  72. var df = getDialogFrame();
  73. var sWebRoot = cfgGet("gsWebRoot");
  74. if (df && df.document &&
  75. (typeof df.dialogIsClosed == "undefined" || !df.dialogIsClosed) &&
  76. typeof sWebRoot != "undefined")
  77. df.document.location.replace(sWebRoot + "/" + qs_dir + "/closedialog.html");
  78. document.getElementById("dialogResizeBar").style.display = "none";
  79. if (typeof hideModal == "function")
  80. hideModal();
  81. var rf = getReportFrame();
  82. if (rf)
  83. {
  84. rf.window.focus();
  85. }
  86. };
  87. function enableResizeDialogFrame(bEnable)
  88. {
  89. getConfigFrame().cfgSet('RESIZING_DIALOG_PANE', bEnable);
  90. };
  91. function resizeDialogFrame(evt, y)
  92. {
  93. if (cfgGet('RESIZING_DIALOG_PANE') == true)
  94. {
  95. if (typeof y == "undefined")
  96. y = evt.clientY;
  97. var pageHeight;
  98. var fMax;
  99. if(document.all)
  100. {
  101. pageHeight = getConfigFrame().document.body.scrollHeight;
  102. fMax = 1;
  103. }
  104. else
  105. {
  106. pageHeight = getConfigFrame().document.body.offsetHeight;
  107. fMax = 0.65;
  108. }
  109. var fPercentage = (pageHeight - y)/pageHeight;
  110. if (fPercentage >= fMax)
  111. {
  112. showDialogFrame(pageHeight*fMax);
  113. }
  114. else if ((pageHeight - y) >= giMIN_DIALOG_SIZE)
  115. {
  116. showDialogFrame(pageHeight - y);
  117. }
  118. else
  119. {
  120. showDialogFrame(giMIN_DIALOG_SIZE);
  121. }
  122. }
  123. };
  124. function attachMouseEvents()
  125. {
  126. if (document.all)
  127. {
  128. document.body.attachEvent("onmouseup", getConfigFrame().mainMouseUp);
  129. document.body.attachEvent("onmousemove", getConfigFrame().mainMouseMove);
  130. }
  131. else
  132. {
  133. document.body.addEventListener("mouseup", getConfigFrame().mainMouseUp, true);
  134. document.body.addEventListener("mousemove", getConfigFrame().mainMouseMove, true);
  135. }
  136. };
  137. function showModal(t, c, w, h) {
  138. var cdlg = new CModal(t, c, null, null, null, h, w, false, false, false, false, goApplicationManager.getReportFrame().oCVQS.getWebContentRoot());
  139. cdlg.show();
  140. dlgSubmit(CMODAL_CONTENT_ID, true);
  141. };