123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| BI and PM: prmt
- *| (C) Copyright IBM Corp. 2002, 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or
- *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *|
- *+------------------------------------------------------------------------+
- */
- /*
- CMultipleRange.js
- This script is used to provide interactivity for the
- multiple select versions for range controls.
- */
- //Constructor to create a CMultipleRange component
- // oRangeControl: the range picker control
- // oLstChoices: the name of the select form control
- // oSubmit: the form control to submit selections to the server
- // bRequired: is this a required field true/false
- // sSubmitType: submit this as a standard form, or as XML
- // oErrorFeedback: object used to provide validation feedback
- // oSizer: image object used to control the minimum size of the multiple select list
- // sRef: the id for the control
- // oInsertButton: the insert button
- // oRemoveButton: the remove button
- function CMultipleRange(oRangeControl, oLstChoices, oSubmit, bRequired, sSubmitType, oErrorFeedback, oSizer, sRef, oInsertButton, oRemoveButton, sCVId)
- {
- this.setCVId(sCVId);
- this.m_oRangeControl = oRangeControl;
- this.m_oLstChoices = oLstChoices;
- this.m_oSubmit = oSubmit;
- this.m_bRequired = bRequired;
- this.m_bValid = false;
- this.m_sSubmitType = sSubmitType;
- this.m_oErrorFeedback = oErrorFeedback;
- this.m_sErrorFeedbackClass = "clsFeedbackWidgetParseErrorArrowLeft";
- this.m_oSizer = oSizer;
- this.m_sRef = sRef;
- this.m_aSuperRangeLiterals = new Array();
- if (oInsertButton)
- {
- this.m_oInsertButton = oInsertButton;
- }
- if (oRemoveButton)
- {
- this.m_oRemoveButton = oRemoveButton;
- }
- this.checkData();
- if (this.m_oSizer)
- {
- this.m_bSizeAvailable = false;
- this.m_iResizeTestCounter = 0;
- this.m_iInterval = window.setInterval ('multipleRange'+ this.m_sRef +'.testResize()', 250);
- }
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- CMultipleRange.prototype = new CPromptControl();
- //select all items
- function CMultipleRange_selectAll()
- {
- for (var i=0; i < this.m_oLstChoices.options.length; i++)
- {
- this.m_oLstChoices.options[i].selected = true;
- }
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //remove selection from all items
- function CMultipleRange_deSelectAll()
- {
- for (var i=0; i < this.m_oLstChoices.options.length; i++)
- {
- this.m_oLstChoices.options[i].selected = false;
- }
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //insert values from the picker control (deprecated)
- //use values in the following format
- // simpleParmValueItem (equals) [value]
- // boundRangeParmValueItem (between) [value from]:[value to]
- // unboundedEndRangeParmValueItem (greater than or equal to) [value from]:
- // unboundedStartRangeParmValueItem (less than or equal to) :[value to]
- //
- // display values formatted in a way that is appropriate for the user's locale
- function CMultipleRange_insert()
- {
- var sInsertUse = decodeURIComponent(this.m_oRangeControl.sGetValue());
- var sInsertDisplay = this.m_oRangeControl.sGetFormatValue();
- if ((sInsertUse) && (sInsertDisplay))
- {
- this.m_oLstChoices.options[this.m_oLstChoices.options.length] = new Option(sInsertDisplay, sInsertUse, false, false);
- //resize the list to fit the data if required
- this.resizeList();
- this.resizeList();
- }
- else
- {
- //animate the controls that are missing values
- //if the browser has the capability
- if (document.getElementById)
- {
- animateValueMissing("tdRangeFrom" + this.m_sRef,"tdRangeTo" + this.m_sRef);
- }
- }
- this.checkData();
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //remove selections from the list of choices (deprecated)
- function CMultipleRange_remove()
- {
- this.removeSelectedChoices();
- //resize the list to fit the data if required
- this.resizeList();
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //perform any special processing for the server.
- // convert to the following format
- // <selectChoices>
- // <selectBoundRange selected="[true | false]">
- // <start displayValue="[user value]" useValue="[system value]"/>
- // <end displayValue="[user value]" useValue="[system value]"/>
- // </selectBoundRange>
- // <selectUnboundedEndRange selected="[true | false]">
- // <start displayValue="[user value]" useValue="[system value]"/>
- // </selectUnboundedEndRange>
- // <selectUnboundedStartRange selected="[true | false]">
- // <end displayValue="[user value]" useValue="[system value]"/>
- // </selectUnboundedStartRange>
- // <selectOption displayValue="[user value]" useValue="[system value]" selected="[true | false]"/>
- // </selectChoices>
- function CMultipleRange_preProcess()
- {
- if (this.m_sSubmitType == K_PRMT_sXML)
- {
- //convert the data to XML and submit
- var sURLValues = K_PRMT_sEMPTY;
- if (this.m_aSuperRangeLiterals.length > 0)
- {
- for (var j=0; j < this.m_aSuperRangeLiterals.length; j++)
- {
- //determine the type of filter
- switch (this.m_aSuperRangeLiterals[j].getType())
- {
- //equals FILTER_EQUAL_TO
- case 0:
- sURLValues += '<selectOption';
- sURLValues += ' displayValue="' + sXmlEncode(this.m_aSuperRangeLiterals[j].getStartDisplayValue()) +'"';
- sURLValues += ' useValue="' + sXmlEncode(this.m_aSuperRangeLiterals[j].getStartUseValue()) +'"';
- if (this.m_aSuperRangeLiterals[j].selected == true)
- {
- sURLValues += ' selected="true" />';
- }
- else
- {
- sURLValues += ' selected="false" />';
- }
- break;
- //greater than or equal to FILTER_GREATER_THAN_OR_EQUAL_TO
- case 1:
- sURLValues += '<selectUnboundedEndRange';
- if (this.m_aSuperRangeLiterals[j].selected == true)
- {
- sURLValues += ' selected="true" >';
- }
- else
- {
- sURLValues += ' selected="false" >';
- }
- sURLValues += '<start displayValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getStartDisplayValue()) +'" useValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getStartUseValue()) +'"/>';
- sURLValues += '</selectUnboundedEndRange>';
- break;
- //less than or equal to FILTER_LESS_THAN_OR_EQUAL_TO
- case 2:
- sURLValues += '<selectUnboundedStartRange';
- if (this.m_aSuperRangeLiterals[j].selected == true)
- {
- sURLValues += ' selected="true" >';
- }
- else
- {
- sURLValues += ' selected="false" >';
- }
- sURLValues += '<end displayValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getEndDisplayValue()) +'" useValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getEndUseValue()) +'"/>';
- sURLValues += '</selectUnboundedStartRange>';
- break;
- //between FILTER_BETWEEN
- case 3:
- sURLValues += '<selectBoundRange';
- if (this.m_aSuperRangeLiterals[j].selected == true)
- {
- sURLValues += ' selected="true" >';
- }
- else
- {
- sURLValues += ' selected="false" >';
- }
- sURLValues += '<start displayValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getStartDisplayValue()) +'" useValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getStartUseValue()) +'"/>';
- sURLValues += '<end displayValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getEndDisplayValue()) +'" useValue="'+ sXmlEncode(this.m_aSuperRangeLiterals[j].getEndUseValue()) +'"/>';
- sURLValues += '</selectBoundRange>';
- break;
- default:
- break;
- }
- }
- }
- addSelectChoices(this.m_oSubmit, sURLValues);
- }
- else
- {
- //select all the choices so they can be submitted with the form
- var i=0;
- for(i = 0; i < this.m_oLstChoices.options.length; i ++)
- {
- this.m_oLstChoices.options[i].selected = true;
- }
- }
- }
- //return true unless this is a required prompt
- //and there are no values
- function CMultipleRange_checkData()
- {
- if ((this.m_bRequired == true) && (this.m_oLstChoices.options.length === 0))
- {
- this.m_bValid = false;
- this.checkFail();
- return false;
- }
- else
- {
- this.m_bValid = true;
- this.checkPass();
- return true;
- }
- }
- //wait until the size of the list box is known
- //then trigger a resize -- used in conjunction with an interval
- function CMultipleRange_testResize()
- {
- if (this.m_bSizeAvailable == false)
- {
- if (this.m_oSizer.width != 0 || this.m_iResizeTestCounter < 100)
- {
- this.m_bSizeAvailable = true;
- this.resizeList();
- }
- else
- {
- this.m_iResizeTestCounter++;
- }
- }
- else
- {
- window.clearInterval(this.m_iInterval);
- }
- }
- //make sure that choices are always visible and set a minimum size
- //resize the list to fit the data if required
- //if there are no items, prevent the list from
- //shrinking too small
- //allow the list to expand to fit the biggest item
- function CMultipleRange_resizeList()
- {
- if (this.m_oSizer)
- {
- if(this.m_oLstChoices.style.tableLayout!='fixed')
- {
- this.m_oLstChoices.style.width='auto';
- }
- if (this.m_oSizer.width < 200)
- {
- this.m_oLstChoices.style.width='200px';
- }
- }
- }
- //Trap whether the user has pressed the delete key
- //in the choices box. Note that this function is
- //IE specific
- function CMultipleRange_catchDeleteKey(iKeyCode)
- {
- //catch the Delete key code
- if (iKeyCode == 46)
- {
- this.removeChoiceList();
- }
- }
- //enable and disable the insert and remove buttons
- //based on what the user has selected
- function CMultipleRange_checkInsertRemove()
- {
- if (this.m_oInsertButton)
- {
- //determine if the range is required
- if (this.m_bRequired == true)
- {
- if ((this.m_oRangeControl.getValid() == true) && this.m_oRangeControl.hasValue())
- {
- this.m_oInsertButton.disabled = false;
- }
- else
- {
- this.m_oInsertButton.disabled = true;
- this.m_oInsertButton.className = "clsInsertRemoveButton";
- }
- }
- else
- {
- if ((this.m_oRangeControl.getValid() == true) && this.m_oRangeControl.hasValue())
- {
- this.m_oInsertButton.disabled = false;
- }
- else
- {
- this.m_oInsertButton.disabled = true;
- this.m_oInsertButton.className = "clsInsertRemoveButton";
- }
- }
- }
- if (this.m_oRemoveButton)
- {
- if (this.m_oLstChoices.selectedIndex == -1)
- {
- this.m_oRemoveButton.disabled = true;
- this.m_oRemoveButton.className = "clsInsertRemoveButton";
- }
- else
- {
- this.m_oRemoveButton.disabled = false;
- }
- }
- }
- //used to add super range literal items when rendering the UI
- function CMultipleRange_addSuperRangeLiteral(sStartUse, sStartDisplay, sEndUse, sEndDisplay, sDataType)
- {
- var newRangeLiteral = new CSuperRangeLiteral(sStartUse, sStartDisplay, sEndUse, sEndDisplay, sDataType);
- //add the new range literal
- this.m_aSuperRangeLiterals = this.m_aSuperRangeLiterals.concat(newRangeLiteral);
- var rangeOption = document.createElement("option");
- rangeOption.text = newRangeLiteral.getLabel();
- rangeOption.value = newRangeLiteral.getLiteral();
- if (window.ie)
- {
- this.m_oLstChoices.add(rangeOption);
- }
- else
- {
- this.m_oLstChoices.add(rangeOption, null);
- }
- }
- //used to add user specified ranges when the user presses the insert button
- function CMultipleRange_insertSuperRangeLiteral()
- {
- //check filters
- var sStartUse = null;
- var sStartDisplay = null;
- var sEndUse = null;
- var sEndDisplay = null;
- var sDataType = null;
- var oRangeControl = this.m_oRangeControl;
- if ( oRangeControl.isRequired() || (oRangeControl.m_oRadioFrom.checked == true))
- {
- var fromGetValue = oRangeControl.fromGetValue();
- if (( fromGetValue!= K_PRMT_sEMPTY) || ( fromGetValue!= null) || ( fromGetValue != false))
- {
- sStartUse = fromGetValue;
- }
- var fromGetFormatValue = oRangeControl.fromGetFormatValue();
- if (( fromGetFormatValue!= K_PRMT_sEMPTY) || ( fromGetFormatValue!= null) || ( fromGetFormatValue != false))
- {
- sStartDisplay = fromGetFormatValue;
- }
- }
- if ( oRangeControl.isRequired() || (oRangeControl.m_oRadioTo.checked == true))
- {
- var toGetValue = oRangeControl.toGetValue();
- if (( toGetValue!= K_PRMT_sEMPTY) || ( toGetValue!= null) || ( toGetValue != false))
- {
- sEndUse = toGetValue;
- }
- var toGetFormatValue = oRangeControl.toGetFormatValue();
- if (( toGetFormatValue!= K_PRMT_sEMPTY) || ( toGetFormatValue!= null) || ( toGetFormatValue != false))
- {
- sEndDisplay = toGetFormatValue;
- }
- }
- if (oRangeControl.isRangeReversed(sStartUse, sEndUse))
- {
- var sTempUse = sStartUse;
- sStartUse = sEndUse;
- sEndUse = sTempUse;
- var sTempDisplay = sStartDisplay;
- sStartDisplay = sEndDisplay;
- sEndDisplay = sTempDisplay;
- }
- this.addSuperRangeLiteral(sStartUse, sStartDisplay, sEndUse, sEndDisplay, sDataType);
- }
- //used to remove user specified ranges when the user presses the remove button
- function CMultipleRange_removeSuperRangeLiteral(ipos)
- {
- //split array in two, remove the given item, join the arrays together
- var firstPart = this.m_aSuperRangeLiterals.slice(0,ipos);
- var secondPart = this.m_aSuperRangeLiterals.slice(ipos+1);
- this.m_aSuperRangeLiterals = firstPart.concat (secondPart);
- }
- function CMultipleRange_initChoiceList()
- {
- //clear the list
- this.m_oLstChoices.options.length = 0;
- //add all the range literals to the list box
- for (var j=0; j < this.m_aSuperRangeLiterals.length; j++)
- {
- //insert into the list box
- var sInsertUse = this.m_aSuperRangeLiterals[j].getLiteral();
- var sInsertDisplay = this.m_aSuperRangeLiterals[j].getLabel();
- if ((sInsertUse) && (sInsertDisplay))
- {
- this.m_oLstChoices.options[this.m_oLstChoices.options.length] = new Option(sInsertDisplay, sInsertUse, false, false);
- }
- }
- this.checkData();
- //resize the list to fit the data if required
- this.resizeList();
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //adds an item to the list box
- function CMultipleRange_insertChoiceList()
- {
- this.insertSuperRangeLiteral();
- this.checkData();
- //resize the list to fit the data if required
- this.resizeList();
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //removes user selected item(s) from the list box and
- //removes the corresponding range literals from the array
- function CMultipleRange_removeChoiceList()
- {
- var sl = this.m_oLstChoices.selectedIndex;
- if (sl != -1)
- {
- for (var i=this.m_oLstChoices.options.length-1; i > -1 ; i--)
- {
- if (this.m_oLstChoices.options[i].selected == true)
- {
- this.m_oLstChoices.options[i]=null;
- //remove the corresponding range literal
- this.removeSuperRangeLiteral(i);
- }
- }
- }
- else
- {
- var sPrompt_Select_Item_First = "sPrompt_Select_Item_First";
- if (typeof PMT_UIM_sPrompt_Select_Item_First == K_PRMT_sSTRING)
- {
- sPrompt_Select_Item_First = PMT_UIM_sPrompt_Select_Item_First;
- }
- alert(sPrompt_Select_Item_First);
- }
- this.checkData();
- //resize the list to fit the data if required
- this.resizeList();
- //check the states of the insert and remove buttons
- this.checkInsertRemove();
- }
- //Prototypes to assign methods to new instances of the object
- CMultipleRange.prototype.selectAll = CMultipleRange_selectAll;
- CMultipleRange.prototype.deSelectAll = CMultipleRange_deSelectAll;
- CMultipleRange.prototype.insert = CMultipleRange_insert;
- CMultipleRange.prototype.remove = CMultipleRange_remove;
- CMultipleRange.prototype.preProcess = CMultipleRange_preProcess;
- CMultipleRange.prototype.checkData = CMultipleRange_checkData;
- CMultipleRange.prototype.resizeList = CMultipleRange_resizeList;
- CMultipleRange.prototype.catchDeleteKey = CMultipleRange_catchDeleteKey;
- CMultipleRange.prototype.checkInsertRemove = CMultipleRange_checkInsertRemove;
- CMultipleRange.prototype.testResize = CMultipleRange_testResize;
- CMultipleRange.prototype.addSuperRangeLiteral = CMultipleRange_addSuperRangeLiteral;
- CMultipleRange.prototype.insertSuperRangeLiteral = CMultipleRange_insertSuperRangeLiteral;
- CMultipleRange.prototype.removeSuperRangeLiteral = CMultipleRange_removeSuperRangeLiteral;
- CMultipleRange.prototype.initChoiceList = CMultipleRange_initChoiceList;
- CMultipleRange.prototype.insertChoiceList = CMultipleRange_insertChoiceList;
- CMultipleRange.prototype.removeChoiceList = CMultipleRange_removeChoiceList;
- /* Range Literal Object */
- /* Note that this object is deprecated */
- // Creates an object that does the work of determining
- // the filter type and provides access to properties
- // constructor
- // sLiteral: the expression that defines the literal
- // sLabel: the localized text description of the literal
- function CRangeLiteral(sLiteral, sLabel)
- {
- this.m_sLiteral = sLiteral;
- this.m_sLabel = sLabel;
- this.m_filterType = this.parseFilterType(sLiteral);
- this.m_sFirstValue = this.getFirstValue();
- this.m_sSecondValue = this.getSecondValue();
- }
- //Parse a range literal into it's component pieces
- //return the type of filter and set the appropriate values
- // :100 less than or equal to 100
- // 100: greater than or equal to 100
- // 100 equal to 100
- // 100 : 1000 between 100 and 1000
- // strings need to be surrounded by quotes
- function CRangeLiteral_parseFilterType(s)
- {
- //does the value contain a range delimeter (e.g. ':')
- var iTest = s.indexOf(K_PRMT_sCOLON);
- var iType = null;
- //at the begining?
- if (iTest === 0)
- {
- iType = FILTER_LESS_THAN_OR_EQUAL_TO;
- this.setFirstValue(false);
- this.setSecondValue(decodeURIComponent(stripSingleQuote(s.substring(1,s.length))));
- }
- //at the end?
- else if (iTest == (s.length -1))
- {
- iType = FILTER_GREATER_THAN_OR_EQUAL_TO;
- this.setFirstValue(decodeURIComponent(stripSingleQuote(s.substring(0,s.length-1))));
- this.setSecondValue(false);
- }
- //at all?
- else if (iTest == -1)
- {
- iType = FILTER_EQUAL_TO;
- this.setFirstValue(decodeURIComponent(stripSingleQuote(s)));
- this.setSecondValue(decodeURIComponent(stripSingleQuote(s)));
- }
- else
- {
- //look for the between range delimeter,
- //a colon with spaces ' : '
- var rDelimiters = /\s:\s/g;
- var arTokens = s.split(rDelimiters);
- //is this a between expression?
- if (arTokens.length == 2)
- {
- //yes
- iType = FILTER_BETWEEN;
- this.setFirstValue(decodeURIComponent(stripSingleQuote(arTokens[0])));
- this.setSecondValue(decodeURIComponent(stripSingleQuote(arTokens[1])));
- }
- else
- {
- //no, treat the whole thing as one item
- //this could be due to time, date, interval and datetime formats
- iType = FILTER_EQUAL_TO;
- this.setFirstValue(decodeURIComponent(stripSingleQuote(s)));
- this.setSecondValue(decodeURIComponent(stripSingleQuote(s)));
- }
- }
- return iType;
- }
- //Return a localized string that can be used for the display value
- // this uses the following function to do the substitutions:
- // sReplaceToken(sMessage, sTokenValue, sNewValue)
- function CRangeLiteral_getFormatValue()
- {
- var s = K_PRMT_sEMPTY;
- var sFromValue = this.getFirstValue();
- var sToValue = this.getSecondValue();
- var sEqualTo = 'equal to ^1';
- var sGreaterThanOrEqualTo = 'greater than or equal to ^1';
- var sLessThanOrEqualTo = 'less than or equal to ^1';
- var sBetweenTo = 'between ^1 and ^2';
- if (typeof PMT_RNG_FILTER_LESS_THAN_EQUAL_TO_STRING == K_PRMT_sSTRING) {
- sLessThanOrEqualTo = PMT_RNG_FILTER_LESS_THAN_EQUAL_TO_STRING;
- }
- if (typeof PMT_RNG_FILTER_EQUAL_STRING == K_PRMT_sSTRING) {
- sEqualTo = PMT_RNG_FILTER_EQUAL_STRING;
- }
- if (typeof PMT_RNG_FILTER_BETWEEN_STRING == K_PRMT_sSTRING) {
- sBetweenTo = PMT_RNG_FILTER_BETWEEN_STRING;
- }
- if (typeof PMT_RNG_FILTER_GREATER_THAN_EQUAL_TO_STRING == K_PRMT_sSTRING) {
- sGreaterThanOrEqualTo = PMT_RNG_FILTER_GREATER_THAN_EQUAL_TO_STRING;
- }
- switch (this.getFilterType())
- {
- //FILTER_EQUAL_TO
- case 0:
- s = sReplaceToken(sEqualTo, "^1", sFromValue);
- break;
- //FILTER_GREATER_THAN_OR_EQUAL_TO
- case 1:
- s = sReplaceToken(sGreaterThanOrEqualTo, "^1", sFromValue);
- break;
- //FILTER_LESS_THAN_OR_EQUAL_TO
- case 2:
- s = sReplaceToken(sLessThanOrEqualTo, "^1", sToValue);
- break;
- //FILTER_BETWEEN
- case 3:
- s = sReplaceToken(sBetweenTo, "^1", sFromValue);
- s = sReplaceToken(s, "^2", sToValue);
- break;
- default:
- return false;
- }
- return s;
- }
- function CRangeLiteral_setLabel(s)
- {
- this.m_sLabel = s;
- }
- function CRangeLiteral_getLabel()
- {
- return this.m_sLabel;
- }
- function CRangeLiteral_setFilterType(s)
- {
- this.m_filterType = s;
- }
- function CRangeLiteral_getFilterType()
- {
- return this.m_filterType;
- }
- function CRangeLiteral_getFirstValue()
- {
- return this.m_sFirstValue;
- }
- function CRangeLiteral_getSecondValue()
- {
- return this.m_sSecondValue;
- }
- function CRangeLiteral_setFirstValue(s)
- {
- this.m_sFirstValue = s;
- }
- function CRangeLiteral_setSecondValue(s)
- {
- this.m_sSecondValue = s;
- }
- CRangeLiteral.prototype.getFirstValue = CRangeLiteral_getFirstValue;
- CRangeLiteral.prototype.getSecondValue = CRangeLiteral_getSecondValue;
- CRangeLiteral.prototype.setFirstValue = CRangeLiteral_setFirstValue;
- CRangeLiteral.prototype.setSecondValue = CRangeLiteral_setSecondValue;
- CRangeLiteral.prototype.getLabel = CRangeLiteral_getLabel;
- CRangeLiteral.prototype.setLabel = CRangeLiteral_setLabel;
- CRangeLiteral.prototype.parseFilterType = CRangeLiteral_parseFilterType;
- CRangeLiteral.prototype.setFilterType = CRangeLiteral_setFilterType;
- CRangeLiteral.prototype.getFilterType = CRangeLiteral_getFilterType;
- CRangeLiteral.prototype.getFormatValue = CRangeLiteral_getFormatValue;
- var objPlay1 = null;
- var objPlay2 = null;
- function animateValueMissing(s1,s2)
- {
- var obj1 = document.getElementById(s1);
- var obj2 = document.getElementById(s2);
- objPlay1 = obj1;
- objPlay2 = obj2;
- if ((objPlay1) && (objPlay1))
- {
- animate();
- }
- }
- function animate()
- {
- CURLOOP = 0;
- ANIMATING = setInterval(animateEffect,EFFECTSPEED);
- }
- //Global variables
- var MAXLOOPS = 5;
- var CURLOOP = 1;
- var EFFECTSPEED = 100;
- var ANIMATING = null;
- //animation function
- function animateEffect()
- {
- if (CURLOOP==MAXLOOPS)
- {
- objPlay1.style.filter = "glow(color=#990000, strength=0, enabled=false)";
- objPlay2.style.filter = "glow(color=#990000, strength=0, enabled=false)";
- clearInterval(ANIMATING);
- return;
- }
- objPlay1.style.filter = "glow(color=#FF6600, strength="+CURLOOP+", enabled=true)";
- objPlay2.style.filter = "glow(color=#FF6600, strength="+CURLOOP+", enabled=true)";
- CURLOOP ++;
- }
- //the SuperRange Literal is an enhanced version of its predecessor, the Range Literal
- function CSuperRangeLiteral(sStartUse, sStartDisplay, sEndUse, sEndDisplay, sDataType)
- {
- this.m_sStartUse = sStartUse;
- this.m_sStartDisplay = sStartDisplay;
- this.m_sEndUse = sEndUse;
- this.m_sEndDisplay = sEndDisplay;
- this.m_sDataType = sDataType;
- this.m_iType = this.getType();
- }
- function CSuperRangeLiteral_getStartUseValue()
- {
- return this.m_sStartUse;
- }
- function CSuperRangeLiteral_setStartUseValue(sStartUse)
- {
- this.m_sStartUse = sStartUse;
- }
- function CSuperRangeLiteral_getStartDisplayValue()
- {
- return this.m_sStartDisplay;
- }
- function CSuperRangeLiteral_setStartDisplayValue(sStartDisplay)
- {
- this.m_sStartDisplay = sStartDisplay;
- }
- function CSuperRangeLiteral_getEndUseValue()
- {
- return this.m_sEndUse;
- }
- function CSuperRangeLiteral_setEndUseValue(sEndUse)
- {
- this.m_sEndUse = sEndUse;
- }
- function CSuperRangeLiteral_getEndDisplayValue()
- {
- return this.m_sEndDisplay;
- }
- function CSuperRangeLiteral_setEndDisplayValue(sEndDisplay)
- {
- this.m_sEndDisplay = sEndDisplay;
- }
- function CSuperRangeLiteral_getType()
- {
- var sFromValue = (this.getStartUseValue() != null) ? this.getStartUseValue().toString() : null;
- var sToValue = (this.getEndUseValue() != null) ? this.getEndUseValue().toString() : null;
- var sFilterType = false;
- //determine type
- if ((sFromValue) && (!sToValue))
- {
- sFilterType = FILTER_GREATER_THAN_OR_EQUAL_TO;
- }
- else if((!sFromValue) && (sToValue))
- {
- sFilterType = FILTER_LESS_THAN_OR_EQUAL_TO;
- }
- else if ((sFromValue) && (sToValue))
- {
- if (sFromValue == sToValue)
- {
- sFilterType = FILTER_EQUAL_TO;
- }
- else
- {
- sFilterType = FILTER_BETWEEN;
- }
- }
- return sFilterType;
- }
- function CSuperRangeLiteral_getLabel()
- {
- var s = K_PRMT_sEMPTY;
- var sFromValue = this.getStartDisplayValue();
- var sToValue = this.getEndDisplayValue();
- var sEqualTo = 'equal to ^1';
- var sGreaterThanOrEqualTo = 'greater than or equal to ^1';
- var sLessThanOrEqualTo = 'less than or equal to ^1';
- var sBetweenTo = 'between ^1 and ^2';
- if (typeof PMT_RNG_FILTER_LESS_THAN_EQUAL_TO_STRING == K_PRMT_sSTRING) {
- sLessThanOrEqualTo = PMT_RNG_FILTER_LESS_THAN_EQUAL_TO_STRING;
- }
- if (typeof PMT_RNG_FILTER_EQUAL_STRING == K_PRMT_sSTRING) {
- sEqualTo = PMT_RNG_FILTER_EQUAL_STRING;
- }
- if (typeof PMT_RNG_FILTER_BETWEEN_STRING == K_PRMT_sSTRING) {
- sBetweenTo = PMT_RNG_FILTER_BETWEEN_STRING;
- }
- if (typeof PMT_RNG_FILTER_GREATER_THAN_EQUAL_TO_STRING == K_PRMT_sSTRING) {
- sGreaterThanOrEqualTo = PMT_RNG_FILTER_GREATER_THAN_EQUAL_TO_STRING;
- }
- switch (this.getType())
- {
- //FILTER_EQUAL_TO
- case 0:
- s = sReplaceToken(sEqualTo, "^1", sFromValue);
- break;
- //FILTER_GREATER_THAN_OR_EQUAL_TO
- case 1:
- s = sReplaceToken(sGreaterThanOrEqualTo, "^1", sFromValue);
- break;
- //FILTER_LESS_THAN_OR_EQUAL_TO
- case 2:
- s = sReplaceToken(sLessThanOrEqualTo, "^1", sToValue);
- break;
- //FILTER_BETWEEN
- case 3:
- s = sReplaceToken(sBetweenTo, "^1", sFromValue);
- s = sReplaceToken(s, "^2", sToValue);
- break;
- default:
- return false;
- }
- return s;
- }
- function CSuperRangeLiteral_getLiteral()
- {
- var sFromValue = this.getStartUseValue();
- var sToValue = this.getEndUseValue();
- var sLiteral = K_PRMT_sEMPTY;
- if (sFromValue)
- {
- sLiteral += sFromValue;
- }
- sLiteral += K_PRMT_sCOLON;
- if (sToValue)
- {
- sLiteral += sToValue;
- }
- return sLiteral;
- }
- CSuperRangeLiteral.prototype.getStartUseValue = CSuperRangeLiteral_getStartUseValue;
- CSuperRangeLiteral.prototype.setStartUseValue = CSuperRangeLiteral_setStartUseValue;
- CSuperRangeLiteral.prototype.getStartDisplayValue = CSuperRangeLiteral_getStartDisplayValue;
- CSuperRangeLiteral.prototype.setStartDisplayValue = CSuperRangeLiteral_setStartDisplayValue;
- CSuperRangeLiteral.prototype.getEndUseValue = CSuperRangeLiteral_getEndUseValue;
- CSuperRangeLiteral.prototype.setEndUseValue = CSuperRangeLiteral_setEndUseValue;
- CSuperRangeLiteral.prototype.getEndDisplayValue = CSuperRangeLiteral_getEndDisplayValue;
- CSuperRangeLiteral.prototype.setEndDisplayValue = CSuperRangeLiteral_setEndDisplayValue;
- CSuperRangeLiteral.prototype.getType = CSuperRangeLiteral_getType;
- CSuperRangeLiteral.prototype.getLabel = CSuperRangeLiteral_getLabel;
- CSuperRangeLiteral.prototype.getLiteral = CSuperRangeLiteral_getLiteral;
|