]> err.no Git - scalable-opengroupware.org/commitdiff
new time controls
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 16 Aug 2004 09:32:04 +0000 (09:32 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 16 Aug 2004 09:32:04 +0000 (09:32 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@247 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxDatePicker.m
SOGo/UI/Scheduler/UIxTimeDateControl.m
SOGo/UI/Scheduler/UIxTimeDateControl.wox
SOGo/UI/Scheduler/UIxTimeSelector.m
SOGo/UI/Scheduler/UIxTimeSelector.wox
SOGo/UI/Scheduler/Version

index bd3bece24fa3ba8b41164d8191d41c45f26d765e..7b69aa181693b5076569ca9720d1eabdd8c46288 100644 (file)
@@ -1,3 +1,11 @@
+2004-08-15  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.54
+
+       * UIxTimeDateControl.*, UIxTimeSelector.*, UIxDatePicker.*:
+         fixed. DatePicker expects day, month, year bindings now, 
+         TimeSelector expects hour, minute, second.
+
 2004-08-16  Helge Hess  <helge.hess@skyrix.com>
 
        * v0.9.53
index db7e548a8d93f9f4eb4967cf359cfea2bdb019a1..579373553635a6dd6351b39c9191ab5ca9b5c2e8 100644 (file)
 
   req = [[self context] request];
   NSLog(@"%@", [req formValues]);
+  [self logWithFormat:@"aptStartDate:%@ aptEndDate:%@",
+        [self aptStartDate],
+        [self aptEndDate]];
   return self;
 }
 
index 68514c1019b50bb33e9b0c4bd44a35e18fff6832..56c830b852e9af212a1ae3108b52706106f1d31f 100644 (file)
@@ -27,7 +27,9 @@
 @interface UIxDatePicker : WOComponent
 {
   NSString       *dateID;
-  NSCalendarDate *date;
+  id             day;
+  id             month;
+  id             year;
   NSString       *label;
 }
 
@@ -42,7 +44,9 @@
 
 - (void)dealloc {
   [self->dateID release];
-  [self->date   release];
+  [self->day    release];
+  [self->month  release];
+  [self->year   release];
   [self->label  release];
   [super dealloc];
 }
   return self->dateID;
 }
 
-- (void)setDate:(NSCalendarDate *)_date {
-  ASSIGN(self->date, _date);
+- (void)setDay:(id)_day {
+    ASSIGN(self->day, _day);
 }
-- (NSCalendarDate *)date {
-  if (self->date == nil) /* HACK, return 'now' */
-    return [NSCalendarDate date];
-  return self->date;
+- (id)day {
+    return self->day;
+}
+- (void)setMonth:(id)_month {
+    ASSIGN(self->month, _month);
+}
+- (id)month {
+    return self->month;
+}
+- (void)setYear:(id)_year {
+    ASSIGN(self->year, _year);
+}
+- (id)year {
+    return self->year;
 }
 
+
 - (void)setLabel:(NSString *)_label {
   ASSIGNCOPY(self->label, _label);
 }
 }
 
 - (NSString *)formattedDateString {
-  return [[self date] descriptionWithCalendarFormat:@"%Y-%m-%d"];
+    return [NSString stringWithFormat:@"%d-%02d-%02d",
+        [[self year] intValue],
+        [[self month] intValue],
+        [[self day] intValue]];
 }
 
 - (NSString *)dateFormat {
     [self debugWithFormat:@"got no date string!"];
     return;
   }
-  
+
   d = [NSCalendarDate dateWithString:dateString calendarFormat:@"%Y-%m-%d"];
   if (d == nil)
     [self logWithFormat:@"WARNING: Could not parse dateString: '%@'", 
          dateString];
   [self logWithFormat:@"%s setting date: %@", __PRETTY_FUNCTION__, d];
-  [self setDate:d];
+  [self setDay:[NSNumber numberWithInt:[d dayOfMonth]]];
+  [self setMonth:[NSNumber numberWithInt:[d monthOfYear]]];
+  [self setYear:[NSNumber numberWithInt:[d yearOfCommonEra]]];
+  
+  [super takeValuesFromRequest:_rq inContext:_ctx];
 }
 
 @end /* UIxDatePicker */
index 0dbbafd88e5b14c4842eb8bc74f9f8b6df7dc7fe..a86defa0a3f1c66ff08304b5241878ba2fd4df14 100644 (file)
 
 @interface UIxTimeDateControl : WOComponent
 {
-  NSString       *controlID;
+  NSString *controlID;
+  NSString *label;
   NSCalendarDate *date;
-  NSString       *label;
-
-  NSCalendarDate *timeComponent;
-  NSCalendarDate *dateComponent;
+  id       hour;
+  id       minute;
+  id       second;
+  id       day;
+  id       month;
+  id       year;
 }
 
+- (void)setControlID:(NSString *)_controlID;
+- (NSString *)controlID;
+- (void)setLabel:(NSString *)_label;
+- (NSString *)label;
+- (void)setDate:(NSCalendarDate *)_date;
+- (NSCalendarDate *)date;
+
+- (void)setHour:(id)_hour;
+- (id)hour;
+- (void)setMinute:(id)_minute;
+- (id)minute;
+- (void)setSecond:(id)_second;
+- (id)second;
+- (void)setDay:(id)_day;
+- (id)day;
+- (void)setMonth:(id)_month;
+- (id)month;
+- (void)setYear:(id)_year;
+- (id)year;
+
 - (NSString *)timeID;
 - (NSString *)dateID;
 
-- (void)setTimeComponent:(NSCalendarDate *)_timeComponent;
-- (void)setDateComponent:(NSCalendarDate *)_dateComponent;
-    
+- (void)_setDate:(NSCalendarDate *)_date;
+
 @end
 
 #include "common.h"
 @implementation UIxTimeDateControl
 
 - (void)dealloc {
-  [self->controlID     release];
-  [self->date          release];
-  [self->label         release];
-  [self->timeComponent release];
-  [self->dateComponent release];
+  [self->controlID release];
+  [self->label     release];
+  [self->date      release];
+  [self->hour      release];
+  [self->minute    release];
+  [self->second    release];
+  [self->day       release];
+  [self->month     release];
+  [self->year      release];
   [super dealloc];
 }
 
 - (NSString *)controlID {
   return self->controlID;
 }
-- (void)setDate:(NSCalendarDate *)_date {
-  ASSIGN(self->date, _date);
-  [self setTimeComponent:_date];
-  [self setDateComponent:_date];
-}
-- (NSCalendarDate *)date {
-  return self->date;
-}
 - (void)setLabel:(NSString *)_label {
   ASSIGNCOPY(self->label, _label);
 }
 - (NSString *)label {
   return self->label;
 }
+- (void)setDate:(NSCalendarDate *)_date {
+    [self _setDate:_date];
+    [self setHour:[NSNumber numberWithInt:[_date hourOfDay]]];
+    [self setMinute:[NSNumber numberWithInt:[_date minuteOfHour]]];
+    [self setYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]];
+    [self setMonth:[NSNumber numberWithInt:[_date monthOfYear]]];
+    [self setDay:[NSNumber numberWithInt:[_date dayOfMonth]]];
+}
+- (void)_setDate:(NSCalendarDate *)_date {
+    ASSIGN(self->date, _date);
+}
+- (NSCalendarDate *)date {
+    return self->date;
+}
 
-- (void)setTimeComponent:(NSCalendarDate *)_timeComponent {
-  ASSIGN(self->timeComponent, _timeComponent);
+- (void)setHour:(id)_hour {
+    ASSIGN(self->hour, _hour);
+}
+- (id)hour {
+    return self->hour;
+}
+- (void)setMinute:(id)_minute {
+    ASSIGN(self->minute, _minute);
 }
-- (NSCalendarDate *)timeComponent {
-  return self->timeComponent;
+- (id)minute {
+    return self->minute;
+}
+- (void)setSecond:(id)_second {
+    ASSIGN(self->second, _second);
+}
+- (id)second {
+    return self->second;
 }
 
-- (void)setDateComponent:(NSCalendarDate *)_dateComponent {
-  ASSIGN(self->dateComponent, _dateComponent);
+- (void)setDay:(id)_day {
+    ASSIGN(self->day, _day);
+}
+- (id)day {
+    return self->day;
 }
-- (NSCalendarDate *)dateComponent {
-  return self->dateComponent;
+- (void)setMonth:(id)_month {
+    ASSIGN(self->month, _month);
+}
+- (id)month {
+    return self->month;
+}
+- (void)setYear:(id)_year {
+    ASSIGN(self->year, _year);
+}
+- (id)year {
+    return self->year;
 }
 
 - (NSString *)timeID {
 
 - (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
   NSCalendarDate *d;
-  
+  unsigned _year, _month, _day, _hour, _minute, _second;
+
   /* call super, so that the form values are applied on the popups */
   [super takeValuesFromRequest:_rq inContext:_ctx];
-  
-  d = [self dateComponent];
-  [self logWithFormat:@"base date: %@", d];
-  
-  d = [d  hour:[[self timeComponent] hourOfDay]
-         minute:[[self timeComponent] minuteOfHour]];
-  [self logWithFormat:@"%s newDate:%@",
-       __PRETTY_FUNCTION__,
-       d];
-  
-  if (d == nil)
-    return;
-  [self setDate:d];
+
+  _year  = [[self year] intValue];
+  if(_year == 0)
+      return;
+
+  _month  = [[self month] intValue];
+  _day    = [[self day] intValue];
+  _hour   = [[self hour] intValue];
+  _minute = [[self minute] intValue];
+  _second = [[self second] intValue];
+  d = [NSCalendarDate dateWithYear:_year
+                             month:_month
+                               day:_day
+                              hour:_hour
+                            minute:_minute
+                            second:_second
+                          timeZone:[[self date] timeZone]];
+  [self debugWithFormat:@"%s setting date:%@", __PRETTY_FUNCTION__, d];
+  [self _setDate:d];
 }
 
 @end /* UIxTimeDateControl */
index 3d52f3b03c8ae54f5904359b9240a9a7f60dbb82..f6e2d465be089a1fbed21675b2f23d2255e83165 100644 (file)
@@ -5,9 +5,24 @@
       xmlns:const="http://www.skyrix.com/od/constant"
       xmlns:rsrc="OGo:url"
 >
-  <var:component className="UIxTimeSelector" timeID="timeID" 
-                 date="timeComponent" />
-  <var:component className="UIxDatePicker"   dateID="dateID" 
-                 date="dateComponent"
-                 label="label" />
+  <table cellpadding="0" cellspacing="2">
+    <tr>
+      <td>
+        <var:component className="UIxTimeSelector"
+                       timeID="timeID"
+                       hour="hour"
+                       minute="minute"
+        />
+      </td>
+      <td>
+        <var:component className="UIxDatePicker"
+                       dateID="dateID"
+                       year="year"
+                       month="month"
+                       day="day"
+                       label="label"
+        />
+      </td>
+    </tr>
+  </table>
 </span>
index a558990e3b31a6a57ad6183d86844905340fe6ba..fcc2a1d5205ced8ec0b1bdabd74a4b5f5489a2e1 100644 (file)
 
 @interface UIxTimeSelector : WOComponent
 {
-  NSString       *timeID;
-  NSCalendarDate *date;
-  BOOL           combined;
-  NSString       *minuteInterval;
-  id             item;
-  NSArray        *hours, *minutes;
-}
-
-- (NSArray *)hours;
-- (NSArray *)minutes;
+  NSString *timeID;
+  id       hour;
+  id       minute;
+  NSString *minuteInterval;
+}
+
+- (void)setTimeID:(NSString *)_timeID;
+- (NSString *)timeID;
+- (void)setHour:(id)_hour;
+- (id)hour;
+- (void)setMinute:(id)_minute;
+- (id)minute;
+- (void)setMinuteInterval:(NSString *)_minuteInterval;
 - (NSString *)minuteInterval;
 
 @end
 
 - (void)dealloc {
   [self->timeID         release];
-  [self->date           release];
+  [self->hour           release];
+  [self->minute         release];
   [self->minuteInterval release];
-  [self->item           release];
-  [self->hours          release];
-  [self->minutes        release];
   [super dealloc];
 }
 
   return self->timeID;
 }
 
-- (void)setDate:(NSCalendarDate *)_date {
-  ASSIGN(self->date, _date);
+- (void)setHour:(id)_hour {
+    ASSIGN(self->hour, _hour);
+}
+- (id)hour {
+    return self->hour;
 }
-- (NSCalendarDate *)date {
-  if (self->date == nil) /* HACK, return 'now' */
-    return [NSCalendarDate date];
-  return self->date;
+- (void)setMinute:(id)_minute {
+    ASSIGN(self->minute, _minute);
+}
+- (id)minute {
+    return self->minute;
 }
 
 - (void)setMinuteInterval:(NSString *)_minuteInterval {
   return self->minuteInterval;
 }
 
-- (void)setItem:(id)_item {
-  ASSIGN(self->item, _item);
-}
-- (id)item {
-  return self->item;
-}
-
-- (NSString *)hoursName {
-  return [[self timeID] stringByAppendingString:@"_hours"];
-}
-
-- (NSString *)minutesName {
-  return [[self timeID] stringByAppendingString:@"_minutes"];
-}
-
-- (NSArray *)hours {
-  NSMutableArray *values;
-  unsigned i, count;
-  
-  if (self->hours)
-    return self->hours;
-        
-  count = 24;
-  values = [NSMutableArray arrayWithCapacity:count];
-  for (i = 0; i < count; i++)
-    [values addObject:[NSNumber numberWithInt:i]];
-  
-  self->hours = [values copy];
-  return self->hours;
-}
-
-- (NSArray *)minutes {
-  NSMutableArray *values;
-  unsigned i, count, iv;
-  
-  if (self->minutes)
-    return self->minutes;
-        
-  iv = [[self minuteInterval] intValue];
-
-  count = 60;
-  values = [NSMutableArray arrayWithCapacity:count];
-  for (i = 0; i < count; i += iv)
-    [values addObject:[NSNumber numberWithInt:i]];
-  
-  self->minutes = [values copy];
-  return self->minutes;
-}
-
-- (NSNumber *)selectedHour {
-  return [[self hours] objectAtIndex:[[self date] hourOfDay]];
-}
-
-- (NSNumber *)selectedMinute {
-  return [[self minutes] objectAtIndex:[[self date] minuteOfHour]];
-}
-
-- (NSString *)displayString {
-  char buf[8];
-  sprintf(buf, "%02d", [item intValue]);
-  return [NSString stringWithCString:buf];
-}
-
-/* action */
-
-- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
-  NSString *h, *m;
-  NSCalendarDate *d;
-  
-  h = [_rq formValueForKey:[self hoursName]];
-  m = [_rq formValueForKey:[self minutesName]];
-  
-  [self logWithFormat:@"got hour (%@): %@", [self hoursName],   h];
-  [self logWithFormat:@"got minute (%@): %@", [self minutesName], m];
-  
-  if (h == nil)
-    return;
-  
-  d = [[self date] hour:[h intValue] minute:[m intValue]];
-  [self logWithFormat:@"%s setting date:%@", __PRETTY_FUNCTION__, d];
-  [self setDate:d];
+- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { 
+    /* call super, so that the form values are applied on the popups */
+    [super takeValuesFromRequest:_rq inContext:_ctx];
 }
 
 @end /* UIxTimeSelector */
index 938bff14c090892258d8e86cc3700c08ddc72ed0..a5c3a7bb7415fd17811c543cfea54a11added7bb 100644 (file)
@@ -6,15 +6,9 @@
       xmlns:rsrc="OGo:url"
       var:id="timeID"
 >
-  <var:popup name="hoursName"
-             list="hours"
-             item="item"
-             displayString="displayString"
-             selection="selectedHour"
-  />:<var:popup name="minutesName"
-                list="minutes"
-                item="item"
-                displayString="displayString"
-                selection="selectedMinute"
-     />
+  <var:time-field hour="hour"
+                  minute="minute"
+                  minuteInterval="minuteInterval"
+                  name="timeID"
+  />
 </span>
index f8d8760cfdcb842a76552a6b56a12a36046fa601..a96e7c7451282e412ae15dc3bf4c68f14d747628 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-SUBMINOR_VERSION:=53
+SUBMINOR_VERSION:=54
 
 # v0.9.41 requires libNGObjWeb     v4.2.431
 # v0.9.31 requires libWEExtensions v4.2.52