]> err.no Git - scalable-opengroupware.org/commitdiff
fixed calendar validation
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 14:23:18 +0000 (14:23 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 19 Jul 2005 14:23:18 +0000 (14:23 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@827 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxDatePicker.m
SOGo/UI/Scheduler/Version
SOGo/UI/Templates/ChangeLog
SOGo/UI/Templates/UIxAppointmentEditor.wox

index ee6dad0e994591353b0034e8dc8aeca5c9f42171..d6dea6e2779c982198b822a80d3f83032b866294 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-19  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxDatePicker.m: code cleanups (v0.9.141)
+
 2005-07-19  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.140
index 65f94a012d0d78af6c173c70447af36144cc8856..3ce082741230d4f7e9d166c7ecd06905d897e094 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2004 SKYRIX Software AG
+  Copyright (C) 2004-2005 SKYRIX Software AG
 
   This file is part of OpenGroupware.org.
 
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #include <NGObjWeb/WOComponent.h>
 
-@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;
 }
 
 - (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;
   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";
 }
 
 
   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 */
     @"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 */
 
   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];
 }
index 776e658bdfbec8fb6e592ae0f0b70cb81bea4663..81ceab5edcd27793c997698384160bdc9159be71 100644 (file)
@@ -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
index 2a5c4d90727f8d9d742f55f53de7ba826784c7ce..9c0c2082478a3061b5e4df1744dce9406ff3a23e 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-19  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxAppointmentEditor.wox: use dateformat specific parsing methods
+         during validation (#1490)
+
 2005-07-19  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * AnaisUidSelector.wox: moved JavaScript into component, renamed quite
index f41a9e4d62e0ba5cc74d5056047be2fa5575884f..86b0c5adcf8ebaddfefaa9b4f4dcc51897fa46be 100644 (file)
@@ -23,7 +23,7 @@
         alert('<var:string label:value="validate_invalid_startdate"/>');
         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('<var:string label:value="validate_invalid_enddate"/>');
         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