]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1040 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 2 Apr 2007 21:29:40 +0000 (21:29 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 2 Apr 2007 21:29:40 +0000 (21:29 +0000)
24 files changed:
ChangeLog
OGoContentStore/OCSContactFieldExtractor.m
OGoContentStore/contact.ocs
OGoContentStore/sql/generate-folderinfo-sql-for-users.sh
SoObjects/Appointments/SOGoAppointmentFolder.h
SoObjects/Appointments/SOGoAppointmentFolder.m
SoObjects/Contacts/SOGoContactGCSFolder.m
SoObjects/Contacts/SOGoContactLDAPFolder.m
UI/Contacts/English.lproj/Localizable.strings
UI/Contacts/French.lproj/Localizable.strings
UI/Contacts/UIxContactEditor.m
UI/Contacts/UIxContactView.m
UI/Scheduler/UIxCalView.h
UI/Scheduler/UIxCalView.m
UI/Scheduler/UIxCalendarSelector.h
UI/Scheduler/UIxCalendarSelector.m
UI/Scheduler/UIxComponentEditor.h
UI/Scheduler/UIxComponentEditor.m
UI/Templates/ContactsUI/UIxContactView.wox
UI/Templates/ContactsUI/UIxContactsListView.wox
UI/WebServerResources/ContactsUI.js
UI/WebServerResources/SchedulerUI.js
UI/WebServerResources/UIxAppointmentEditor.css
UI/WebServerResources/UIxTaskEditor.css

index 1f675d5fb9dcd4583ec46ccb82843dd2791ed9b1..ac1ae32f3dfa5541d395079701784a2afd513671 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2007-04-02  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * UI/Contacts/UIxContactView.m ([UIxContactView -workUrl]): we
+       want the "work" url instead of the "home".
+
+       * UI/Contacts/UIxContactEditor.m ([UIxContactEditor
+       -_saveSnapshot]): save url values from snapshot.
+       ([UIxContactEditor -initSnapshot]): load url values from snapshot.
+
+       * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor
+       -calendarList]): new method replacing "availableCalendars".
+
+       * UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector
+       -calendarFolders]): we now take the list of subscribed calendar
+       from the container.
+
+       * SoObjects/Appointments/SOGoAppointmentFolder.m
+       ([SOGoAppointmentFolder -calendarFoldersInContext:context]): new
+       method derived from and replacing [UIxCalView calendarFolders].
+
 2007-03-30  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount
index 7b53fd061840140723565e508d21610ff7d31564..5ca2024fd6532f9a9af76baa6d390a02b048cda3 100644 (file)
@@ -42,7 +42,7 @@ static NSString *fieldNames[] = {
   nil, nil
 };
 
-- (NSMutableDictionary *) extractQuickFieldsFromVCard: (NGVCard *) _vCard
+- (NSMutableDictionary *) extractQuickFieldsFromVCard: (NGVCard *) vCard
 {
   NSMutableDictionary *fields;
   NSArray *values;
@@ -50,15 +50,15 @@ static NSString *fieldNames[] = {
   NSString *value;
   unsigned int max;
 
-  if (_vCard == nil)
+  if (vCard == nil)
     return nil;
 
   fields = [NSMutableDictionary dictionaryWithCapacity:16];
 
-  value = [_vCard fn];
+  value = [vCard fn];
   if (value)
     [fields setObject: value forKey: @"cn"];
-  values = [_vCard n];
+  values = [vCard n];
   if (values)
     {
       max = [values count];
@@ -70,26 +70,25 @@ static NSString *fieldNames[] = {
                     forKey: @"givenName"];
         }
     }
-  value = [_vCard preferredTel];
+  value = [vCard preferredTel];
   if (value)
     [fields setObject: value forKey: @"telephoneNumber"];
-  value = [_vCard preferredEMail];
+  value = [vCard preferredEMail];
   if (value)
     [fields setObject: value forKey: @"mail"];
-  values = [_vCard org];
-  if (values)
+  values = [vCard org];
+  max = [values count];
+  if (max > 0)
     {
-      max = [values count];
-      if (max > 0)
-        {
-          [fields setObject: [values objectAtIndex: 0] forKey: @"o"];
-          if (max > 1)
-            [fields setObject: [values objectAtIndex: 1] forKey: @"ou"];
-        }
+      [fields setObject: [values objectAtIndex: 0] forKey: @"o"];
+      if (max > 1)
+       [fields setObject: [values objectAtIndex: 1] forKey: @"ou"];
     }
-  adr = [_vCard preferredAdr];
+  adr = [vCard preferredAdr];
   if (adr)
     [fields setObject: [adr value: 3] forKey: @"l"];
+  value = [[vCard uniqueChildWithTag: @"X-AIM"] value: 0];
+  [fields setObject: value forKey: @"screenname"];
 
   return fields;
 }
index 29fa99155ed99bbc5d7610b6bfa7b52caee34ad8..d1372447bff51913ab52abf3ef81f16d36ef9369 100644 (file)
       sqlType    = "VARCHAR(256)";
       allowsNull = YES;
     },
+    {
+      columnName = screenname;
+      sqlType    = "VARCHAR(256)";
+      allowsNull = YES;
+    },
     {
       columnName = l;
       sqlType    = "VARCHAR(256)";
index e8ba9c594bd80029b6385d64afeec14369badd10..0868d1915566ea78f3ee8fe74bb5ac0b0052bc00 100755 (executable)
@@ -110,6 +110,7 @@ CREATE TABLE SOGo_${USER_TABLE}_contacts_quick (
   givenname       VARCHAR(256),
   cn              VARCHAR(256),
   sn              VARCHAR(256),
+  screenname      VARCHAR(256),
   l               VARCHAR(256),
   mail            VARCHAR(256),
   o               VARCHAR(256),
index 48eac1d0bc3b813d10df4fb288632534943f6728..b072bb20fff645d177440564cd88d68c2d911f4b 100644 (file)
 
 - (NSArray *) fetchAllSOGoAppointments;
 
+- (NSArray *) calendarFoldersInContext: (WOContext *) context;
+
 @end
 
 #endif /* __Appointments_SOGoAppointmentFolder_H__ */
index c511e3fcdf5e335eccebf85fba4779b914aa2f13..8069190031f455fc492387058507cfd29c6c4b16 100644 (file)
@@ -72,7 +72,7 @@ static NSNumber   *sharedYes = nil;
             NSStringFromClass([self superclass]), [super version]);
 
   lm      = [NGLoggerManager defaultLoggerManager];
-  logger  = [lm loggerForDefaultKey:@"SOGoAppointmentFolderDebugEnabled"];
+  logger  = [lm loggerForDefaultKey: @"SOGoAppointmentFolderDebugEnabled"];
 
 //   securityInfo = [self soClassSecurityInfo];
 //   [securityInfo declareRole: SOGoRole_Delegate
@@ -221,7 +221,8 @@ static NSNumber   *sharedYes = nil;
 
   filters = [NSMutableArray new];
 
-  children = [[parentNode getElementsByTagName: @"comp-filter"] objectEnumerator];
+  children = [[parentNode getElementsByTagName: @"comp-filter"]
+              objectEnumerator];
   node = [children nextObject];
   while (node)
     {
@@ -443,7 +444,7 @@ static NSNumber   *sharedYes = nil;
   }
   
   if (nameFields == nil)
-    nameFields = [[NSArray alloc] initWithObjects:@"c_name", nil];
+    nameFields = [[NSArray alloc] initWithObjects: @"c_name", nil];
   
   qualifier = [EOQualifier qualifierWithQualifierFormat:@"uid = %@", _u];
   records   = [_f fetchFields: nameFields matchingQualifier: qualifier];
@@ -1133,6 +1134,68 @@ static NSNumber   *sharedYes = nil;
   return events;
 }
 
+#warning We only support ONE calendar per user at this time
+- (BOOL) _appendSubscribedFolders: (NSDictionary *) subscribedFolders
+                    toFolderList: (NSMutableArray *) calendarFolders
+{
+  NSEnumerator *keys;
+  NSString *currentKey;
+  NSMutableDictionary *currentCalendar;
+  BOOL firstShouldBeActive;
+  unsigned int count;
+
+  firstShouldBeActive = YES;
+
+  keys = [[subscribedFolders allKeys] objectEnumerator];
+  currentKey = [keys nextObject];
+  count = 1;
+  while (currentKey)
+    {
+      currentCalendar = [NSMutableDictionary new];
+      [currentCalendar autorelease];
+      [currentCalendar
+       setDictionary: [subscribedFolders objectForKey: currentKey]];
+      [currentCalendar setObject: currentKey forKey: @"folder"];
+      [calendarFolders addObject: currentCalendar];
+      if ([[currentCalendar objectForKey: @"active"] boolValue])
+       firstShouldBeActive = NO;
+      count++;
+      currentKey = [keys nextObject];
+    }
+
+  return firstShouldBeActive;
+}
+
+- (NSArray *) calendarFoldersInContext: (WOContext *) context
+{
+  NSMutableDictionary *userCalendar, *calendarDict;
+  NSMutableArray *calendarFolders;
+  SOGoUser *activeUser;
+  BOOL firstActive;
+
+  calendarFolders = [NSMutableArray new];
+  [calendarFolders autorelease];
+
+  activeUser = [context activeUser];
+
+  userCalendar = [NSMutableDictionary new];
+  [userCalendar autorelease];
+  [userCalendar setObject: @"/" forKey: @"folder"];
+  [userCalendar setObject: @"Calendar" forKey: @"displayName"];
+  [calendarFolders addObject: userCalendar];
+
+  calendarDict = [[activeUser userSettings] objectForKey: @"Calendar"];
+  firstActive = [[calendarDict objectForKey: @"activateUserFolder"] boolValue];
+  firstActive = ([self _appendSubscribedFolders:
+                        [calendarDict objectForKey: @"SubscribedFolders"]
+                      toFolderList: calendarFolders]
+                || firstActive);
+  [userCalendar setObject: [NSNumber numberWithBool: firstActive]
+               forKey: @"active"];
+
+  return calendarFolders;
+}
+
 /* folder type */
 
 - (NSString *) folderType
index 29dbac21b8fc16e878f0452deb45d60ba5c93eba..cc15b14a9c574e72be93548558b05d8d8d502933 100644 (file)
@@ -27,8 +27,8 @@
 #import "SOGoContactGCSFolder.h"
 
 #define folderListingFields [NSArray arrayWithObjects: @"c_name", @"cn", \
-                                     @"sn", @"givenname", @"l",          \
-                                     @"mail", @"telephonenumber",        \
+                                     @"givenname", @"screenname", \
+                                    @"o", @"mail", @"telephonenumber", \
                                      nil]
 
 @implementation SOGoContactGCSFolder
   fields = folderListingFields;
   qualifier = [self _qualifierForFilter: filter];
   records = [[self ocsFolder] fetchFields: fields
-                              matchingQualifier: qualifier];
+                             matchingQualifier: qualifier];
   if (records)
     {
       ordering
index b14734e802acc7112e6de48d7e7413d7135aa4f5..fb51aa20d71328fecd620f0113cc0352d766e245 100644 (file)
@@ -45,6 +45,7 @@
 #define folderListingFields [NSArray arrayWithObjects: @"c_name", @"cn", \
                                      @"displayName",                     \
                                      @"streetAddress",                   \
+                                     @"o", \
                                      @"sn", @"givenname", @"l",          \
                                      @"mail", @"telephonenumber",        \
                                      @"mailNickname",                    \
index c6256673b14cb6e52f97b7fce5209876de687abd..d94efb2741bb3cb4dd2e3cfffb625fb7140d7ca2 100644 (file)
@@ -6,8 +6,8 @@
 "Common" = "Common";
 "Contact editor" = "Contact editor";
 "Contact viewer" = "Contact viewer";
-"Copy from Anais" = "Copy from Anais";
-"EMail" = "EMail";
+"Email" = "Email";
+"Screen Name" = "Screen Name";
 "Extended" = "Extended";
 "Fax" = "Fax";
 "Firstname" = "Firstname";
@@ -18,7 +18,8 @@
 "MobilePhone" = "MobilePhone";
 "Name" = "Name";
 "OfficePhone" = "OfficePhone";
-"Organisation" = "Organisation";
+"Organization" = "Organization";
+"Work Phone" = "Work Phone";
 "Phone" = "Phone";
 "Phones" = "Phones";
 "Postal" = "Postal";
index 660de024232f0cfedb3bd818df481cd856f168c9..940de3a53f21ed7827e7b9985ceb485e7ea9f27d 100644 (file)
@@ -16,7 +16,8 @@
 "Common"            = "Identité";
 "Contact editor"    = "Éditer le contact";
 "Contact viewer"    = "Visualiser le contact";
-"EMail"             = "Courriel";
+"Email"             = "Adresse Ã©lectronique";
+"Screen Name"      = "Pseudo";
 "Extended"          = "Informations complémentaires";
 "Fax"               = "Fax";
 "Firstname"         = "Prénom";
@@ -25,7 +26,8 @@
 "Location"          = "Lieux";
 "MobilePhone"       = "Mobile";
 "OfficePhone"       = "Bureau";
-"Organisation"      = "Société";
+"Organization"      = "Société";
+"Work Phone" = "Travail";
 "Phone"             = "Téléphone";
 "Postal"            = "Professionnelle";
 "Save"              = "Sauvegarder";
index a6da42802b96e6d870aa44453852eeaf32855236..0b6dd7b7420601d050e977d5957d705451a84ca9 100644 (file)
 
 /* load/store content format */
 
-- (void)_fixupSnapshot {
+- (void) _fixupSnapshot
+{
   // TODO: perform sanity checking, eg build CN on demand
   NSString *cn, *gn, *sn;
   
-  cn = [snapshot objectForKey:@"cn"];
-  gn = [snapshot objectForKey:@"givenName"];
-  sn = [snapshot objectForKey:@"sn"];
+  cn = [snapshot objectForKey: @"cn"];
+  gn = [snapshot objectForKey: @"givenName"];
+  sn = [snapshot objectForKey: @"sn"];
   
   if (![sn isNotNull] || [sn length] == 0)
     sn = nil;
       // TODO: need a better name parser here
       NSRange r;
       
-      r = [cn rangeOfString:@" "];
+      r = [cn rangeOfString: @" "];
       sn = (r.length > 0)
        ? [cn substringFromIndex:(r.location + r.length)]
        : cn;
     }
-    [snapshot setObject:sn forKey:@"sn"];
+    [snapshot setObject:sn forKey: @"sn"];
   }
   if (sn == nil && gn == nil)
     cn = @"[noname]";
   else if (gn == nil)
     cn = sn;
   else
-    cn = [[gn stringByAppendingString:@" "] stringByAppendingString:sn];
-  [snapshot setObject:cn forKey:@"cn"];
+    cn = [[gn stringByAppendingString: @" "] stringByAppendingString:sn];
+  [snapshot setObject:cn forKey: @"cn"];
 }
 
 /* helper */
   uri = [[[self context] request] uri];
     
   /* first: identify query parameters */
-  r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
+  r = [uri rangeOfString: @"?" options:NSBackwardsSearch];
   if (r.length > 0)
     uri = [uri substringToIndex:r.location];
     
   /* next: append trailing slash */
-  if (![uri hasSuffix:@"/"])
-    uri = [uri stringByAppendingString:@"/"];
+  if (![uri hasSuffix: @"/"])
+    uri = [uri stringByAppendingString: @"/"];
   
   /* next: append method */
   uri = [uri stringByAppendingString:_method];
     [self initSnapshot];
   else
     return [NSException exceptionWithHTTPStatus:404 /* Not Found */
-                        reason:@"could not open contact"];
+                        reason: @"could not open contact"];
 
   return self;
 }
 - (void) _saveSnapshot
 {
   CardElement *element;
+  NSArray *units;
 
   [card setNWithFamily: [snapshot objectForKey: @"sn"]
         given: [snapshot objectForKey: @"givenName"]
                          value: [snapshot objectForKey: @"calFBURL"]];
   [card setUniqueChild: element];
 
+  units = [NSArray arrayWithObject: [snapshot objectForKey: @"workService"]];
+  [card setOrg: [snapshot objectForKey: @"workCompany"]
+       units: units];
+
   [self _savePhoneValues];
   [self _saveEmails];
+  [[self _elementWithTag: @"url" ofType: @"home"]
+    setValue: 0 to: [snapshot objectForKey: @"homeURL"]];
+  [[self _elementWithTag: @"url" ofType: @"work"]
+    setValue: 0 to: [snapshot objectForKey: @"workURL"]];
+
   [[card uniqueChildWithTag: @"x-aim"]
-    setValue: 0 to: [snapshot objectForKey: @"screenName"]];
+    setValue: 0
+    to: [snapshot objectForKey: @"screenName"]];
 }
 
 - (id <WOActionResults>) saveAction
     [self redirectToLocation: [self relativePathToUserFolderSubPath: url]];
 }
 
-- (id)newAction {
+- (id) newAction
+{
   // TODO: this is almost a DUP of UIxAppointmentEditor
   /*
     This method creates a unique ID and redirects to the "edit" method on the
 
   if ([objectId length] == 0)
     return [NSException exceptionWithHTTPStatus:500 /* Internal Error */
-                        reason:@"could not create a unique ID"];
+                        reason: @"could not create a unique ID"];
 
-  nextMethod = [NSString stringWithFormat:@"../%@/%@", 
-                          objectId, [self editActionName]];
+  nextMethod = [NSString stringWithFormat: @"../%@/%@", 
+                        objectId, [self editActionName]];
   uri = [self _completeURIForMethod:nextMethod];
   return [self redirectToLocation:uri];
 }
index f6919bfe7772e7992d84609843d0d892194e3444..b80dc597ee6b0af5dda0ab091278126daf88a2b0 100644 (file)
 
 - (NSString *) workUrl
 {
-  return [self _urlOfType: @"home"];
+  return [self _urlOfType: @"work"];
 }
 
 - (BOOL) hasOtherInfos
index 4b2eeb10c3aecbc6443acea7b63138b335c910aa..9cf7c7bb776e2443634bdb0261d7520723b57d08 100644 (file)
   a SOPE clientObject (which usually is an SOGoAppointmentFolder).
 */
 
-@class NSString, NSArray, NSDictionary, NSMutableDictionary, NSCalendarDate, SOGoAptFormatter;
+@class NSArray;
+@class NSCalendarDate;
+@class NSDictionary;
+@class NSMutableDictionary;
+@class NSString;
+
+@class SOGoAptFormatter;
 @class SOGoAppointmentFolder;
 
 @interface UIxCalView : UIxComponent
 {
-  NSArray          *appointments;
-  NSMutableArray *calendarFolders;
+  NSArray *appointments;
   NSMutableDictionary *componentsData;
-  NSArray          *tasks;
-  NSArray          *allDayApts;
-  id               appointment;
-  NSCalendarDate   *currentDay;
+  NSArray *tasks;
+  NSArray *allDayApts;
+  id appointment;
+  NSCalendarDate *currentDay;
   SOGoAptFormatter *aptFormatter;
   SOGoAptFormatter *aptTooltipFormatter;
   SOGoAptFormatter *privateAptFormatter;
   } aptFlags;
 }
 
-
 /* config */
 
-- (void)configureFormatters;
+- (void) configureFormatters;
 
 /* accessors */
 
 - (void) setTasks: (NSArray *) _tasks;
 - (NSArray *) tasks;
 
-- (NSArray *)allDayApts;
-- (id)appointment;
-- (BOOL)isMyApt;
-- (BOOL)canAccessApt; /* protection */
+- (NSArray *) allDayApts;
+- (id) appointment;
+- (BOOL) isMyApt;
+- (BOOL) canAccessApt; /* protection */
 
-- (BOOL)hasDayInfo;
-- (BOOL)hasHoldidayInfo;
-- (BOOL)hasAllDayApts;
+- (BOOL) hasDayInfo;
+- (BOOL) hasHoldidayInfo;
+- (BOOL) hasAllDayApts;
 
-- (NSDictionary *)aptTypeDict;
-- (NSString *)aptTypeLabel;
-- (NSString *)aptTypeIcon;
-- (SOGoAptFormatter *)aptFormatter;
+- (NSDictionary *) aptTypeDict;
+- (NSString *) aptTypeLabel;
+- (NSString *) aptTypeIcon;
+- (SOGoAptFormatter *) aptFormatter;
 
-- (NSString *)shortTextForApt;
-- (NSString *)shortTitleForApt;
-- (NSString *)tooltipForApt;
-- (NSString *)appointmentViewURL;
+- (NSString *) shortTextForApt;
+- (NSString *) shortTitleForApt;
+- (NSString *) tooltipForApt;
+- (NSString *) appointmentViewURL;
 
-- (id)holidayInfo;
+- (id) holidayInfo;
 
 /* related to current day */
-- (void)setCurrentDay:(NSCalendarDate *)_day;
-- (NSCalendarDate *)currentDay;
-- (NSString *)currentDayName; /* localized */
+- (void) setCurrentDay: (NSCalendarDate *) _day;
+- (NSCalendarDate *) currentDay;
+- (NSString *) currentDayName; /* localized */
 
 /* defaults */
-- (BOOL)showFullNames;
-- (BOOL)showAMPMDates;
-- (unsigned)dayStartHour;
-- (unsigned)dayEndHour;
-- (BOOL)shouldDisplayWeekend;
-- (BOOL)shouldDisplayRejectedAppointments;
-
-- (NSCalendarDate *)referenceDateForFormatter;
+- (BOOL) showFullNames;
+- (BOOL) showAMPMDates;
+- (unsigned) dayStartHour;
+- (unsigned) dayEndHour;
+- (BOOL) shouldDisplayWeekend;
+- (BOOL) shouldDisplayRejectedAppointments;
+
+- (NSCalendarDate *) referenceDateForFormatter;
  
-- (NSCalendarDate *)thisMonth;
-- (NSCalendarDate *)nextMonth;
+- (NSCalendarDate *) thisMonth;
+- (NSCalendarDate *) nextMonth;
 
 /* fetching */
 
-- (NSCalendarDate *)startDate;
-- (NSCalendarDate *)endDate;
+- (NSCalendarDate *) startDate;
+- (NSCalendarDate *) endDate;
 - (NSArray *) fetchCoreAppointmentsInfos;
 - (NSArray *) fetchCoreTasksInfos;
 
 /* date selection */
 
-- (NSDictionary *)todayQueryParameters;
-- (NSDictionary *)currentDayQueryParameters;
-
-/* calendarUIDs */
-
-- (NSString *)formattedCalendarUIDs;
+- (NSDictionary *) todayQueryParameters;
+- (NSDictionary *) currentDayQueryParameters;
 
 /* CSS related */
 
-- (NSString *)aptStyle;
+- (NSString *) aptStyle;
 
 /* protected methods */
 - (NSDictionary *) _dateQueryParametersWithOffset: (int) daysOffset;
index 11047344f9fe191bbbdc26faefb81aa0bf09b2e9..726fca518f2dc0222f04ee809754c75ac3eebdb0 100644 (file)
@@ -56,7 +56,6 @@ static BOOL shouldDisplayWeekend = NO;
         = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz];
       [self configureFormatters];
       componentsData = [NSMutableDictionary new];
-      calendarFolders = nil;
     }
 
   return self;
@@ -64,15 +63,14 @@ static BOOL shouldDisplayWeekend = NO;
 
 - (void) dealloc
 {
-  [calendarFolders release];
   [componentsData release];
-  [appointments               release];
-  [allDayApts                 release];
-  [appointment                release];
-  [currentDay                 release];
-  [aptFormatter               release];
-  [aptTooltipFormatter        release];
-  [privateAptFormatter        release];
+  [appointments release];
+  [allDayApts release];
+  [appointment release];
+  [currentDay release];
+  [aptFormatter release];
+  [aptTooltipFormatter release];
+  [privateAptFormatter release];
   [privateAptTooltipFormatter release];
   [super dealloc];
 }
@@ -449,62 +447,6 @@ static BOOL shouldDisplayWeekend = NO;
   return [[self startDate] tomorrow];
 }
 
-#warning We only support ONE calendar per user at this time
-- (BOOL) _appendSubscribedFolders: (NSDictionary *) subscribedFolders
-{
-  NSEnumerator *keys;
-  NSString *currentKey;
-  NSMutableDictionary *currentCalendar;
-  BOOL firstShouldBeActive;
-  unsigned int count;
-
-  firstShouldBeActive = YES;
-
-  keys = [[subscribedFolders allKeys] objectEnumerator];
-  currentKey = [keys nextObject];
-  count = 1;
-  while (currentKey)
-    {
-      currentCalendar = [NSMutableDictionary new];
-      [currentCalendar autorelease];
-      [currentCalendar
-       setDictionary: [subscribedFolders objectForKey: currentKey]];
-      [currentCalendar setObject: currentKey forKey: @"folder"];
-      [calendarFolders addObject: currentCalendar];
-      if ([[currentCalendar objectForKey: @"active"] boolValue])
-       firstShouldBeActive = NO;
-      count++;
-      currentKey = [keys nextObject];
-    }
-
-  return firstShouldBeActive;
-}
-
-- (void) _setupCalendarFolders
-{
-  NSMutableDictionary *userCalendar, *calendarDict;
-  SOGoUser *activeUser;
-  BOOL firstActive;
-
-  calendarFolders = [NSMutableArray new];
-  activeUser = [context activeUser];
-
-  userCalendar = [NSMutableDictionary new];
-  [userCalendar autorelease];
-  [userCalendar setObject: @"/" forKey: @"folder"];
-  [userCalendar setObject: [self labelForKey: @"Calendar"]
-                  forKey: @"displayName"];
-  [calendarFolders addObject: userCalendar];
-
-  calendarDict = [[activeUser userSettings] objectForKey: @"Calendar"];
-  firstActive = [[calendarDict objectForKey: @"activateUserFolder"] boolValue];
-  firstActive = ([self _appendSubscribedFolders:
-                        [calendarDict objectForKey: @"SubscribedFolders"]]
-                || firstActive);
-  [userCalendar setObject: [NSNumber numberWithBool: firstActive]
-               forKey: @"active"];
-}
-
 - (SOGoAppointmentFolder *) _aptFolder: (NSString *) folder
                      withClientObject: (SOGoAppointmentFolder *) clientObject
 {
@@ -524,14 +466,6 @@ static BOOL shouldDisplayWeekend = NO;
   return aptFolder;
 }
 
-- (NSArray *) calendarFolders
-{
-  if (!calendarFolders)
-    [self _setupCalendarFolders];
-
-  return calendarFolders;
-}
-
 - (NSArray *) _activeCalendarFolders
 {
   NSMutableArray *activeFolders;
@@ -542,12 +476,10 @@ static BOOL shouldDisplayWeekend = NO;
   activeFolders = [NSMutableArray new];
   [activeFolders autorelease];
 
-  if (!calendarFolders)
-    [self _setupCalendarFolders];
-
   clientObject = [self clientObject];
 
-  folders = [calendarFolders objectEnumerator];
+  folders = [[clientObject calendarFoldersInContext: context]
+             objectEnumerator];
   currentFolderDict = [folders nextObject];
   while (currentFolderDict)
     {
@@ -662,14 +594,6 @@ static BOOL shouldDisplayWeekend = NO;
   return [self queryParametersBySettingSelectedDate: currentDay];
 }
 
-/* calendarUIDs */
-
-- (NSString *) formattedCalendarUIDs
-{
-  return [[[self clientObject] calendarUIDs]
-           componentsJoinedByString: @", "];
-}
-
 /* Actions */
 
 - (NSString *) _userFolderURI
index 3d15fc774aa29a6d11a8780fa882038581489618..410ce6dbb12a0a88512af8bcfbd68230f4ca4304 100644 (file)
@@ -32,7 +32,6 @@
 
 @interface UIxCalendarSelector : UIxComponent
 {
-  NSMutableArray *calendarFolders;
   NSMutableDictionary *colors;
 
   NSDictionary *currentCalendarFolder;
@@ -40,6 +39,7 @@
 }
 
 - (NSArray *) calendarFolders;
+
 - (void) setCurrentCalendarFolder: (NSDictionary *) newCurrentCalendarFolder;
 - (NSDictionary *) currentCalendarFolder;
 
index ab6b124a14a6f49ea607ba206ab354869f2b7944..d28e94847ccb1666c25686ab5a8d1dff45a7be89 100644 (file)
@@ -31,6 +31,7 @@
 #import <SOGo/AgenorUserManager.h>
 #import <SOGo/SOGoUser.h>
 #import <SOGoUI/UIxComponent.h>
+#import <Appointments/SOGoAppointmentFolder.h>
 
 #import "UIxCalendarSelector.h"
 
@@ -90,8 +91,7 @@ colorForNumber (unsigned int number)
 {
   if ((self = [super init]))
     {
-      colors = [NSMutableDictionary new];
-      calendarFolders = nil;
+      colors = nil;
       currentCalendarFolder = nil;
     }
 
@@ -100,34 +100,35 @@ colorForNumber (unsigned int number)
 
 - (void) dealloc
 {
-  [calendarFolders release];
   [currentCalendarFolder release];
   [colors release];
   [super dealloc];
 }
 
-- (void) setCalendarFolders: (NSArray *) newCalendarFolders
+- (NSArray *) calendarFolders
 {
+  NSArray *calendarFolders;
   NSEnumerator *newFolders;
   NSDictionary *currentFolder;
   unsigned int count;
 
-  ASSIGN (calendarFolders, newCalendarFolders);
-
-  newFolders = [calendarFolders objectEnumerator];
-  currentFolder = [newFolders nextObject];
-  count = 0;
-  while (currentFolder)
+  calendarFolders
+    = [[self clientObject] calendarFoldersInContext: context];
+  if (!colors)
     {
-      [colors setObject: colorForNumber (count)
-             forKey: [currentFolder objectForKey: @"folder"]];
-      count++;
+      colors = [NSMutableDictionary new];
+      count = 0;
+      newFolders = [calendarFolders objectEnumerator];
       currentFolder = [newFolders nextObject];
+      while (currentFolder)
+       {
+         [colors setObject: colorForNumber (count)
+                 forKey: [currentFolder objectForKey: @"folder"]];
+         count++;
+         currentFolder = [newFolders nextObject];
+       }
     }
-}
 
-- (NSArray *) calendarFolders
-{
   return calendarFolders;
 }
 
index f67981871ef6c1e126d98d51376a6269232d25f9..e7c53351d5725187276fe528c96a2236ae1cdb6a 100644 (file)
@@ -41,6 +41,7 @@
   id item;
 
   NSString *saveURL;
+  NSMutableArray *calendarList;
   
   /* individual values */
   NSCalendarDate *cycleUntilDate;
 - (void) setIsCycleEndUntil;
 - (void) setIsCycleEndNever;
 
-- (NSString *) componentOwner;
-- (NSArray *) availableCalendars;
-
 /* access */
 - (BOOL) isMyComponent;
 - (BOOL) canEditComponent;
index 1b8c8d7d63c4355be0c6edaf9818c871cbd5a8f2..11258889a97d75742f2fbdf8b312642b88ea1ed3 100644 (file)
@@ -42,6 +42,7 @@
 #import <SOGo/AgenorUserManager.h>
 #import <SOGo/SOGoUser.h>
 #import <SOGoUI/SOGoDateFormatter.h>
+#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
 #import <SoObjects/Appointments/SOGoAppointmentObject.h>
 #import <SoObjects/Appointments/SOGoTaskObject.h>
 
@@ -62,6 +63,7 @@
       organizer = nil;
       attendeesNames = nil;
       attendeesEmails = nil;
+      calendarList = nil;
     }
 
   return self;
@@ -82,6 +84,7 @@
   [url release];
   [attendeesNames release];
   [attendeesEmails release];
+  [calendarList release];
 
   [super dealloc];
 }
 
 - (NSString *) itemCategoryText
 {
-  return [self labelForKey: [NSString stringWithFormat: @"category_%@", item]];
+  return [self labelForKey:
+                [NSString stringWithFormat: @"category_%@", item]];
+}
+
+- (NSArray *) calendarList
+{
+  SOGoAppointmentFolder *folder;
+  NSEnumerator *allCalendars;
+  NSDictionary *currentCalendar;
+
+  if (!calendarList)
+    {
+      calendarList = [NSMutableArray new];
+      folder = [[self clientObject] container];
+      allCalendars
+       = [[folder calendarFoldersInContext: context] objectEnumerator];
+      currentCalendar = [allCalendars nextObject];
+      while (currentCalendar)
+       {
+         if ([[currentCalendar objectForKey: @"active"] boolValue])
+           [calendarList addObject: currentCalendar];
+         currentCalendar = [allCalendars nextObject];
+       }
+    }
+
+  return calendarList;
+}
+
+- (NSString *) itemCalendarText
+{
+  return item;
+}
+
+- (NSString *) calendarsFoldersList
+{
+  NSArray *calendars;
+
+  calendars = [[self calendarList] valueForKey: @"folder"];
+
+  return [calendars componentsJoinedByString: @","];
+}
+
+- (NSString *) componentCalendar
+{
+  return @"/";
 }
 
 /* priorities */
 
 /* contact editor compatibility */
 
-- (NSArray *) availableCalendars
-{
-  NSEnumerator *rawContacts;
-  NSString *list, *currentId;
-  NSMutableArray *calendars;
-  SOGoUser *user;
-
-  calendars = [NSMutableArray array];
-
-  user = [context activeUser];
-  list = [[user userDefaults] stringForKey: @"calendaruids"];
-  if ([list length] == 0)
-    list = [self shortUserNameForDisplay];
-
-  rawContacts
-    = [[list componentsSeparatedByString: @","] objectEnumerator];
-  currentId = [rawContacts nextObject];
-  while (currentId)
-    {
-      if ([currentId hasPrefix: @"-"])
-        [calendars addObject: [currentId substringFromIndex: 1]];
-      else
-        [calendars addObject: currentId];
-      currentId = [rawContacts nextObject];
-    }
-
-  return calendars;
-}
-
-- (NSString *) componentOwner
-{
-  return componentOwner;
-}
-
 - (NSString *) urlButtonClasses
 {
   NSString *classes;
index e7094c4447be83ff70d2cedb421fdef1ea7d441a..adfdbeacaff38864e6e2c783b13182be5a9b08e8 100644 (file)
@@ -27,9 +27,9 @@
         ><var:if condition="hasHomeInfos"
         ><div id="homeInfos"
           ><h4><var:string label:value="Home" /></h4
-            ><var:string value="homePobox" escapeHTML="NO"
+            ><var:string value="homeStreetAddress" escapeHTML="NO"
             /><var:string value="homeExtendedAddress" escapeHTML="NO"
-            /><var:string value="homeStreetAddress" escapeHTML="NO"
+            /><var:string value="homePobox" escapeHTML="NO"
             /><var:string value="homeCityAndProv" escapeHTML="NO"
             /><var:string value="homePostalCodeAndCountry" escapeHTML="NO"
             /><var:string value="homeUrl" escapeHTML="NO"
index ed78ceba238f5e1dab5ee0971da7e677c1460613..2b007b12766554280de86150a97ca2259ea4964f 100644 (file)
@@ -15,7 +15,7 @@
           <!-- localize -->
           <td class="tbtv_headercell">
             <var:component className="UIxSortableTableHeader"
-              label:label="Lastname"
+              label:label="Name"
               const:sortKey="cn"
               const:href="view"
               var:queryDictionary="context.request.formValues"
           </td>
           <td class="tbtv_headercell">
             <var:component className="UIxSortableTableHeader"
-              label:label="EMail"
+              label:label="Email"
               const:sortKey="mail"
               const:href="view"
               var:queryDictionary="context.request.formValues"
               />
           </td>
           <td class="tbtv_headercell">
-            <var:string label:value="Phone" />
+            <var:string label:value="Screen Name" />
           </td>
           <td class="tbtv_headercell">
-            <var:string label:value="Location" />
+            <var:string label:value="Organization" />
+          </td>
+          <td class="tbtv_headercell">
+            <var:string label:value="Work Phone" />
           </td>
         </tr>
 
             onclick="return onContactRowClick(event, this);"
             ondblclick="return onContactRowDblClick(event, this);"
             oncontextmenu="return onContactContextMenu(event, this);">
-            <td onmousedown="return false;"><img rsrc:src="abcard.gif" /><var:string value="displayName" const:escapeHTML="YES" /></td>
-            <td onmousedown="return false;"><var:string value="currentContact.mail"            /></td>
-            <td onmousedown="return false;"><var:string value="currentContact.telephonenumber" /></td>
-            <td onmousedown="return false;"><var:string value="currentContact.l"               /></td>
+            <td onmousedown="return false;"><img rsrc:src="abcard.gif"
+               /><var:string value="displayName" const:escapeHTML="YES" /></td>
+            <td onmousedown="return false;"><var:string value="currentContact.mail"/></td>
+            <td onmousedown="return false;"><var:string value="currentContact.screenname"/></td>
+            <td onmousedown="return false;"><var:string value="currentContact.o"/></td>
+            <td onmousedown="return false;"><var:string value="currentContact.telephonenumber"/></td>
           </tr>
         </var:foreach>
       </tbody>
index caee6cdb7cec219ed5aa13c79205436d0a38fb45..f63a3d6a2d44165c365fb8fa5fdb9cde8da6602b 100644 (file)
@@ -377,7 +377,7 @@ function onFolderSelectionChange() {
 function onSearchFormSubmit() {
   var searchValue = $("searchValue");
 
-  openContactsFolder(URLForFolderID(currentContactFolder),
+  openContactsFolder(currentContactFolder,
                     "search=" + searchValue.value);
 
   return false;
index 856077e52d5080cb7993505b6e3c27871c86c603..2c069d7e190848613a237c137530728b206168c2 100644 (file)
@@ -956,16 +956,6 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail)
   return false;
 }
 
-function onChangeCalendar(list) {
-   var form = document.forms.editform;
-   log ("before: " + form.getAttribute("action"));
-   var urlElems = form.getAttribute("action").split("/");
-   urlElems[urlElems.length-4]
-      = list.childNodesWithTag("option")[list.value].innerHTML;
-   form.setAttribute("action", urlElems.join("/"));
-   log ("after: " + form.getAttribute("action"));
-}
-
 function validateBrowseURL(input) {
   var button = $("browseURLBtn");
 
index 5e12f260e9e7ab2f9b9497f52b9b65d2f656a195..383f1ef6ee9014c06ef21c1615d02fb4e5b8b16e 100644 (file)
@@ -89,6 +89,9 @@ TEXTAREA
   right: 1em;
   padding-bottom: 0em; }
 
+SELECT#calendarList
+{ width: 7em; }
+
 A#changeUrlButton
 { margin-left: 1em; }
 
index e80c430ecf0aa92e6fd4c4b58f02200aeab4ef6e..579f492c5c7b11bbc801477da39599d29b3a419e 100644 (file)
@@ -61,6 +61,9 @@ TEXTAREA
   right: 1em;
   padding-bottom: 0em; }
 
+SELECT#calendarList
+{ width: 7em; }
+
 A#changeUrlButton
 { margin-left: 1em; }