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_PromptBaseIntervalTextBox(_cZD, _cOI, _cCB1, _cKS){G_HAL.F_VerifyDependencies("G_ResManager");G_HAL.F_VerifyDependencies("U_PromptInputParser");G_HAL.F_VerifyDependencies("C_PromptBaseTextBox");this.F_ConstructBaseClass(_cZD, _cOI, _cCB1, _cKS);this._cUN={};this._c0E(this._cUQ);this._c0D();this._c5B={};this._c5B[ "day" ]=null;this._c5B[ "hour" ]=null;this._c5B[ "minute" ]=null;this._c5B[ "second" ]=((this._cWX||this._c1E)?null:true);this._c5B[ "millisecond" ]=(this._c1E?null:true);this._cAD1={};this._cAD1[ "day" ]=null;this._cAD1[ "hour" ]=null;this._cAD1[ "minute" ]=null;this._cAD1[ "second" ]=((this._cWX||this._c1E)?null:false);this._cAD1[ "millisecond" ]=(this._c1E?null:false);this._cF1;this._cBT1();};C_PromptBaseIntervalTextBox.F_Extends(C_PromptBaseControl);C_PromptBaseIntervalTextBox.prototype.F_Detach=function(){this._cS21.F_Detach();this._cXX.F_Detach();this._cVN.F_Detach();if(this._cWN){this._cWN.F_Detach();}if(this._cB9){this._cB9.F_Detach();}delete this._c5B;delete this._cAD1;delete this._cUN;this._cWO1();};C_PromptBaseIntervalTextBox.prototype.F_Focus=function(){this._cS21.F_Focus();};C_PromptBaseIntervalTextBox.prototype._c0D=function(){C_PromptBaseIntervalTextBox.superClass._c0D.call(this);this._cWX=false;this._c1E=false;if(this._cWM.getAttribute("showSeconds")){this._cWX=( this._cWM.getAttribute( "showSeconds" )=="true"?true:false );}if(this._cWM.getAttribute("showMilliseconds")){this._c1E=( this._cWM.getAttribute( "showMilliseconds" )=="true"?true:false );}this._cT21=this._cWM.getAttribute("specname")?"prompting":"authoring";};C_PromptBaseIntervalTextBox.prototype._c0E=function(_cGN1){if(!_cGN1||!_cGN1.match(/^-?\d+\s\d\d:\d\d:\d\d\.\d\d\d$/gi)){return;}var _cTS=_cGN1.split( " " );this._cUN[ "day" ]=_cTS[ 0 ];var _c2E=_cTS[ 1 ].split(":");this._cUN[ "hour" ]=this._cWS(_c2E[ 0 ]);this._cUN[ "minute" ]=this._cWS(_c2E[ 1 ]);var _cC9=_c2E[ 2 ].split(".");this._cUN[ "second" ]=this._cWS(_cC9[ 0 ]);this._cUN[ "millisecond" ]=this._cWS(_cC9[ 1 ]);};C_PromptBaseIntervalTextBox.prototype._cBT1=function(){var _cB81=this._cOG.insertRow(0);if(this._cSQ){_cB81.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleLabel);}_cB81.insertCell(0);this._cBD1(_cB81, G_ResManager.F_GetString("IDS_CCHL_PRMT_DAYS"));this._cBD1(_cB81, G_ResManager.F_GetString("IDS_CCHL_PRMT_HOURS"));this._cBD1(_cB81, G_ResManager.F_GetString("IDS_CCHL_PRMT_MINUTES"));if(this._cWX||this._c1E){this._cBD1(_cB81, G_ResManager.F_GetString("IDS_CCHL_PRMT_SECONDS"));}if(this._c1E){this._cBD1(_cB81, G_ResManager.F_GetString("IDS_CCHL_PRMT_MILLISECONDS"));}var _cCD1=this._cOG.insertRow(1);var _cKX=_cCD1.insertCell(0);if(this._cWC1&&!this._cUJ){this._cRD(_cKX);if(this._cSQ){_cKX.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.F_IsDirectionRtl(_cKX)?C_PromptControl.M_sAttrRoleAdornmentR:C_PromptControl.M_sAttrRoleAdornmentL);}}this._cS21=this._cXS(_cCD1, "day");this._cXX=this._cXS(_cCD1, "hour");this._cVN=this._cXS(_cCD1, "minute");if(this._cWX||this._c1E){this._cWN=this._cXS(_cCD1, "second");}if(this._c1E){this._cB9=this._cXS(_cCD1, "millisecond");}};C_PromptBaseIntervalTextBox.prototype._cBD1=function(_cB81,_cQN1){var _c4L1=_cB81.insertCell(_cB81.cells.length);_c4L1.setAttribute( "colSpan", "2" );_c4L1.className=this._cSQ?"pc":"clsDialogText";_c4L1.style.paddingRight="5px";_c4L1.style.paddingLeft="2px";if(this._cSQ&&C_PromptControl.F_IsDirectionRtl(_c4L1)){_c4L1.style.textAlign="right";}_c4L1.innerHTML=_cQN1;};C_PromptBaseIntervalTextBox.prototype._cXS=function(_cCD1,_cBG1){var _cDD1=_cCD1.insertCell(_cCD1.cells.length);if(this._cSQ){_cDD1.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleInput);}var _c281=_cDD1.appendChild(document.createElement("table"));U_Accessibility.F_SetRoleForLayoutTable(_c281);if(this._cSQ){_c281.classList.add(C_PromptControl.M_sPromptClass);_c281.style.width=_c281.style.height="100%";}if(this._cOG&&this._cOG.id){_c281.setAttribute('id', this._cOG.id+_cBG1);}var _c6M=this._cD2();switch(_cBG1){case "minute":_c6M.setAttribute( "maxlength", "2" );break;case "second":_c6M.setAttribute( "maxlength", "2" );break;case "millisecond":_c6M.setAttribute( "maxlength", "3" );break;}this._cF1=_cBG1;var _cKS=this._cWC1?"0":"";if(this._cUQ){_cKS=this._cUN[ _cBG1 ];}var _c2I1=_cCD1.insertCell(_cCD1.cells.length);_c2I1.innerText=" ";if(this._cSQ){_c2I1.setAttribute(C_PromptControl.M_sAttrRole, C_PromptControl.M_sAttrRoleSpacer);}else{_c2I1.style.width="15px";}if(G_HAL.M_oLibraries["hal"]["enableAccessibility"]){var _cC81=G_ResManager.F_GetString("IDS_CCHL_AC_"+_cBG1);C_PromptControl.F_AddAriaLabelParm(_c6M, _cC81);}return new C_PromptBaseTextBox(_c281, _c6M, this, _cKS);};C_PromptBaseIntervalTextBox.prototype._cD2=function(){var _c2P1=U_XML.F_CreateDocument();var _c6M=_c2P1.createElement("promptTextBox");_c6M.setAttribute( "required", ( this._cWC1?"true":"false" ) );_c6M.setAttribute( "multiSelect", ( !this._cHX?"false":"true" ) );_c6M.setAttribute( "renderAdornmentsCell", "false" );_c6M.setAttribute( "validation", "integer" );_c6M.setAttribute( "formatting", "integer" );_c6M.setAttribute( "renderAdornmentsCell", "false" );_c6M.setAttribute( "inputClass", "clsCCHLIntervalWidget" );_c6M.setAttribute( "size", "4" );if(this._cKN){_c6M.setAttribute( "restrictInput", "true" );_c6M.setAttribute( "restrictInputExponents", "true" );}if(this._cWM.getAttribute("hideAdornments")){_c6M.setAttribute( "hideAdornments", this._cWM.getAttribute( "hideAdornments" ) );}return _c6M;};C_PromptBaseIntervalTextBox.prototype.F_GetParameterValue=function(){var _cED1=this._c3E();var _cWB1=null;if(_cED1){if(this._cT21&&this._cT21==="authoring"){_cWB1=( _cED1[ "negative" ]?"-":"" ) +_cED1[ "day" ] + " " +(this._cQD?"'":"")+this._cD81( _cED1[ "hour" ].toString(), 2 ) + ":" +this._cD81( _cED1[ "minute" ].toString(), 2 ) + ":" +this._cD81( _cED1[ "second" ].toString(), 2 ) + "." +this._cD81(_cED1[ "millisecond" ].toString(), 3)+(this._cQD?"'":"");}else {_cWB1=(_cED1["negative"]?"-":"")+"P" + _cED1["day"] + "DT" +this._cD81(_cED1["hour"].toString(), 2) + "H" +this._cD81(_cED1["minute"].toString(), 2) + "M" +this._cD81(_cED1["second"].toString(), 2) + "." +this._cD81(_cED1["millisecond"].toString(), 3) + "S";}}return(new C_IntervalValue(false, _cWB1, this._cWX, this._c1E));};C_PromptBaseIntervalTextBox.prototype._cWS=function(_cUL1){_cUL1=_cUL1.replace(/^0*/, "");return(_cUL1==""?"0":_cUL1);};C_PromptBaseIntervalTextBox.prototype._cD81=function(_cUL1,_cFK1){while(_cUL1.length<_cFK1){_cUL1="0"+_cUL1;}return _cUL1;};C_PromptBaseIntervalTextBox.prototype._c3E=function(){if(this._c4E()){return null;}var _cED1={};_cED1[ "negative" ]=false;var _cXN=0;if(this._c1E){_cED1[ "millisecond" ]=this._cWS(this._cB9.F_GetDisplayValue());_cED1[ "millisecond" ] = ( ( isNaN( _cED1[ "millisecond" ] )||_cED1[ "millisecond" ]=="" )?0:parseInt( _cED1[ "millisecond" ], 10 ) );if(_cED1[ "millisecond" ]<0){_cED1[ "negative" ]=true;_cED1[ "millisecond" ] = Math.abs( _cED1[ "millisecond" ] );}}else{_cED1[ "millisecond" ]=U_PromptInputParser._cWG;}if(this._cWX||this._c1E){_cED1[ "second" ]=this._cWS(this._cWN.F_GetDisplayValue());_cED1[ "second" ] = ( ( isNaN( _cED1[ "second" ] )||_cED1[ "second" ]=="" )?0:parseInt( _cED1[ "second" ], 10 ) );if(_cED1[ "second" ]<0){_cED1[ "negative" ]=true;_cED1[ "second" ] = Math.abs( _cED1[ "second" ] );}if(_cED1[ "second" ]>U_PromptInputParser._cU21){_cXN=parseInt(_cED1[ "second" ] /(U_PromptInputParser._cU21+1), 10);_cED1[ "second" ] = _cED1[ "second" ] % ( U_PromptInputParser._cU21 + 1 );}}else{_cED1[ "second" ]=U_PromptInputParser._cV21;}_cED1[ "minute" ]=this._cWS(this._cVN.F_GetDisplayValue());_cED1[ "minute" ] = ( ( isNaN( _cED1[ "minute" ] )||_cED1[ "minute" ]=="" )?0:parseInt( _cED1[ "minute" ], 10 ) );if(_cED1[ "minute" ]<0){_cED1[ "negative" ]=true;_cED1[ "minute" ] = Math.abs( _cED1[ "minute" ] );}if(_cXN){_cED1[ "minute" ]+= _cXN;_cXN=0;}if(_cED1[ "minute" ]>U_PromptInputParser._cW21){_cXN=parseInt(_cED1[ "minute" ] /(U_PromptInputParser._cW21+1), 10);_cED1[ "minute" ] = _cED1[ "minute" ] % ( U_PromptInputParser._cW21 + 1 );}_cED1[ "hour" ]=this._cWS(this._cXX.F_GetDisplayValue());_cED1[ "hour" ] = ( ( isNaN( _cED1[ "hour" ] )||_cED1[ "hour" ]=="" )?0:parseInt( _cED1[ "hour" ], 10 ) );if(_cED1[ "hour" ]<0){_cED1[ "negative" ]=true;_cED1[ "hour" ] = Math.abs( _cED1[ "hour" ] );}if(_cXN){_cED1[ "hour" ]+= _cXN;_cXN=0;}if(_cED1[ "hour" ]>U_PromptInputParser._cFD1){_cXN=parseInt(_cED1[ "hour" ] /(U_PromptInputParser._cFD1+1), 10);_cED1[ "hour" ] = _cED1[ "hour" ] % ( U_PromptInputParser._cFD1 + 1 );}_cED1[ "day" ]=this._cWS(this._cS21.F_GetDisplayValue());if(_cED1[ "day" ].indexOf( "-" ) != -1 ){_cED1[ "negative" ]=true;}_cED1[ "day" ] = ( ( isNaN( _cED1[ "day" ] )||_cED1[ "day" ]=="" )?0:parseInt( _cED1[ "day" ], 10 ) );if(_cED1[ "day" ]<0){_cED1[ "negative" ]=true;_cED1[ "day" ] = Math.abs( _cED1[ "day" ] );}if(_cXN){_cED1[ "day" ] = ( _cED1[ "day" ] < 0 )?_cED1[ "day" ] - _cXN:_cED1[ "day" ] + _cXN;}if ((_cED1[ "day" ]==0 )&&( _cED1[ "hour" ]==0 )&&( _cED1[ "minute" ]==0 )&&( _cED1[ "second" ]==0 )&&( _cED1[ "millisecond" ]==0 ) ){_cED1[ "negative" ]=false;}return _cED1;};C_PromptBaseIntervalTextBox.prototype._c4E=function(){if((this._cS21.F_GetDisplayValue()=="")&&(this._cXX.F_GetDisplayValue()=="")&&(this._cVN.F_GetDisplayValue()=="")&&(this._cWN?this._cWN.F_GetDisplayValue()=="":true)&&(this._cB9?this._cB9.F_GetDisplayValue()=="":true)){return true;}else{return false;}};C_PromptBaseIntervalTextBox.prototype.F_PromptControl_OnValidUserInput=function(_cTN){var _c6B=this._c1K();this._c16(_cTN, true);if(!_c6B&&this._c1K()){this._cE7(true);this._cK7();}};C_PromptBaseIntervalTextBox.prototype.F_PromptControl_OnInvalidUserInput=function(_cTN){var _c6B=this._c1K();this._c16(_cTN, false);if(_c6B&&!this._c1K()){this._cE7(false);this._cU4();}};C_PromptBaseIntervalTextBox.prototype._c16=function(_cTN,_cDP1){switch(_cTN){case this._cS21:this._c5B[ "day" ]=_cDP1;break;case this._cXX:this._c5B[ "hour" ]=_cDP1;break;case this._cVN:this._c5B[ "minute" ]=_cDP1;break;case this._cWN:this._c5B[ "second" ]=_cDP1;break;case this._cB9:this._c5B[ "millisecond" ]=_cDP1;break;default:this._c5B[ this._cF1 ]=_cDP1;}};C_PromptBaseIntervalTextBox.prototype._c1K=function(){if(this._c5B[ "day" ]&& this._c5B[ "hour" ]&& this._c5B[ "minute" ]&& this._c5B[ "second" ]&& this._c5B[ "millisecond" ]){return true;}else{return false;}};C_PromptBaseIntervalTextBox.prototype.F_PromptControl_OnFocus=function(){this._cG21();};C_PromptBaseIntervalTextBox.prototype.F_PromptControl_HasInput=function(_c5M){this._cD9(_c5M, true);this._cMX();};C_PromptBaseIntervalTextBox.prototype.F_PromptControl_EmptyInput=function(_c5M){this._cD9(_c5M, false);if(!this._cG1()){this._cLN();}};C_PromptBaseIntervalTextBox.prototype._cG1=function(){if(this._cAD1[ "day" ]|| this._cAD1[ "hour" ]|| this._cAD1[ "minute" ]|| this._cAD1[ "second" ]|| this._cAD1[ "millisecond" ]){return true;}else{return false;}};C_PromptBaseIntervalTextBox.prototype._cD9=function(_cTN,_cDP1){switch(_cTN){case this._cS21:this._cAD1[ "day" ]=_cDP1;break;case this._cXX:this._cAD1[ "hour" ]=_cDP1;break;case this._cVN:this._cAD1[ "minute" ]=_cDP1;break;case this._cWN:this._cAD1[ "second" ]=_cDP1;break;case this._cB9:this._cAD1[ "millisecond" ]=_cDP1;break;default:this._cAD1[ this._cF1 ]=_cDP1;}};C_PromptBaseIntervalTextBox.prototype.F_SetEnabled=function(_cQL1){if(this._cS21){this._cS21.F_SetEnabled(_cQL1);}if(this._cXX){this._cXX.F_SetEnabled(_cQL1);}if(this._cVN){this._cVN.F_SetEnabled(_cQL1);}if(this._cWN){this._cWN.F_SetEnabled(_cQL1);}if(this._cB9){this._cB9.F_SetEnabled(_cQL1);}};C_PromptBaseIntervalTextBox.prototype.F_ClearParameterValue=function(){var _cKS=this._cWC1?"0":"";this._cS21.F_ClearParameterValue(_cKS);this._cXX.F_ClearParameterValue(_cKS);this._cVN.F_ClearParameterValue(_cKS);if(this._cWN){this._cWN.F_ClearParameterValue(_cKS);}if(this._cB9){this._cB9.F_ClearParameterValue(_cKS);}};C_PromptBaseIntervalTextBox.prototype.F_SetParameterValue=function(_cYO1){var _cWB1=this.F_ToUseValue(_cYO1);if(!_cWB1||!_cWB1.match(/^-?P\d+DT\d{1,2}H\d{1,2}M\d{1,2}\.\d{1,3}S$/gi)){this.F_ClearParameterValue();}else{var _cRL1=_cWB1.split(/P/i);var _cRR1=_cRL1[0];_cRL1=_cRL1[1].split(/DT/i);this._cS21.F_SetParameterValue({"use": _cRR1+_cRL1[0]});_cRL1=_cRL1[1].split(/H/i);this._cXX.F_SetParameterValue({"use": _cRL1[0]});_cRL1=_cRL1[1].split(/M/i);this._cVN.F_SetParameterValue({"use": _cRL1[0]});if(this._cWN||this._cB9){_cRL1=_cRL1[1].split(/[.,S]+/i);if(this._cWN){this._cWN.F_SetParameterValue({"use": _cRL1[0]});}if(this._cB9){this._cB9.F_SetParameterValue({"use": _cRL1[1]});}}}};C_PromptBaseIntervalTextBox.prototype.F_SetValidator=function(_cN21){this._cS21.F_SetValidator(_cN21);this._cXX.F_SetValidator(_cN21);this._cVN.F_SetValidator(_cN21);if(this._cWN){this._cWN.F_SetValidator(_cN21);}if(this._cB9){this._cB9.F_SetValidator(_cN21);}};
|