]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1141 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 7 Aug 2007 21:21:16 +0000 (21:21 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 7 Aug 2007 21:21:16 +0000 (21:21 +0000)
ChangeLog
SOPE/NGCards/ChangeLog
SOPE/NGCards/iCalMonthlyRecurrenceCalculator.m
SOPE/NGCards/iCalRecurrenceRule.m
SoObjects/Appointments/SOGoCalendarComponent.m
UI/Contacts/UIxContactFoldersView.m
UI/WebServerResources/UIxContactsUserFolders.js

index 93ede875057fe3b7ad76838c482eef640ceb0f46..d7acd4f587dbe92ee034186429f3e0e41b4951c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-08-07  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/Appointments/SOGoCalendarComponent.m
+       ([SOGoCalendarComponent
+       -sendEMailUsingTemplateNamed:_pageNameforOldObject:_oldObjectandNewObject:_newObjecttoAttendees:_attendees]):
+       set the mail date to the current date string returned by our
+       rfc822DateString extension method.
+
+       * UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView
+       -_gcsFoldersFromFolder:): ignore the personal folders who are
+       returned but don't really exist.
+
 2007-08-02  Francis Lachapelle  <flachapelle@inverse.ca>
 
        * UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView _responseForResults:]):
index 911fbddf5a07a8c8433050c91984eb7730164121..679c350ae2bec2694bd3928d835d8c6ab0653377 100644 (file)
@@ -1,3 +1,17 @@
+2007-08-07  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * iCalRecurrenceRule.m ([iCalRecurrenceRule
+       -valueForFrequency:value]): returns NSNotFound whenever the
+       frequency text has a length of 0.
+       ([iCalRecurrenceRule -byDayMask]): return an empty mask whenever
+       the "byday" value has a length of 0.
+
+2007-02-12  Helge Hess  <helge.hess@opengroupware.org>
+       * iCalMonthlyRecurrenceCalculator.m: fixed byday calculation for days
+       which overflow the number of days in a month. Should fix OGo bug
+       #1829. (v4.7.79)
+       
 2007-07-10  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * iCalToDo.m ([iCalToDo -setDue:newDueDate]): use setDateTime:
index a711254040cc1f12b223988a4b8fadfadf8a7e05..2516534a9d5a80d9f85fbe595582966efdfd7d7c 100644 (file)
@@ -1,5 +1,6 @@
 /*
-  Copyright (C) 2004-2005 SKYRIX Software AG
+  Copyright (C) 2004-2007 SKYRIX Software AG
+  Copyright (C) 2007      Helge Hess
   
   This file is part of SOPE.
   
@@ -246,20 +247,21 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet,
   unsigned       monthIdxInRange, numberOfMonthsInRange, interval;
   int            diff;
   NGMonthSet byMonthList = { // TODO: fill from rrule, this is the default
+    /* enable all months of the year */
     YES, YES, YES, YES, YES, YES, 
     YES, YES, YES, YES, YES, YES
   };
-  NSArray *byMonthDay = nil; // array of ints (-31..-1 and 1..31)
+  NSArray       *byMonthDay; // array of ints (-31..-1 and 1..31)
   NGMonthDaySet byMonthDaySet;
   
   eventStartDate  = [self->firstRange startDate];
   eventDayOfMonth = [eventStartDate dayOfMonth];
-  timeZone   = [eventStartDate timeZone];
-  rStart     = [_r startDate];
-  rEnd       = [_r endDate];
-  interval   = [self->rrule repeatInterval];
-  until      = [self lastInstanceStartDate]; // TODO: maybe replace
-  byMonthDay = [self->rrule byMonthDay];
+  timeZone        = [eventStartDate timeZone];
+  rStart          = [_r startDate];
+  rEnd            = [_r endDate];
+  interval        = [self->rrule repeatInterval];
+  until           = [self lastInstanceStartDate]; // TODO: maybe replace
+  byMonthDay      = [self->rrule byMonthDay];
   
 
   /* check whether the range to be processed is beyond the 'until' date */
@@ -274,8 +276,12 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet,
   
   /* precalculate month days (same for all instances) */
 
-  if (byMonthDay != nil)
+  if (byMonthDay != nil) {
+#if HEAVY_DEBUG
+    NSLog(@"byMonthDay: %@", byMonthDay);
+#endif
     NGMonthDaySet_fillWithByMonthDay(&byMonthDaySet, byMonthDay);
+  }
   
   
   // TODO: I think the 'diff' is to skip recurrence which are before the
@@ -317,6 +323,10 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet,
       - check whether the month is in the BYMONTH list
     */
     
+    /*
+      Note: the function below adds exactly a month, eg:
+            2007-01-30 + 1month => 2007-02-*28*!!
+    */
     cursor = [eventStartDate dateByAddingYears:0
                              months:(diff + monthIdxInRange)
                              days:0];
@@ -362,19 +372,71 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet,
     
     // TODO: add processing of byhour/byminute/bysecond etc
     
+    /* 
+       Next step is to create NSCalendarDate instances from our 'monthDays'
+       set. We walk over each day of the 'monthDays' set. If its flag isn't
+       set, we continue.
+       If its set, we add the date to the instance.
+       
+       The 'cursor' is the *startdate* of the event (not necessarily a
+       component of the sequence!) plus the currently processed month.
+       Eg:
+         startdate: 2007-01-30
+        cursor[1]: 2007-01-30
+        cursor[2]: 2007-02-28 <== Note: we have February!
+    */
+    
     for (dom = 1, doCont = YES; dom <= numDaysInMonth && doCont; dom++) {
       NSCalendarDate *start;
       
       if (!monthDays[dom])
        continue;
-      
-      if (eventDayOfMonth == dom)
+
+      // TODO: what is this good for?
+      /*
+       Here we need to correct the date. Remember that the startdate given in
+       the event is not necessarily a date of the sequence!
+
+       The 'numDaysInMonth' localvar contains the number of days in the
+       current month (eg 31 for Januar, 28 for most February's, etc)
+       
+       Eg: MONTHLY;BYDAY=-1WE (last wednesday, every month)
+       
+         cursor:  2007-01-30 (eventDayOfMonth = 30)
+         =>start: 2007-01-31 (dom = 31)
+         cursor:  2007-02-28 (eventDayOfMonth = 30)
+         =>start: 2007-02-28 (dom = 28)
+       
+       Note: in case the cursor already had an event-day overflow, that is the
+             'eventDayOfMonth' is bigger than the 'numDaysInMonth', the cursor
+             will already be corrected!
+             Eg:
+               start was:      2007-01-30
+               cursor will be: 2007-02-28
+      */
+      if (eventDayOfMonth == dom) {
        start = cursor;
+      }
       else {
-       start = [cursor dateByAddingYears:0 months:0
-                       days:(dom - eventDayOfMonth)];
+       int maxDay = 
+         eventDayOfMonth > numDaysInMonth ? numDaysInMonth : eventDayOfMonth;
+       
+       start = [cursor dateByAddingYears:0 months:0 days:(dom - maxDay)];
       }
-      
+
+      /*
+       Setup for 2007-02-28, MONTHLY;BYDAY=-1WE.
+         dom:             28
+         eventDayOfMonth: 31
+         cursor:          2007-02-28
+         start:           2007-02-25 <== WRONG
+      */
+
+#if HEAVY_DEBUG
+      NSLog(@"DOM %i EDOM %i NUMDAYS %i START: %@ CURSOR: %@", 
+           dom, eventDayOfMonth, numDaysInMonth,
+           start, cursor);
+#endif
       doCont = [self _addInstanceWithStartDate:start
                     limitDate:until
                     limitRange:_r
index fe66f48cc9662a7affc43a221581e8d576f97dda..ea981406f0e8f28b5b5741862806d2d063a2080e 100644 (file)
   NSString *frequency;
   iCalRecurrenceFrequency freq;
 
-  frequency = [value uppercaseString];
-  if ([frequency isEqualToString:@"WEEKLY"])
-    freq = iCalRecurrenceFrequenceWeekly;
-  else if ([frequency isEqualToString:@"MONTHLY"])
-    freq = iCalRecurrenceFrequenceMonthly;
-  else if ([frequency isEqualToString:@"DAILY"])
-    freq = iCalRecurrenceFrequenceDaily;
-  else if ([frequency isEqualToString:@"YEARLY"])
-    freq = iCalRecurrenceFrequenceYearly;
-  else if ([frequency isEqualToString:@"HOURLY"])
-    freq = iCalRecurrenceFrequenceHourly;
-  else if ([frequency isEqualToString:@"MINUTELY"])
-    freq = iCalRecurrenceFrequenceMinutely;
-  else if ([frequency isEqualToString:@"SECONDLY"])
-    freq = iCalRecurrenceFrequenceSecondly;
+  if ([value length] > 0)
+    {
+      frequency = [value uppercaseString];
+      if ([frequency isEqualToString:@"WEEKLY"])
+       freq = iCalRecurrenceFrequenceWeekly;
+      else if ([frequency isEqualToString:@"MONTHLY"])
+       freq = iCalRecurrenceFrequenceMonthly;
+      else if ([frequency isEqualToString:@"DAILY"])
+       freq = iCalRecurrenceFrequenceDaily;
+      else if ([frequency isEqualToString:@"YEARLY"])
+       freq = iCalRecurrenceFrequenceYearly;
+      else if ([frequency isEqualToString:@"HOURLY"])
+       freq = iCalRecurrenceFrequenceHourly;
+      else if ([frequency isEqualToString:@"MINUTELY"])
+       freq = iCalRecurrenceFrequenceMinutely;
+      else if ([frequency isEqualToString:@"SECONDLY"])
+       freq = iCalRecurrenceFrequenceSecondly;
+      else
+       freq = NSNotFound;
+    }
   else
     freq = NSNotFound;
 
 {
   NSArray *days;
   unsigned int mask, count, max;
-  NSString *day;
+  NSString *day, *value;
 
   mask = 0;
 
-  days = [[self namedValue: @"byday"] componentsSeparatedByString: @","];
-  max = [days count];
-  for (count = 0; count < max; count++)
+  value = [self namedValue: @"byday"];
+  if ([value length] > 0)
     {
-      day = [days objectAtIndex: count];
-      day = [day substringFromIndex: [day length] - 2];
-      mask |= [self weekDayFromICalRepresentation: day];
+      days = [value componentsSeparatedByString: @","];
+      max = [days count];
+      for (count = 0; count < max; count++)
+       {
+         day = [days objectAtIndex: count];
+         day = [day substringFromIndex: [day length] - 2];
+         mask |= [self weekDayFromICalRepresentation: day];
+       }
     }
 
   return mask;
index c77601288d95bd4ab0cdd342c47cdec71bc67bfe..50e2c4758cd69e208861fdfa6e6e9923b3f8e9e1 100644 (file)
@@ -34,6 +34,7 @@
 #import <NGMail/NGSendMail.h>
 
 #import <SoObjects/SOGo/LDAPUserManager.h>
+#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
 #import <SoObjects/SOGo/SOGoPermissions.h>
 #import <SoObjects/SOGo/SOGoUser.h>
 #import <SoObjects/Appointments/SOGoAppointmentFolder.h>
@@ -337,7 +338,7 @@ static BOOL sendEMailNotifications = NO;
   iCalPerson *attendee;
   NSString *recipient;
   SOGoAptMailNotification *p;
-  NSString *subject, *text, *header;
+  NSString *mailDate, *subject, *text, *header;
   NGMutableHashMap *headerMap;
   NGMimeMessage *msg;
   NGMimeBodyPart *bodyPart;
@@ -408,7 +409,8 @@ static BOOL sendEMailNotifications = NO;
           [headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
           [headerMap setObject: sender forKey: @"From"];
           [headerMap setObject: recipient forKey: @"To"];
-          [headerMap setObject: [NSCalendarDate date] forKey: @"date"];
+         mailDate = [[NSCalendarDate date] rfc822DateString];
+          [headerMap setObject: mailDate forKey: @"date"];
           [headerMap setObject: subject forKey: @"Subject"];
           msg = [NGMimeMessage messageWithHeader: headerMap];
 
index 385a4955481ec30cf66942e537303f9aab0d480f..ed6dcd9d48b3c61c1834b2ed84c9324306d90970 100644 (file)
       if ([currentContactFolder
            isKindOfClass: [SOGoContactGCSFolder class]])
        {
-         folderName = [NSString stringWithFormat: @"/Contacts/%@",
-                                [currentContactFolder nameInContainer]];
-         currentDictionary = [NSMutableDictionary new];
-         [currentDictionary autorelease];
          displayName = [[currentContactFolder ocsFolder] folderName];
-         [currentDictionary setObject: displayName forKey: @"displayName"];
-         [currentDictionary setObject: folderName forKey: @"name"];
-         [currentDictionary setObject: @"contact" forKey: @"type"];
-         [gcsFolders addObject: currentDictionary];
+         if (displayName)
+           {
+             folderName = [NSString stringWithFormat: @"/Contacts/%@",
+                                    [currentContactFolder nameInContainer]];
+             currentDictionary
+               = [NSMutableDictionary dictionaryWithCapacity: 3];
+             [currentDictionary setObject: displayName forKey: @"displayName"];
+             [currentDictionary setObject: folderName forKey: @"name"];
+             [currentDictionary setObject: @"contact" forKey: @"type"];
+             [gcsFolders addObject: currentDictionary];
+           }
        }
       currentContactFolder = [contactSubfolders nextObject];
     }
index fdc5689953c820bab2968583bd0da7037f770a2d..d060d319a22c46b4f1c00bd6f119d081a2d05fd5 100644 (file)
@@ -40,8 +40,8 @@ function addLineToTree(tree, parent, line) {
       }
       offset = nodes.length - 1;
    }
-   else
-      window.alert("nope:" + window.opener.userFolderType);
+//    else
+//       window.alert("nope:" + window.opener.userFolderType);
 
    return offset;
 }