123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971 |
- // 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.
- // of the Custom Exceptions feature of PowerPlay Studio.
- // The functions are Internet Explorer specific.
- var gDefinedExceptionPane = "";
- var gCreateExceptionPane = "";
- var gSelectedException = 0;
- var gbEditPaneActive = 0;
- var customExceptComboBoxes = new Array();
- var customExceptComboBoxIds = new Array();
- var exceptionDefinitionPane = null;
- var exceptionCreationPane = null;
- function writeErrorMessage (msg) {
- displayCommonMessage(msg, MESSAGE_TYPE_INFO, [message_ok_button_text], [function() {removeMessage();}]);
- }
- function numberChange(control) {
- var v = control.value;
- var name = control.name;
- var strMin = localizedStrMinimum.toLowerCase();
- var strMax = localizedStrMaximum.toLowerCase();
- name = name.substr(0, name.length-1);
- if ( (v.toLowerCase() == strMin && name.toLowerCase() == "from") || (v.toLowerCase() == strMax && name.toLowerCase() == "to") ) {
- return;
- }
- var w = "";
- var negative = false;
- var len = v.length;
- for ( var i = 0; i < len; i++ ) {
- if ( ( i==0||i==(len-1) ) && v.charAt(i)=="-" ) {
- negative = true;
- }
- else {
- if ( v.charAt(i) != thousandsep )
- w = w + v.charAt(i);
- }
- }
- v = w;
- var reptchr = "/[^0-9" + decimalpt + "]/";
- var pos = v.search(eval(reptchr));
- if (pos != -1)
- v = v.substring(0,pos);
- if ( negative )
- control.value = "-" + v;
- else
- control.value = v;
- }
- function toHex (num) {
- hexChars = "0123456789ABCDEF";
- var result = "";
- while (num > 0) {
- var hexC = hexChars[num % 16];
- result = hexC + result;
- num = (num - (num % 16)) /16;
- }
-
- if (result.length != 6) {
- for (var i=result.length; i < 6; i++) result = "0" + result;
- }
-
- return result;
- }
- function rgbToHex(num) {
- var r = parseInt(num.substring(4));
- var remains = num.substring(num.indexOf(",") + 1);
- var g = parseInt(remains);
- remains = remains.substring(remains.indexOf(",") + 1);
- var b = parseInt(remains);
- var dec = 65536 * r + 256 * g + b;
- return toHex(dec);
- }
- function setMinField() {
- var obj = document.getElementById(minField);
- if (obj)
- {
- obj.value = localizedStrMinimum;
- localizedStrMinimum = obj.value;
- }
- }
- function setMaxField() {
- var obj = document.getElementById(maxField);
- if (obj)
- {
- obj.value = localizedStrMaximum;
- localizedStrMaximum = obj.value;
- }
- }
- function showHideLayers() { // ask jason no arguments
- var p,v,obj,args=showHideLayers.arguments;
- for (var i=0; i<(args.length-2); i+=3) // ask jason if he remembers
- if ((obj=document.getElementById(args[i]))!=null) {
- v=args[i+2];
- if (obj.style) {
- obj=obj.style;
- v=(v=='show')?'visible':(v='hide')?'hidden':v;
- }
-
- obj.visibility=v;
- }
- }
- function hideAllLayers() {
- for (var i = 1; i < 6; i++) {
- showHideLayers('LayerMin' + i,'','hide');
- showHideLayers('LayerMax' + i,'','hide');
- showHideLayers('LayerFGColor' + i,'','hide');
- showHideLayers('LayerBGColor' + i,'','hide');
- }
- }
- function showLayer (event, name) {
- var obj=document.getElementById(name);
- if (obj) {
- hideAllLayers();
- showHideLayers(name, '', 'show');
- }
- var mgr = new eventManager(event);
- mgr.cancelBubble();
- }
- function refreshDetails(currentX) {
- var range;
- var marker;
- var count = 1;
- var ranges;
- var fgColorVal, bgColorVal, fontSize, textAlign, bold, italic, underlined;
-
- 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 ( var 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));
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
- fontSize = "0";
- if (currentRange.charAt(0) != _rseparator) {
- fontSize = currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
- textAlign = "0";
- if (currentRange.charAt(0) != _rseparator) {
- textAlign = currentRange.substr(0, currentRange.indexOf(_rseparator, 0));
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
-
- bold = false;
- if (currentRange.charAt(0) != _rseparator) {
- bold = (currentRange.substr(0, currentRange.indexOf(_rseparator, 0)) == "1");
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
-
- italic = false;
- if (currentRange.charAt(0) != _rseparator) {
- italic = (currentRange.substr(0, currentRange.indexOf(_rseparator, 0)) == "1");
- }
- currentRange = currentRange.substr((currentRange.indexOf(_rseparator, 0)+1), currentRange.length);
-
- underlined = false;
- if (currentRange.charAt(0) != _rseparator) {
- underlined = (currentRange == "1");
- }
-
- // set up the display
- document.getElementById("Min" + i).innerHTML = minValue;
- document.getElementById("Max" + i).innerHTML = maxValue;
- var exampleCell = document.getElementById("Example" + i);
- exampleCell.innerHTML = '12345';
- exampleCell.style.backgroundColor = bgColorVal;
- exampleCell.style.color = fgColorVal;
-
- if (!bold)
- exampleCell.style.fontWeight = "";
-
- if (italic)
- exampleCell.style.fontStyle = "italic";
-
- if (underlined)
- exampleCell.style.textDecoration = "underline";
-
- switch (textAlign) {
- case "0": exampleCell.style.textAlign = "right"; break;
- case "1": exampleCell.style.textAlign = "left"; break;
- case "2": exampleCell.style.textAlign = "center"; break;
- case "3": exampleCell.style.textAlign = "right"; break;
- }
-
-
- //Set attributes for easy retrieval
- exampleCell.setAttribute("fontSize",fontSize);
- exampleCell.setAttribute("textAlign",textAlign);
-
- if (!bold)
- exampleCell.setAttribute("bold","false");
-
- if (italic)
- exampleCell.setAttribute("italic","true");
-
- if (underlined)
- exampleCell.setAttribute("underline","true");
-
- }
- }
- function clearDetails() {
- for (var i = 1; i <= 5; i++) {
- document.getElementById("currentExceptionLabel").innerHTML = "  ";
- document.getElementById("Min" + i).innerHTML = "";
- document.getElementById("Max" + i).innerHTML = "";
- var exampleCell = document.getElementById("Example" + i);
- exampleCell.innerHTML = "";
- exampleCell.style.backgroundColor = "#FFFFFF";
- exampleCell.style.color = "#000000";
- exampleCell.style.fontWeight = "bold";
- exampleCell.style.fontStyle = "";
- exampleCell.style.textDecoration = "";
- exampleCell.style.textAlign = "";
- exampleCell.setAttribute("fontSize",0);
-
- exampleCell.setAttribute("fontSize","0");
- exampleCell.setAttribute("textAlign","0");
- exampleCell.setAttribute("bold","true");
- exampleCell.setAttribute("italic","false");
- exampleCell.setAttribute("underline","false");
- }
- }
- function loadDetails(selectedOption) {
- // clear the existing exception from the display
- clearDetails();
- gSelectedException = selectedOption.selectedIndex;
- if(gSelectedException == 0) // the 'none' option is selected, there is nothing to load
- return;
- if (!topparent.getXtabFrame().document.fhidden.EX1) {
- clearDetails();
- return;
- }
-
- var customX = topparent.getXtabFrame().document.fhidden.EX1.value;
- var remainingX = customX;
- var currentX;
- var count = 0;
- for (var i = 1; i < gSelectedException*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);
- }
- var sLabel = document.getElementById("DefinedExceptions")[gSelectedException].text;
- document.getElementById("currentExceptionLabel").innerHTML = CEncodingUtil.HtmlEncode(sLabel);
- refreshDetails(currentX);
- }
- function isDuplicateName (name, otherEx)
- {
- //nothing to check!
- if (otherEx.length <= 0) {
- return false;
- }
-
- var tabPos = otherEx.indexOf('\t\t', 0);
- if (tabPos > 0) {
- otherEx = otherEx.substr(0, tabPos);
- }
-
- while (otherEx.charAt(0) == '\t') {
- otherEx = otherEx.substr(1);
- }
-
- var fwdPtr = 0;
- var backPtr = -1;
- while (fwdPtr >= 0) {
- fwdPtr = otherEx.indexOf('\t', backPtr+1);
- if (name.toLowerCase() == otherEx.substr(backPtr+1, fwdPtr-(backPtr+1)).toLowerCase()) {
- return true; //duplicate...return TRUE
- }
- fwdPtr = otherEx.indexOf('\t', fwdPtr+1);
- backPtr = fwdPtr;
- }
-
- //unique name...return FALSE
- return false;
- }
- function getStartPosition() {
- var selectedVal = gSelectedException - 1;
- if (selectedVal < 0) {
- return -1;
- }
- var customX = topparent.getXtabFrame().document.fhidden.EX1.value;
- var count = 0;
- for (var i = 0; i < selectedVal*2; i++) {
- count = customX.indexOf('\t', count+1) ;
- }
- if (customX.charAt(count) == '\t') {
- return count+1;
- } else {
- return count;
- }
- }
- function getEndPosition(startCount) {
- var customX = topparent.getXtabFrame().document.fhidden.EX1.value;
- var endCount = customX.indexOf('\t', startCount);
- endCount = customX.indexOf('\t', endCount+1);
- if (endCount < 0) return customX.length;
- return endCount;
- }
- function buildException() {
- var def = document.getElementById("exception_name_edit_field").value;
- var strMin = localizedStrMinimum.toLowerCase();
- var strMax = localizedStrMaximum.toLowerCase();
- //Error: no exception name
- if (def.length <= 0) {
- writeErrorMessage(noNameErr);
- return (-1);
- }
- def += '\t';
-
- var ranges = "";
- var validChars = "/[^0-9" + decimalpt + "\-]/";
- var pos;
- for ( var i=1 ; i < 6 ; i++ ) {
- var from = document.getElementById("From" + i).value;
- var to = document.getElementById("To" + i).value;
- var decimalPtPattern = new RegExp('\\' + decimalpt);
- if (from != "" && to != "") {
- if (from.toLowerCase() != strMin && !CNumUtil.validateNumField(document.getElementById("From" + i), true, validChars)) {
- writeErrorMessage(invalidRangeValueErr);
- return (-1);
- }
- if (from.toLowerCase() != strMin){
- from = CNumUtil.normalizeDecimal(from);
- ranges += from;
- }
- ranges += _rseparator;
- if (to.toLowerCase() != strMax && !CNumUtil.validateNumField(document.getElementById("To" + i), true, validChars)) {
- writeErrorMessage(invalidRangeValueErr);
- return (-1);
- }
- if (to.toLowerCase() != strMax){
- to = CNumUtil.normalizeDecimal(to);
- ranges += to;
- }
- ranges += _rseparator;
- if (parseFloat(from) > parseFloat(to)) {
- writeErrorMessage(invalidRangeErr);
- return (-1);
- }
- var font = document.getElementById("FGColor" + i);
- var cell = document.getElementById("BGColor" + i);
- var strFont;
- var strCell;
- var strFont = font.getAttribute("color");
- var strCell = cell.getAttribute("color");
-
- var strBold = (document.getElementById("bold" + i).getAttribute("pressed") == "true")? "1" : "0" ;
- var strItalic = (document.getElementById("italic" + i).getAttribute("pressed") == "true")? "1" : "0" ;
- var strUnderline = (document.getElementById("underline" + i).getAttribute("pressed") == "true")? "1" : "0" ;
-
- var strTextAlign = "0";
- if (document.getElementById("textAlign" + i + "_left").getAttribute("pressed") == "true")
- strTextAlign = "1";
- else if (document.getElementById("textAlign" + i + "_center").getAttribute("pressed") == "true")
- strTextAlign = "2";
- else if (document.getElementById("textAlign" + i + "_right").getAttribute("pressed") == "true")
- strTextAlign = "3";
-
- var fontSizes = new Array(0,4,6,7,8,9,10,11,12,13,14,15,16,18,20);
- var strFontSize = "" + fontSizes[customExceptComboBoxes[("fontSize" + i)].getSelectedItem()];
-
- strFont = strFont.toUpperCase();
- ranges += strFont;
- ranges += _rseparator;
- strCell = strCell.toUpperCase();
- ranges += strCell;
- ranges += _rseparator;
-
- ranges += strFontSize;
- ranges += _rseparator;
-
- ranges += strTextAlign;
- ranges += _rseparator;
-
- ranges += strBold;
- ranges += _rseparator;
-
- ranges += strItalic;
- ranges += _rseparator;
-
- ranges += strUnderline;
- ranges += ';';
- } else if (from != "" || to != "") {
- writeErrorMessage(missingRangeValueErr);
- return (-1);
- }
- }
-
- //Error: no valid ranges
- if (ranges.length <= 0) {
- writeErrorMessage(noValidRangeErr);
- return (-1);
- }
-
- //trim off trailing ';'
- ranges = ranges.substr(0, ranges.length-1);
- def += ranges;
- return (def);
- }
- function addException() {
- clearAllPopups();
- var beforeX, afterX, currentX, customX;
- var hidEx = topparent.getXtabFrame().document.fhidden.EX1;
- if(!hidEx)
- customX = "";
- else
- customX = topparent.getXtabFrame().document.fhidden.EX1.value;
-
- var end;
- var start = getStartPosition();
- if (start < 0 || gbEditPaneActive == 0) {
- //must be a new one!! look for '\t\t'...
- var tabPos = customX.indexOf('\t\t', 0);
- if (tabPos < 0) {
- if (customX.length > 0) {
- beforeX = customX + '\t';
- } else {
- beforeX = ""
- }
- end = -1;
- } else {
- beforeX = customX.substr(0, tabPos);
- if( beforeX.length > 0 )
- beforeX += '\t';
- end = tabPos;
- }
- } else {
- beforeX = customX.substr(0, start);
- end = getEndPosition(start) ;
- }
-
- if (end < 0) {
- afterX = "";
- } else {
- afterX = customX.substr(end);
- }
-
- currentX = buildException();
- if (currentX == -1) {
- return;
- }
-
- //now, finally, check for duplicate names
- var tempBeforeX = beforeX;
- if (beforeX.charAt(beforeX.length-1) == '\t') {
- tempBeforeX = beforeX.substr(0, beforeX.length-1);
- }
- otherEx = tempBeforeX + afterX;
- if ( isDuplicateName(currentX.substr(0, currentX.indexOf('\t', 0)), otherEx) ) {
- writeErrorMessage(duplicateNameErr);
- return;
- }
- if(!hidEx) {
- var hiddenForm = topparent.getXtabFrame().document.getElementById("fhidden");
- // set the form's display style to "none" to avoid the xtab shifting downwards. For some unknown reason, IE adjusts the view for this new
- // input object even though it is hidden.
- hiddenForm.style.display = "none";
- if (!topparent.getGlobal("safari"))
- {
- var htmlToAppend = '<INPUT TYPE="HIDDEN" NAME="EX1" VALUE=""/>' + "\n";
- hiddenForm.innerHTML += htmlToAppend;
- }
- else
- {
- var vxPara = topparent.getXtabFrame().document.createElement('INPUT');
- vxPara.setAttribute('type', 'hidden');
- vxPara.setAttribute('NAME', 'EX1');
- vxPara.setAttribute('value', ' ');
- hiddenForm.appendChild(vxPara);
- }
- }
- topparent.getXtabFrame().document.fhidden.EX1.value = beforeX + currentX + afterX;
- var exceptName = document.getElementById("exception_name_edit_field").value;
- // reset the action pane the default size
- topparent.setActionPaneHeight("225");
- document.getElementById("exceptPaneContainer").removeChild(exceptionCreationPane);
- document.getElementById("exceptPaneContainer").appendChild(exceptionDefinitionPane);
- var exceptionList = document.getElementById("DefinedExceptions");
- var index = exceptionList.length;
- var command;
- if (gbEditPaneActive == 0) {
- command = 'A';
- }
- else {
- command = 'E';
- }
-
- topparent.getXtabFrame().doit('X' + command + ':' + '-1');
- if(command == 'A') {
- var newOption = new Option(exceptName,"");
- exceptionList[index] = newOption;
- exceptionList.selectedIndex = index;
- } else {
- exceptionList[gSelectedException].text = exceptName;
- }
- // refresh the details for the currently selected exception
- loadDetails(exceptionList);
- }
- function deleteException () {
- var exceptionList = document.getElementById("DefinedExceptions");
- var index = exceptionList.selectedIndex;
- if (index == 0) // if the none option is selected don't do anything
- return;
-
- topparent.getXtabFrame().doit('XD:' + index);
- exceptionList[index] = null;
- exceptionList.selectedIndex = 0;
- gSelectedException = 0;
- clearDetails();
- }
- function buildSelectionString () {
- var result = "";
- var rowSelections = topparent.getXtabFrame().getSelected("r");
- var colSelections = topparent.getXtabFrame().getSelected("c");
- for(var i = 0; i < rowSelections.length; ++i) {
- if( rowSelections[i].getAttribute("summary") )
- result += "S";
- result += rowSelections[i].getAttribute("ppdsId") + "\t";
- }
- for(var i = 0; i < colSelections.length; ++i) {
- if( colSelections[i].getAttribute("summary") )
- result += "S";
- result += colSelections[i].getAttribute("ppdsId") + "\t";
- }
- if (topparent.getXtabFrame().allSelected)
- result += "ALL" + "\t";
- return result;
- }
- function generateDefaultName() {
-
- var generatedName = "";
- var i = 1;
- if(!topparent.getXtabFrame().document.fhidden.EX1)
- return defaultExceptionNameLabel + i;
- var customX = topparent.getXtabFrame().document.fhidden.EX1.value;
- while(generatedName == "") {
- if(!customX) {
- generatedName = defaultExceptionNameLabel + i;
- }
- else if(!isDuplicateName(defaultExceptionNameLabel + i, customX)) {
- generatedName = defaultExceptionNameLabel + i;
- }
- ++i;
- }
- return generatedName;
- }
- function newException () {
- gbEditPaneActive = 0;
- // adjust the size of the action pane to accomodate the new exception pane.
- topparent.setActionPaneHeight("280");
-
- document.getElementById("exceptPaneContainer").removeChild(exceptionDefinitionPane);
- document.getElementById("exceptPaneContainer").appendChild(exceptionCreationPane);
- // load defaults values
- document.getElementById("exception_name_edit_field").value = generateDefaultName();
- for (var i = 1; i <= 5; i++) {
- document.getElementById("From" + i).value = "";
- document.getElementById("To" + i).value = "";
- setColorPicker(("BGColor" + i),"FFFFFF");
- setColorPicker(("FGColor" + i),"000000");
- setButtonState(document.getElementById("bold" + i),true);
- setButtonState(document.getElementById("italic" + i),false);
- setButtonState(document.getElementById("underline" + i),false);
- setButtonState(document.getElementById("textAlign" + i + "_left"),false);
- setButtonState(document.getElementById("textAlign" + i + "_center"),false);
- setButtonState(document.getElementById("textAlign" + i + "_right"),false);
- customExceptComboBoxes[("fontSize" + i)].setSelectedItem(0);
- }
- }
- function editException () {
- if(gSelectedException == 0) // none option is selected
- return newException();
- gbEditPaneActive = 1;
- // adjust the size of the action pane to accomodate the edit exception pane.
- topparent.setActionPaneHeight("294");
- var exceptionsSelect = document.getElementById("DefinedExceptions");
- var nameOfException = exceptionsSelect[exceptionsSelect.selectedIndex].text;
- var minSetting = new Array(5);
- var maxSetting = new Array(5);
- var bgColors = new Array(5);
- var fgColors = new Array(5);
- var fontSizes = new Array(5);
- var textAligns = new Array(5);
- var bolds = new Array(5);
- var italics = new Array(5);
- var underlines = new Array(5);
- for (var i = 1; i <= 5; ++i) {
- minSetting[i-1] = document.getElementById("Min" + i).innerHTML;
- maxSetting[i-1] = document.getElementById("Max" + i).innerHTML;
- var cellExample = document.getElementById("Example" + i);
- bgColors[i-1] = cellExample.style.backgroundColor;
- fgColors[i-1] = cellExample.style.color;
-
- fontSizes[i-1] = parseInt(cellExample.getAttribute("fontSize"));
- textAligns[i-1] = parseInt(cellExample.getAttribute("textAlign"));
- bolds[i-1] = (cellExample.getAttribute("bold") == "true");
- italics[i-1] = (cellExample.getAttribute("italic") == "true");
- underlines[i-1] = (cellExample.getAttribute("underline") == "true");
- }
- document.getElementById("exceptPaneContainer").removeChild(exceptionDefinitionPane);
- document.getElementById("exceptPaneContainer").appendChild(exceptionCreationPane);
-
- document.getElementById("exception_name_edit_field").value = nameOfException;
- for (var i = 1; i <= 5; ++i) {
- document.getElementById("From" + i).value = minSetting[i-1];
- document.getElementById("To" + i).value = maxSetting[i-1];
-
- var bgcolor = bgColors[i-1].toString();
- var fgcolor = fgColors[i-1].toString();
-
- if (bgcolor.substring(0,3) == "rgb") {
- bgcolor = rgbToHex(bgcolor);
- fgcolor = rgbToHex(fgcolor);
- } else {
- bgcolor = bgcolor.toUpperCase().substr(1);
- fgcolor = fgcolor.toUpperCase().substr(1);
- }
- setColorPicker(("BGColor" + i),bgcolor);
- setColorPicker(("FGColor" + i),fgcolor);
-
- setButtonState(document.getElementById("bold" + i), bolds[i-1]);
- setButtonState(document.getElementById("italic" + i), italics[i-1]);
- setButtonState(document.getElementById("underline" + i), underlines[i-1]);
-
- setButtonState(document.getElementById("textAlign" + i + "_left"), (textAligns[i-1] == "1"));
- setButtonState(document.getElementById("textAlign" + i + "_center"), (textAligns[i-1] == "2"));
- setButtonState(document.getElementById("textAlign" + i + "_right"), (textAligns[i-1] == "3"));
-
- var fontSizeItem = 0;
- switch (fontSizes[i-1]) {
- case 0: fontSizeItem = 0; break;
- case 4: fontSizeItem = 1; break;
- case 6: fontSizeItem = 2; break;
- case 7: fontSizeItem = 3; break;
- case 8: fontSizeItem = 4; break;
- case 9: fontSizeItem = 5; break;
- case 10: fontSizeItem = 6; break;
- case 11: fontSizeItem = 7; break;
- case 12: fontSizeItem = 8; break;
- case 13: fontSizeItem = 9; break;
- case 14: fontSizeItem = 10; break;
- case 15: fontSizeItem = 11; break;
- case 16: fontSizeItem = 12; break;
- case 18: fontSizeItem = 13; break;
- case 20: fontSizeItem = 14; break;
- }
- customExceptComboBoxes[("fontSize" + i)].setSelectedItem(fontSizeItem);
-
- }
- }
- function onCancel() {
- clearAllPopups();
- topparent.setActionPaneHeight("230");
- document.getElementById("exceptPaneContainer").removeChild(exceptionCreationPane);
- document.getElementById("exceptPaneContainer").appendChild(exceptionDefinitionPane);
- loadDetails(document.getElementById("DefinedExceptions"));
- }
- function onOk() {
- applyException();
- topparent.closeActionPane();
- }
- function applyException () {
- var selectionString = buildSelectionString();
- if (selectionString.length == 0) {
- return;
- }
- if (selectionString.indexOf("ALL") >= 0)
- selectionString = 0;
- var command;
- var index = document.getElementById("DefinedExceptions").selectedIndex;
- var value = '"' + selectionString + '"';
- if (index == 0) {
- index = "none";
- }
-
- command = 'XP:' + '"' + index +'"' + '\t' + value;
- topparent.getXtabFrame().doit(command);
- }
- function init () {
- topparent.openActionPane();
- topparent.setActionPaneHeight("230");
-
- initFontSizes();
-
- // cache the defined exceptions pane and clear it from the active pane
- exceptionDefinitionPane = document.getElementById("definedExceptPane");
- document.getElementById("exceptPaneContainer").removeChild(exceptionDefinitionPane);
- // cache the new/edit exception pane and clear it from active pane
- exceptionCreationPane = document.getElementById("createExceptPane");
- document.getElementById("exceptPaneContainer").removeChild(exceptionCreationPane);
-
- // set the active pane to the defined exception pane
- document.getElementById("exceptPaneContainer").appendChild(exceptionDefinitionPane);
- }
- function fontButtonClicked(event) {
- var eventM = new eventManager(event);
- eventM.cancelBubble();
- var button = eventM.getSrc();
- toggleButton(button);
- }
- function toggleButton(button) {
- if (button.getAttribute("isdisabled") == "true")
- return;
- if (button.getAttribute("pressed") == "true") {
- setButtonState(button,false);
- } else {
- setButtonState(button,true);
- }
- }
- function setButtonState(button,pressed) {
- if (pressed) {
- button.className = "chartOptionsFontButtonPressed";
- button.setAttribute("pressed","true");
- } else {
- button.className = "chartOptionsFontButton";
- button.setAttribute("pressed","false");
- }
- }
- function rolloverbutton(button) {
- if (button.getAttribute("isdisabled") == "true")
- return;
- if (button.getAttribute("pressed") == "true") {
- button.className = "chartOptionsFontButtonRolloverPressed";
- } else {
- button.className = "chartOptionsFontButtonRollover";
- }
- }
- function rolloutbutton(button) {
- if (button.getAttribute("isdisabled") == "true")
- return;
- if (button.getAttribute("pressed") == "true") {
- button.className = "chartOptionsFontButtonPressed";
- } else {
- button.className = "chartOptionsFontButton";
- }
- }
- function alignButtonClicked(event) {
- var eventM = new eventManager(event);
- eventM.cancelBubble();
- var button = eventM.getSrc();
-
- if (button.getAttribute("pressed") == "true") {
- setButtonState(button,false);
- } else {
- setButtonState(document.getElementById(button.id.substr(0,button.id.indexOf("_")) + "_left"),false);
- setButtonState(document.getElementById(button.id.substr(0,button.id.indexOf("_")) + "_center"),false);
- setButtonState(document.getElementById(button.id.substr(0,button.id.indexOf("_")) + "_right"),false);
- setButtonState(button,true);
- }
- }
- function initFontSizes() {
-
- //Because of the removal of the combo boxes from the dom, they have to be intialized each
- //time the edit exception pane is viewed.
-
- for (var i = 1; i <= 5; i++) {
- var id = "fontSize" + i;
- initializeFontSizeSelect(id);
- }
- }
- function initializeFontSizeSelect(comboBoxId,action) {
- var currentFontSizeSelect = document.getElementById(comboBoxId);
- if (currentFontSizeSelect) {
- var currentComboBox = initComboBox(currentFontSizeSelect);
- currentComboBox.addItem(new cbTextItem(strDefault, action, true));
- currentComboBox.addItem(new cbTextItem("4", action, false));
- currentComboBox.addItem(new cbTextItem("6", action, false));
- currentComboBox.addItem(new cbTextItem("7", action, false));
- currentComboBox.addItem(new cbTextItem("8", action, false));
- currentComboBox.addItem(new cbTextItem("9", action, false));
- currentComboBox.addItem(new cbTextItem("10", action, false));
- currentComboBox.addItem(new cbTextItem("11", action, false));
- currentComboBox.addItem(new cbTextItem("12", action, false));
- currentComboBox.addItem(new cbTextItem("13", action, false));
- currentComboBox.addItem(new cbTextItem("14", action, false));
- currentComboBox.addItem(new cbTextItem("15", action, false));
- currentComboBox.addItem(new cbTextItem("16", action, false));
- currentComboBox.addItem(new cbTextItem("18", action, false));
- currentComboBox.addItem(new cbTextItem("20", action, false));
- customExceptComboBoxes[comboBoxId] = currentComboBox;
- customExceptComboBoxIds[customExceptComboBoxIds.length] = comboBoxId;
- }
- }
- function clearAllPopups() {
- for (var i = 0; i < customExceptComboBoxIds.length; i++) {
- customExceptComboBoxes[customExceptComboBoxIds[i]].hideDropDown();
- }
- hideColorPicker();
- }
|