ppwebinfo.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: pps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2017
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. //all user inputs for accessing arrays are 1 based
  9. var ppwebInfo;
  10. function DimensionFilters()
  11. {
  12. function DimFilterRecord(Label,Code,IsTimeDim,IsMeasureDim,TopCode,TopLabel)
  13. {
  14. this.label = Label;
  15. this.code = Code;
  16. this.topCode = TopCode;
  17. this.topLabel = TopLabel;
  18. this.isTimeDim = IsTimeDim;
  19. this.isMeasureDim = IsMeasureDim;
  20. }
  21. dimRecordArray = new Array();
  22. this.AddDim = function(Label,Code,IsTimeDim,isMeasureDim,TopCode,TopLabel,dimIdx)
  23. {
  24. dimRecordArray[parseInt(dimIdx)] = new DimFilterRecord(Label,Code,IsTimeDim,isMeasureDim,TopCode,TopLabel);
  25. }
  26. this.GetDimLabel = function(dimIdx)
  27. {
  28. return (dimRecordArray[parseInt(dimIdx)].label);
  29. }
  30. this.GetDimCode = function(dimIdx)
  31. {
  32. return (dimRecordArray[parseInt(dimIdx)].code);
  33. }
  34. this.GetDimTopLabel = function(dimIdx)
  35. {
  36. return (dimRecordArray[parseInt(dimIdx)].topLabel);
  37. }
  38. this.GetDimTopCode = function(dimIdx)
  39. {
  40. return (dimRecordArray[parseInt(dimIdx)].topCode);
  41. }
  42. this.IsDimFiltered = function(dimIdx)
  43. {
  44. return (dimRecordArray[parseInt(dimIdx)].code != dimRecordArray[parseInt(dimIdx)].topCode);
  45. }
  46. this.IsTimeDim = function(dimIdx)
  47. {
  48. return (dimRecordArray[parseInt(dimIdx)].isTimeDim);
  49. }
  50. this.IsMeasureDim = function(dimIdx)
  51. {
  52. return (dimRecordArray[parseInt(dimIdx)].isMeasureDim);
  53. }
  54. this.GetNumDimensions = function()
  55. {
  56. return dimRecordArray.length;
  57. }
  58. }
  59. function AxisInfo()
  60. {
  61. function NestGroup(Code,DimIdx,Group)
  62. {
  63. this.code = Code;
  64. this.dimIdx = DimIdx;
  65. this.group = Group;
  66. }
  67. var nestGroups = new Array();
  68. this.AddLevel = function(Level,Code,DimIdx,Group)
  69. {
  70. nestGroups[parseInt(Level)] = new NestGroup(Code,DimIdx,Group);
  71. }
  72. this.GetCatCode = function(Level) {
  73. return nestGroups[parseInt(Level)].code;
  74. }
  75. this.GetDim = function(Level) {
  76. return nestGroups[parseInt(Level)].dimIdx;
  77. }
  78. this.GetNestGroupInDim = function(Level) {
  79. return nestGroups[parseInt(Level)].group;
  80. }
  81. this.GetNestingDepth = function()
  82. {
  83. return nestGroups.length;
  84. }
  85. }
  86. function XtabInfo()
  87. {
  88. var rowInfo = new AxisInfo();
  89. var colInfo = new AxisInfo();
  90. this.GetRowInfo = function()
  91. {
  92. return rowInfo;
  93. }
  94. this.GetColumnInfo = function()
  95. {
  96. return colInfo;
  97. }
  98. this.GetZeroSuppressionIdx = function()
  99. {
  100. if (typeof document.fhidden.ZS != "undefined")
  101. return parseInt(document.fhidden.ZS.value);
  102. else
  103. return 0;
  104. }
  105. this.Is8020Suppressed = function()
  106. {
  107. if (typeof document.fhidden.ETS != "undefined")
  108. return (parseInt(document.fhidden.ETS.value) == 1);
  109. else
  110. return false;
  111. }
  112. this.GetCurrency = function()
  113. {
  114. if (typeof document.fhidden.D != "undefined")
  115. return parseInt(document.fhidden.D.value);
  116. else
  117. return 0;
  118. } // we won't interpret each of the codes as there are too many and cube specific..
  119. this.GetMaxNumberOfRows = function()
  120. {
  121. return parseInt(document.fhidden.G.value);
  122. }
  123. this.GetMaxNumberOfColumns = function()
  124. {
  125. return parseInt(document.fhidden.H.value);
  126. }
  127. this.GetRowPage = function()
  128. {
  129. if (typeof document.fhidden.J != "undefined")
  130. return parseInt(document.fhidden.J.value);
  131. else
  132. return 0;
  133. }
  134. this.GetColumnPage = function()
  135. {
  136. if (typeof document.fhidden.K != "undefined")
  137. return parseInt(document.fhidden.K.value);
  138. else
  139. return 0;
  140. }
  141. this.IsGetDataLaterOn = function()
  142. {
  143. return (document.fhidden.GD.value != "1");
  144. }
  145. }
  146. function PPWebInfo()
  147. {
  148. var filters = new DimensionFilters();
  149. var xtabInfo = new XtabInfo();
  150. this.GetDimensionInfo = function()
  151. {
  152. return filters;
  153. }
  154. this.GetXtabInfo = function()
  155. {
  156. return xtabInfo;
  157. }
  158. this.getCubeName = function()
  159. {
  160. return document.fhidden.E.value;
  161. }
  162. this.GetCurrentMeasure = function()
  163. {
  164. if (typeof document.fhidden.V != "undefined")
  165. return parseInt(document.fhidden.V.value);
  166. else
  167. return 0;
  168. }
  169. this.GetCurrentMeasureString = function()
  170. {
  171. var type = 0;
  172. if (typeof document.fhidden.V != "undefined")
  173. type = parseInt(document.fhidden.V.value);
  174. return topparent.getGlobal("renderAs")[type]._label;
  175. }
  176. this.GetBackURL = function()
  177. {
  178. return document.fhidden.PP_BACK.value;
  179. }
  180. this.GetResetURL = function()
  181. {
  182. return document.fhidden.HOME.value;
  183. }
  184. this.GetLanguage = function()
  185. {
  186. return document.fhidden.LA.value;
  187. }
  188. this.GetLocale = function()
  189. {
  190. return document.fhidden.LO.value;
  191. }
  192. this.IsSplitViewOn = function()
  193. {
  194. if (document.fhidden.YS) return true;
  195. else return false;
  196. }
  197. this.GetDisplayType = function()
  198. {
  199. if (typeof document.fhidden.Y != "undefined")
  200. return parseInt(document.fhidden.Y.value);
  201. else
  202. return 0;
  203. }
  204. this.GetSplitViewDisplayType = function()
  205. {
  206. if (typeof document.fhidden.YS != "undefined")
  207. return parseInt(document.fhidden.YS.value);
  208. else
  209. return 0;
  210. }
  211. this.isActionPaneOpen = function()
  212. {
  213. return (parseInt(document.fhidden.ACTPANE.value) != 0);
  214. }
  215. }
  216. function initialize_ppwbInfo() {
  217. ppwebInfo = new PPWebInfo();
  218. //Store the dimensions
  219. var dimCache = topparent.getGlobal("dimCache");
  220. var dimbarcontent = document.getElementById("dimbar-content");
  221. if (!dimbarcontent)
  222. dimbarcontent = topparent.getChartFrame().document.getElementById("dimbar-content");
  223. var dim = dimbarcontent.firstChild;
  224. while (dim.tagName == "A") {
  225. var dimIdx = parseInt(dim.getAttribute("number")) - 1;
  226. var dimtopnode = dimCache.getDimTopNode(dimIdx);
  227. ppwebInfo.GetDimensionInfo().AddDim(dim.getAttribute("category"),dim.getAttribute("code"),topparent.getGlobal("gDimensionInfo[" + dimIdx + "]").isTimeDimension,topparent.getGlobal("gDimensionInfo[" + dimIdx + "]").isMeasureDimension,dimtopnode.getCode(),dimtopnode.getLabel(),dimIdx)
  228. dim = dim.nextSibling;
  229. }
  230. //Store the axis info
  231. //Rows
  232. var level = 0;
  233. var levelselect = xtabCache.getXtabLevelSelector("r",level);
  234. while (levelselect) {
  235. ppwebInfo.GetXtabInfo().GetRowInfo().AddLevel(level,levelselect.getAttribute("code"),levelselect.getAttribute("dimIdx"),levelselect.getAttribute("groupLevel"))
  236. level++;
  237. levelselect = xtabCache.getXtabLevelSelector("r",level);
  238. }
  239. //Columns
  240. var level = 0;
  241. var levelselect = xtabCache.getXtabLevelSelector("c",level);
  242. while (levelselect) {
  243. ppwebInfo.GetXtabInfo().GetColumnInfo().AddLevel(level,levelselect.getAttribute("code"),levelselect.getAttribute("dimIdx"),levelselect.getAttribute("groupLevel"))
  244. level++;
  245. levelselect = xtabCache.getXtabLevelSelector("c",level);
  246. }
  247. }