/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| BI and PM: prmt *| (C) Copyright IBM Corp. 2002, 2021 *| *| US Government Users Restricted Rights - Use, duplication or *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *| *+------------------------------------------------------------------------+ */ /** @file This script is used to provide interactivity for the SelectValue single and multiple select prompt components. */ /** @private @class */ cognos.Prompt.Control.SelectValue = cognos.Prompt.Control.f_extend({ f_initialize: function( v_oProps ) { this._type_ = "cognos.Prompt.Control.SelectValue"; this.f_parent( v_oProps ); // call parent's f_initialize this.m_aOptions = null; this.m_aSuperLiterals = []; this.m_currentlySelected = null; // set selectValueUI to selectUI if ( !this.selectUI ) { this.selectUI = this["@selectValueUI"]; } if ( this.m_oRangeControl ) { this.selectUI = "dropdown"; } if ( this.selectUI == "checkboxGroup" && !this.isMulti() ) { this.selectUI = "radioGroup"; } else if ( this.selectUI == "radioGroup" && this.isMulti() ) { this.selectUI = "checkboxGroup"; } else if ( this.selectUI == "dropdown" ) { this["@multiSelect"] = false; } this.f_initCompleted(); }, checkData: function() { this.m_bValid = true; var v_bPass = this.f_parent(); // call parent's checkData if ( !v_bPass || (this.isRequired() && !this.hasValue() )) { this.m_bValid = false; this.checkFail(); } else { this.m_bValid = true; this.checkPass(); } return this.m_bValid; }, clearValues: function() { this.f_parent(); this.f_deselectAll(); }, singleValueSelect: function(event) { var selectedIndex = event.target.selectedIndex; var options = this.f_getOptions(); var selected = options[selectedIndex]; //only set aria-selected = true for valid options if (selected.hasAttribute("role") && selected.getAttribute("role") === "option") { if (this.m_currentlySelected !== null) { this.m_currentlySelected.setAttribute("aria-selected","false"); } this.m_currentlySelected = selected; selected.setAttribute("aria-selected","true"); } else { //if invalid option selected - clear the previously selected if (this.m_currentlySelected !== null) { this.m_currentlySelected.setAttribute("aria-selected","false"); this.m_currentlySelected = null; } } }, multiValueSelect: function (event) { var options = this.f_getOptions(); for (let i = 0 ; i < options.length ; i++ ) { options[i].setAttribute("aria-selected",options[i].selected); } }, f_drawCompleted: function() { var v_elPrompt = $( this.f_getId(K_PRMT_sSV_PREFIX) ); var v_elContainer = $( this.f_getId("PRMT_SV_CONTAINER_") ); if ( v_elPrompt ) { var v_CPE = new C_PromptElement(); var v_sStyle = this["@style"]; // @listStyle is used by the search control. if ( this["@listStyle"] ) { v_sStyle = (v_sStyle ? v_sStyle : K_PRMT_sEMPTY) + this["@listStyle"]; } v_CPE.f_setStyle( v_elPrompt, cssParser(this["@style"], "color,font,text") + (this["@listStyle"] ? this["@listStyle"] : K_PRMT_sEMPTY) ); // put it back at the right place. this.f_moveInContainer( v_elContainer, v_elPrompt ); v_elPrompt.m_oPrompt = this; var v_sWidth = cssParser( v_sStyle, "width", true ); if ( v_sWidth ) { if ( this.m_oRangeControl && this.m_oRangeControl.isMulti() ) { var p = v_elPrompt; p.style.width = "100%"; var v_reTable = new RegExp("div", "i"); while (p && !p.nodeName.match(v_reTable)) { p.setAttribute("width", "100%"); p = p.parentNode; } } else { v_elPrompt.style.width = v_sWidth; } } var v_sHeight = cssParser( v_sStyle, "height", true ); if ( v_sHeight && this.selectUI != "dropdown" ) { v_elPrompt.style.height = v_sHeight; v_elPrompt.style.maxHeight = "none"; } if ( this.selectUI == "checkboxGroup" || this.selectUI == "radioGroup" ) { // link a11y label if it exists var v_a11yLabel = $( this.f_getId("PRMT_LBL_") ); if ( v_a11yLabel ) { var v_container = $( this.f_getId("PRMT_SV_CONTAINER_") ); v_container.setAttribute("aria-labelledby", this.f_getId("PRMT_LBL_")); } var v_sChildStyle = cssParser( v_sStyle, "color,font,text" ); if ( v_sChildStyle ) { var v_oChild = v_elPrompt.firstChild; while ( v_oChild ) { v_CPE.f_setStyle( v_oChild, v_sChildStyle ); v_oChild = v_oChild.nextSibling; } } } else { // link a11y label if it exists using FOR var v_a11yLabel = $( this.f_getId("PRMT_LBL_") ); if ( v_a11yLabel && !v_a11yLabel.getAttribute("for")) { v_a11yLabel.setAttribute("for", this.f_getId("PRMT_SV_")); } // @listSize is used by the cognos.Prompt.Control.Search. if ( this["@listSize"] ) { v_elPrompt.setAttribute( "size", this["@listSize"] ); v_elPrompt.selectedIndex=-1; } else if ( this.selectUI == "listBox" ) { v_elPrompt.setAttribute( "size", "11" ); v_elPrompt.selectedIndex=-1; } else if ( this.selectUI == "dropdown" && !this.isMulti() && typeof this["@columnName"] == K_PRMT_sUNDEFINED) { v_elPrompt.selectedIndex=(window.isAllowEmptyStringHeaderText && !window.isAllowEmptyStringHeaderText()) ? 0 : -1; } if ( !this.isMulti() ) { v_elPrompt.removeAttribute( "multiple" ); v_elPrompt.setAttribute("aria-multiselectable", 'false'); //REPORT-13599 PRMTUtils.f_addEvent( v_elPrompt, "change", this.singleValueSelect.bind(this) ); } else { v_elPrompt.setAttribute("aria-multiselectable", 'true'); //REPORT-13599 PRMTUtils.f_addEvent( v_elPrompt, "change", this.multiValueSelect.bind(this) ); } if ( this.isRequired() ) { v_elPrompt.setAttribute("aria-required", true); } } if ( typeof SYSTEMPROPERTY_CHANGE_DROPDOWN_BACKGROUNDCOLOR_ALL !== K_PRMT_sUNDEFINED && SYSTEMPROPERTY_CHANGE_DROPDOWN_BACKGROUNDCOLOR_ALL === true ) { if ( this.selectUI == "listBox" || this.selectUI == "dropdown" ) { var v_sBackgroundColor = cssParser( v_sStyle, "background-color", true ); if ( v_sBackgroundColor ) { v_elPrompt.style.backgroundColor = v_sBackgroundColor; } } } if ( this[K_PRMT_sATTR_DISABLED] ) { v_elPrompt.setAttribute( "disabled", "disabled" ); } PRMTUtils.f_addEvent( v_elPrompt, "change", this.f_onChange.bind(this) ); // ipad quirk, Select with one option does not fire onChange, but it fires onBlur if (this.selectUI == "listBox" && PRMTUtils.f_isMobileDevice()) { PRMTUtils.f_addEvent( v_elPrompt, "blur", this.f_onBlur.bind(this) ); } this.m_elPrompt = v_elPrompt; } var v_link = $( this.f_getId(K_PRMT_sSV_LINK_SELECT_PREFIX) ); if ( v_link ) { PRMTUtils.f_addEvent( v_link, "click", this.f_selectAll.bind(this) ); } v_link = $( this.f_getId(K_PRMT_sSV_LINK_DESELECT_PREFIX) ); if ( v_link ) { PRMTUtils.f_addEvent( v_link, "click", this.f_deselectAll.bind(this) ); } this.f_parent(); // call parent's f_drawCompleted // set the classnames if (this.selectUI == "checkboxGroup" || this.selectUI == "radioGroup") { //set the css class to the option parent DIV var v_aOptions = this.f_getOptions(); var v_iLength = v_aOptions.length; var isFirstTabIndexSet = false; for (var i = 0; i < v_iLength; i++) { var v_cb = v_aOptions[i]; var v_div = v_cb.parentNode; if (v_cb.type == "checkbox") { v_div.className = (v_cb.checked ? K_PRMT_CSS_CHECKBOX_CHECKED : K_PRMT_CSS_CHECKBOX); PRMTUtils.f_addEvent( v_div, "keydown", this.f_checkboxKeyNav.bind(this) ); if (!isFirstTabIndexSet) { v_cb.tabIndex = 0; isFirstTabIndexSet = true; } else { v_cb.tabIndex = -1; } } else { v_div.className = (v_cb.checked ? K_PRMT_CSS_RADIOBUTTON_CHECKED : K_PRMT_CSS_RADIOBUTTON); } PRMTUtils.f_updateElementAriaChecked(v_cb, v_cb.checked); var v_label = v_div.nextSibling; if ( G_IsBidiEnabled && v_label && this["@contentTextDirection"] ) { v_label.innerHTML = PRMT_BidiUtils.enforceBidiDirection(v_label.innerHTML, PRMT_BidiUtils.getTextDirection(v_label.firstChild.nodeValue, this["@contentTextDirection"])); } if ( this.isRequired() ) { v_cb.setAttribute("aria-required", true); } } } else { var v_aOptions = this.f_getOptions(); for (var i = 0; i < v_aOptions.length; i++) { var v_elOption = v_aOptions[i]; if ( G_IsBidiEnabled && v_elOption && this["@contentTextDirection"] ) { v_elOption.innerHTML = PRMT_BidiUtils.enforceBidiDirection(v_elOption.innerHTML, PRMT_BidiUtils.getTextDirection(v_elOption.firstChild.nodeValue, this["@contentTextDirection"])); } } } // FIXME: remove the hardcoded minimal width and use CSS if (!this.f_isBUX()) { setTimeout( this.f_updateSize.bind(this), 20 ); } // focus Select control var oCV = this.f_getCV(); if (oCV && typeof oCV.getCurrentPromptControlFocus == K_PRMT_sFUNCTION){ if (this["@name"] == oCV.getCurrentPromptControlFocus()) { var v_elPrompt = $( this.f_getId(K_PRMT_sSV_PREFIX) ); v_elPrompt.focus(); oCV.setCurrentPromptControlFocus(null); } } } }); /** * Getter for range inputId * rangeInputId used by range label to associate the label (From/To) to the input when there are not radio buttons * */ cognos.Prompt.Control.SelectValue.prototype.f_getRangeInputId = function() { return (this.m_oRangeControl ? this.f_getId(K_PRMT_sSV_PREFIX) : null ); } /** * Adds an option element to the list of candidates for a choice. @private @param {HTMLelement} v_option @param {cognos.Value[]} v_aSC @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_addCandidateForSelection = function(v_option, v_aSC) { for (var i = 0; i < v_aSC.length; i++) { v_aSC[i].m_aCandidates.push( { "option": v_option, "score": this.f_getScore(v_aSC[i], v_option) } ); } }; /** Adds an option element to the list of candidates for a choice. @private @param {object} v_oMap @param {String} v_sKey @param {object} v_oValue @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_addOptionInValueMap = function( v_oMap, v_sKey, v_oValue ) { if (typeof(v_oValue.m_aCandidates) === K_PRMT_sUNDEFINED ) { // A choice will need an array for candidates. v_oValue.m_aCandidates = []; } v_sKey = sDecodeU003( v_sKey ); if ( v_oMap[v_sKey] ) { v_oMap[v_sKey].push( v_oValue ); } else { v_oMap[v_sKey] = [v_oValue]; } }; /** Select the elements which have the best match for each choice. @private @param v_oChoices The 'selectChoices' node from RSVP. @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_applySelection = function(v_oChoices) { var i; var v_oCandidate = null; var v_aCandidates = null; var v_aToSelect = null; var v_iHighScore = 0; for ( var v_idx = 0; v_idx < v_oChoices.c.length; v_idx++ ) { v_aCandidates = v_oChoices.c[v_idx].m_aCandidates; if (v_aCandidates && v_aCandidates.length) { v_aToSelect = []; v_iHighScore = 0; // Find candidates with highest score for (i = 0; i < v_aCandidates.length; i++) { v_oCandidate = v_aCandidates[i]; if (v_oCandidate.score > v_iHighScore) { v_aToSelect = []; v_iHighScore = v_oCandidate.score; } if (v_oCandidate.score === v_iHighScore) { v_aToSelect.push(v_oCandidate.option); } } // apply selection for (i=0; i < v_aToSelect.length; i++) { v_aToSelect[i].checked = true; v_aToSelect[i].selected = true; } } } }; /** Compare values. See {@link cognos.Prompt.Control#f_compare} for details. @see cognos.Prompt.Control#f_compare @private @return {Integer} */ cognos.Prompt.Control.SelectValue.prototype.f_compare = function( v_oValue ) { var v_iRetval = 1; if ( SYSTEMPROPERTY_REORDER_DROPDOWN_VALUES_IN_RANGES === true && v_oValue ) { // f_compare is used by Ranges. We supposed we are using DROPDOWN controls. var v_iThis = this.m_elPrompt.selectedIndex; var v_iCompareTo = v_oValue.m_elPrompt.selectedIndex; if ( v_iCompareTo > v_iThis ) { v_iRetval = -1; } else if ( v_iCompareTo == v_iThis ) { v_iRetval = 0; } } return v_iRetval; }; /** Sets the JavaScript references used by custom scripts based on generated code from Blaring and before. (Custom Scripts Workaround) @private @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_CSW_init = function() { var v_sPrefix = "listBox"; switch( this.selectUI ) { case "checkboxGroup": v_sPrefix = "checkBoxList"; break; case "radioGroup": v_sPrefix = "radioList"; break; } var v_oPC = this.f_CSW_createJSObject( v_sPrefix ); if ( v_oPC ) { if (typeof v_oPC.selectAll == K_PRMT_sUNDEFINED ) { v_oPC.selectAll = this.f_selectAll.bind(this); } if (typeof v_oPC.checkData == K_PRMT_sUNDEFINED ) { v_oPC.checkData = this.checkData.bind(this); } } if ( this.selectUI == "checkboxGroup" || this.selectUI == "radioGroup" ) { var aChoices = document.getElementsByName( this.f_getId("pOpt_") ); if (aChoices.length > 0) { if (aChoices.length == 1) { aChoices = aChoices[0]; } this.f_CSW_SetFormElement("_oLstChoices", aChoices); } } else { this.f_CSW_SetFormElement("_oLstChoices"); } }; /** @private @param {boolean} v_bSelected @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_deselectAll = function( v_bSelected ) { this.f_selectAll( false ); }; /** Draws a deselect link inside of the container passes as a param @private @param {C_PromptElement} v_div Container @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_drawDeselectLink = function( v_div ) { var v_a1 = $CE("a", { "id": this.f_getId(K_PRMT_sSV_LINK_DESELECT_PREFIX), "href": "javascript:;", "onclick": "document.location.hash='';", "class": "clsLink pl"}, v_div ); v_a1.f_appendText( this[K_PRMT_LABEL_DESELECT] ); }; /** @private @param {C_PromptElement} v_el Container. @return {C_PromptElement} */ cognos.Prompt.Control.SelectValue.prototype.f_drawInput = function( v_el ) { var v_oInput = $( this.f_getId(K_PRMT_sSV_PREFIX) ); if ( v_oInput && this.f_isHidingGroupingBox() ) { PRMTUtils.f_removeClass( v_oInput, "clsCheckBoxList" ); PRMTUtils.f_removeClass( v_oInput, "pv" ); PRMTUtils.f_addClass( v_oInput, "clsCheckBoxHidingGroupingList" ); } var v_oContainer = $CE("div", {"id": this.f_getId("PRMT_SV_CONTAINER_")}, v_el); var v_sCustomDir = cssParser( this["@style"], "direction", true ); var v_FinalDir = ((v_sCustomDir == "ltr" || v_sCustomDir == "rtl") ? v_sCustomDir : PRMT_BidiUtils.lookupDirection($( this.f_getId(this.m_sDivPrefix) ))); var v_sAlignStyle = "text-align:" + ( ( v_FinalDir == "rtl" ) ? "left" : "right"); v_oContainer.f_appendText(K_PRMT_sEMPTY); switch( this.selectUI ) { case "checkboxGroup": this.f_drawSelectLinks( v_el, v_sAlignStyle ); break; case "radioGroup": if ( !this.isRequired() ) { var v_div = $CE( "div", {style:v_sAlignStyle}, v_el ); if ( this[K_PRMT_sATTR_DISABLED] ) { var v_span = $CE( "span", { "class": "clsLink", "style": "text-decoration:underline;color: #CCCCCC" }, v_div ); v_span.f_appendText( this[K_PRMT_LABEL_DESELECT] ); } else { this.f_drawDeselectLink( v_div ); } } break; case "listBox": if ( this.isMulti() ) { this.f_drawSelectLinks( v_el, v_sAlignStyle ); } else if ( !this.isRequired() && typeof this["@columnName"] == K_PRMT_sUNDEFINED ) { var v_div = $CE( "div", {style:v_sAlignStyle}, v_el ); this.f_drawDeselectLink( v_div ); } break; } return v_oInput; }; /** Renders the layout of the control: position lists, adornments and control inputs. @private @param {C_PromptElement} v_trLayout Container for this control. @return {C_PromptElement} */ cognos.Prompt.Control.SelectValue.prototype.f_drawLayout = function( v_trLayout ) { if ( !(this["@hideAdornments"] || this.m_bSkipAdornments) ) { this.f_drawAdornments( v_trLayout ); } var v_sWidth = cssParser(this["@style"], "width", true); // set to 100% only if already set to relative size v_sWidth = ( (/\d%/).test( v_sWidth ) ? "100%" : K_PRMT_sEMPTY ); this.m_elPrompt = this.f_drawInput( $CE( "td", {"width":v_sWidth}, v_trLayout ) ); this.setAriaRequired(); }; /** @private @param {C_PromptElement} v_el Container @return {void} */ cognos.Prompt.Control.SelectValue.prototype.f_drawSelectLinks = function( v_el, v_sAlignStyle ) { var v_sStyle = v_sAlignStyle; if ( typeof SYSTEMPROPERTY_SELECTVALUE_LINKS_NOWRAP !== K_PRMT_sUNDEFINED && SYSTEMPROPERTY_SELECTVALUE_LINKS_NOWRAP === true ) { v_sStyle = v_sAlignStyle + ";white-space:nowrap;padding:5px 0px 0px 0px"; } var v_aSO = this.getSelectOptions(); // bug 538852.1,587743,592296,593802 var v_iLimitWhenToHideLinks = ( this.f_isHidingGroupingBox() ? 1 : 0); if ( (!v_aSO || v_aSO.length <= v_iLimitWhenToHideLinks) && !this.m_bIsAComponent ) { v_sStyle += ";display:none"; } var v_div = $CE( "div", {"style":v_sStyle}, v_el ); if ( this[K_PRMT_sATTR_DISABLED] ) { var v_spanProps = { "class": "clsLink", "style": "text-decoration:underline;color: #CCCCCC" }; var v_span = $CE( "span", v_spanProps, v_div ); v_span.f_appendText( (v_sAlignStyle == "text-align:right") ? this[K_PRMT_LABEL_RESULTS_SELECT_ALL] : this[K_PRMT_LABEL_RESULTS_DESELECT_ALL]); v_div.f_appendText( K_PRMT_sSP ); v_span = $CE( "span", v_spanProps, v_div ); v_span.f_appendText( (v_sAlignStyle == "text-align:right") ? this[K_PRMT_LABEL_RESULTS_DESELECT_ALL] : this[K_PRMT_LABEL_RESULTS_SELECT_ALL]); } else { var v_a1 = $CE( "a", { "id": (v_sAlignStyle == "text-align:right") ? this.f_getId(K_PRMT_sSV_LINK_SELECT_PREFIX) : this.f_getId(K_PRMT_sSV_LINK_DESELECT_PREFIX), "href": "javascript:;", "onclick": "document.location.hash='';", "class": "clsLink pl"}, v_div ); v_a1.m_oPrompt = this; v_a1.f_appendText( (v_sAlignStyle == "text-align:right") ? this[K_PRMT_LABEL_RESULTS_SELECT_ALL] : this[K_PRMT_LABEL_RESULTS_DESELECT_ALL] ); v_div.f_appendText( K_PRMT_sSP ); var v_a2 = $CE( "a", { "id": (v_sAlignStyle == "text-align:right") ? this.f_getId(K_PRMT_sSV_LINK_DESELECT_PREFIX) : this.f_getId(K_PRMT_sSV_LINK_SELECT_PREFIX), "href": "javascript:;", "onclick": "document.location.hash='';", "class": "clsLink pl"}, v_div ); v_a2.f_appendText( (v_sAlignStyle == "text-align:right") ? this[K_PRMT_LABEL_RESULTS_DESELECT_ALL] : this[K_PRMT_LABEL_RESULTS_SELECT_ALL]); } }; /** Return an attribute for an object. @private @param {object} v_obj Object acting as dictionary. @param {String} v_sAttr Key for the value. @return (String) null if attribute don't exists, return attribute value as a string otherwise. */ cognos.Prompt.Control.SelectValue.prototype.f_getAttribute = function( v_obj, v_sAttr ) { var v_sValue = null; if ( typeof(v_obj[v_sAttr]) !== K_PRMT_sUNDEFINED ) { v_sValue = v_obj[v_sAttr]; if ( typeof(v_sValue) !== K_PRMT_sSTRING ) { v_sValue = v_sValue.toString(); } v_sValue = sDecodeU003( v_sValue ); } return (v_sValue); }; /** @private @return {array} */ cognos.Prompt.Control.SelectValue.prototype.f_getOptions = function( ) { var result = []; var v_elPrompt = this.m_elPrompt; if ( v_elPrompt ) { switch( this.selectUI ) { case "checkboxGroup": case "radioGroup": // find first checked radio or checkbox // v_elPrompt should be a div with a DIV/input for each value and a label as a second child var v_div = v_elPrompt.firstChild; var v_cbDiv = v_div == null ? null : v_div.firstChild; var v_cb = (v_cbDiv != null && v_cbDiv.firstChild && v_cbDiv.firstChild.tagName == "INPUT" ? v_cbDiv.firstChild : null); var v_lbl = v_cbDiv == null? null : v_cbDiv.nextSibling; while ( v_div && (v_cbDiv = v_div.firstChild) && (v_cb) && (v_lbl = v_cbDiv.nextSibling) ) { v_cb = v_cbDiv.firstChild; result.push( v_cb ); v_div = v_div.nextSibling; } break; default: // v_elPrompt should be a select control result = v_elPrompt.options; }; } return result; }; cognos.Prompt.Control.SelectValue.prototype.f_getOptionPV = function(v_elOption) { var v_oPV = null; var v_sUse = v_elOption.getAttribute(K_PRMT_sATTR_USE_VALUE); if (v_sUse === null) { v_sUse = v_elOption.value; } // for embedded IE 9 "feature" if (!v_sUse && v_elOption.attributes && v_elOption.attributes['value']) { v_sUse = v_elOption.attributes['value'].value; } var v_sDisplay = v_elOption.getAttribute(K_PRMT_sATTR_DISPLAY_VALUE); if (v_sDisplay === null) { v_sDisplay = v_elOption.getAttribute(K_PRMT_sDV); } var v_oPV = {"use": v_sUse, "display": v_sDisplay}; if ( v_elOption.getAttribute(K_PRMT_sATTR_NULL) || v_elOption.getAttribute(K_PRMT_sNULLUSE) ) { v_oPV['nil'] = true; } return v_oPV; }; /** @private @return {cognos.Value[]} */ cognos.Prompt.Control.SelectValue.prototype.f_getPV = function(bSkipType, v_allOptions) { var v_elPrompt = this.m_elPrompt; var v_aPV = []; var v_oPV = null; if ( v_elPrompt && ((this.selectUI == "checkboxGroup" || this.selectUI == "radioGroup") || ( v_elPrompt.selectedIndex >= (v_elPrompt.getAttribute('hasLabel') ? 2 : 0)) || v_allOptions)) { var v_startScanOption = 0; var v_sOptionSelectAttr;; switch( this.selectUI ) { case "checkboxGroup": case "radioGroup": v_sOptionSelectAttr = "checked"; break; default: // v_elPrompt should be a select control v_sOptionSelectAttr = "selected"; v_startScanOption = v_elPrompt.selectedIndex; };// switch var v_bBreakAfterOne = !this.isMulti(); var v_aOptions = this.f_getOptions(); var v_iLength = v_aOptions.length; if (v_allOptions) { for (var i = 0; i < v_iLength; i++) { v_aPV.push( this.f_getOptionPV(v_aOptions[i]) ); } } else { for (var i = v_startScanOption; i < v_iLength; i++) { if ( v_aOptions[i][v_sOptionSelectAttr] ) { v_aPV.push( this.f_getOptionPV(v_aOptions[i]) ); if ( v_bBreakAfterOne ) { break; } } } } } return v_aPV; }; /** Calculate a score for a option element matching a selectOption node. Scores: