HxG_5.prototype.JSFDatePicker=function () { this.type=hX_5.CMP_datepicker; this.ctype=hX_5.CLASS_DP; this.DOMobj_input=null; this.buttonBorder=-1; this.buttonColor=hX_5.CLR_BTN; this.commonConstructor(); this.objPopup=null; this.JSFBTN=null; this.attributeTable=[]; this.attributeTable ['validator']=['DTVid', hX_5.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['DTPid', hX_5.ARG_TO_NAN, false, null, null]; this.attributeTable ['css-prefix']=['CSSPrefix', hX_5.ARG_TO_NAN, false, null, null]; this.attributeTable ['first-day-of-week']=['nFirstDayOfWeek', hX_5.ARG_TO_NUM,false, 0, 6]; this.attributeTable ['multi-line']=['multiLine', hX_5.ARG_IS_TRUE, false, null, null]; this.attributeTable ['button-color']=['buttonColor', hX_5.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_5.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); } HxG_5.prototype.JSFDatePicker.prototype.commonConstructor=function () { this.nFirstDayOfWeek=hX_5.DTFMT_DEFAULTFIRSTDAYWEEK; this.CSSPrefix=null; this.multiLine=true; this.DTPid=this.DTVid=hX_5._E; this.DTP=this.DTV=null; this.oDate=this.oFocDate=this.oLastDate=this.oLastFocus=this.escapeToValue=null; this.oToday=new Date(); this.baseClass=hX_5._E; this.classes=null; this.CL_HDR=0; this.CL_HDR_L1=1; this.CL_HDR_L2=2; this.CL_HDR_YR=3; this.CL_HDR_MN=4; this.CL_HDR_WD=5; this.CL_BODY=6; this.CL_BTN=7; this.CL_M_HOV=8; this.CL_M_CUR=9; this.CL_M_OTH=10; this.CL_D_CUR=11; this.CL_D_INV=12; this.CL_T=13; this.CL_T_CUR=14; this.CL_SZ=15; this.HTML=this.sUnique=this.sUniqueD=null; this.timerTimed=this.timerInterval=this.wiggleX=this.wiggleY=0; this.HPCT="100%"; this.SPN1=hX_5.brw.isIE()?'':''; this.ESPN=''; } HxG_5.prototype.JSFDatePicker.prototype.onPageLoad=function () { this.DOMobj_input=this.DOMobj; if (this.DTPid && this.DTP == null) this.DTP=hX_5.getConverterById(this.DTPid); if (this.DTP == null) this.DTP=new hX_5.DateTimeConverter(); if (this.DTVid && this.DTV == null) this.DTV=hX_5.getValidatorById(this.DTVid); if (this.DTV == null) this.DTV=new hX_5.DateTimeValidator(); this.JSFBTN=new hX_5.JSFSubButton(this, 1, this.buttonBorder, this.buttonColor, hX_5.STR_DATE_DN_TOGGLE, null, true, hX_5.R_IMG_CAL_HINKIES); this.objPopup=hX_5.addPopup (this.id + "_POPUP", this.JSFBTN.oSpn.id, null, hX_5.POP_STYLE_CLICK, this); this.sUnique=this.id + "_POPUP_"; this.sUniqueD=this.sUnique + "DAY_"; this.redraw(); return true; } HxG_5.prototype.JSFDatePicker.prototype.redraw=function (resizeOnly) { if (this.JSFBTN) this.JSFBTN.size(resizeOnly); return true; } HxG_5.prototype.JSFDatePicker.prototype.uirelease=function (free) { if (this.JSFBTN) this.JSFBTN.depress("btn1", false); if (this.HTML) { this.pressButton (this.HTML.hdrbtn1, false); this.pressButton (this.HTML.hdrbtn2, false); this.pressButton (this.HTML.hdrbtn3, false); this.pressButton (this.HTML.hdrbtn4, false); } if (hX_5.uistate.getActiveComponent()==this && this.JSFBTN && this.JSFBTN.btn1) hX_5.i.setFocus(this.JSFBTN.btn1); if (free!=null) hX_5.uirelease(true); return true; } HxG_5.prototype.JSFDatePicker.prototype.destroy=function () { if (this.objPopup) hX_5.removePopup(this.objPopup.id); if (this.JSFBTN) { if (this.JSFBTN.destroy) this.JSFBTN.destroy(); delete this.JSFBTN; } if (this.classes) { while (this.classes.length>0) this.classes.pop(); delete this.classes; } delete this.attributeTable; if (this.HTML) delete this.HTML; return true; } HxG_5.prototype.JSFDatePicker.prototype.setValue=function (value, notify, raw, returns) { return this.iSetValue(value, notify, raw, returns); } HxG_5.prototype.JSFDatePicker.prototype.iSetValue=function (value, notify, raw, returns) { var r=false; if (this.DOMobj_input) { if (raw) { this.DOMobj_input.value=value; r=true; } else { var ivalue=null, was=this.getValue(); if (hX_5.isString(value)) ivalue=this.DTP.stringToValue (value); else if (hX_5.isObject(value) && value.constructor && value.constructor == Date) ivalue=value.Hx4Clone(0); if (ivalue && this.DTV.validate(ivalue, this.DTP, null, true)) { this.oDate=ivalue; if (returns) r=this.DTP.valueToString(ivalue); else { this.DOMobj_input.value=this.DTP.valueToString(ivalue); if (notify && was!=this.DOMobj_input.value) { hX_5.i.markEvent (this.DOMobj_input, hX_5._onF); hX_5.i.fireEvent (this.DOMobj_input, hX_5._onC); hX_5.i.fireEvent (this.DOMobj_input, hX_5._onB); } r=true; } } else { r=(returns) ? hX_5._E : false; } } } return r; } HxG_5.prototype.JSFDatePicker.prototype.reValue=function (dInc, notify, inValue) { if (this.DOMobj_input) { var skipInc=false, value=(inValue!=null) ? this.DTP.stringToValue(inValue) : this.getValue(true); if (value==null || !this.DTV.validate(value, this.DTP, null, true) && (inValue != null || this.DOMobj_input.value.length==0) && this.DTV && this.DTP) { value=this.oToday.Hx4Clone(0); value=this.DTV.coerce(value, this.DTP, null, true); } else if (this.DOMobj_input.value.length==0) skipInc=true; if (value) { if (!skipInc) { this.DTP.setCalendar(); value=hX_5.cal.adjustDate(value,0,0,dInc,0,0,0); } if (this.DTV.validate(value, this.DTP, null, true)) { if (inValue!=null) return (this.iSetValue(value, false, false, true)); else { this.iSetValue (value, notify); return true; } } } } return ((inValue) ? inValue : false); } HxG_5.prototype.JSFDatePicker.prototype.reValuePop=function (y, m, d, idate, updateSel, nofocus) { if (this.DOMobj_input) { var td, dd=d, o, f=null; if (idate) { f=idate; if (!this.DTV.validate(f, this.DTP, null, true)) return; } else { this.DTP.setCalendar(); f=this.oFocDate.Hx4Clone(0); if ((dd>=100 || dd<=-100)) { o=hX_5.cal.dateToCalendar(f); dd=(dd>=100) ? (hX_5.cal.daysInMonth(o.month,o.year)-o.date) : (-(o.date-1)); } f=hX_5.cal.adjustDate(f,y,m,dd,0,0,0); f=this.DTV.coerce(f, this.DTP, null, true); if (f==null) return; } this.updateGrid(f, (y!=0 || m!=0), (updateSel!=null)); if (nofocus==null) { this.oFocDate=f; this.showFocus (f); } } } HxG_5.prototype.JSFDatePicker.prototype.setDateFromValue=function () { this.oDate=this.getValue(true); if (this.oDate == null || !this.DTV.validate(this.oDate, this.DTP, null, true)) { this.oDate=this.oToday.Hx4Clone(0); this.oDate=this.DTV.coerce(this.oDate, this.DTP, null, true); } this.oFocDate=this.oDate.Hx4Clone(0); return true; } HxG_5.prototype.JSFDatePicker.prototype.getValue=function(cast) { if (this.DOMobj_input) { if (cast) { var d=this.DTP.stringToValue (this.DOMobj_input.value); return ((d != null) ? d.Hx4Clone(0) : this.oToday.Hx4Clone(0)); } return (this.DOMobj_input.value); } return null; } HxG_5.prototype.JSFDatePicker.prototype.setAttribute=function(a) { var wasV=this.DTVid, wasC=this.DTPid; hX_5.parseArg (this.attributeTable, this, a); if (this.bDsc) { this.bDsc.btnColor=this.buttonColor this.bDsc.btnBorder=this.buttonBorder; } if (this.DTPid && this.DTPid != wasC) this.DTP=hX_5.getConverterById(this.DTPid); if (this.DTVid && this.DTVid != wasV) this.DTV=hX_5.getValidatorById(this.DTVid); if (this.HTMLrendered) this.redraw(); return true; } HxG_5.prototype.JSFDatePicker.prototype.getAttribute=function (attribute) { return (hX_5.getArg(this.attributeTable, this, attribute)); } HxG_5.prototype.JSFDatePicker.prototype.setClassNames=function () { var i, test; if (this.type==hX_5.CMP_calendar) test=((this.CSSPrefix != null && this.CSSPrefix.length>0) ? this.CSSPrefix : hX_5.CLASS_CA); else test=((this.CSSPrefix != null && this.CSSPrefix.length>0) ? this.CSSPrefix : hX_5.CLASS_DEF) + hX_5.CLASS_DP; if (test != this.baseClass) { this.baseClass=test; this.classes=[]; for (i=0; i<=this.CL_SZ; i++) this.classes.push(this.baseClass + hX_5.CLASS_DPS[i]); } if (!hX_5.isClassDefined(this.classes[this.CL_M_HOV])) this.classes[this.CL_M_HOV]=null; } HxG_5.prototype.JSFDatePicker.prototype.isRedirectFcnKey=function (evt) { if (evt.altKey || evt.ctrlKey) return false; var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; return (code == hX_5.KEY_UPARROW || code == hX_5.KEY_DNARROW); } HxG_5.prototype.JSFDatePicker.prototype.doRedirectFcnKey=function (evt, newValue) { var r=null, code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (evt.altKey || evt.ctrlKey) return r; if (code == hX_5.KEY_UPARROW) r=this.reValue(+1, false, newValue); else if (code == hX_5.KEY_DNARROW) r=this.reValue(-1, false, newValue); return r; } HxG_5.prototype.JSFDatePicker.prototype.dispatchCancel=function (evt) { if (this.objPopup.isPopped()) this.iSetValue(this.escapeToValue, true, true); } HxG_5.prototype.JSFDatePicker.prototype.dispatchPopEvent=function (evt, src) { var r=false, stop=true, nYrAdj=0, nDayAdj=0, nMonAdj=0, b, bo; if (!this.objPopup.isPopped()) return r; if ((this.timerTimed != 0 || this.timerInterval != 0) && (evt.type==hX_5._evKD || evt.type==hX_5._evKU || evt.type==hX_5._evMU || evt.type==hX_5._evMM)) { if (evt.type==hX_5._evMM) stop=(this.timerInterval!=0)?((Math.abs(this.wiggleX-evt.clientX)>4 || Math.abs(this.wiggleY-evt.clientY)>4)):false; if (stop) this.stopTimer(); } if (evt.type==hX_5._evKD) { switch (evt.keyCode) { case hX_5.KEY_SPACEBAR: case hX_5.KEY_ENTER: this.setValue(this.oFocDate, true); this.reValuePop (0,0,0,this.oDate,true); hX_5.popMgr.endTimed(true); break; case hX_5.KEY_HOME: nDayAdj=-100; break; case hX_5.KEY_PGUP: nMonAdj=-1; break; case hX_5.KEY_END: nDayAdj=+100; break; case hX_5.KEY_PGDN: nMonAdj=+1; break; case hX_5.KEY_LTARROW: if (evt.shiftKey) nMonAdj=-1; else nDayAdj=-1; break; case hX_5.KEY_UPARROW: if (evt.shiftKey) nYrAdj=-1; else nDayAdj=-7; break; case hX_5.KEY_RTARROW: if (evt.shiftKey) nMonAdj=1; else nDayAdj=1; break; case hX_5.KEY_DNARROW: if (evt.shiftKey) nYrAdj=+1; else nDayAdj=7; break; case hX_5.KEY_TAB: nDayAdj=evt.shiftKey ? -1 : 1; break; default: break; } if (nYrAdj!=0 || nDayAdj!=0 || nMonAdj!=0) this.reValuePop (nYrAdj,nMonAdj,nDayAdj); } else if (src.tagName!=undefined && (evt.type==hX_5._evMD || evt.type==hX_5._evMM)) { if (evt.type==hX_5._evMD && src.id!=undefined && src.id.indexOf("HDRBTN")>=0) { b=parseInt (src.id.substr(src.id.length-1),10); bo=(b==1) ? this.HTML.hdrbtn1 : ((b==2) ? this.HTML.hdrbtn2 : ((b==3) ? this.HTML.hdrbtn3 : this.HTML.hdrbtn4)); nYrAdj=(b==1) ? -1 : ((b==2) ? +1 : 0); nMonAdj=(b==3) ? -1 : ((b==4) ? +1 : 0); this.pressButton (bo, true); this.reValuePop (nYrAdj,nMonAdj,0); this.wiggleX=evt.clientX; this.wiggleY=evt.clientY; this.timerTimed=hX_5.i.startTimerTimed (this.id, "btn" + b, "start", 100); } else { if (src.tagName==hX_5._SPN || src.tagName==hX_5._ANC) src=src.parentNode; if (src && src.tagName && src.tagName == hX_5._TD && src.id && src.id.indexOf(this.sUniqueD)>=0) { if (evt.type==hX_5._evMD) { this.oDate=this.tagToDate(src); this.reValuePop (0,0,0,this.tagToDate(src),true); } else this.reValuePop (0,0,0,this.tagToDate(src)); } } } else if (src.tagName!=undefined && evt.type==hX_5._evMU) { if (src.tagName == hX_5._SPN || src.tagName == hX_5._ANC) src=src.parentNode; if (src && src.tagName && src.tagName == hX_5._TD && src.id && src.id.indexOf(this.sUniqueD)>=0) { if (this.setValue (this.tagToDate(src),true)) { this.reValuePop (0,0,0,this.oDate,true); hX_5.popMgr.endTimed(); } } } return r; } HxG_5.prototype.JSFDatePicker.prototype.dispatchComponent=function (item, evt, action, keycode) { var r=true, dropit=false, undropit=false; if (this.objPopup != null) { if (item=="btn1") { if (action==hX_5._evMD) { if (this.objPopup.isPopped()) undropit=true; else dropit=true; } else if (action==hX_5._evKD) { if (keycode == hX_5.KEY_ENTER || keycode == hX_5.KEY_SPACEBAR || ((!evt.ctrlKey) && (keycode == hX_5.KEY_UPARROW || keycode == hX_5.KEY_DNARROW))) { if (this.objPopup.isPopped()) undropit=true; else dropit=true; r=false; } else if (!evt.ctrlKey && (keycode >= hX_5.KEY_SPACEBAR && keycode <= hX_5.KEY_DNARROW)) { r=false; } } else if (action==hX_5._evKP || action==hX_5._evKU) { if (keycode >= hX_5.KEY_SPACEBAR && keycode <= hX_5.KEY_DNARROW) r=false; } else if (action==hX_5._evMC || action==hX_5._evMCC || action==hX_5._evMM || action==hX_5._evMO || action==hX_5._evMV || action==hX_5._evMU || action==hX_5._evB || action==hX_5._evF) { } else { this.uirelease(true); } } else if (item==hX_5._lINP) { if (action==hX_5._evKD) { if (!evt.altKey && !evt.ctrlKey) { if (keycode == hX_5.KEY_DNARROW) this.reValue(-1, false); else if (keycode == hX_5.KEY_UPARROW) this.reValue(+1, false); } } } else { this.uirelease(true); } if (dropit) { this.uirelease(true); this.escapeToValue=this.DOMobj_input.value; hX_5.i.setFocus(this.JSFBTN.btn1); hX_5.uistate.setActiveComponent (this); this.JSFBTN.depress("btn1", true); this.setDateFromValue(); this.sizePickerToInput(); this.objPopup.uivisible(); this.showFocus(this.oFocDate); r=false; } else if (undropit) { this.uirelease(true); r=false; } } if (!r) hX_5.i.cancelAction(evt, true); return r; } HxG_5.prototype.JSFDatePicker.prototype.dispatchTimer=function (item, action) { if (action == "spin") { var btn=parseInt(item.substr(item.length-1),10); var nYrAdj=(btn==1) ? -1 : ((btn==2) ? +1 : 0); var nMonAdj=(btn==3) ? -1 : ((btn==4) ? +1 : 0); this.reValuePop (nYrAdj, nMonAdj, 0, null); } else if (action == "start") { this.timerTimed=0; this.timerInterval=hX_5.i.startTimerInterval (this.id, item, "spin", 50); } } HxG_5.prototype.JSFDatePicker.prototype.stopTimer=function (item, action) { if (this.timerInterval != 0) hX_5.i.killTimerInterval(this.timerInterval); if (this.timerTimed != 0) hX_5.i.killTimerTimed(this.timerTimed); this.timerTimed=this.timerInterval=0; this.pressButton (this.HTML.hdrbtn1, false); this.pressButton (this.HTML.hdrbtn2, false); this.pressButton (this.HTML.hdrbtn3, false); this.pressButton (this.HTML.hdrbtn4, false); } HxG_5.prototype.JSFDatePicker.prototype.sizePickerToInput=function () { return (this.objPopup) ? (this.buildContent(this.objPopup.getElem(), this.objPopup.getDoc(), this.sUnique)):false; } HxG_5.prototype.JSFDatePicker.prototype.buildContent=function (el, doc, unq) { this.setClassNames(); if (!this.HTML) this.HTML=new hX_5.JSFMonth(this, el, doc, unq, this.multiLine); if (!this.HTML.valid) return false; if (el.className != this.baseClass) el.className=this.baseClass; hX_5.g.setP(el, hX_5._OFW, hX_5._VS); hX_5.g.setP(el, hX_5._WD, hX_5._E); hX_5.g.setP(el, hX_5._HT, hX_5._E); if (this.type==hX_5.CMP_datepicker) { if (this.HTML.table.className != this.classes[this.CL_SZ]) this.HTML.table.className=this.classes[this.CL_SZ]; } else { if (this.HTML.table.width != this.HPCT) this.HTML.table.width=this.HPCT; } if (this.HTML.td1.width != hX_5._E) this.HTML.td1.width=hX_5._E; if (this.HTML.td2.width != hX_5._E) this.HTML.td2.width=hX_5._E; if (this.HTML.hdrTable.className != this.classes[this.CL_HDR]) this.HTML.hdrTable.className=this.classes[this.CL_HDR]; if (this.HTML.hdrTable.width != this.HPCT) this.HTML.hdrTable.width=this.HPCT; if (this.HTML.hdrtr1.cells[0].className != this.classes[this.CL_HDR_L1])this.HTML.hdrtr1.cells[0].className=this.classes[this.CL_HDR_L1]; if (this.HTML.hdrtr1.cells[1].className != this.classes[this.CL_HDR_YR])this.HTML.hdrtr1.cells[1].className=this.classes[this.CL_HDR_YR]; if (this.HTML.hdrtr1.cells[2].className != this.classes[this.CL_HDR_L1])this.HTML.hdrtr1.cells[2].className=this.classes[this.CL_HDR_L1]; if (this.multiLine) { if (this.HTML.hdrtr2.cells[0].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[0].className=this.classes[this.CL_HDR_L2]; if (this.HTML.hdrtr2.cells[1].className != this.classes[this.CL_HDR_MN])this.HTML.hdrtr2.cells[1].className=this.classes[this.CL_HDR_MN]; if (this.HTML.hdrtr2.cells[2].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[2].className=this.classes[this.CL_HDR_L2]; } else { if (this.HTML.hdrtr2.cells[0].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[0].className=this.classes[this.CL_HDR_L2]; if (this.HTML.hdrtr2.cells[1].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[1].className=this.classes[this.CL_HDR_L2]; if (this.HTML.hdrtr2.cells[2].className != this.classes[this.CL_HDR_MN])this.HTML.hdrtr2.cells[2].className=this.classes[this.CL_HDR_MN]; if (this.HTML.hdrtr2.cells[3].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[3].className=this.classes[this.CL_HDR_L2]; if (this.HTML.hdrtr2.cells[4].className != this.classes[this.CL_HDR_L2])this.HTML.hdrtr2.cells[4].className=this.classes[this.CL_HDR_L2]; } if (this.HTML.hdrbtn1.className != this.classes[this.CL_BTN]) this.HTML.hdrbtn1.className=this.classes[this.CL_BTN]; if (this.HTML.hdrbtn2.className != this.classes[this.CL_BTN]) this.HTML.hdrbtn2.className=this.classes[this.CL_BTN]; if (this.HTML.hdrbtn3.className != this.classes[this.CL_BTN]) this.HTML.hdrbtn3.className=this.classes[this.CL_BTN]; if (this.HTML.hdrbtn4.className != this.classes[this.CL_BTN]) this.HTML.hdrbtn4.className=this.classes[this.CL_BTN]; var i,c,s; if (this.HTML.bodyTable.className != this.classes[this.CL_BODY]) this.HTML.bodyTable.className=this.classes[this.CL_BODY]; if (this.HTML.bodyTable.width != this.HPCT) this.HTML.bodyTable.width=this.HPCT; for (i=this.nFirstDayOfWeek; i < this.nFirstDayOfWeek + 7; i++) { c=this.HTML.bodytr1.cells[i - this.nFirstDayOfWeek]; if (c.width != hX_5._E) c.width=hX_5._E; if (c.className != this.classes[this.CL_HDR_WD]) c.className=this.classes[this.CL_HDR_WD]; s=this.SPN1 + this.DTP.valueToSShortDayLabel(i%7) + this.ESPN; if (hX_5.getIHTML(c) != s) hX_5.setIHTML(c,s); } this.updateGrid(this.oFocDate, true, false); return true; } HxG_5.prototype.JSFMonth=function (thisp, inobj, doc, suffix, multi) { this.valid=false; if (inobj == null) return; this.table=this.tr1=this.tr2=this.td1=this.td2=null; this.hdrTable=this.hdrtr1=this.hdrtr2=null; this.hdrbtn1=this.hdrbtn2=this.hdrbtn3=this.hdrbtn4=null; this.hdrMonth=this.hdrYear=null; this.bodyTable=this.bodytr1=this.bodytr2=null; this.table=hX_5.getFirstChildInCell(inobj); if ((this.table == null) || (this.table.tagName != hX_5._TAB)) { this.table=doc.createElement(hX_5._TAB); this.table.setAttribute (hX_5._ID, suffix + "TABLE"); this.table.cellPadding=this.table.cellSpacing=this.table.border=hX_5._Z; inobj.appendChild(this.table); this.tr1=this.table.insertRow(0); this.tr2=this.table.insertRow(1); this.td1=this.tr1.insertCell(0); this.td2=this.tr2.insertCell(0); this.td1.vAlign=this.td2.vAlign=hX_5._TOP; this.td1.align=this.td2.align=hX_5._LFT; } if (!this.table) return; this.tr1=this.table.rows[0]; this.tr2=this.table.rows[1]; this.td1=this.tr1.cells[0]; this.td2=this.tr2.cells[0]; if (!this.tr1 || !this.tr2 || !this.td1 || !this.td2) return; var htd1, htd2, htd3, htd4, htd5, htd6, htd7=null, htd8=null; this.hdrTable=hX_5.getFirstChildInCell(this.td1); if (this.hdrTable == null) { this.hdrTable=doc.createElement(hX_5._TAB); this.hdrTable.setAttribute (hX_5._ID, suffix + "HDR_TABLE"); this.hdrTable.cellPadding=this.hdrTable.cellSpacing=this.hdrTable.border=hX_5._Z; this.td1.appendChild(this.hdrTable); this.hdrtr1=this.hdrTable.insertRow(0); this.hdrtr2=this.hdrTable.insertRow(1); htd1=this.hdrtr1.insertCell(0); htd2=this.hdrtr1.insertCell(0); htd3=this.hdrtr1.insertCell(0); if (!multi) htd7=this.hdrtr2.insertCell(0); htd4=this.hdrtr2.insertCell(0); htd5=this.hdrtr2.insertCell(0); htd6=this.hdrtr2.insertCell(0); if (!multi) { htd8=this.hdrtr2.insertCell(0); htd7.vAlign=htd8.vAlign=hX_5._MID; htd7.align=hX_5._LFT; htd8.align=hX_5._RGT; } htd1.vAlign=htd2.vAlign=htd3.vAlign=htd4.vAlign=htd5.vAlign=htd6.vAlign=hX_5._MID; htd1.align=htd4.align=hX_5._LFT; htd2.align=htd5.align=hX_5._CTR; htd3.align=htd6.align=hX_5._RGT; } if (!this.hdrTable) return; this.hdrtr1=this.hdrTable.rows[0]; this.hdrtr2=this.hdrTable.rows[1]; htd1=this.hdrtr1.cells[0]; htd2=this.hdrtr1.cells[1]; htd3=this.hdrtr1.cells[2]; if (multi) { htd4=this.hdrtr2.cells[0]; htd5=this.hdrtr2.cells[1]; htd6=this.hdrtr2.cells[2]; } else { htd7=this.hdrtr2.cells[0]; htd4=this.hdrtr2.cells[1]; htd5=this.hdrtr2.cells[2]; htd6=this.hdrtr2.cells[3]; htd8=this.hdrtr2.cells[4]; } if (!this.hdrtr1 || !this.hdrtr2 || !htd1 || !htd2 || !htd3 || !htd4 || !htd5 || !htd6) return; this.hdrbtn1=hX_5.getFirstChildInCell(htd1); if (!this.hdrbtn1) this.hdrbtn1=thisp.emitButtonHTML (((multi)?htd1:htd7), suffix + "HDRBTN1", doc, ((multi)?1:3), 0, hX_5.STR_DATE_PREVIOUS_YEAR) this.hdrbtn2=hX_5.getFirstChildInCell(htd3); if (!this.hdrbtn2) this.hdrbtn2=thisp.emitButtonHTML (((multi)?htd3:htd8), suffix + "HDRBTN2", doc, ((multi)?0:2), 0, hX_5.STR_DATE_NEXT_YEAR) this.hdrbtn3=hX_5.getFirstChildInCell(htd4); if (!this.hdrbtn3) this.hdrbtn3=thisp.emitButtonHTML (htd4, suffix + "HDRBTN3", doc, 1, 0, hX_5.STR_DATE_PREVIOUS_MONTH) this.hdrbtn4=hX_5.getFirstChildInCell(htd6); if (!this.hdrbtn4) this.hdrbtn4=thisp.emitButtonHTML (htd6, suffix + "HDRBTN4", doc, 0, 0, hX_5.STR_DATE_NEXT_MONTH) this.hdrYear=htd2; this.hdrMonth=htd5; var i, j, r, c; this.bodyTable=hX_5.getFirstChildInCell(this.td2); if (this.bodyTable == null) { this.bodyTable=doc.createElement(hX_5._TAB); this.bodyTable.setAttribute (hX_5._ID, suffix + "BODY_TABLE"); this.bodyTable.cellPadding=this.bodyTable.cellSpacing=this.bodyTable.border=hX_5._Z; this.td2.appendChild(this.bodyTable); for (i=0; i < 7; i++) { r=this.bodyTable.insertRow(i); for (j=0; j < 7; j++) { c=r.insertCell(j); c.vAlign=hX_5._MID; c.align=hX_5._CTR; c.style.cursor=hX_5._PTR; } } } if (!this.bodyTable) return; this.bodytr1=this.bodyTable.rows[0]; this.bodytr2=this.bodyTable.rows[1]; if (this.bodytr1 && this.bodytr2) this.valid=true; } HxG_5.prototype.JSFDatePicker.prototype.emitButtonHTML=function (parent, id, doc, wellx, welly, alt) { var b=null; if (id) { b=doc.createElement(hX_5._IMG); b.setAttribute (hX_5._ID, id); b.className=this.classes[this.CL_BTN]; b.src=this.r.getURL (hX_5.R_IMG_SPACER); if (hX_5.brw.isIE()) b.hideFocus=true; else if (hX_5.brw.isNavOrMoz()) hX_5.g.setP(b, hX_5._ZUF, hX_5._IGN); b.alt=b.title=alt; b.style.backgroundImage=this.r.getURI (hX_5.R_IMG_VLG_HINKIES); b.style.backgroundPosition=this.r.wellPosition(hX_5.R_IMG_VLG_HINKIES, wellx, welly); b.style.backgroundRepeat=hX_5._NREP; b.style.margin=hX_5._ZPX; b.style.cursor="pointer"; if (b.unselectable!=undefined) b.unselectable=true; parent.appendChild(b); } return b; } HxG_5.prototype.JSFDatePicker.prototype.pressButton=function (id, down) { var b=hX_5.getElementById(id), w=((b==this.HTML.hdrbtn1||b==this.HTML.hdrbtn3)?1:0)+((!this.multiLine&&(b==this.HTML.hdrbtn1||b==this.HTML.hdrbtn2))?2:0); if (b) hX_5.g.setP(b,hX_5._BPOS,this.r.wellPosition(hX_5.R_IMG_VLG_HINKIES,w,((down)?1:0))); } HxG_5.prototype.JSFDatePicker.prototype.updateGrid=function (newDate, init, updateSel) { this.DTP.setCalendar(); var was=this.oLastDate,el,cl,x,y,iDaysBefore,iDaysInAndBefore,iNoOfRows,dInM,sizeChanged=false,row,cell,t,tC,tF; this.oLastDate=this.oDate; if (!init && this.dateToTag(newDate)!=null) { if (!updateSel) return true; el=this.dateToTag(this.oDate); if (el!=null) { cl=this.calcClass(this.oDate, el.id.charAt(el.id.length-1)=="X"); if (el.className!=cl) el.className=cl; } el=(was!=null)?this.dateToTag(was):null; if (el!=null) { cl=this.calcClass(was, el.id.charAt(el.id.length-1)=="X"); if (el.className!=cl) el.className=cl; } return true; } hX_5.g.setP(this.HTML.hdrtr1, hX_5._DSP, (this.multiLine)?hX_5._E:hX_5._NO); var yr=this.DTP.valueToYearLabel(newDate), mo=this.DTP.valueToMonthLabel(newDate); if (!hX_5.brw.isNavOrMoz()) { yr=this.SPN1 + yr + this.ESPN; mo=this.SPN1 + mo + this.ESPN; } if (this.multiLine) { if (hX_5.getIHTML(this.HTML.hdrYear) != yr) hX_5.setIHTML(this.HTML.hdrYear,yr); if (hX_5.getIHTML(this.HTML.hdrMonth) != mo) hX_5.setIHTML(this.HTML.hdrMonth,mo); } else { yr=mo + " " + yr; if (hX_5.getIHTML(this.HTML.hdrMonth) != yr) hX_5.setIHTML(this.HTML.hdrMonth,yr); } tC=hX_5.cal.dateToCalendar(newDate); dInM=hX_5.cal.daysInMonth(tC.month, tC.year); t=newDate.Hx4Clone(0); t=hX_5.cal.adjustDate(t,0,0,(1-tC.date),0,0,0); if (this.DTV) { if (this.DTV.minimumDate) { t=hX_5.cal.adjustDate(t,0,0,-1,0,0,0); x=t.Hx4CompareDate(this.DTV.minimumDate, false) >=0; hX_5.g.setP(this.HTML.hdrbtn1, hX_5._DSP, (x)?hX_5._E:hX_5._NO); hX_5.g.setP(this.HTML.hdrbtn3, hX_5._DSP, (x)?hX_5._E:hX_5._NO); t=hX_5.cal.adjustDate(t,0,0,+1,0,0,0); } if (this.DTV.maximumDate) { t=hX_5.cal.adjustDate(t,0,0,dInM,0,0,0); x=t.Hx4CompareDate(this.DTV.maximumDate, false) <= 0; hX_5.g.setP(this.HTML.hdrbtn2, hX_5._DSP, (x)?hX_5._E:hX_5._NO); hX_5.g.setP(this.HTML.hdrbtn4, hX_5._DSP, (x)?hX_5._E:hX_5._NO); t=hX_5.cal.adjustDate(t,0,0,-dInM,0,0,0); } } iDaysBefore=hX_5.cal.getDay(t) - this.nFirstDayOfWeek; if (iDaysBefore < 0) iDaysBefore+=7; iDaysInAndBefore=dInM + iDaysBefore; iNoOfRows=Math.floor(iDaysInAndBefore/7); if (iDaysInAndBefore > iNoOfRows*7) iNoOfRows++; if (iDaysBefore) t=hX_5.cal.adjustDate(t,0,0,-iDaysBefore,0,0,0); for (y=iNoOfRows; y<6; y++) { row=this.HTML.bodyTable.rows[y+1]; if (row && row.style.display != hX_5._NO) { row.style.display=hX_5._NO; for(x=0; x<7; x++) row.cells[x].id=hX_5._E; sizeChanged=true; } } for (y=0; y7) || (r==nRows-1 && oLDate.date<7)), sid=this.dateToID(oDate, inM), sDate=this.DTP.cvtToDigits(oLDate.date), cl=this.calcClass(oDate, inM); if (cell.id != sid) cell.setAttribute(hX_5._ID, sid); if (cell.className != cl) cell.className=cl; if (this.type==hX_5.CMP_datepicker && cell.tabIndex!=undefined && cell.tabIndex != hX_5._1) cell.tabIndex=hX_5._1; if (cell.firstChild!=undefined && cell.firstChild.tagName!=undefined && cell.firstChild.tagName==hX_5._SPN && cell.firstChild.firstChild!=undefined && cell.firstChild.firstChild.nodeType==hX_5.TEXT_NODE) { cell.firstChild.firstChild.nodeValue=sDate; } else hX_5.setIHTML(cell, this.SPN1 + sDate + this.ESPN); return true; } HxG_5.prototype.JSFDatePicker.prototype.dateToTag=function(oDate,inM) { var r=hX_5.getElementById(this.dateToID(oDate,true)); if (r==null) r=hX_5.getElementById(this.dateToID(oDate,false)); return r; } HxG_5.prototype.JSFDatePicker.prototype.dateToID=function(oDate,inM) { return ((oDate) ? this.sUniqueD + this.DTP.valueToConstant(oDate)+((inM)?"X":"O"): hX_5._E); } HxG_5.prototype.JSFDatePicker.prototype.tagToDate=function(tag) { return ((tag&&tag.id!=undefined) ? this.DTP.constantToValue(tag.id.substr(this.sUniqueD.length,tag.id.length-1)) : null); } HxG_5.prototype.JSFDatePicker.prototype.calcClass=function(oDate, inMonth) { var s=(this.oDate!=null) && (0==oDate.Hx4CompareDate(this.oDate)), t=(0==oDate.Hx4CompareDate(this.oToday)); var cl=(inMonth)?this.CL_M_OTH:this.CL_M_CUR; if (t) cl=this.CL_T; if (s) cl=(t)?this.CL_T_CUR:this.CL_D_CUR; cl=this.classes[cl]; if (!this.DTV.validate(oDate, this.DTP, true, true)) cl=this.classes[this.CL_D_INV]; return cl; } HxG_5.prototype.JSFDatePicker.prototype.showFocus=function(d) { var w, o=(d)?this.dateToTag(d):null; if (o!=null) { if (this.type==hX_5.CMP_datepicker && this.objPopup.isPopped()) { if (o.focus!=undefined) { o.focus(); } else { w=hX_5.getFirstChildInCell(o); if (w && w.tagName!=undefined && w.focus) hX_5.i.setFocus(w,false,true); } } if (this.classes[this.CL_M_HOV]!=null) { w=(this.lastFocus!=null)?this.dateToTag(this.lastFocus):null; if (w!=null) w.className=hX_5.replaceAll(w.className,hX_5._B + this.classes[this.CL_M_HOV],hX_5._E); o.className=o.className + hX_5._B + this.classes[this.CL_M_HOV]; this.lastFocus=this.tagToDate(o); } } } HxG_5.prototype.JSFDatePicker.prototype.hideFocus=function() { var w=(this.lastFocus!=null)?this.dateToTag(this.lastFocus):null; if (w!=null && this.classes[this.CL_M_HOV]!=null) w.className=hX_5.replaceAll(w.className,hX_5._B + this.classes[this.CL_M_HOV],hX_5._E); this.lastFocus=null; }