ppwbtoolbar.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. // This forms the javascript functions used for PowerPlay Studio Toolbar
  9. // The functions handle any minor browser differences.
  10. // Browser detection code
  11. var version = parseInt(navigator.appVersion);
  12. var isIE = navigator.appVersion.indexOf("MSIE")>0
  13. var isNS = navigator.appName.indexOf("Netscape")>=0;
  14. if( navigator.appVersion == "" )
  15. isIE = true;
  16. var isIE3 = isIE && version<4
  17. var isIE4 = isIE && version>=4
  18. var isIE5 = isIE && version>4
  19. var isNS3 = isNS && version<4
  20. var isNS4 = isNS && version>=4
  21. // Variables and constants
  22. //var _postable = isIE5 || isNS; //uncomments this line if support IE version before IE4 SP2. 4.72,3612,1713 update version SP2, 3283
  23. var _postable = isIE4 || isNS;; //comments this line if support IE version before IIE4 SP2. 4.72,3612,1713 update version SP2, 3283.
  24. function winFocus(w){
  25. if(w!=null&&w.focus!=null)
  26. w.focus();
  27. }
  28. function compTail(s1, s2) {
  29. if (s1.indexOf(s2) == s1.length - s2.length)
  30. return true;
  31. return false;
  32. }
  33. function doOver(n,r,noStatus){
  34. if (iconState[n] != -1/* hidden */) {
  35. if (!isIE3 && !bRenderAsIE3) {
  36. if(iconState[n]==2) // ignore rollover if disabled
  37. r=0;
  38. document.images[iconName[n]].src=img[n][iconState[n]*2+r].src;
  39. }
  40. if (!noStatus)
  41. {
  42. if(iconState[n]==1&&iconHelp2[n]!=null)
  43. window.status=iconHelp2[n];
  44. else
  45. window.status=iconHelp1[n];
  46. }
  47. }
  48. return true;
  49. }
  50. function set(n){
  51. if(iconPress[n]){
  52. for(var i=0;i<max;i++){
  53. if(iconPress[i]==iconPress[n]){
  54. if (iconState[i] != -1) {
  55. iconState[i]=0;
  56. doOver(i,0);
  57. }
  58. }
  59. }
  60. iconState[n]=1;
  61. }else{
  62. doOver(n,2); // show depressed state of icon without changing state variable
  63. }
  64. }
  65. function clear(n){
  66. if(iconUnpress[n]){
  67. for(var i=0;i<max;i++){
  68. if(iconUnpress[i]==iconUnpress[n]){
  69. if (iconState[i] != -1) {
  70. iconState[i]=1;
  71. doOver(i,0);
  72. }
  73. }
  74. }
  75. iconState[n]=0;
  76. }
  77. }
  78. function doClick(n){
  79. if(iconState[n]==2)
  80. return;
  81. // bug fix 381158- replaced code from new UI
  82. else if(iconState[n]==1)
  83. {
  84. if(iconUnpress[n] > 1)
  85. iconState[n]=0;
  86. }
  87. else
  88. {
  89. if(iconPress[n] > 1)
  90. iconState[n]=1;
  91. }
  92. doOver(n,0);
  93. eval(iconAction[n]);
  94. }
  95. function doit(s){
  96. var winFX = parent.getWindow();
  97. if(parent.FXloaded!=null && parent.FXloaded==1)
  98. winFX.doit(s);
  99. }
  100. // this function is used by alert agent
  101. function doit2(s){
  102. var gparent = parent.parent;
  103. var winFX = gparent.getWindow();
  104. if(gparent.FXloaded!=null && gparent.FXloaded==1)
  105. winFX.doit(s);
  106. }
  107. function isLeftPaneUp() {
  108. var winFX = parent.getWindow();
  109. var fh = winFX.document.fhidden;
  110. var returnVal = false;
  111. if (fh.EXPL.value != 0 || fh.CUSX.value != 0 || fh.FIND.value != 0 || fh.OPTS.value != 0 || fh.PDFPO.value != 0)
  112. returnVal = true;
  113. return returnVal;
  114. }
  115. function ra( as ) {
  116. if( !parent.FXloaded || parent.FXloaded != 1 )
  117. return;
  118. var winFX = parent.getWindow();
  119. var fh = winFX.document.fhidden;
  120. if ( !winFX._fhchanged ) {
  121. winFX._fhchanged = true;
  122. winFX._fhtarget = fh.target;
  123. winFX._fhaction = fh.action;
  124. winFX._fhRA = fh.RA.value;
  125. }
  126. var RA_CSV = 1,
  127. RA_XLS = 11,
  128. RA_PDF = 12,
  129. RA_DRILLTHRU = 4,
  130. RA_BOOKMARK = 7,
  131. RA_SPECS = 98;
  132. RA_XLSX=13;
  133. var cnctTemp = fh.CNCT.value;
  134. if( as == RA_CSV || as == RA_PDF || as == RA_DRILLTHRU || as == RA_BOOKMARK || as == RA_XLS || as == RA_SPECS || as == RA_XLSX) {
  135. FTok = false;
  136. fh.RA.value = as;
  137. // self.window is the toolbar window (FT) so the target is our
  138. // parent window -- whatever that is.
  139. var targetWindow = self.window.parent;
  140. if( ! targetWindow.name || targetWindow.length == 0 )
  141. targetWindow.name = "PPESTarget";
  142. fh.target = targetWindow.name;
  143. if( as == RA_BOOKMARK ) {
  144. if( parent.parent != parent ) {
  145. fh.target = "_blank"; // open a new window because bookmarks set the location
  146. }
  147. fh.HTTPSBM.value = location.protocol.toLowerCase();
  148. } else if (as == RA_DRILLTHRU ){
  149. fh.target = "_blank";
  150. } else if( as == RA_CSV ) {
  151. fh.action += "?MIME=.CSV";
  152. } else if( as == RA_XLS ) {
  153. fh.action += "?MIME=.XLS";
  154. fh.CNCT.value = 24;
  155. } else if( as == RA_XLSX ) {
  156. fh.action += "?MIME=.XLSX";
  157. fh.CNCT.value = 24;
  158. }else if( as == RA_PDF ) {
  159. fh.action += "?MIME=.PDF";
  160. fh.CO.value = "";
  161. } else if( as == RA_SPECS ) { /* Show Specs (PPX & CFX) */
  162. fh.target = "_blank";
  163. }
  164. if( as == RA_PDF && document.cookie.length != 0 && getCookie("PageOrientation") )
  165. submitExportIcon( winFX );
  166. else
  167. fh.submit();
  168. fh.CNCT.value=cnctTemp;
  169. } else {
  170. // We're not expecting it -- eat it
  171. }
  172. }
  173. function doParent(action){
  174. var winFX = parent.getWindow();
  175. if(parent.FXloaded!=null && parent.FXloaded==1)
  176. winFX.doParent(action);
  177. }
  178. function doSelect(action){
  179. var winFX = parent.getWindow();
  180. if(parent.FXloaded!=null && parent.FXloaded==1)
  181. winFX.doSelect(action);
  182. }
  183. function what(t){
  184. window.status=t;
  185. return true;
  186. }
  187. function ret()
  188. {
  189. if( document.pqr != null )
  190. document.pqr.submit();
  191. }
  192. function hp(sTopic) {
  193. parent.getWindow().hp(sTopic);
  194. }
  195. function syncpg(){
  196. if (ftr && ftr.R) {
  197. for(var i=0;i<ftr.R.length;i++){
  198. if(compTail(ftr.R.options[i].value, ':' + fh.G.value))
  199. ftr.R.selectedIndex=i;
  200. }
  201. }
  202. if (ftc && ftc.C) {
  203. for(var i=0;i<ftc.C.length;i++){
  204. if(compTail(ftc.C.options[i].value, ':' + fh.H.value))
  205. ftc.C.selectedIndex=i;
  206. }
  207. }
  208. }
  209. function sync(){
  210. var winFX=parent.getWindow();
  211. iconState=winFX.iconState;
  212. if (isIE3 || bRenderAsIE3) {
  213. ftr=document.ftoolbarr;
  214. ftc=document.ftoolbarc;
  215. for(var n=0;n<max;n++) {
  216. if (iconState[n] != -1/* hidden */) {
  217. document.images[iconName[n]].src=img[n][iconState[n]*2].src;
  218. }
  219. }
  220. } else {
  221. ftr=document.ftoolbar;
  222. ftc=document.ftoolbar;
  223. for(var i=0;i<max;i++)
  224. doOver(i,0,true);
  225. }
  226. fh=winFX.document.fhidden;
  227. syncpg();
  228. winFocus(winFX);
  229. }
  230. function init(){
  231. if(parent.FXloaded!=null){
  232. parent.FTloaded=1;
  233. parent.sync();
  234. }
  235. }
  236. function finish(){
  237. if(parent.FXloaded!=null)
  238. parent.FTloaded=0;
  239. }