123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- // Licensed Materials - Property of IBM
- //
- // IBM Cognos Products: pps
- //
- // (C) Copyright IBM Corp. 2005, 2017
- //
- // 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 the Main pane of the
- // Custom Exceptions feature of PowerPlay Studio.
- // The functions handle any minor browser differences.
- var isNSBrowser = navigator.appName.indexOf("Netscape")>=0;
- if( navigator.appVersion == "" )
- isNSBrowser = false;
- var isNSMac = isNSBrowser && navigator.platform.indexOf("Mac") >= 0;
- var isIE = false; // Microsoft Internet Explorer
- var isNS4 = false; // Netscape 4+
- var isW3C = false; // W3C compliant (inc NS6)
- var isUnknown = true; // in case something else comes along
- if (document.getElementById) {
- isW3C = true ; // NS6, MSIE 5, 6 and Opera 6.01 in Opera mode
- isUnknown = false;
- }
- if (document.all) {
- isIE = true ; // MSIE (all versions) and Opera 6.01 in MSIE 5 mode
- isUnknown = false;
- }
- if (document.layers) {
- isNS4 = true ; // NS 4
- isUnknown = false;
- }
- var isGecko = isNSBrowser && isW3C;
- function findObj(n, d) {
- if (!isGecko) {
- var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
- d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
- if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
- for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
- if(!x && document.getElementById) x=document.getElementById(n); return x;
- } else {
- var p,i,x;
- if(!d)
- d=document;
- if((p=n.indexOf("?"))>0 && parent.frames.length) {
- d=parent.frames[n.substring(p+1)].contentDocument;
- n=n.substring(0,p);
- }
- x = document.getElementById(n);
- if(!x&&d.childNodes)
- x=d.getElementById(n);
- for (i=0;!x&&i<d.forms.length;i++)
- x=d.forms[i][n];
- return x;
- }
- }
- function editException () {
- if (parent.isXtabStillLoading())
- {
- setTimeout("editException(" + index + ")", 50);
- return;
- }
- winFX.doit('XE:' + parent.getSelException() );
- }
- function addException () {
- if (parent.isXtabStillLoading())
- {
- setTimeout("addException()", 50);
- return;
- }
- winFX.doit('XA:' + parent.getSelException() );
- }
- function deleteException () {
- if (parent.isXtabStillLoading())
- {
- setTimeout("deleteException(" + value + ")", 50);
- return;
- }
- var index = parent.getSelException();
- if (index == 0)
- return;
-
- winFX.doit('XD:' + index);
- }
- function applyException () {
- if (parent.isXtabStillLoading())
- {
- setTimeout("applyException()", 50);
- return;
- }
- if (findObj("selInfo").value.indexOf("sel_info") > 0) {
- writeErrorMessage(errNoSelection);
- return;
- }
- var command;
- var index = findObj("DefinedExceptions").selectedIndex;
- var value = '"' + findObj("selInfo").value + '"';
- if (index == 0) {
- index = "none";
- }
-
- command = 'XP:' + '"' + index +'"' + '\t' + value;
- winFX.doit(command);
- }
- function writeLayerDocument (content) {
- var doc = document.layers["Details"].document;
- doc.open();
- doc.write(content);
- doc.close();
- }
- function clearDetails(startIdx, bDoNoneLabel) {
- if (isNSBrowser && !isGecko) {
- var content = '<table cellspacing="0" cellpadding="0" border="0" ><tr width="100%"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> ' + fromLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> ' + toLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> ' + colorLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td></tr><tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr><tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr><tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" align="center" class="CustomExceptionDescription">' + noneLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right"';
- content = content + 'class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr><tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr><tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr></table>';
- writeLayerDocument(content);
- } else if (!isGecko) {
- for (var i = startIdx; i < 6; i++) {
- eval("document.all.From" + i).innerHTML = "";
- eval("document.all.To" + i).innerHTML = "";
- eval("document.all.Color" + i).innerHTML = "";
- eval("document.all.Color" + i + ".style").color = "#000000";
- eval("document.all.Color" + i + ".style").backgroundColor = "#FFFFFF";
- eval("document.all.Color" + i + ".style").height = 12;
- }
- if (bDoNoneLabel) {
- document.all.To3.innerHTML = noneLabel;
- document.all.To3.style.textAlign = "center";
- }
- } else {
- for (var i = startIdx; i < 6; i++) {
- document.getElementById("From" + i).innerHTML = "";
- document.getElementById("From" + i).style.height = 12;
- document.getElementById("To" + i).innerHTML = "";
- document.getElementById("To" + i).style.height = 12;
- document.getElementById("Color" + i).innerHTML = "";
- document.getElementById("Color" + i).style.color = "#000000";
- document.getElementById("Color" + i).style.backgroundColor = "#FFFFFF";
- document.getElementById("Color" + i).style.height = 12;
- }
- if (bDoNoneLabel) {
- document.getElementById("To3").innerHTML = noneLabel;
- document.getElementById("To3").style.textAlign = "center";
- }
- }
- }
- function refreshDetails(currentX) {
- var range;
- var marker;
- var count = 1;
- var ranges;
- var i;
- var layerDoc = '<table cellspacing="0" cellpadding="0" border="0" ><tr width="100%"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> ' + fromLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> ' + toLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> ' + colorLabel + '</td><td width="1" bgcolor="#CCCCFF"> </td></tr>';
- var fgColorVal, bgColorVal;
-
- marker = currentX.indexOf("\t");
- if (marker < 0 && currentX.length > 0) {
- ranges = currentX;
- } else {
- ranges = currentX.substr(0, marker);
- }
- marker = 0;
- while ( (marker = ranges.indexOf(";", marker+1)) > 0 ) {
- count++;
- }
- for ( i = 1; i <= count; i++) {
- var currentRange;
- var minValue, maxValue;
- if ( (marker = ranges.indexOf(";", 0)) > 0 ) {
- currentRange = ranges.substr(0, marker);
- ranges = ranges.substr(marker+1, ranges.length);
- } else {
- currentRange = ranges;
- }
- //Minimum
- minValue = localizedStrMinimum;
- if (currentRange.charAt(0) != _rseparator) {
- minValue = currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- minValue = minValue.replace("\.", decimalpt);
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
- //Maximum
- maxValue = localizedStrMaximum;
- if (currentRange.charAt(0) != _rseparator) {
- maxValue = currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- maxValue = maxValue.replace("\.", decimalpt);
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
- //Font color
- fgColorVal = "#000000";
- if (currentRange.charAt(0) != _rseparator) {
- fgColorVal = '#' + currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
- //Background color
- bgColorVal = "#FFFFFF";
- if (currentRange.charAt(0) != _rseparator) {
- bgColorVal = '#' + currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- }
- if (isNSBrowser && !isGecko) {
- layerDoc += '<tr><td width="1" bgcolor="#CCCCFF"> </td><td height="20%" width="40%" bgcolor="#FFFFFF"> ' + minValue + ' </td>';
- layerDoc += '<td width="1" bgcolor="#CCCCFF"> </td><td height="20%" width="40%" bgcolor="#FFFFFF"> ' + maxValue + ' </td>';
- layerDoc += '<td width="1" bgcolor="#CCCCFF"> </td><td width="20%" height="20%" align="right" bgcolor=' + '"' + bgColorVal + '"' + '><font color=' + '"' + fgColorVal + '"' + '>123</font></td><td width="1" bgcolor="#CCCCFF"> </td></tr>';
- } else if (!isGecko) {
- eval("document.all.From" + i).innerHTML = minValue;
- eval("document.all.To" + i).innerHTML = maxValue;
- eval("document.all.Color" + i).style.color = fgColorVal;
- eval("document.all.Color" + i).style.backgroundColor = bgColorVal;
- eval("document.all.Color" + i).innerHTML = "123";
- eval("document.all.Color" + i).style.height = 12;
- } else {
- document.getElementById("From" + i).innerHTML = minValue;
- document.getElementById("To" + i).innerHTML = maxValue;
- document.getElementById("Color" + i).style.color = fgColorVal;
- document.getElementById("Color" + i).style.backgroundColor = bgColorVal;
- document.getElementById("Color" + i).innerHTML = "123";
- document.getElementById("Color" + i).style.height = 15;
- }
- }
- if (isNSBrowser && !isGecko) {
- //clear the rest...
- for (; i < 6 ; i++ ) {
- layerDoc += '<tr bgcolor="#FFFFFF"><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" height="20%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="40%" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td><td width="20%" align="right" class="CustomExceptionDescription"> </td><td width="1" bgcolor="#CCCCFF"> </td></tr>';
- }
- layerDoc += '</table>';
- writeLayerDocument(layerDoc);
- } else if (!isGecko){
- clearDetails(i, false);
- //gets set to center for "none" exception
- document.all.To3.style.textAlign = "left";
- } else {
- clearDetails(i, false);
- //gets set to center for "none" exception
- document.getElementById("To3").style.textAlign = "left";
- }
- }
- function loadDetails(selectedVal) {
- if ( parent.isXtabStillLoading() ) {
- setTimeout("loadDetails(" + selectedVal + ")", 50);
- return;
- }
- parent.setSelException(selectedVal);
- if (selectedVal == 0 || typeof(findObj("EX1", winFX.document)) == "undefined") {
- clearDetails(1, true);
- return;
- }
- var customX = findObj("EX1", winFX.document).value;
- var remainingX = customX;
- var currentX;
- var count = 0;
- for (var i = 1; i < selectedVal*2; i++) {
- //trim off the name
- count = remainingX.indexOf("\t") + 1;
- if ( count == 1 ) {
- count = 0;
- break;
- }
- remainingX = remainingX.substring(count, customX.length);
- }
- var endcount = remainingX.indexOf("\t");
- if (endcount < 0) {
- currentX = remainingX;
- } else {
- currentX = remainingX.substr(0, endcount);
- }
-
- refreshDetails(currentX);
- }
- function writeErrorMessage (msg) {
- var err = findObj("ErrorMessage");
- if (err) {
- if (isNSBrowser && !isGecko) {
- err.visibility = "visible";
- err.moveTo(11, document.layers["Details"].top + document.layers["Details"].clip.bottom);
- err.resizeTo(parent.FE.innerWidth - 26, 50);
- err.document.open();
- err.document.write('<html><body><table><tr><td><img src="../ppwb/Graphics/error.gif" height=18 width=18 alt=""></td><td class="CustomException" valign="middle">' + msg + '</td></tr></table></body></html>');
- err.document.close();
- } else {
- err.innerHTML = '<table><tr><td valign="middle"><img src="../ppwb/Graphics/error.gif" height=18 width=18 alt=""></td><td class="CustomException" valign="middle">' + msg + '</td></tr></table><br><br>';
- }
- }
- }
- function computeClip (layer) {
- layer.clip.left = 1;
- layer.clip.top = -1;
- if (isNSMac) {
- layer.clip.bottom = 100;
- layer.clip.right = parent.FE.innerWidth - (0.1 * parent.FE.innerWidth);
- } else {
- layer.clip.bottom = 120;
- layer.clip.right = parent.FE.innerWidth - 25;
- }
- }
|