123456 |
- // Licensed Materials - Property of IBM
- // IBM Cognos Products: cchl
- // (C) Copyright IBM Corp. 2003, 2016.
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- function C_PromptBaseDateTextBox(_cL7, _cH21, _cCB1, _cKS){G_HAL.F_VerifyDependencies("G_ResManager");G_HAL.F_VerifyDependencies("U_PromptInputParser");G_HAL.F_VerifyDependencies("C_PromptBaseTextBox");G_HAL.F_VerifyDependencies("C_PromptBaseDateCalendar");G_HAL.F_VerifyDependencies("D_PromptCalendar");this.F_ConstructBaseClass(_cL7, _cH21, _cCB1, _cKS);this._cUG=false;this._c0D();this._cBT1();};C_PromptBaseDateTextBox.F_Extends(C_PromptBaseControl);C_PromptBaseDateTextBox.prototype.F_Detach=function(){this._c3B.F_Detach();this._cWO1();};C_PromptBaseDateTextBox.prototype.F_Focus=function(){this._c3B.F_Focus();};C_PromptBaseDateTextBox.prototype._c0D=function(){C_PromptBaseDateTextBox.superClass._c0D.call(this);this._cMS=0;this._cY71=null;this._c0D1=null;this._cLR1=(this._cUQ&&this._cSD(this._cUQ))?U_PromptInputParser.F_ParseDate(this._cUQ, U_PromptInputParser._cDA):new Date();if(this._cWM.getAttribute("calendar")){this._cMS=( this._cWM.getAttribute( "calendar" )=="Imperial" )?1:0;}var _cZ71=this._cWM.getAttribute("firstDate");if(_cZ71&&this._cSD(_cZ71)){this._cY71=U_PromptInputParser.F_ParseDate(_cZ71, U_PromptInputParser._cDA);}var _c1D1=this._cWM.getAttribute("lastDate");if(_c1D1&&this._cSD(_c1D1)){this._c0D1=U_PromptInputParser.F_ParseDate(_c1D1, U_PromptInputParser._cDA);}if(this._c0D1&&(this._cLR1>this._c0D1)){this._cLR1=new Date(this._c0D1.valueOf());}if(this._cY71&&(this._cLR1<this._cY71)){this._cLR1=new Date(this._cY71.valueOf());}};C_PromptBaseDateTextBox.prototype._cBT1=function(){var _c6M=this._cT4();var _c79=this._cOG.insertRow(0);var _c0K=_c79.insertCell(0);var _cVG=_c0K.appendChild(document.createElement("table"));U_Accessibility.F_SetRoleForLayoutTable(_cVG);this._cF7(_cVG, "tblDateTextBox");C_PromptControl.F_AddAriaLabelParm(_c6M, G_ResManager.F_GetString("IDS_CCHL_AC_DATE"));this._c3B=new C_PromptBaseTextBox(_cVG, _c6M, this, U_PromptInputParser.F_GetDateInTransferableFormat(this._cLR1));this._cOG.style.width=_cVG.offsetWidth+"px";var _cSX=_c79.insertCell(1);_cSX.style.paddingLeft="5px";_cSX.style.verticalAlign="top";_cSX.style.width="32px";var _cRS=_cSX.appendChild(document.createElement("img"));this._cF7(_cRS, "imgDatePicker");_cRS.className="clsCCHLToolbarButton";_cRS.src=G_HAL.F_GetImageURL("cchl/images/icon_datepicker.gif");_cRS.style.width="25px";_cRS.style.height="20px";_cRS.style.padding="0px";_cRS.onmouseover=C_PromptBaseDateTextBox._cW5;_cRS.onmouseout=C_PromptBaseDateTextBox._cM7;_cRS.onmousedown=C_PromptBaseDateTextBox._cX5;if(G_HAL.M_oLibraries["hal"]["enableAccessibility"]){_cRS.tabIndex=0;_cRS.setAttribute( "role", "button" );_cRS.alt=G_ResManager.F_GetString("IDS_CCHL_AC_DATE_PICKER");}this._cSS=_cRS;};C_PromptBaseDateTextBox.prototype._cT4=function(){var _c2P1=U_XML.F_CreateDocument();var _c6M=_c2P1.createElement("promptTextBox");_c6M.setAttribute( "required", ( this._cWC1?"true":"false" ) );_c6M.setAttribute("parameter", this._c881);_c6M.setAttribute( "multiSelect", (!this._cHX?"false":"true") );_c6M.setAttribute( "validation", "date" );_c6M.setAttribute( "formatting", "date" );_c6M.setAttribute( "hideAdornments", ( this._cUJ?"true":"false" ) );_c6M.setAttribute( "multiLine", "false" );_c6M.setAttribute( "hideText", "false" );_c6M.setAttribute( "calendar", ( this._cMS==0?"Gregorian":"Imperial" ) );_c6M.setAttribute( "renderAdornmentsCell", ( this._cT5?"true":"false" ) );if(this._cWM.getAttribute("firstDate")){_c6M.setAttribute( "firstDate", this._cWM.getAttribute( "firstDate" ) );}if(this._cWM.getAttribute("lastDate")){_c6M.setAttribute( "lastDate", this._cWM.getAttribute( "lastDate" ) );}return _c6M;};C_PromptBaseDateTextBox.prototype._cSD=function(_cGN1){return(_cGN1.match(/^\d\d\d\d-\d\d-\d\d$/gi)?true:false);};C_PromptBaseDateTextBox._cW5=function(e){e.stopPropagation();this.style.borderColor="#336699";this.style.backgroundColor="#e3e9f3";};C_PromptBaseDateTextBox._cM7=function(e){e.stopPropagation();var _c4B=this.parentNode.parentNode.parentNode.parentNode._cJN;_c4B._cU1();if(_c4B._cUG){_c4B._cUG=false;}};C_PromptBaseDateTextBox.prototype._cU1=function(){if(!this._cUG){this._cSS.style.borderColor="#cccccc";this._cSS.style.backgroundColor="white";}};C_PromptBaseDateTextBox.prototype.F_PromptControl_OnValidUserInput=function(){this._cK7();};C_PromptBaseDateTextBox.prototype.F_PromptControl_OnInvalidUserInput=function(){this._cU4();};C_PromptBaseDateTextBox._cX5=function(e){if(G_HAL.M_oTestListener&&G_HAL.M_oTestListener.F_TestListener_ElementOnMouseDown){G_HAL.M_oTestListener.F_TestListener_ElementOnMouseDown(e);}e.stopPropagation();var _c4B=this.parentNode.parentNode.parentNode.parentNode._cJN;_c4B._cG21();_c4B._c89();};C_PromptBaseDateTextBox.prototype._c89=function(){this._cUG=true;var _cJI=this._cWM.cloneNode(true);D_PromptCalendar.F_Show(this._cSS, this, _cJI, this._cLR1?U_PromptInputParser.F_GetDateInTransferableFormat(this._cLR1):null, this._cSQ);};C_PromptBaseDateTextBox.prototype.F_Dialog_OnOK=function(){this._cLR1=new Date(D_PromptCalendar.F_GetDateObject().valueOf());this._c3B.F_SetValue(U_PromptInputParser.F_GetFormatDate(this._cLR1));this._cUG=false;this._cU1();};C_PromptBaseDateTextBox.prototype.F_PromptCalendar_OnValueChange=function(){this._cLR1=new Date(D_PromptCalendar.F_GetDateObject().valueOf());this._c3B.F_SetValue(U_PromptInputParser.F_GetFormatDate(this._cLR1));if(!this._cHX){this._cU3();}};C_PromptBaseDateTextBox.prototype.F_GetDateObject=function(){return this._cLR1;};C_PromptBaseDateTextBox.prototype.F_GetText=function(){return this._c3B.F_GetDisplayValue();};C_PromptBaseDateTextBox.prototype.F_PromptTextBox_OnValueChange=function(_cTN){if(_cTN.F_ValidateInput()){if(this._cMS==1){this._cLR1=U_PromptInputParser.F_ParseEra(_cTN.F_GetDisplayValue(), U_PromptInputParser.F_GetProperty("dateOrder"));}else{this._cLR1=U_PromptInputParser.F_ParseDate(_cTN.F_GetDisplayValue(), U_PromptInputParser.F_GetProperty("dateOrder"));}this._cLR1=(this._cLR1===false)?null:this._cLR1;}};C_PromptBaseDateTextBox.prototype.F_GetParameterValue=function(){var _c781;if(!this._cLR1){_c781=new C_DateValue(false, null, this._cMS);}else{_c781=new C_DateValue(false, U_PromptInputParser.F_GetDateInTransferableFormat(this._cLR1), this._cMS);}return _c781;};C_PromptBaseDateTextBox.prototype.F_PromptControl_OnFocus=function(){this._cG21();};C_PromptBaseDateTextBox.prototype.F_SetEnabled=function(_cQL1){this._c3B.F_SetEnabled(_cQL1);if(G_HAL.M_oLibraries["hal"]["enableAccessibility"]){this._cSS.tabIndex=_cQL1?0:-1;}};C_PromptBaseDateTextBox.prototype.F_ClearParameterValue=function(){this._cLR1=new Date();if(this._c0D1&&this._cLR1>this._c0D1){this._cLR1=new Date(this._c0D1.valueOf());}if(this._cY71&&this._cLR1<this._cY71){this._cLR1=new Date(this._cY71.valueOf());}this._c3B.F_SetValue(U_PromptInputParser.F_GetFormatDate(this._cLR1));};C_PromptBaseDateTextBox.prototype.F_SetParameterValue=function(_cYO1){var _cWB1=this.F_ToUseValue(_cYO1);if(!_cWB1||!_cWB1.match(/^\d+-\d{1,2}-\d{1,2}$/g)){this.F_ClearParameterValue();}else{var _cRL1=_cWB1.split(/-/);this._cLR1=new Date(_cRL1[0], _cRL1[1]-1, _cRL1[2]);this._c3B.F_SetValue(U_PromptInputParser.F_GetFormatDate(this._cLR1));}};C_PromptBaseDateTextBox.prototype.F_SetValidator=function(_cN21){if(this._c3B){this._c3B.F_SetValidator(_cN21);}};
|