C_PromptRange.js 13 KB

123456
  1. // Licensed Materials - Property of IBM
  2. // IBM Cognos Products: cchl
  3. // (C) Copyright IBM Corp. 2003, 2016.
  4. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. C_PromptRange._cDI1=0;C_PromptRange._cHT=2;C_PromptRange._c9Y=3;C_PromptRange._c1S1=4;C_PromptRange._cTD1=5;C_PromptRange._cUD1=6;function C_PromptRange(_cHO, _cJY, _cCB1, _cT81, _cKS){G_HAL.F_VerifyDependencies("U_PromptInputParser");G_HAL.F_VerifyDependencies("C_PromptBaseTextBox");this.F_ConstructBaseClass(_cHO, _cJY, _cCB1, _cKS);this._cU81=_cT81;this._cFE;this._cGE;this._c0D();this._cF1;this._c5B={};this._c5B[ "min" ]=null;this._c5B[ "max" ]=null;this._cAD1={};this._cAD1[ "min" ]=null;this._cAD1[ "max" ]=null;this._cH31={};this._cH31[ "min" ]=null;this._cH31[ "max" ]=null;this._cIO={};this._cIO[ "min" ]=null;this._cIO[ "max" ]=null;this._cBT1();this._cHE();};C_PromptRange.F_Extends(C_PromptBaseControl);C_PromptRange.prototype.F_Detach=function(){this._cFE.F_Detach();this._cGE.F_Detach();this._cWO1();};C_PromptRange.prototype._c0D=function(){C_PromptRange.superClass._c0D.call(this);this._cB61=this._cWM.getAttribute("multiLine")=="true"?true:false;};C_PromptRange.prototype._cGK=function(_c9U1){if(!this._cUQ){return null;}var _c7M1;switch(this._cU81){case C_PromptRange._cHT:case C_PromptRange._c9Y:_c7M1="date";break;case C_PromptRange._c1S1:_c7M1="time";break;case C_PromptRange._cTD1:_c7M1="dateTime";break;case C_PromptRange._cUD1:_c7M1="interval";break;default:_c7M1="simpleValue";break;}var _c9O=U_PromptInputParser.F_SplitUseValueRange(this._cUQ, _c7M1);return(_c9O===null?null:_c9O[ _c9U1?0:1 ]);};C_PromptRange.prototype._cHE=function(){if(!this._cWC1){this._cIE(true);this._cIE(false);this._c83();}};C_PromptRange.prototype._cBT1=function(){this._cF1="min";this._cJO(true);this._cF1="max";this._cJO(false);this._cF1=null;};C_PromptRange.prototype._cJO=function(_c9U1){var _cMT=this._cOG.insertRow(this._cOG.rows.length);if(this._cSQ){_cMT.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleLabel);if(C_PromptControl.F_IsDirectionRtl(_cMT)){_cMT.style["text-align"] = "right";}}var _cNT=_cMT.insertCell(0);if(!this._cWC1){_cNT.setAttribute( "colSpan", "2" );}_cNT.className=this._cSQ?"pc":"clsDialogText";_cNT.style.paddingBottom="2px";if(!_c9U1&&!this._cSQ){_cNT.style.paddingTop="15px";}_cNT.innerText=( _c9U1?G_ResManager.F_GetString( "IDS_CCHL_PRMT_FROM" ):G_ResManager.F_GetString( "IDS_CCHL_PRMT_TO" ) );if(G_HAL.M_oLibraries["hal"]["enableAccessibility"]){_cNT.tabIndex=0;_cNT.setAttribute( "role", "gridcell" );}var _c8M1=this._cOG.insertRow(this._cOG.rows.length);var _c0K;if(!this._cWC1){if(this._cSQ){if(this._cU81!=C_PromptRange._cDI1||!this._cB61){_c8M1.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleInput);}}var _cKY=_c8M1.insertCell(0);if(this._cSQ){_cKY.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleRadio);}else{_cKY.style.width="20px";_cKY.style.verticalAlign="top";_cKY.style.paddingLeft="6px";}var _cXD1=U_DOM.F_GetUniqueId();var _cI31=this._c3H(_c9U1, _cKY, _cXD1, _cNT.innerText);this._cH31[(_c9U1?"min":"max")]=_cI31;_c0K=_c8M1.insertCell(1);if(this._cSQ){_c0K.style.width="100%";}else{_c0K.style.paddingLeft="6px";}}else{_c0K=_c8M1.insertCell(0);if(this._cSQ){_c0K.style["padding" + (C_PromptControl.F_IsDirectionRtl(_c0K)?"Right":"Left")] = "8px";}else{_c0K.style.paddingLeft="16px";}}var _cNG=_c0K.appendChild(document.createElement("table"));U_Accessibility.F_SetRoleForLayoutTable(_cNG);if(this._cSQ){_c0K.style.verticalAlign="top";_cNG.classList.add(C_PromptControl.M_sPromptClass);} this._cF7(_cNG, _c9U1?"tblMinValue":"tblMaxValue");this._cJ9(_c9U1, _cNG, _cNT.innerText);if(!this._cWC1){var _c9M1=this._cOG.insertRow(this._cOG.rows.length);var _cHK=_c9M1.insertCell(0);if(this._cSQ){if(C_PromptControl.F_IsDirectionRtl(_c9M1)){_c9M1.style["text-align"] = "right";}if(this._cU81==C_PromptRange._cDI1&&this._cB61){_c9M1.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleInput);}_cHK.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleRadio);}else{_cHK.style.width="20px";_cHK.style.paddingLeft="6px";}var _cFB=this._c37(_c9U1);var _cI31 =this._c3H(_c9U1, _cHK, _cXD1,(_cNT.innerText+_cFB));this._cIO[(_c9U1?"min":"max")]=_cI31;var _cJ31=_c9M1.insertCell(1);_cJ31.className=this._cSQ?"pc":"clsDialogText";if(this._cSQ){_cJ31.style.verticalAlign="top";_cJ31.style.paddingTop="5px";}else{_cJ31.style.color="black";_cJ31.style.fontSize="11px";_cJ31.style.paddingTop="2px";}if(!this._cSQ){_cJ31.style.paddingLeft="8px";}var _cOT=_cJ31.appendChild(document.createElement("span"));_cOT.innerText=_cFB;_cOT.setAttribute( "_cQB1", ( _c9U1?"min":"max" ) );_cOT.onclick=C_PromptRange._c34;}};C_PromptRange._c34=function(e){e.stopPropagation();var _c9U1=( this.getAttribute( "_cQB1" )=="min" );var _c5M=C_PromptBaseControl.F_GetControl(this);_c5M._cIE(_c9U1, "boundary");if(!_c5M._cHX){_c5M._cU3();}};C_PromptRange.prototype._c37=function(_c9U1){var _cSR;switch(this._cU81){case C_PromptRange._cDI1:_cSR=_c9U1?G_ResManager.F_GetString( "IDS_CCHL_PRMT_LOWEST_VALUE" ):G_ResManager.F_GetString( "IDS_CCHL_PRMT_HIGHEST_VALUE" );break;case C_PromptRange._cHT:case C_PromptRange._c9Y:case C_PromptRange._cTD1:_cSR=_c9U1?G_ResManager.F_GetString( "IDS_CCHL_PRMT_EARLIEST_DATE" ):G_ResManager.F_GetString( "IDS_CCHL_PRMT_LATEST_DATE" );break;case C_PromptRange._c1S1:_cSR=_c9U1?G_ResManager.F_GetString( "IDS_CCHL_PRMT_EARLIEST_TIME" ):G_ResManager.F_GetString( "IDS_CCHL_PRMT_LATEST_TIME" );break;case C_PromptRange._cUD1:_cSR=_c9U1?G_ResManager.F_GetString( "IDS_CCHL_PRMT_LOWEST_INTERVAL" ):G_ResManager.F_GetString( "IDS_CCHL_PRMT_HIGHEST_INTERVAL" );break;}return _cSR;};C_PromptRange.prototype._c3H=function(_c9U1,_cYF1,_cXD1,_cC81){var _cV81;var _cW81=(_c9U1?"from":"to");_cW81+= _cXD1;var _cV81=document.createElement("input");_cV81.setAttribute( "type", "radio" );_cV81.setAttribute("name", _cW81);if(G_HAL.M_oLibraries["hal"]["enableAccessibility"]){_cV81.setAttribute("aria-label", _cC81);}this._cF7(_cV81, _c9U1?"radioMinValue":"radioMaxValue");_cV81.onclick=C_PromptRange._c4H;if(this._cSQ){_cYF1=_cYF1.appendChild(document.createElement("label"));_cYF1.appendChild(_cV81);_cYF1.classList.add("pc");var _cOP1=_cYF1.appendChild(document.createElement("span"));}else{_cYF1.appendChild(_cV81);}return _cV81;};C_PromptRange.prototype._cJ9=function(_c9U1,_cNG,_cK31){if(this._cSQ){if(this._cU81!=C_PromptRange._c1S1&&this._cU81!=C_PromptRange._cTD1){_cNG.style.width=_cNG.style.height="100%";}}else{_cNG.style.width="100%";}var _c5M;switch(this._cU81){case C_PromptRange._cDI1:C_PromptControl.F_AddAriaLabelParm(this._cWM, _cK31);_c5M=new C_PromptBaseTextBox(_cNG, this._cWM, this, this._cGK(_c9U1));break;case C_PromptRange._cHT:_c5M=new C_PromptBaseDateCalendar(_cNG, this._cWM, this, false, this._cGK(_c9U1));break;case C_PromptRange._c9Y:_c5M=new C_PromptBaseDateTextBox(_cNG, this._cWM, this, this._cGK(_c9U1));break;case C_PromptRange._c1S1:_c5M=new C_PromptBaseTimeTextBox(_cNG, this._cWM, this, !_c9U1, this._cGK(_c9U1));break;case C_PromptRange._cTD1:_c5M=new C_PromptBaseDateTime(_cNG, this._cWM, this, !_c9U1, this._cGK(_c9U1));break;case C_PromptRange._cUD1:_c5M=new C_PromptBaseIntervalTextBox(_cNG, this._cWM, this, this._cGK(_c9U1));break;}if(_c9U1){this._cFE=_c5M;}else{this._cGE=_c5M;}};C_PromptRange.prototype.F_PromptControl_OnValidUserInput=function(_cTN){if(typeof this._cFE=="undefined"){this._c5B[ "min" ]=true;return;}if(_cTN==this._cFE){if(this._c5B[ "max" ]&&( this._c5B[ "min" ]!==true ) ){this._cK7();}this._c5B[ "min" ]=true;}else{if(this._c5B[ "min" ]&&( this._c5B[ "max" ]!==true ) ){this._cK7();}this._c5B[ "max" ]=true;}};C_PromptRange.prototype.F_PromptControl_OnInvalidUserInput=function(_cTN){if(_cTN==this._cFE){if ((this._c5B[ "max" ]!==false )&&( this._c5B[ "min" ]!==false ) ){this._cU4();}this._c5B[ "min" ]=false;}else{if ((this._c5B[ "min" ]!==false )&&( this._c5B[ "max" ]!==false ) ){this._cU4();}this._c5B[ "max" ]=false;}};C_PromptRange.prototype.F_ValidateInput=function(){return(this._cFE.F_ValidateInput()&&this._cGE.F_ValidateInput());};C_PromptRange.prototype.F_FormatInput=function(){return(this._cFE.F_FormatInput()&&this._cGE.F_FormatInput());};C_PromptRange.prototype.F_SetMinValue=function(_cWB1){this._cFE.F_SetValue(_cWB1);this._cIE(true);};C_PromptRange.prototype.F_SetMaxValue=function(_cWB1){this._cGE.F_SetValue(_cWB1);this._cIE(false);};C_PromptRange.prototype.F_GetParameterValue=function(){var _cLY=null, _cMY=null;if(this._cWC1||(this._cH31[ "min" ].checked)){_cLY=this._cFE.F_GetParameterValue().F_GetUseValue();}if(this._cWC1||(this._cH31[ "max" ].checked)){_cMY=this._cGE.F_GetParameterValue().F_GetUseValue();}if((_cLY!==null)&&(_cMY!==null)){switch(this._cU81){case C_PromptRange._cDI1:if(this._cWM.getAttribute("numbersOnly")=="true"){var _cL31=Number(_cLY);var _cM31=Number(_cMY);if(Math.F_SortNumeric(_cL31, _cM31)>0){var _c2S1=_cLY;_cLY=_cMY;_cMY=_c2S1;}}break;case C_PromptRange._cUD1:if(U_PromptInputParser.F_SortInterval(_cLY, _cMY)>0){var _c2S1=_cLY;_cLY=_cMY;_cMY=_c2S1;}break;case C_PromptRange._cHT:case C_PromptRange._c9Y:case C_PromptRange._c1S1:case C_PromptRange._cTD1:if(U_PromptInputParser.F_SortDateTime(_cLY, _cMY)>0){var _c2S1=_cLY;_cLY=_cMY;_cMY=_c2S1;}break;}}var _c6J=this._cFE.F_GetParameterValue();_c6J._cMH1=true;_c6J.F_SetUseValue(_cLY, C_ParameterValue._cUC1);_c6J.F_SetUseValue(_cMY, C_ParameterValue._cZB1);return _c6J;};C_PromptRange.prototype.F_PromptControl_OnFocus=function(_c5M){this.F_SetRadioBasedOnUserFocus(_c5M);this._cG21();};C_PromptRange.prototype.F_SetRadioBasedOnUserFocus=function(_c5M){if(_c5M==this._cFE){this._cIE(true, "input");}else if(_c5M==this._cGE){this._cIE(false, "input");}if(!this._cHX){this._cU3();}};C_PromptRange.prototype._cIE=function(_c9U1,_cNY){if(this._cWC1){return;}var _cN31=this._cH31[(_c9U1?"min":"max")];var _cKO=this._cIO[(_c9U1?"min":"max")];var _cPP1=this._cGK(_c9U1);if(_cNY=="input"){_cN31.checked=true;}else if ((_cPP1===null )||( _cPP1=="" )||( _cNY=="boundary" ) ){_cKO.checked=true;}else{_cN31.checked=true;}};C_PromptRange._c4H=function(e){e.stopPropagation();var _c5M=C_PromptBaseControl.F_GetControl(this);_c5M._c83();if(!_c5M._cHX){_c5M._cU3();}};C_PromptRange.prototype.F_Focus=function(){if(this._cFE&&this._cFE.F_Focus){this._cFE.F_Focus();}};C_PromptRange.prototype._c96=function(_c9U1,_cJY){var _cK9=_cJY.selectSingleNode("value/item");if(!this._cWC1){if(this._cIO[(_c9U1?"min":"max")].checked){_cK9=null;}}return _cK9;};C_PromptRange.prototype._cD=function(_c2P1,_c3S1,_cK9,_c9U1){var _cYD1=_c3S1.appendChild(_c2P1.createElement((_c9U1?"start":"end")));_cYD1.setAttribute( "xsi:type", "bus:simpleParmValueItem" );for(var i=0;i<_cK9.childNodes.length;i++){_cYD1.appendChild(_cK9.childNodes[ i ].cloneNode(true));}};C_PromptRange.prototype.F_PromptControl_HasInput=function(_c5M){this._cD9(_c5M, true);if ((this._cAD1[ "min" ]===true )||( this._cAD1[ "max" ]===true ) ){this._c83();}};C_PromptRange.prototype.F_PromptControl_EmptyInput=function(_c5M){this._cD9(_c5M, false);if ((this._cAD1[ "min" ]===false )&&( this._cAD1[ "max" ]===false ) ){this._c83();}};C_PromptRange.prototype._cD9=function(_c5M,_cDP1){switch(_c5M){case this._cFE:this._cAD1[ "min" ]=_cDP1;break;case this._cGE:this._cAD1[ "max" ]=_cDP1;break;default:this._cAD1[ this._cF1 ]=_cDP1;break;}};C_PromptRange.prototype._c83=function(){if(!this._cHX){return;}var _cEI1=this._cH31[ "min" ];var _cFI1=this._cH31[ "max" ];if((_cEI1&&_cFI1&&!_cEI1.checked&&!_cFI1.checked)||(_cEI1&&!_cEI1.checked&&(this._cAD1[ "max" ]===false))||(_cFI1&&!_cFI1.checked&&(this._cAD1[ "min" ]===false))||(this._cAD1[ "min" ]===false )&&( this._cAD1[ "max" ]===false ) ){this._cLN();}else{this._cMX();}};C_PromptRange.prototype.F_SetEnabled=function(_cAM1){if(this._cFE.F_SetEnabled){this._cFE.F_SetEnabled(_cAM1);}if(this._cGE.F_SetEnabled){this._cGE.F_SetEnabled(_cAM1);}};C_PromptRange.prototype.F_IsEnabled=function(){if(this._cFE.F_IsEnabled&&this._cGE.F_IsEnabled){return(this._cFE.F_IsEnabled()&&this._cGE.F_IsEnabled());}return false;};C_PromptRange.prototype.F_IsValid=function(){if(this._cFE.F_IsValid&&this._cGE.F_IsValid){return(this._cFE.F_IsValid()&&this._cGE.F_IsValid());}return false;};C_PromptRange.prototype.F_ClearParameterValue=function(){this._cFE.F_ClearParameterValue();this._cGE.F_ClearParameterValue();if(!this._cWC1){this._cIO["min"].checked=true;this._cIO["max"].checked=true;}};C_PromptRange.prototype.F_SetParameterValue=function(_cYO1){this._cFE.F_SetParameterValue(_cYO1["start"]);this._cGE.F_SetParameterValue(_cYO1["end"]);if(!this._cWC1){if(_cYO1["start"]&&_cYO1["start"]["use"]){this._cH31["min"].checked=true;}else{this._cIO["min"].checked=true;}if(_cYO1["end"]&&_cYO1["end"]["use"]){this._cH31["max"].checked=true;}else{this._cIO["max"].checked=true;}}};C_PromptRange.prototype.F_SetValidator=function(_cN21){this._cFE.F_SetValidator(_cN21);this._cGE.F_SetValidator(_cN21);};