]> err.no Git - scalable-opengroupware.org/commitdiff
updated formatters to resemble OGo's style more closely, fixed bugs in displaying...
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Jul 2005 18:13:24 +0000 (18:13 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Jul 2005 18:13:24 +0000 (18:13 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@663 d1b88da0-ebda-0310-925b-ed51d893ca5b

34 files changed:
SOGo/SoObjects/Appointments/ChangeLog
SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m
SOGo/SoObjects/Appointments/Version
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/Version
SOGo/UI/Common/calendar.css
SOGo/UI/SOGoUI/ChangeLog
SOGo/UI/SOGoUI/SOGoAptFormatter.h
SOGo/UI/SOGoUI/SOGoAptFormatter.m
SOGo/UI/SOGoUI/Version
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/GNUmakefile
SOGo/UI/Scheduler/UIxCalDayChartview.m
SOGo/UI/Scheduler/UIxCalDayListview.m
SOGo/UI/Scheduler/UIxCalDayOverview.m
SOGo/UI/Scheduler/UIxCalDayView.m
SOGo/UI/Scheduler/UIxCalInlineAptView.m
SOGo/UI/Scheduler/UIxCalMonthOverview.m
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/UIxCalWeekChartview.m
SOGo/UI/Scheduler/UIxCalWeekColumnsview.m
SOGo/UI/Scheduler/UIxCalWeekOverview.m
SOGo/UI/Scheduler/Version
SOGo/UI/Scheduler/images/apt_icon_private.gif [new file with mode: 0644]
SOGo/UI/Templates/ChangeLog
SOGo/UI/Templates/UIxAppointmentEditor.wox
SOGo/UI/Templates/UIxCalDayChartview.wox
SOGo/UI/Templates/UIxCalDayListview.wox
SOGo/UI/Templates/UIxCalDayOverview.wox
SOGo/UI/Templates/UIxCalInlineAptView.wox
SOGo/UI/Templates/UIxCalMonthOverview.wox
SOGo/UI/Templates/UIxCalWeekChartview.wox
SOGo/UI/Templates/UIxCalWeekColumnsview.wox
SOGo/UI/Templates/UIxCalWeekOverview.wox

index 59da00a73e7f1f1adf0e30f6d203a59c4aeb249c..4e8bb904d10048d416b316326cb58bbe82fe4663 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * SOGoAppointmentFolder.m: fetch new priority field in core infos
+         (v0.9.34)
+
 2005-07-04  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * SOGoAppointmentFolder.m: fetch new priority field in overview infos
index 8f63cef758a363cbb8c879b63e12329e40aa7630..d0da865f9c1eadd1bc0c4e4afd774c265fe41955 100644 (file)
@@ -413,7 +413,7 @@ static NSTimeZone *MET    = nil;
                                @"status", @"ispublic",
                                @"isallday", @"isopaque",
                                @"participants", @"partmails",
-                               @"partstates", @"sequence", nil];
+                               @"partstates", @"sequence", @"priority", nil];
   }
   return [self fetchFields:infos
                from:_startDate
index c59b4fbb1bdb90d946add79ee37ee4fc1b5d12e7..9b34cb773990a2d88acd31534fb04e9bbf189b3d 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=33
+SUBMINOR_VERSION:=34
 
 # v0.9.32 requires libGDLContentStore v4.5.26
 # v0.9.28 requires libNGiCal          v4.5.47
index 2640b5335056b699cf4440af237a91eb62385f17..9d8455da5eceaaf46a670354ae00743c4038326c 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * calendar.css: added appointment priority styles (v0.9.37)
+
 2005-03-23  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * renamed "default.strings" to "Localizable.strings" (v0.9.36)
index 8f9b0cb11125a1deb1f129e69e7ba35f93fbc77a..b37763b2d8db4325c20873f4754197e6a02fa1bd 100644 (file)
@@ -1,5 +1,5 @@
 # Version file
 
-SUBMINOR_VERSION:=36
+SUBMINOR_VERSION:=37
 
 # v0.9.28 requires NGExtensions v4.5.136
index 81ea3a6b5b334ef56306288a77f0fdcc1344e187..198eae4d2b52f1b248096f178e92e677280d4ccf 100644 (file)
   font-style:       italic;
 }
 
+.apt_prio0, .apt_prio5, .apt_prio6, .apt_prio7, .apt_prio8, .apt_prio9 {
+  font-weight:      normal;
+}
+
+.apt_prio1, .apt_prio2, .apt_prio3, .apt_prio4 {
+  font-weight:      bold;
+}
+
+
 .anais_me {
   color:            #0000FF;
 }
index e782f8c49cdd90eefb2b7ad4371c73f033ad995d..c2b37e12d7b4c05a11aeecf76eb4726487ab6745 100644 (file)
@@ -1,3 +1,12 @@
+2005-07-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * SOGoAptFormatter.[hm]: new API. -stringForObjectValue: is deprecated
+         now and should not be used anymore. Formatting needs a referenceDate
+         in order to properly display time ranges. Time ranges are currently
+         rendered in SOGoAptFormatter, but this should probably be delegated
+         to a natural language aware auxiliary (date-)formatter. Also, some
+         new formatting options have been introduced. (v0.9.24)
+
 2005-01-26  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * SOGoDateFormatter.[hm]: new method -setFrenchDateFormat: to override
index e4c0202a0bcc1dd15a1fe7bcbb64236079e9d279..c81068344d3f947985ea470967c7ecec3619588a 100644 (file)
 @interface SOGoAptFormatter : NSFormatter
 {
   NSTimeZone *tz;
-  SEL formatAction;
-  NSString *privateTitle;
+  SEL        formatAction;
+  NSString   *privateTitle;
+  BOOL       omitsEndDate;
 }
 
 - (id)initWithDisplayTimeZone:(NSTimeZone *)_tz;
 
 - (void)setTooltip;
+- (void)setSingleLineFullDetails;
 - (void)setFullDetails;
 - (void)setTitleOnly;
 - (void)setShortTitleOnly;
+- (void)setOmitsEndDate;
 
 - (void)setPrivateTooltip;
 - (void)setPrivateDetails;
 
 - (void)setPrivateTitle:(NSString *)_privateTitle;
 - (NSString *)privateTitle;
-  
+
+- (NSString *)stringForObjectValue:(id)_obj
+  referenceDate:(NSCalendarDate *)_refDate;
+
 @end
 
 #endif /* __SOGoAptFormatter_H_ */
index e468d78321bfc379d1fdbe7533935e8a2ddbd85a..750a0ee18a9c24a24a8511dc235d133dab4c815f 100644 (file)
 #include "common.h"
 
 @interface SOGoAptFormatter(PrivateAPI)
-- (NSString *)titleForApt:(id)_apt;
-- (NSString *)shortTitleForApt:(id)_apt;
+- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate;
+- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate;
 - (NSTimeZone *)displayTZ;
-- (void)appendTimeInfoFromApt:(id)_apt toBuffer:(NSMutableString *)_buf;
+
+- (void)appendTimeInfoForDate:(NSCalendarDate *)_date
+  usingReferenceDate:(NSCalendarDate *)_refDate
+  toBuffer:(NSMutableString *)_buf;
+
+- (void)appendTimeInfoFromApt:(id)_apt
+  usingReferenceDate:(NSCalendarDate *)_refDate
+  toBuffer:(NSMutableString *)_buf;
+@end
+
+// TODO: Clean this up, put it into NGExtensions!
+@interface NSCalendarDate (UIxCalMonthOverviewExtensions_UsedPrivates)
+- (BOOL)isDateInSameMonth:(NSCalendarDate *)_other;
 @end
 
 @implementation SOGoAptFormatter
 /* accessors */
 
 - (void)setTooltip {
-  self->formatAction = @selector(tooltipForApt:);
+  self->formatAction = @selector(tooltipForApt::);
+}
+
+- (void)setSingleLineFullDetails {
+  self->formatAction = @selector(singleLineFullDetailsForApt::);
 }
 
 - (void)setFullDetails {
-  self->formatAction = @selector(fullDetailsForApt:);
+  self->formatAction = @selector(fullDetailsForApt::);
 }
 
 - (void)setPrivateTooltip {
-  self->formatAction = @selector(tooltipForPrivateApt:);
+  self->formatAction = @selector(tooltipForPrivateApt::);
 }
 
 - (void)setPrivateDetails {
-  self->formatAction = @selector(detailsForPrivateApt:);
+  self->formatAction = @selector(detailsForPrivateApt::);
 }
 
 - (void)setTitleOnly {
-  self->formatAction = @selector(titleForApt:);
+  self->formatAction = @selector(titleForApt::);
 }
 
 - (void)setShortTitleOnly {
-  self->formatAction = @selector(shortTitleForApt:);
+  self->formatAction = @selector(shortTitleForApt::);
 }
 
 - (void)setPrivateSuppressAll {
-  self->formatAction = @selector(suppressApt:);
+  self->formatAction = @selector(suppressApt::);
 }
 
 - (void)setPrivateTitleOnly {
-  self->formatAction = @selector(titleOnlyForPrivateApt:);
+  self->formatAction = @selector(titleOnlyForPrivateApt::);
 }
 
 - (void)setPrivateTitle:(NSString *)_privateTitle {
   return self->privateTitle;
 }
 
+- (void)setOmitsEndDate {
+  self->omitsEndDate = YES;
+}
+
 - (NSString *)stringForObjectValue:(id)_obj {
-  return [self performSelector:self->formatAction withObject:_obj];
+  [self warnWithFormat:@"%s called, please use "
+                       @"stringForObjectValue:referenceDate: instead!",
+                       __PRETTY_FUNCTION__];
+  return [self stringForObjectValue:_obj referenceDate:nil];
+}
+
+- (NSString *)stringForObjectValue:(id)_obj
+  referenceDate:(NSCalendarDate *)_refDate
+{
+  return [self performSelector:self->formatAction
+               withObject:_obj
+               withObject:_refDate];
 }
 
 /* Private */
   return self->tz;
 }
 
-- (void)appendTimeInfoFromApt:(id)_apt toBuffer:(NSMutableString *)_buf {
-  NSCalendarDate *startDate, *endDate;
+- (void)appendTimeInfoForDate:(NSCalendarDate *)_date
+  usingReferenceDate:(NSCalendarDate *)_refDate
+  toBuffer:(NSMutableString *)_buf
+{
+  /* several cases:
+   * 12:00
+   * 12:00 - 13:00
+   * 12:00 (07-05) - 13:00 (07-07)
+   * 12:00 (12-30-2004) - 13:00 (01-01-2005)
+   */
+
+  [_buf appendFormat:@"%02i:%02i",
+                     [_date hourOfDay],
+                     [_date minuteOfHour]];
+  if (_refDate && ![_date isDateOnSameDay:_refDate]) {
+    [_buf appendFormat:@" (%02i-%02i",
+                       [_date monthOfYear],
+                       [_date dayOfMonth]];
+    if ([_date yearOfCommonEra] != [_refDate yearOfCommonEra])
+      [_buf appendFormat:@"-%04i", [_date yearOfCommonEra]];
+    [_buf appendString:@")"];
+  }
+}
+
+- (void)appendTimeInfoFromApt:(id)_apt
+  usingReferenceDate:(NSCalendarDate *)_refDate
+  toBuffer:(NSMutableString *)_buf
+{
+  NSCalendarDate *startDate, *endDate, *date;
+  NSTimeZone     *dtz;
   BOOL           spansRange;
 
   spansRange = NO;
+  dtz        = [self displayTZ];
   startDate  = [_apt valueForKey:@"startDate"];
-  [startDate setTimeZone:[self displayTZ]];
+  [startDate setTimeZone:dtz];
   endDate    = [_apt valueForKey:@"endDate"];
   if(endDate != nil) {
-    [endDate setTimeZone:[self displayTZ]];
+    [endDate setTimeZone:dtz];
     spansRange = ![endDate isEqualToDate:startDate];
   }
-  [_buf appendFormat:@"%02i:%02i",
-                       [startDate hourOfDay],
-                       [startDate minuteOfHour]];
-  if(spansRange) {
-    [_buf appendFormat:@", %02i:%02i",
-                         [endDate hourOfDay],
-                         [endDate minuteOfHour]];
+  if (_refDate)
+    [_refDate setTimeZone:dtz];
+
+#if 0
+  if (!_refDate || [startDate isDateOnSameDay:_refDate])
+    date = startDate;
+  else
+    date = [startDate hour:0 minute:0];
+#else
+  date = startDate;
+#endif
+
+  [self appendTimeInfoForDate:date
+        usingReferenceDate:_refDate
+        toBuffer:_buf];
+
+  if (spansRange && !self->omitsEndDate) {
+    [_buf appendString:@" - "];
+#if 0
+    if (!_refDate || [endDate isDateOnSameDay:_refDate])
+      date = endDate;
+    else
+      date = [endDate hour:23 minute:59];
+#else
+    date = endDate;
+#endif
+    [self appendTimeInfoForDate:date
+          usingReferenceDate:_refDate
+          toBuffer:_buf];
   }
 }
 
-- (NSString *)titleForApt:(id)_apt {
+- (NSString *)titleForApt:(id)_apt :(NSCalendarDate *)_refDate {
   return [_apt valueForKey:@"title"];
 }
 
-- (NSString *)shortTitleForApt:(id)_apt {
+- (NSString *)shortTitleForApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSString *title;
   
-  title = [self titleForApt:_apt];
+  title = [self titleForApt:_apt :_refDate];
   if ([title length] > 12)
     title = [[title substringToIndex:11] stringByAppendingString:@"..."];
   
   return title;
 }
 
-- (NSString *)fullDetailsForApt:(id)_apt {
+- (NSString *)singleLineFullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSMutableString *aptDescr;
-  NSString *s;
+  NSString        *s;
+  
+  aptDescr = [NSMutableString stringWithCapacity:60];
+  [self appendTimeInfoFromApt:_apt
+        usingReferenceDate:_refDate
+        toBuffer:aptDescr];
+  if ((s = [_apt valueForKey:@"location"]) != nil) {
+    [aptDescr appendFormat:@"; (%@)", s];
+  }
+  if ((s = [_apt valueForKey:@"title"]) != nil)
+    [aptDescr appendFormat:@"; %@", [self titleForApt:_apt :_refDate]];
+  return aptDescr;
+}
+
+- (NSString *)fullDetailsForApt:(id)_apt :(NSCalendarDate *)_refDate {
+  NSMutableString *aptDescr;
+  NSString        *s;
     
   aptDescr = [NSMutableString stringWithCapacity:60];
-  [self appendTimeInfoFromApt:_apt toBuffer:aptDescr];
+  [self appendTimeInfoFromApt:_apt
+        usingReferenceDate:_refDate
+        toBuffer:aptDescr];
   if ((s = [_apt valueForKey:@"location"]) != nil) {
     if([s length] > 12)
       s = [[s substringToIndex:11] stringByAppendingString:@"..."];
     [aptDescr appendFormat:@" (%@)", s];
   }
   if ((s = [_apt valueForKey:@"title"]) != nil)
-    [aptDescr appendFormat:@"<br />%@", [self shortTitleForApt:_apt]];
+    [aptDescr appendFormat:@"<br />%@", [self shortTitleForApt:_apt :_refDate]];
   
   return aptDescr;
 }
 
-- (NSString *)detailsForPrivateApt:(id)_apt {
+- (NSString *)detailsForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSMutableString *aptDescr;
   NSString        *s;
 
   aptDescr = [NSMutableString stringWithCapacity:40];
-  [self appendTimeInfoFromApt:_apt toBuffer:aptDescr];
+  [self appendTimeInfoFromApt:_apt
+        usingReferenceDate:_refDate
+        toBuffer:aptDescr];
   if ((s = [self privateTitle]) != nil)
     [aptDescr appendFormat:@"<br />%@", s];
   return aptDescr;
 }
 
-- (NSString *)titleOnlyForPrivateApt:(id)_apt {
+- (NSString *)titleOnlyForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSString *s;
   
   s = [self privateTitle];
   return s;
 }
 
-- (NSString *)tooltipForApt:(id)_apt {
-  NSCalendarDate  *startDate, *endDate;
+- (NSString *)tooltipForApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSMutableString *aptDescr;
   NSString        *s;
-  BOOL            spansRange;
-    
-  spansRange = NO;
-  startDate = [_apt valueForKey:@"startDate"];
-  [startDate setTimeZone:[self displayTZ]];
-  endDate = [_apt valueForKey:@"endDate"];
-  if(endDate != nil) {
-    [endDate setTimeZone:[self displayTZ]];
-    spansRange = ![endDate isEqualToDate:startDate];
-  }
+
   aptDescr = [NSMutableString stringWithCapacity:60];
-  [aptDescr appendFormat:@"%02i:%02i",
-           [startDate hourOfDay],
-           [startDate minuteOfHour]];
-  if (spansRange) {
-    [aptDescr appendFormat:@" - %02i:%02i",
-             [endDate hourOfDay],
-             [endDate minuteOfHour]];
-  }
-    
+  [self appendTimeInfoFromApt:_apt
+        usingReferenceDate:_refDate
+        toBuffer:aptDescr];  
   if ((s = [_apt valueForKey:@"title"]) != nil)
     [aptDescr appendFormat:@"\n%@", s];
   if ((s = [_apt valueForKey:@"location"]) != nil)
   return aptDescr;
 }
 
-- (NSString *)tooltipForPrivateApt:(id)_apt {
-  NSCalendarDate  *startDate, *endDate;
+- (NSString *)tooltipForPrivateApt:(id)_apt :(NSCalendarDate *)_refDate {
   NSMutableString *aptDescr;
   NSString        *s;
-  BOOL            spansRange;
   
-  spansRange = NO;
-  startDate  = [_apt valueForKey:@"startDate"];
-  [startDate setTimeZone:[self displayTZ]];
-  endDate = [_apt valueForKey:@"endDate"];
-  if(endDate != nil) {
-    [endDate setTimeZone:[self displayTZ]];
-    spansRange = ![endDate isEqualToDate:startDate];
-  }
   aptDescr = [NSMutableString stringWithCapacity:25];
-  [aptDescr appendFormat:@"%02i:%02i",
-    [startDate hourOfDay],
-    [startDate minuteOfHour]];
-  if (spansRange) {
-    [aptDescr appendFormat:@" - %02i:%02i",
-      [endDate hourOfDay],
-      [endDate minuteOfHour]];
-  }
-
+  [self appendTimeInfoFromApt:_apt
+        usingReferenceDate:_refDate
+        toBuffer:aptDescr];  
   if ((s = [self privateTitle]) != nil)
     [aptDescr appendFormat:@"\n%@", s];
 
   return aptDescr;
 }
 
-- (NSString *)suppressApt:(id)_apt {
+- (NSString *)suppressApt:(id)_apt :(NSCalendarDate *)_refDate {
   return @"";
 }
 
index ebab15badd4ec0f2916a207343636ffcd55b9954..78651189daa3bd271c5578dab23e941dd60d3aff 100644 (file)
@@ -1,5 +1,5 @@
 # $Id$
 
-SUBMINOR_VERSION:=23
+SUBMINOR_VERSION:=24
 
 # v0.9.18 requires NGExtensions v4.5.136
index 2284a2cef4dabc88a4e09978fcc2240b36b11b53..a67b00ac574ea33f894d0c66601c0fa8e37a4903 100644 (file)
@@ -1,3 +1,29 @@
+2005-07-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.123
+
+       * UIxCalWeekOverview.m, UIxCalWeekColumnsview.m,
+         UIxCalDayChartview.m, UIxCalDayListview.m,
+         UIxCalMonthOverview.m, UIxCalDayOverview.m: properly adjust formatter
+
+       * UIxCalDayOverview.m: fixed bugs in -aptsForCurrentDate and properly
+         override -allDayApts to also display appointments spanning ranges
+
+       * UIxCalWeekChartview.m: fixed bugs in -isRowActive logic
+
+       * UIxCalDayView.m: fixed bugs in filtering and range logic
+
+       * UIxCalView.m: added a deprecation warning, some code cleanup
+
+       * UIxCalInlineAptView.m: added new 'referenceDate' binding which will
+         be used with the revised appointment formatter to properly display
+         time ranges. Also adds 'priority' style information when this can
+         be found in the appointment.
+
+       * GNUmakefile: added new image resource
+
+       * images/apt_icon_private.gif: new resource for private appointments
+
 2005-03-23  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * renamed "default.strings" to "Localizable.strings" (v0.9.122)
index ff7b04945415e2c92d4a785be77f91420241c7cc..e3f140685ee5339b1a5b39e31ce8d9a5fec34ea1 100644 (file)
@@ -105,6 +105,7 @@ SchedulerUI_RESOURCE_FILES += \
        images/last.gif                         \
        images/green_corner.gif                 \
        images/invisible_space_2.gif            \
+       images/apt_icon_private.gif             \
 
 SchedulerUI_LOCALIZED_RESOURCE_FILES += \
        Localizable.strings             \
index a6e8d61f729ac0b4fe65c5e4bbbc0a30c69362df..feffaf0717cc4dca21eb290e1faf74d5c2fb89c1 100644 (file)
 @end
 
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalDayChartview
 
+- (void)configureFormatters {
+  [super configureFormatters];
+  
+  [self->aptFormatter setShortTitleOnly];
+}
+
 - (NSArray *)columns {
   static NSArray *columns = nil;
   if(columns == nil) {
index 437154c8d2cdbdcdcfdb167aca4e922b0561e8d3..d0abf930f6f08876a20988bccdc98e08b8c5b27c 100644 (file)
 @end
 
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 #include <SOGo/AgenorUserManager.h>
 #include <SOGo/SoObjects/Appointments/SOGoAppointmentFolder.h>
 
 @implementation UIxCalDayListview
 
 - (void)dealloc {
-  [self->uids release];
+  [self->uids       release];
   [self->currentUid release];
   [super dealloc];
 }
 
+- (void)configureFormatters {
+  [super configureFormatters];
+  
+  [self->aptFormatter setShortTitleOnly];
+}
+
 /* accessors */
 
 - (NSArray *)uids {
index 3539b7088b37e44ddd05963fa7bd86d4d903537f..d1ea47ba2d471ad52206deb46f9c9fd7d8353008 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "UIxCalDayOverview.h"
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalDayOverview
 
     return count == 0 ? 1 : count;
 }
 
+/* overriding */
+
+- (void)configureFormatters {
+  [super configureFormatters];
+
+  [self->aptFormatter setSingleLineFullDetails];
+  [self->aptTooltipFormatter setTooltip];
+}
+
+- (NSArray *)aptsForCurrentDate {
+  NSArray        *apts;
+  NSMutableArray *filtered;
+  unsigned       i, count;
+  NSCalendarDate *start, *end;
+  
+  start = self->currentDate;
+  end   = [start dateByAddingYears:0
+                            months:0
+                              days:0
+                             hours:0
+                           minutes:59
+                           seconds:59];
+  
+  apts     = [self appointments];
+  filtered = [[NSMutableArray alloc] initWithCapacity:1];
+  count    = [apts count];
+  for (i = 0; i < count; i++) {
+    id apt;
+    NSCalendarDate *aptStartDate;
+    
+    apt = [apts objectAtIndex:i];
+    aptStartDate = [apt valueForKey:@"startDate"];
+    if([aptStartDate isGreaterThanOrEqualTo:start] &&
+       [aptStartDate isLessThan:end])
+    {
+      [filtered addObject:apt];
+    }
+  }
+  
+  return [filtered autorelease];
+}
+
+- (NSArray *)allDayApts {
+  NSCalendarDate *start;
+  NSArray        *apts;
+  NSMutableArray *filtered;
+  unsigned       i, count;
+  
+  if (self->allDayApts)
+    return self->allDayApts;
+
+  start    = [self startDate];
+  apts     = [self appointments];
+  filtered = [[NSMutableArray alloc] initWithCapacity:1];
+  count    = [apts count];
+  for (i = 0; i < count; i++) {
+    id       apt;
+    NSNumber *bv;
+    
+    apt = [apts objectAtIndex:i];
+    bv  = [apt valueForKey:@"isallday"];
+    if ([bv boolValue]) {
+      [filtered addObject:apt];
+    }
+    else {
+      NSCalendarDate *aptStartDate;
+
+      aptStartDate = [apt valueForKey:@"startDate"];
+      if([aptStartDate isLessThan:start]) {
+        [filtered addObject:apt];
+      }
+    }
+  }
+  
+  ASSIGN(self->allDayApts, filtered);
+  [filtered release];
+  return self->allDayApts;
+}
+
 @end
index b00caf8a8fbed9ec976202e3957eed2663a1b6ae..8ad071d5e6235a5551ac8ffbf6b8faaf04c0b1e5 100644 (file)
        or after are also fine */
 
     NSCalendarDate *min, *max;
-    NSArray *aptDateRanges;
+    NSArray        *aptDateRanges;
 
     min = [[self startDate] hour:[self dayStartHour] minute:0];
-    max = [[self startDate] hour:[self dayEndHour] minute:0];
+    max = [[self startDate] hour:[self dayEndHour]   minute:0];
 
     aptDateRanges = [[self appointments] valueForKey:@"startDate"];
     if([aptDateRanges count] != 0) {
         NSCalendarDate *d;
         
         aptDateRanges = [aptDateRanges sortedArrayUsingSelector:@selector(compareAscending:)];
-        d = [aptDateRanges objectAtIndex:0];
-        min = (NSCalendarDate *)[d earlierDate:min];
-        d = [aptDateRanges objectAtIndex:[aptDateRanges count] - 1];
-        max = (NSCalendarDate *)[d laterDate:max];
+        d   = [aptDateRanges objectAtIndex:0];
+        if ([d isDateOnSameDay:min])
+          min = (NSCalendarDate *)[d earlierDate:min];
+        d   = [aptDateRanges objectAtIndex:[aptDateRanges count] - 1];
+        if ([d isDateOnSameDay:max])
+          max = (NSCalendarDate *)[d laterDate:max];
     }
 
     return [self _getDatesFrom:min to:max];
 
 - (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to {
     NSMutableArray *dates;
-    unsigned i, count, offset;
+    unsigned       i, count, offset;
 
     offset = [_from hourOfDay];
-    count = ([_to hourOfDay] + 1) - offset;
-    dates = [[NSMutableArray alloc] initWithCapacity:count];
+    count  = ([_to hourOfDay] + 1) - offset;
+    dates  = [[NSMutableArray alloc] initWithCapacity:count];
     for(i = 0; i < count; i++) {
         NSCalendarDate *date;
         
 }
 
 - (NSArray *)aptsForCurrentDate {
-    NSArray *apts;
-    NSMutableArray *filtered;
-    unsigned i, count;
-    NSCalendarDate *start, *end;
-    
-    start = self->currentDate;
-    end = [start dateByAddingYears:0
+  NSArray        *apts;
+  NSMutableArray *filtered;
+  unsigned       i, count;
+  NSCalendarDate *start, *end;
+
+  start = self->currentDate;
+  end   = [start dateByAddingYears:0
                             months:0
                               days:0
                              hours:0
                            minutes:59
                            seconds:59];
+  
+  apts     = [self appointments];
+  filtered = [[NSMutableArray alloc] initWithCapacity:1];
+  count    = [apts count];
+  for(i = 0; i < count; i++) {
+    id apt;
+    NSCalendarDate *aptStartDate;
     
-    apts = [self appointments];
-    filtered = [[NSMutableArray alloc] initWithCapacity:1];
-    count = [apts count];
-    for(i = 0; i < count; i++) {
-        id apt;
-        NSCalendarDate *aptStartDate;
-        
-        /* NOTE: appointments are totally opaque objects, we don't know much
-            about them. The reason for this is that they are backend-dependent
-            and we'd like to use UIx for SOGo *and* ZideStore also.
-            We have to accept the fact that we know just a little bit
-            of their API which is completely KVC driven.
-            */
-        
-        apt = [apts objectAtIndex:i];
-        aptStartDate = [apt valueForKey:@"startDate"];
-        if([aptStartDate isGreaterThanOrEqualTo:start] &&
-           [aptStartDate isLessThan:end]) {
-            [filtered addObject:apt];
+    /* NOTE: appointments are totally opaque objects, we don't know much
+      about them. The reason for this is that they are backend-dependent
+      and we'd like to use UIx for SOGo *and* ZideStore also.
+      We have to accept the fact that we know just a little bit
+      of their API which is completely KVC driven.
+      */
+    
+    apt = [apts objectAtIndex:i];
+    aptStartDate = [apt valueForKey:@"startDate"];
+    if([aptStartDate isGreaterThanOrEqualTo:start] &&
+       [aptStartDate isLessThan:end])
+    {
+      [filtered addObject:apt];
+    }
+    else {
+      /* multiple day range? */
+      NSCalendarDate *aptEndDate;
+      
+      if ((aptEndDate = [apt valueForKey:@"endDate"])) {
+        if ([aptEndDate isLessThanOrEqualTo:end] ||
+            ([aptStartDate isLessThan:start] &&
+             [aptEndDate   isGreaterThan:end]))
+        {
+          [filtered addObject:apt];
         }
+      }
     }
-    
-    return [filtered autorelease];
+  }
+
+  return [filtered autorelease];
 }
 
 - (BOOL)hasAptsForCurrentDate {
-    return [[self aptsForCurrentDate] count] != 0;
+  return [[self aptsForCurrentDate] count] != 0;
 }
 
 @end
index 555254f931baaf8af2932fd638bf5a094e66b59d..5198e3da1c1bebe2b15a06eae460eac5638016cc 100644 (file)
   id   url;
   id   style;
   id   queryDictionary;
+  id   referenceDate;
   BOOL canAccess;
 }
 
 @end
 
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalInlineAptView
 
@@ -46,6 +48,7 @@
   [self->url              release];
   [self->style            release];
   [self->queryDictionary  release];
+  [self->referenceDate    release];
   [super dealloc];
 }
 
   ASSIGN(self->style, _style);
 }
 - (id)style {
+  NSNumber *prio;
+  
+  if ((prio = [self->appointment valueForKey:@"priority"])) {
+    return [NSString stringWithFormat:@"%@ apt_prio%@", self->style, prio];
+  }
   return self->style;
 }
 
   return self->queryDictionary;
 }
 
+- (void)setReferenceDate:(id)_referenceDate {
+  ASSIGN(self->referenceDate, _referenceDate);
+}
+- (id)referenceDate {
+  return self->referenceDate;
+}
+
 - (void)setCanAccess:(BOOL)_canAccess {
   self->canAccess = _canAccess;
 }
 
 /* helpers */
 
+- (NSString *)title {
+  return [self->formatter stringForObjectValue:self->appointment
+                          referenceDate:[self referenceDate]];
+}
+
 - (NSString *)tooltip {
-  return [self->tooltipFormatter stringForObjectValue:self->appointment];
+  return [self->tooltipFormatter stringForObjectValue:self->appointment
+                                 referenceDate:[self referenceDate]];
 }
 
 @end
index 5d343807d3aa1c4832ae4a511bd3c4e9a1afe87f..7aca59171015be619dc92fd8f259220135e9c4c0 100644 (file)
@@ -1,14 +1,20 @@
 // $Id$
 
 #include "UIxCalMonthOverview.h"
-#include <NGExtensions/NGExtensions.h>
+#include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalMonthOverview
 
-
 - (void)dealloc {
-    [self->currentWeekStart release];
-    [super dealloc];
+  [self->currentWeekStart release];
+  [super dealloc];
+}
+
+- (void)configureFormatters {
+  [super configureFormatters];
+  
+  [self->aptFormatter setShortTitleOnly];
 }
 
 - (void)setDayIndex:(int)_idx {
index ebf6314616e910f47da1d81602710cb36aa081b7..d2095c88bce96e0c4e6eae34ee88d36017eade72 100644 (file)
@@ -26,7 +26,7 @@ static BOOL shouldDisplayWeekend = NO;
   self = [super init];
   if(self) {
     NSTimeZone *tz;
-    
+
     tz = [self viewTimeZone];
     self->aptFormatter =
       [[SOGoAptFormatter alloc] initWithDisplayTimeZone:tz];
@@ -156,7 +156,9 @@ static BOOL shouldDisplayWeekend = NO;
 }
 
 - (NSString *)tooltipForApt {
-  return [[self aptTooltipFormatter] stringForObjectValue:self->appointment];
+  [self warnWithFormat:@"%s IS DEPRECATED!", __PRETTY_FUNCTION__];
+  return [[self aptTooltipFormatter] stringForObjectValue:self->appointment
+                                     referenceDate:[self currentDay]];
 }
 
 - (NSString *)aptStyle {
@@ -201,7 +203,7 @@ static BOOL shouldDisplayWeekend = NO;
 - (NSArray *)allDayApts {
   NSArray        *apts;
   NSMutableArray *filtered;
-  unsigned i, count;
+  unsigned       i, count;
 
   if (self->allDayApts)
     return self->allDayApts;
@@ -210,11 +212,11 @@ static BOOL shouldDisplayWeekend = NO;
   count    = [apts count];
   filtered = [[NSMutableArray alloc] initWithCapacity:3];
   for (i = 0; i < count; i++) {
-    id apt;
+    id       apt;
     NSNumber *bv;
 
     apt = [apts objectAtIndex:i];
-    bv = [apt valueForKey:@"isallday"];
+    bv  = [apt valueForKey:@"isallday"];
     if ([bv boolValue])
       [filtered addObject:apt];
   }
index da79ddbe1892b2680ca8f264f2e226a427ad5dc8..3d9e3253eebb948f90d3629536c329219a9949dc 100644 (file)
 
 /* row is active, if apt intersects hour range */
 - (BOOL)isRowActive {
-  NSCalendarDate *aptStart, *aptEnd;
-  int aptStartHour, aptEndHour;
-
-  aptStart      = [self->appointment valueForKey:@"startDate"];
-  aptEnd        = [self->appointment valueForKey:@"endDate"];
+  NSCalendarDate *aptStart, *aptEnd, *date;
+  int            aptStartHour, aptEndHour;
+  BOOL           isStartOnSameDay, isEndOnSameDay;
+
+  aptStart         = [self->appointment valueForKey:@"startDate"];
+  aptEnd           = [self->appointment valueForKey:@"endDate"];
+  date             = [self currentDay];
+  isStartOnSameDay = [aptStart isDateOnSameDay:date];
+  isEndOnSameDay   = [aptEnd   isDateOnSameDay:date];
+
+  if (!isStartOnSameDay && !isEndOnSameDay)
+    return YES;
   aptStartHour  = [aptStart hourOfDay];
   aptEndHour    = [aptEnd   hourOfDay];
-
-  return (([self hour] >= aptStartHour) &&
-          ([self hour] <= aptEndHour));
+  if (isStartOnSameDay && isEndOnSameDay)
+    return (([self hour] >= aptStartHour) &&
+            ([self hour] <= aptEndHour));
+  if (!isStartOnSameDay)
+    return [self hour] <= aptEndHour;
+  return [self hour] >= aptStartHour;
 }
 
 /* item is active, if apt's dateRange intersects the range
index 7b381c9e127903c54fc0fa486388ddb09b565f87..b279783b39245ab38fcfc19b64f5989f881971af 100644 (file)
 @end
 
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalWeekColumnsview
 
+- (void)configureFormatters {
+  [super configureFormatters];
+  
+  [self->aptFormatter setOmitsEndDate];
+}
+
 - (void)setDayIndex:(char)_idx {
   NSCalendarDate *d;
     
index edaeb9e243e2b35b9406cf74ec2d09015ce95027..d8f16795934cc70f28c65c43cf0978837f326750 100644 (file)
 
 #include "UIxCalWeekOverview.h"
 #include "common.h"
+#include <SOGoUI/SOGoAptFormatter.h>
 
 @implementation UIxCalWeekOverview
 
+- (void)configureFormatters {
+  [super configureFormatters];
+  
+  [self->aptFormatter setOmitsEndDate];
+}
+
 - (void)setDayIndex:(char)_idx {
     NSCalendarDate *d;
     
index a7539b3fd5eb8746f76b3a42930f91805f2cdb53..82292a3edf9d40c3ba29c2a78a2ba858164bda2b 100644 (file)
@@ -1,7 +1,8 @@
 # Version file
 
-SUBMINOR_VERSION:=122
+SUBMINOR_VERSION:=123
 
+# v0.9.123 requires SOGoUI       v0.9.24
 # v0.9.115 requires NGiCal       v4.5.44
 # v0.9.113 requires libSOGo      v0.9.30
 # v0.9.112 requires SOGoLogic    v0.9.12
diff --git a/SOGo/UI/Scheduler/images/apt_icon_private.gif b/SOGo/UI/Scheduler/images/apt_icon_private.gif
new file mode 100644 (file)
index 0000000..614079d
Binary files /dev/null and b/SOGo/UI/Scheduler/images/apt_icon_private.gif differ
index 6cf78bb5f7e793931f5f6d89eb7166f1c6332d70..2f109869d9fd925a0ac0eca242dbc1d241f32475 100644 (file)
@@ -1,3 +1,14 @@
+2005-07-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxCalDayOverview.wox, UIxCalInlineAptView.wox,
+         UIxCalWeekOverview.wox, UIxCalWeekColumnsview.wox,
+         UIxCalDayChartview.wox, UIxCalDayListview.wox,
+         UIxCalWeekChartview.wox, UIxCalMonthOverview.wox: added referenceDate
+         bindings for all UIxAptInlineViews
+
+       * UIxAppointmentEditor.wox: added redirect in case user who is not
+         allowed to edit view tries to do so
+
 2005-07-04  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * UIxCalDayOverview.wox, UIxCalWeekOverview.wox,
index 12e7b7d40362144742761a26502f62bb096324af..3736a60bd29ce946e75e78c512b5dae85acd64c7 100644 (file)
     </form>
   </var:if>
   <var:if condition="canEditApt" const:negate="YES">
-    Forbidden
+    Forbidden ... <var:redirect const:setURL="view" />
   </var:if>
 </var:component>
index 20b869af862cb13faca0c10777409d4a2a22bf7a..31bfc904111ad30343f4b7ef987ee31026c631a3 100644 (file)
                                                url="appointmentViewURL"
                                                style="aptStyle"
                                                queryDictionary="currentDayQueryParameters"
+                                               referenceDate="currentDate"
                                                canAccess="canAccessApt"
                                 />
                               </span>
index 078ede357fa219cc22fa5dd4fe6c55c011249344..a96f41589f59f2193a3295a06b34f6bce472ebb3 100644 (file)
                                                url="appointmentViewURL"
                                                style="aptStyle"
                                                queryDictionary="currentDayQueryParameters"
+                                               referenceDate="currentDate"
                                                canAccess="canAccessApt"
                                 />
                               </span>
index e5f76e044251fe7d49929fa9d44c24ef97f649b8..d7dbcc4f5eb85aba0344c2e09de890be2244a11c 100644 (file)
                             </td>
                             <td class="dayoverview_content_apts" width="90%">
                               <var:foreach list="allDayApts" item="appointment">
-                                <a var:href="appointmentViewURL"
-                                   var:queryDictionary="currentDateQueryParameters"
-                                   var:title="tooltipForApt"
-                                   var:class="aptStyle"
-                                ><var:string value="shortTextForApt"
-                                             const:escapeHTML="NO"
-                                 /></a>
+                                <var:component className="UIxCalInlineAptView"
+                                               appointment="appointment"
+                                               formatter="aptFormatter"
+                                               tooltipFormatter="aptTooltipFormatter"
+                                               url="appointmentViewURL"
+                                               style="aptStyle"
+                                               queryDictionary="currentDateQueryParameters"
+                                               referenceDate="selectedDate"
+                                               canAccess="canAccessApt"
+                                />
                                 <br />
                               </var:foreach>
                             </td>
                                                url="appointmentViewURL"
                                                style="aptStyle"
                                                queryDictionary="currentDayQueryParameters"
+                                               referenceDate="currentDate"
                                                canAccess="canAccessApt"
                                 />
                                 <br />
index 0e058bb5695566bcf77fdb855c3a8f6763fff895..501a36eb3ef988a6e03b3a368a90066876261331 100644 (file)
@@ -9,15 +9,14 @@
     <a var:href="url"
        var:title="tooltip"
        var:queryDictionary="queryDictionary"
-    ><small><var:string value="appointment"
-                        formatter="formatter"
+    ><small><var:string value="title"
                         const:escapeHTML="NO"
                         style="style"
             /></small></a>
   </var:if>
   <var:if condition="canAccess" const:negate="YES">
-    <small><var:string value="appointment"
-                       formatter="formatter"
+    <img rsrc:src="apt_icon_private.gif" />
+    <small><var:string value="title"
                        const:escapeHTML="NO"
                        style="style"
            /></small>
index fffafb376c7ea74aa5195b4e242646c52a32ef2e..29e60365bcc6d971dcc043a1951728908d06da6a 100644 (file)
                                      tooltipFormatter="aptTooltipFormatter"
                                      url="appointmentViewURL"
                                      style="aptStyle"
+                                     referenceDate="currentDay"
                                      canAccess="canAccessApt"
                       />
                       <br />
                          var:queryDictionary="currentDayQueryParameters"
                       ><var:string value="currentDay.dayOfMonth"/></a>
                     </span>
-                    <br/>
+                    <!-- removed for 0.8
+                     <br/>
                     <span class="monthoverview_day_new">
                       <a href="new"
                          var:queryDictionary="currentDayQueryParameters"
                       >[<var:string label:value="new"/>]</a>
-                    </span>
+                    </span>-->
                   </var:month-title>
                   <var:month>
                     <var:component className="UIxCalInlineAptView"
                                    tooltipFormatter="aptTooltipFormatter"
                                    url="appointmentViewURL"
                                    style="aptStyle"
+                                   referenceDate="currentDay"
                                    canAccess="canAccessApt"
                     />
                     <br />
index 69ffb7d070f98aad1055bbd2524a4f0f2d135070..4b52132ce5e5e4a5b05d12cc47ba933c3000897c 100644 (file)
                                      url="appointmentViewURL"
                                      style="aptStyle"
                                      queryDictionary="currentDayQueryParameters"
+                                     referenceDate="currentDay"
                                      canAccess="canAccessApt"
                       />
                     </span>
index 56e5b3df563715aed83dc05046110960ebab46b2..38665dfb058eec053f0ae8b4dfd6bdc3538b7520 100644 (file)
                                              url="appointmentViewURL"
                                              style="aptStyle"
                                              queryDictionary="currentDayQueryParameters"
+                                             referenceDate="currentDay"
                                              canAccess="canAccessApt"
                               />
                               <br />
                                          url="appointmentViewURL"
                                          style="aptStyle"
                                          queryDictionary="currentDayQueryParameters"
+                                         referenceDate="currentDay"
                                          canAccess="canAccessApt"
                           />
                           <br />
index 74d235ab501a3d8556a17de8e45b8d66f34325d1..581d2e116951daf1c6f64039027ba099a8705fc5 100644 (file)
                            tooltipFormatter="aptTooltipFormatter"
                            url="appointmentViewURL"
                            style="aptStyle"
+                           referenceDate="currentDay"
                            queryDictionary="currentDayQueryParameters"
                            canAccess="canAccessApt"
             />
                        tooltipFormatter="aptTooltipFormatter"
                        url="appointmentViewURL"
                        style="aptStyle"
+                       referenceDate="currentDay"
                        canAccess="canAccessApt"
         />
         <br />