From 0ca6651b84ebd6a05027797defd93eb5598e3b12 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 19 Jul 2005 14:23:18 +0000 Subject: [PATCH] fixed calendar validation git-svn-id: http://svn.opengroupware.org/SOGo/trunk@827 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Scheduler/ChangeLog | 4 ++ SOGo/UI/Scheduler/UIxDatePicker.m | 81 ++++++++++------------ SOGo/UI/Scheduler/Version | 2 +- SOGo/UI/Templates/ChangeLog | 5 ++ SOGo/UI/Templates/UIxAppointmentEditor.wox | 4 +- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index ee6dad0e..d6dea6e2 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,7 @@ +2005-07-19 Helge Hess + + * UIxDatePicker.m: code cleanups (v0.9.141) + 2005-07-19 Marcus Mueller * v0.9.140 diff --git a/SOGo/UI/Scheduler/UIxDatePicker.m b/SOGo/UI/Scheduler/UIxDatePicker.m index 65f94a01..3ce08274 100644 --- a/SOGo/UI/Scheduler/UIxDatePicker.m +++ b/SOGo/UI/Scheduler/UIxDatePicker.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,19 +18,18 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include -@class NSString, NSCalendarDate; +@class NSString; @interface UIxDatePicker : WOComponent { - NSString *dateID; - id day; - id month; - id year; - NSString *label; + NSString *dateID; + id day; + id month; + id year; + NSString *label; } - (NSString *)dateID; @@ -62,19 +61,19 @@ } - (void)setDay:(id)_day { - ASSIGN(self->day, _day); + ASSIGN(self->day, _day); } - (id)day { return self->day; } - (void)setMonth:(id)_month { - ASSIGN(self->month, _month); + ASSIGN(self->month, _month); } - (id)month { return self->month; } - (void)setYear:(id)_year { - ASSIGN(self->year, _year); + ASSIGN(self->year, _year); } - (id)year { return self->year; @@ -111,36 +110,29 @@ return [useISOFormats boolValue]; } - (NSString *)formattedDateString { + char buf[22]; + if ([self useISOFormats]) { - return [NSString stringWithFormat:@"%04d-%02d-%02d", - [[self year] intValue], - [[self month] intValue], - [[self day] intValue]]; + sprintf(buf, "%04d-%02d-%02d", + [[self year] intValue], + [[self month] intValue], + [[self day] intValue]); } else { - return [NSString stringWithFormat:@"%02d/%02d/%04d", - [[self day] intValue], - [[self month] intValue], - [[self year] intValue]]; + sprintf(buf, "%02d/%02d/%04d", + [[self day] intValue], + [[self month] intValue], + [[self year] intValue]); } + return [NSString stringWithCString:buf]; } - (NSString *)dateFormat { - if ([self useISOFormats]) { - return @"%Y-%m-%d"; - } - else { - return @"%d/%m/%Y"; - } + return [self useISOFormats] ? @"%Y-%m-%d" : @"%d/%m/%Y"; } - (NSString *)jsDateFormat { - if ([self useISOFormats]) { - return @"yyyy-mm-dd"; - } - else { - return @"dd/mm/yyyy"; - } + return [self useISOFormats] ? @"yyyy-mm-dd" : @"dd/mm/yyyy"; } @@ -164,10 +156,8 @@ languages = nil; #endif - return [rm urlForResourceNamed:@"skycalendar.html" - inFramework:nil - languages:languages - request:[ctx request]]; + return [rm urlForResourceNamed:@"skycalendar.html" inFramework:nil + languages:languages request:[ctx request]]; } /* JavaScript */ @@ -182,14 +172,14 @@ @"var calendar_%@ = new skycalendar(document.getElementById('%@'));\n" @"calendar_%@.setCalendarPage('%@');\n" @"calendar_%@.setDateFormat('%@');\n"; - + return [NSString stringWithFormat:code, - self->dateID, - self->dateID, - self->dateID, - [self calendarPageURL], - self->dateID, - [self jsDateFormat]]; + self->dateID, + self->dateID, + self->dateID, + [self calendarPageURL], + self->dateID, + [self jsDateFormat]]; } /* action */ @@ -206,12 +196,13 @@ d = [NSCalendarDate dateWithString:dateString calendarFormat:[self dateFormat]]; - if (d == nil) + if (d == nil) { [self warnWithFormat:@"Could not parse dateString: '%@'", dateString]; - [self setDay:[NSNumber numberWithInt:[d dayOfMonth]]]; + } + [self setDay: [NSNumber numberWithInt:[d dayOfMonth]]]; [self setMonth:[NSNumber numberWithInt:[d monthOfYear]]]; - [self setYear:[NSNumber numberWithInt:[d yearOfCommonEra]]]; + [self setYear: [NSNumber numberWithInt:[d yearOfCommonEra]]]; [super takeValuesFromRequest:_rq inContext:_ctx]; } diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index 776e658b..81ceab5e 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=140 +SUBMINOR_VERSION:=141 # v0.9.136 requires SOGoUI v0.9.30 # v0.9.123 requires Appointments v0.9.35 diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index 2a5c4d90..9c0c2082 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,3 +1,8 @@ +2005-07-19 Helge Hess + + * UIxAppointmentEditor.wox: use dateformat specific parsing methods + during validation (#1490) + 2005-07-19 Marcus Mueller * AnaisUidSelector.wox: moved JavaScript into component, renamed quite diff --git a/SOGo/UI/Templates/UIxAppointmentEditor.wox b/SOGo/UI/Templates/UIxAppointmentEditor.wox index f41a9e4d..86b0c5ad 100644 --- a/SOGo/UI/Templates/UIxAppointmentEditor.wox +++ b/SOGo/UI/Templates/UIxAppointmentEditor.wox @@ -23,7 +23,7 @@ alert(''); return false; } - if (cal_prs_date1(e.value) == null) + if (calendar_startTime_date.prs_date(e.value) == null) return false; e = document.getElementById('endTime_date'); @@ -31,7 +31,7 @@ alert(''); return false; } - if (cal_prs_date1(e.value) == null) + if (calendar_endTime_date.prs_date(e.value) == null) return false; // TODO: parse start/enddate and ensure that start is before end -- 2.39.5