2 Copyright (C) 2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 function uixEarlierDate(date1, date2) {
23 // can this be done in a sane way?
24 if (date1.getYear() < date2.getYear()) return date1;
25 if (date1.getYear() > date2.getYear()) return date2;
27 if (date1.getMonth() < date2.getMonth()) return date1;
28 if (date1.getMonth() > date2.getMonth()) return date2;
30 if (date1.getDate() < date2.getDate()) return date1;
31 if (date1.getDate() > date2.getDate()) return date2;
36 function validateAptEditor() {
37 var e, startdate, enddate, tmpdate;
39 e = document.getElementById('summary');
40 if (e.value.length == 0) {
41 if (!confirm(labels.validate_notitle))
45 e = document.getElementById('startTime_date');
46 if (e.value.length != 10) {
47 alert(labels.validate_invalid_startdate);
50 startdate = calendar_startTime_date.prs_date(e.value);
51 if (startdate == null) {
52 alert(labels.validate_invalid_startdate);
56 e = document.getElementById('endTime_date');
57 if (e.value.length != 10) {
58 alert(labels.validate_invalid_enddate);
61 enddate = calendar_endTime_date.prs_date(e.value);
62 if (enddate == null) {
63 alert(labels.validate_invalid_enddate);
67 tmpdate = uixEarlierDate(startdate, enddate);
68 if (tmpdate == enddate) {
69 alert(labels.validate_endbeforestart);
72 else if (tmpdate == null /* means: same date */) {
76 start = document.forms[0]['startTime_time_hour'].value;
77 end = document.forms[0]['endTime_time_hour'].value;
79 alert(labels.validate_endbeforestart);
82 else if (start == end) {
83 start = document.forms[0]['startTime_time_minute'].value;
84 end = document.forms[0]['endTime_time_minute'].value;
86 alert(labels.validate_endbeforestart);