| <?xml version="1.0" encoding="UTF-8" ?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| |
| --> |
| <library> |
| |
| <class name="dateField" extends="view" width="104"> |
| |
| <attribute name="enabled" value="true" type="boolean" /> |
| <attribute name="setDefaultToday" value="false" type="boolean" /> |
| <attribute name="additionalDay" value="0" type="number" /> |
| |
| <handler name="oninit"> |
| if (this.setDefaultToday){ |
| if (this.additionalDay==0){ |
| this._text.setAttribute('text',parseDateToString(new Date())); |
| } else { |
| var date = new Date(); |
| date.setTime(date.getTime()+86400000); |
| this._text.setAttribute('text',parseDateToString(date)); |
| } |
| } |
| </handler> |
| |
| <method name="setText" args="txt"> |
| this.setAttribute('text',txt); |
| </method> |
| <method name="getText" > |
| return this._text.getText(); |
| </method> |
| |
| <method name="setDate" args="d"> |
| |
| </method> |
| <method name="getDate"> |
| var tString = this._text.getText(); |
| var y = tString.substring(6,10); |
| var m = Number(tString.substring(3,5))-1; |
| var d = tString.substring(0,2); |
| var date = new Date(y,m,d); |
| if ($debug) Debug.write(date); |
| return date; |
| </method> |
| |
| <attribute name="text" value="" type="string" /> |
| |
| <customEdittext name="_text" width="$once{ parent.width-22 }" regexpType="date" |
| align="left" text="${ parent.text }" enabled="${ parent.enabled }" /> |
| |
| <blueButton resourceItem="date_icon_rsc" align="right" |
| opacity="${ ((parent.enabled) ? 1 : 0.4) }" |
| x_insetResource="2" y_insetResource="2" width="20" height="20" |
| width_insetResource="16" height_insetResource="16"> |
| <handler name="onclick"> |
| if (parent.enabled) { |
| new lz.calendarWindow(this.parent.parent,{fieldRef:this.parent._text,x:this.parent.x+(this.parent.width-200),y:this.parent.y}); |
| } |
| </handler> |
| <labelTooltip labelid="162" /> |
| </blueButton> |
| |
| </class> |
| |
| </library> |