ppwb.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: pps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2019
  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.
  9. // except for those functions involved with HTML4
  10. // The functions handle any minor browser differences.
  11. // Browser detection code
  12. var version = parseInt(navigator.appVersion);
  13. var isIE = navigator.appVersion.indexOf("MSIE")>0;
  14. var isNS = navigator.appName.indexOf("Netscape")>=0;
  15. if( navigator.appVersion == "" )
  16. isIE = true;
  17. var isIE3 = isIE && version<4;
  18. var isIE4 = isIE && version>=4;
  19. var isNS3 = isNS && version<4;
  20. var isNS4 = isNS && version>=4;
  21. var fh, fdb, fm, img, iconHelp;
  22. var imgNm;
  23. var FTok = false;
  24. var _fhchanged = false;
  25. var _fhtarget;
  26. var _fhaction;
  27. var _fhRA;
  28. var gparent = getGrandParentofFXWindow();
  29. var sparent = getGrandParentofFXWindowAsString();
  30. var hasFinishedLoading = 0;
  31. var pdb; //for primitive debugger...
  32. //used in formURL()
  33. var _essHidden = new Array();
  34. _essHidden[0] = "DC";
  35. _essHidden[1] = "E";
  36. _essHidden[2] = "I";
  37. _essHidden[3] = "LA";
  38. _essHidden[4] = "LO";
  39. _essHidden[5] = "M";
  40. _essHidden[6] = "RC";
  41. _essHidden[7] = "DM";
  42. _essHidden[8] = "DX";
  43. _essHidden[9] = "PH";
  44. _essHidden[10] = "PT";
  45. _essHidden[11] = "FC";
  46. _essHidden[12] = "Y";
  47. _essHidden[13] = "G";
  48. _essHidden[14] = "H";
  49. _essHidden[15] = "J";
  50. _essHidden[16] = "K";
  51. _essHidden[17] = "SHN";
  52. function winFocus(w) {
  53. if(w!=null&&w.focus!=null)
  54. w.focus();
  55. }
  56. function checkFrame() {
  57. var fh=document.fhidden;
  58. if (parent == self || !gparent.sync) {
  59. resetHiddenForm();
  60. // Invoked without frameset
  61. fh.CNCT.value=0;
  62. fh.submit();
  63. }
  64. }
  65. function sync( ){
  66. img=gparent.FT.img;
  67. iconHelp=gparent.FT.iconHelp1;
  68. FTok = true;
  69. }
  70. function NoDebugger () {
  71. window.onerror=function (msg,url,line){ return true };
  72. this.out = noFunc;
  73. this.dump = noFunc;
  74. this.dumpArgs = noFunc;
  75. this.getObjectName = noFunc;
  76. this.getFunctionName = noFunc;
  77. this.checkHide = noFunc;
  78. }
  79. function noFunc() { return true; }
  80. function initDebug() {
  81. if (typeof Debugger != "undefined") {
  82. pdb = new Debugger ();
  83. } else {
  84. pdb = new NoDebugger ();
  85. }
  86. }
  87. function initVars(){
  88. initDebug();
  89. fh=document.fhidden;
  90. fh.CO.value = "";
  91. if (!gparent.is_save && fh.DSHSP) {
  92. fh.removeChild(fh.DSHSP);
  93. }
  94. captureScreenRes(fh);
  95. fdb=document.fdimbar;
  96. if (isIE3)
  97. fm=document.fmeasure;
  98. else
  99. fm=document.fmain;
  100. if(gparent.FXloaded!=null){
  101. if (!fh.YS)
  102. gparent.FXloaded=1;
  103. else {
  104. if (window.name == "FX1") {
  105. gparent.FX1loaded=1;
  106. }
  107. if (window.name == "FX2") {
  108. gparent.FX2loaded=1;
  109. }
  110. if (gparent.FX1loaded && gparent.FX2loaded) {
  111. gparent.FXloaded=1;
  112. }
  113. }
  114. gparent.sync();
  115. }
  116. }
  117. function captureScreenRes(fh){
  118. setCookie("BRes",screen.availWidth + "*" + screen.availHeight,(10*365),cookieSecure);
  119. }
  120. function initNormal(){
  121. checkFrame();
  122. if ( parseInt(QPversion) != parseInt(JavaScriptVersion) )
  123. alert(invalidVersion);
  124. }
  125. function getIContext() {
  126. var str = "window.parent.parent.parent." + window.parent.parent.name + "iContext";
  127. var icontext = eval(str);
  128. if (icontext != null && typeof icontext != "undefined" && icontext.iEvents != null && icontext.iEvents.fireEvent != null) {
  129. return icontext;
  130. }
  131. return null;
  132. }
  133. function fireEvent(evt, params, payload) {
  134. var icontext = getIContext();
  135. if (icontext != null) {
  136. icontext.iEvents.fireEvent(evt, params, payload);
  137. }
  138. }
  139. function updateToolbar() {
  140. var icontext = getIContext();
  141. if (icontext != null && icontext.scope) {
  142. icontext.scope.initOnDemandToolbar();
  143. }
  144. }
  145. function init(){
  146. initVars();
  147. fh.RA.value = "";
  148. initNormal();
  149. updateToolbar();
  150. if (gparent.initialOpen) {
  151. gparent.initialOpen = false;
  152. if (!gparent.is_save && !gparent.no_auto_resize) {
  153. fireEvent('com.ibm.bux.widget.autoResize', null);
  154. } else {
  155. handleSaveDone();
  156. }
  157. } else {
  158. fireEvent('com.ibm.bux.widget.modified', null, { 'modified': true });
  159. }
  160. }
  161. function resize(){
  162. initVars();
  163. }
  164. function finish(){
  165. if(gparent.FXloaded!=null)
  166. gparent.FXloaded=0;
  167. if(gparent.FX1loaded!=null)
  168. gparent.FX1loaded=0;
  169. if(gparent.FX2loaded!=null)
  170. gparent.FX2loaded=0;
  171. FTok = false;
  172. }
  173. function resetHiddenForm(){
  174. if ( _fhchanged ) {
  175. fh.RA.value = _fhRA;
  176. fh.action = _fhaction;
  177. fh.target = _fhtarget;
  178. }
  179. if (fh.RA.value > 0) fh.RA.value = 0;
  180. }
  181. function isLeftPaneManipulateCmd() {
  182. var sCommand = fh.CO.value;
  183. var cmd = sCommand.charAt(0);
  184. var cmdOption = sCommand.charAt(1);
  185. if ( cmd != "M" )
  186. return false;
  187. if ( cmdOption != "X" && cmdOption != "E" &&
  188. cmdOption != "A" && cmdOption != "F" && cmdOption != "T" && cmdOption != "P")
  189. return false;
  190. return true;
  191. }
  192. function isLeftPaneUp() {
  193. var returnVal = false;
  194. if (fh.EXPL.value != 0 || fh.CUSX.value != 0 || fh.FIND.value != 0 || fh.OPTS.value != 0 || fh.PDFPO.value != 0 || fh.ZS_OPTS.value != 0)
  195. returnVal = true;
  196. return returnVal;
  197. }
  198. function crosstab()
  199. {
  200. if( parent.FE ) {
  201. var sTemplate = "";
  202. var sCommand = fh.CO.value;
  203. if (fh.TMPL) {
  204. sTemplate = fh.TMPL.value;
  205. }
  206. if (fh.CNCT.value != 11 && fh.target != "_self" && fh.CO.value.substring(0,2)!='GE') {
  207. fh.CNCT.value=4;
  208. }
  209. }
  210. else if ( fh.target == "_self"){
  211. if(parent.name == "")
  212. parent.name= "parentname";
  213. fh.target = parent.name;
  214. }
  215. FTok=false;
  216. fh.submit();
  217. resetAllForms();
  218. }
  219. function setFormValue(aForm, name, value) {
  220. for (var j=0; j<aForm.elements.length; j++) {
  221. if (aForm.elements[j].name == name) {
  222. aForm.elements[j].value = value;
  223. break;
  224. }
  225. }
  226. }
  227. function doit(action){
  228. initVars(); // required for NS3 as it does not trap the resize event
  229. if (action.charAt(0) == "!") {
  230. eval(action.substring(1));
  231. } else {
  232. if(fh) {
  233. if(fh.RA.value != 2)
  234. resetHiddenForm();
  235. if( action.substring(0,2) == "LM" ){
  236. fh.LM.value=action;
  237. } else {
  238. fh.CO.value=action;
  239. }
  240. if (fh.CNCT.value == 5) {
  241. fh.CNCT.value = 1;
  242. fh.target = "_self";
  243. }
  244. crosstab();
  245. }
  246. }
  247. }
  248. function doParent(action){
  249. initVars(); // required for NS3 as it does not trap the resize event
  250. if(fh) {
  251. resetHiddenForm();
  252. fh.CO.value=action;
  253. if( isLeftPaneUp() || parent.FX1 || parent.FX2 ) {
  254. if (self.parent.parent.name == "")
  255. self.parent.parent.name = "FR";
  256. fh.target = self.parent.parent.name;
  257. }
  258. else
  259. fh.target = "_parent";
  260. FTok=false;
  261. fh.submit();
  262. resetAllForms();
  263. }
  264. }
  265. function doSelect(action){
  266. action = eval("'" + action + "'"); // needed to interpret \t
  267. resetAllForms();
  268. doit(action);
  269. }
  270. function doOver(a,n,r){
  271. if(FTok && !isIE3){
  272. if (!isNS3 || a.indexOf("sort")!=0)
  273. document.images[a].src=img[n][r].src;
  274. window.status=iconHelp[n];
  275. }
  276. return true;
  277. }
  278. function doClick(a,n,it){
  279. doOver(a,n,2);
  280. eval("doit('" + it + "')");
  281. }
  282. function what(t){
  283. window.status=t;
  284. return true;
  285. }
  286. function resetForm(f){
  287. if(f!=null&&f.reset!=null)
  288. f.reset();
  289. }
  290. function resetAllForms(){
  291. if(document.forms!=null) {
  292. for(var f=0; f<document.forms.length; f++) {
  293. resetForm(document.forms[f]);
  294. }
  295. }
  296. }
  297. function hp(topic){
  298. fh=document.fhidden;
  299. var lang = "";
  300. if (fh && fh.LA)
  301. lang = fh.LA.value;
  302. help(lang, topic);
  303. }
  304. function getGrandParentofFXWindow()
  305. {
  306. return window.parent.parent;
  307. }
  308. function getGrandParentofFXWindowAsString()
  309. {
  310. return "window.parent.parent";
  311. }
  312. function cgiEscape(str) {
  313. var str2=escape(str);
  314. var str2=str2.replace(/\+/g, "%2b");
  315. return (str2);
  316. }
  317. function formURL(){
  318. var form=document.fhidden;
  319. var q="?";
  320. var url = form.action;
  321. for (var i = 0; i < _essHidden.length; i++) {
  322. var str = "form.";
  323. str += _essHidden[i];
  324. var ele = eval(str);
  325. if ( ele ) {
  326. if ( ele.value.length > 0) {
  327. url += q;
  328. url += cgiEscape(ele.name);
  329. url += "=";
  330. if ( ele.name == "E" )
  331. url += form.EC.value;
  332. else
  333. url += cgiEscape(ele.value);
  334. q="&";
  335. }
  336. }
  337. }
  338. return (url);
  339. }