bux_base.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: pps
  4. //
  5. // (C) Copyright IBM Corp. 2010, 2017
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. /*****************************************************/
  9. /************* Dashboard (BUX) Support *************/
  10. /*****************************************************/
  11. // used to calculate the proper width of the iWidget for an AutoResize event
  12. function getPowerPlayScrollWidth() {
  13. var xtabWidth = getXtabWidth();
  14. var chartWidth = getChartWidth();
  15. var actionPaneWidth = getActionPaneWidth();
  16. var contentWidth = Math.max(xtabWidth, chartWidth);
  17. var powerPlayWidth = Math.max(contentWidth, actionPaneWidth);
  18. if (topparent.getGlobal("treeVisible"))
  19. powerPlayWidth = powerPlayWidth + 192 ;
  20. return powerPlayWidth + 30;
  21. }
  22. // used to calculate the proper height of the iWidget for an AutoResize event
  23. function getPowerPlayScrollHeight() {
  24. var xtabHeight = getXtabHeight();
  25. var chartHeight = getChartHeight();
  26. var actionPaneHeight = getActionPaneHeight();
  27. return xtabHeight + chartHeight + actionPaneHeight + 40;
  28. }
  29. function getXtabWidth() {
  30. if (noXtabFrame()) {
  31. return 0;
  32. }
  33. var xtabDoc = topparent.getXtabFrame().window.document;
  34. var titleWidth = getTitleWidth(xtabDoc);
  35. var divWidth = xtabDoc.getElementById("innerNice1-tab0").scrollWidth;
  36. var tableWidth = xtabDoc.getElementById("xtab").scrollWidth;
  37. var statusLineWidth = getStatusLineWidth(xtabDoc);
  38. return Math.max(titleWidth, Math.max(divWidth, Math.max(tableWidth, statusLineWidth)));
  39. }
  40. function getXtabHeight() {
  41. if (noXtabFrame()) {
  42. return 0; // no Xtab
  43. }
  44. var xtabDoc = topparent.getXtabFrame().window.document;
  45. var titleHeight = getTitleHeight(xtabDoc);
  46. var statusLineHeight = getStatusLineHeight(xtabDoc);
  47. var xtabHeight = xtabDoc.getElementById("xtab").scrollHeight;
  48. return xtabHeight + titleHeight + statusLineHeight + 20;
  49. }
  50. function getChartWidth() {
  51. if (noChartFrame()) {
  52. return 0; // no Chart
  53. }
  54. var chartDoc = topparent.getChartFrame().window.document;
  55. var titleWidth = getTitleWidth(chartDoc);
  56. var statusLineWidth = getStatusLineWidth(chartDoc);
  57. var divWidth = chartDoc.getElementById("innerNice1-tab0").scrollWidth;
  58. var chartWidth = chartDoc.getElementById("chart").scrollWidth;
  59. return Math.max(titleWidth, Math.max(divWidth, Math.max(chartWidth, statusLineWidth)));
  60. }
  61. function getChartHeight() {
  62. if (noChartFrame()) {
  63. return 0; // no Chart
  64. }
  65. var chartDoc = topparent.getChartFrame().window.document;
  66. var titleHeight = getTitleHeight(chartDoc);
  67. var statusLineHeight = getStatusLineHeight(chartDoc);
  68. var chartHeight = chartDoc.getElementById("chart").scrollHeight;
  69. return chartHeight + titleHeight + statusLineHeight + 20;
  70. }
  71. function getActionPaneWidth() {
  72. var rows = topparent.document.getElementById("rightFrameset").rows;
  73. rows = rows.split(',');
  74. if (parseInt(rows) == 0) {
  75. return 0;
  76. }
  77. return topparent.getActionFrame().window.document.body.scrollWidth;
  78. }
  79. function getActionPaneHeight() {
  80. var rows = topparent.document.getElementById("rightFrameset").rows;
  81. rows = rows.split(',');
  82. return parseInt(rows[1]);
  83. }
  84. function getTitleWidth(doc) {
  85. if (doc && doc.getElementById("titleDiv"))
  86. return doc.getElementById("titleDiv").scrollWidth;
  87. return 0;
  88. }
  89. function getTitleHeight(doc) {
  90. if (doc && doc.getElementById("titleDiv"))
  91. return doc.getElementById("titleDiv").scrollHeight;
  92. return 0;
  93. }
  94. function getStatusLineWidth(doc) {
  95. if (doc && doc.getElementById("status_line"))
  96. return doc.getElementById("status_line").scrollWidth;
  97. return 0;
  98. }
  99. function getStatusLineHeight(doc) {
  100. if (doc && doc.getElementById("status_line"))
  101. return doc.getElementById("status_line").scrollHeight + 15;
  102. return 0;
  103. }
  104. function noXtabFrame() {
  105. return topparent.getGlobal("isChart") && !topparent.getGlobal("isSplitView");
  106. }
  107. function noChartFrame() {
  108. return !topparent.getGlobal("isChart") && !topparent.getGlobal("isSplitView");
  109. }
  110. function saveAsToDashboard(evt) {
  111. var payload = evt.payload;
  112. var dashboardStoreID = payload.cm$storeID;
  113. topparent.setGlobal("is_save", true);
  114. addToHiddenForm("DSHSP", 'storeID("' + dashboardStoreID + '")');
  115. doParent('RU:5')
  116. }
  117. function saveToDashboard(evt) {
  118. var payload = evt.payload;
  119. var dashboardStoreID = payload.cm$storeID;
  120. topparent.setGlobal("is_save", true);
  121. addToHiddenForm("DSHSP", 'storeID("' + dashboardStoreID + '")');
  122. doParent('RU:6')
  123. }
  124. function addToHiddenForm(name, value) {
  125. var input = document.createElement("input");
  126. input.name = name;
  127. input.value = value;
  128. input.type = "hidden";
  129. fh.appendChild(input);
  130. }