123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: pps
- //
- // (C) Copyright IBM Corp. 2005, 2022
- //
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- // This forms the javascript functions used for PowerPlay Studio
- // except for those functions involved with HTML4
- // The functions handle any minor browser differences.
- var fh, gImgArray, iconHelp;
- var imgNm;
- var FTok = false;
- var _fhchanged = false;
- var _fhtarget;
- var _fhaction;
- var _fhRA;
- var gparent = getGrandParentofFXWindow();
- var hasFinishedLoading = 0;
- function winFocus(w) {
- if(w!=null&&w.focus!=null)
- w.focus();
- }
- function sync( ){
- gImgArray=gparent.FT.gToolbarImg;
- iconHelp=gparent.FT.iconHelp1;
- FTok = true;
- }
- function initVars(){
- fh=document.fhidden;
- if (fh) {
- fh.CO.value = "";
- fh.RA.value = "999";
- captureScreenRes(fh);
- if(gparent.FXloaded!=null){
- gparent.FXloaded=1;
- gparent.sync();
- }
- }
- }
- function captureScreenRes(fh){
- setCookie("BRes",screen.availWidth + "*" + screen.availHeight,(10*365),topparent.getGlobal('cookieSecure'));
- }
- function initXtab(){
- initVars();
- reloadActionPane();
- reloadToolbar();
- }
- function crosstab()
- {
- var ACT_PANE_NONE = 0;
- var ACT_PANE_FIND = 1;
- var ACT_PANE_HIDESHOW = 2;
- var ACT_PANE_EXPLAIN = 4;
- var ACT_PANE_PDFOPTIONS = 5;
- var ACT_PANE_DISPLAYOPTIONS = 6;
- var ACT_PANE_CALCULATION = 7;
- var ACT_PANE_CUSTOMEXCEPTIONS = 8;
- var ACT_PANE_EDITTITLE = 9;
- var ACT_PANE_CUSTOM_SUBSETS_INIT = 10;
- var ACT_PANE_RANK = 11;
- var ACT_PANE_SUPPRESS_OPTIONS = 12;
- var ACT_PANE_CHART_OPTIONS = 13;
- var ACT_PANE_XTAB_OPTIONS = 14;
- var ACT_PANE_ABOUT = 15;
- var actionFrame = ACT_PANE_NONE;
- switch (fh.CO.value) {
- case "MF": actionFrame = ACT_PANE_FIND; break;
- case "ME": actionFrame = ACT_PANE_EXPLAIN; break;
- case "MQ": actionFrame = ACT_PANE_HIDESHOW; break;
- case "MT": actionFrame = ACT_PANE_DISPLAYOPTIONS; break;
- case "MC": actionFrame = ACT_PANE_CALCULATION; break;
- case "MX": actionFrame = ACT_PANE_CUSTOMEXCEPTIONS; break;
- case "MP": actionFrame = ACT_PANE_PDFOPTIONS; break;
- case "MI": actionFrame = ACT_PANE_EDITTITLE; break;
- case "MO": actionFrame = ACT_PANE_RANK; break;
- case "MD": actionFrame = ACT_PANE_SUPPRESS_OPTIONS; break;
- case "MY": actionFrame = ACT_PANE_CHART_OPTIONS; break;
- case "MB": actionFrame = ACT_PANE_XTAB_OPTIONS; break;
- case "MA": actionFrame = ACT_PANE_ABOUT; break;
- default:
- if (fh.CO.value.indexOf("MZ") == 0) {
- actionFrame = ACT_PANE_CUSTOM_SUBSETS_INIT;
- }
- }
- if (actionFrame != ACT_PANE_NONE)
- {
- if(actionFrame == ACT_PANE_EXPLAIN)
- setSelections();
-
- if (fh.ACTPANE.value == actionFrame &&
- (actionFrame != ACT_PANE_CUSTOM_SUBSETS_INIT || fh.CO.value == "MZI") &&
- (topparent.document.getElementById("rightFrameset").rows.indexOf("*,0")))
- {//Close Action frame and set to none.
- topparent.closeActionPane();
- return;
- }
- else
- {//Set to correct action pane and render
- fh.ACTPANE.value = actionFrame;
- fh.CNCT.value = 19;
- fh.target = "ActionPane";
- }
- parseAndSubmit(fh);
- }
- else
- {
- var xtabFrame = topparent.getXtabFrame();
- var chartFrame = topparent.getChartFrame();
- if ( topparent.isChartPaneOpen() )
- {
- topparent.chartHeight = chartFrame.document.body.offsetHeight;
- topparent.xtabHeight = xtabFrame.document.body.offsetHeight;
- }
- if((fh.CO.value).substring(0,2)!='GE') //export to PDF
- fh.target = topparent.Data.name;
- else
- fh.target = "_blank";
-
- if ((fh.CO.value).substring(0,4) == 'RA:1') {
-
- fh.target = "_blank";
- }
-
- fh.CNCT.value = 14;
- parseAndSubmit(fh);
- }
- FTok=false;
- }
- function doit(action){
- //preventative parsing
- if ( action.charAt((action.length - 1)) == '\t' && action.charAt((action.length - 2)) == '\t' )
- action = action.substr(0, action.length - 2);
- initVars(); // required for NS3 as it does not trap the resize event
- if (action.charAt(0) == "!") {
- eval(action.substring(1));
- } else {
- if(fh) {
- if(fh.RA.value != 12)
- fh.RA.value = 999;
- if( action.substring(0,2) == "LM" ){
- fh.LM.value=action;
- } else {
- fh.CO.value=action;
- }
- if (fh.CNCT.value == 5) {
- fh.CNCT.value = 1;
- fh.target = "_self";
- }
- crosstab();
- }
- }
- }
- function doParent(action, target){
- fh.CO.value=action;
- if (!topparent.name)
- topparent.name = "temp";
-
- if (target)
- fh.target = target;
- else
- fh.target = topparent.name;
- FTok=false;
- parseAndSubmit(fh);
- }
- function doOver(a,n,r){
- if(FTok) {
- document.images[a].src=gImgArray[n][r].src;
- window.status=what(iconHelp[n]);
- }
- return true;
- }
- function doClick(a,n,it){
- doOver(a,n,2);
- eval("doit('" + it + "')");
- }
- function what(t){
- status = t;
- return true;
- }
- function getGrandParentofFXWindow()
- {
- var retVal = window.parent;
-
- // If we are in split-view, the parent
- // frame will be the "Data" frame. If so,
- // we want the parent of "Data".
- if (retVal.name == "Data")
- retVal = window.parent.parent;
- return retVal;
- }
- function setSelections() {
- var rowSelections = getSelected("r");
- var colSelections = getSelected("c");
- var action = fh.CO.value;
- if(fh.CO.value == "ME")
- fh.EXPL.value = '1';
- if (rowSelections.length == 1 && rowSelections[0].getAttribute("nodeId")){
- if (colSelections.length == 1 || !colSelections.length){
- action += ":" + "r" + rowSelections[0].getAttribute("nodeId");
- }
- }
- if (colSelections.length == 1 && colSelections[0].getAttribute("nodeId")){
- if (!rowSelections.length)
- action += ":" + "c" + colSelections[0].getAttribute("nodeId");
-
- if(rowSelections.length == 1)
- {
- if(fh.CO.value == "ME")
- fh.EXPL.value = '1\tc' + colSelections[0].getAttribute("nodeId");
- }
- }
- fh.CO.value=action;
- }
- function parseAndSubmit(fh)
- {
- //************WARNING*************
- //** Do not do this with any other hidden form parameter
- //** The ACTPANE parameter is special since we know that
- //** it's value is correct, and won't corrupt the LKGS
- //********************************
- //We need to add the active action pane to the LKGS
- if (fh.LKGS)
- fh.LKGS.value += "&ACTPANE=" + fh.ACTPANE.value;
-
- if (fh.DSHSP && !topparent.getGlobal('is_save')) {
- fh.removeChild(fh.DSHSP);
- }
- if ((document.charset && document.charset.toLowerCase() == "shift_jis") ||
- (document.characterSet && document.characterSet.toLowerCase() == "shift_jis"))
- {
- var children = fh.childNodes;
- var length = children.length;
- var i=0;
- for (; i < length; i++)
- {
- var child = children[i];
- if (child.value)
- {
- child.value = escape(child.value);
- var str = child.value;
- str = str.replace(/%u2016/g, "%u2225");
- str = str.replace(/%u2014/g, "%u2015");
- str = str.replace(/%u301C/g, "%uff5e");
- str = str.replace(/%u2212/g, "%uff0d");
- child.value = unescape(str);
- }
- }
- }
- // XSRF-TOKEN cookie is null when disableXSRFCheck=true in bootstrap.properties.
- var xsrfTokenCookie = getCookie("XSRF-TOKEN");
- if (xsrfTokenCookie && (fh.CO.value).substring(0,3) == 'IP:')
- {
- // CAPSIRTS-412 / CAPP-171 and CAPP-332
- // 1. In PowerPlay Studio, right click in blank area of right pane or click "Display Options" in toolbar.
- // 2. Select "Edit Title...", enter or change title, and click "OK".
-
- var input = document.createElement("input");
- input.setAttribute("name", "pp_client_caf");
- input.setAttribute("type", "hidden");
- fh.appendChild(input);
- fh.ppClientCAF = input;
- fh.ppClientCAF.setAttribute("value", "");
-
- var existingForm = document.getElementById(fh.id);
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function()
- {
- if (xhr.readyState === 4)
- {
- parent.Data.document.write(xhr.responseText);
- parent.Data.document.close();
- }
- }
- xhr.open(existingForm.method, existingForm.action, false);
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.setRequestHeader("X-XSRF-TOKEN", xsrfTokenCookie);
- xhr.send(getFormDataQueryString(existingForm));
- }
- else
- {
- fh.submit();
- }
- }
- function getFormDataQueryString(form)
- {
- var keyValuePairs = [];
- for (var i = 0; i < form.elements.length; i++)
- {
- var element = form.elements[i];
- keyValuePairs.push(encodeURIComponent(element.name) + "=" + encodeURIComponent(element.value));
- }
- return queryString = keyValuePairs.join("&");
- }
|