diff --git a/ChangeLog b/ChangeLog index dbdffd6a8..fcf609223 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2011-07-12 Francis Lachapelle + + * SoObjects/SOGo/SOGoFolder.m (-compare:): handle the case when + the display name is not defined. + + * UI/Scheduler/UIxCalListingActions.m + (-_fetchFields:forComponentOfType:): test the calendar name and + set it to an empty string if it's not defined. + + * UI/Scheduler/UIxCalendarSelector.m (-calendars): idem. + + * UI/WebServerResources/UIxCalendarProperties.js (onOKClick): + refuses to save the properties if the calendar name is empty. + + * UI/WebServerResources/SchedulerUI.js (updateCalendarProperties): + Create a new text node in case the calendar has no name. + 2011-07-12 Wolfgang Sourdeau * OpenChange/MAPIStoreTable.m diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index c785debc9..8a9e6fb3c 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,8 @@ +2011-07-12 Francis Lachapelle + + * iCalCalendar.m (-addTimeZone:): now returns true if the timezone + was already defined in the calendar. + 2011-07-11 Francis Lachapelle * iCalDailyRecurrenceCalculator.m diff --git a/SOPE/NGCards/iCalCalendar.h b/SOPE/NGCards/iCalCalendar.h index 12e9a33b1..12778b57e 100644 --- a/SOPE/NGCards/iCalCalendar.h +++ b/SOPE/NGCards/iCalCalendar.h @@ -74,7 +74,7 @@ - (NSArray *) freeBusys; - (NSArray *) timezones; -- (void) addTimeZone: (iCalTimeZone *) iTZ; +- (BOOL) addTimeZone: (iCalTimeZone *) iTZ; - (iCalTimeZone *) timeZoneWithId: (NSString *) tzId; /* collection */ diff --git a/SOPE/NGCards/iCalCalendar.m b/SOPE/NGCards/iCalCalendar.m index 079d8f298..da567a1d5 100644 --- a/SOPE/NGCards/iCalCalendar.m +++ b/SOPE/NGCards/iCalCalendar.m @@ -160,13 +160,15 @@ return [self childrenWithTag: @"vfreebusy"]; } -- (void) addTimeZone: (iCalTimeZone *) iTZ +- (BOOL) addTimeZone: (iCalTimeZone *) iTZ { iCalTimeZone *possibleTz; possibleTz = [self timeZoneWithId: [iTZ tzId]]; if (!possibleTz) [self addChild: iTZ]; + + return (!possibleTz); } - (iCalTimeZone *) timeZoneWithId: (NSString *) tzId diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 9079816b8..62b01002f 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -232,9 +232,14 @@ { comparison = [self _compareByNameInContainer: otherFolder]; if (comparison == NSOrderedSame) - comparison - = [[self displayName] - localizedCaseInsensitiveCompare: [otherFolder displayName]]; + if ([self displayName] == nil) + comparison = NSOrderedAscending; + else if ([otherFolder displayName] == nil) + comparison = NSOrderedDescending; + else + comparison + = [[self displayName] + localizedCaseInsensitiveCompare: [otherFolder displayName]]; } return comparison; diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 2e32bf7a6..f75a38cf8 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -312,7 +312,7 @@ static NSArray *tasksFields = nil; NSNull *marker; SOGoAppointmentFolders *clientObject; SOGoUser *ownerUser; - NSString *owner, *role; + NSString *owner, *role, *calendarName; BOOL isErasable, folderIsRemote; infos = [NSMutableArray array]; @@ -381,7 +381,10 @@ static NSArray *tasksFields = nil; forKey: @"c_folder"]; [newInfo setObject: [currentFolder ownerInContext: context] forKey: @"c_owner"]; - [newInfo setObject: [currentFolder displayName] + calendarName = [currentFolder displayName]; + if (calendarName == nil) + calendarName = @""; + [newInfo setObject: calendarName forKey: @"calendarName"]; if (![[newInfo objectForKey: @"c_title"] length]) [self _fixComponentTitle: newInfo withType: component]; diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index 0bd0418c3..7da4392b3 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -1,6 +1,6 @@ /* UIxCalendarSelector.m - this file is part of SOGo * - * Copyright (C) 2007, 2008 Inverse inc. + * Copyright (C) 2007-2011 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -107,6 +107,8 @@ _intValueFromHex (NSString *hexString) calendar = [NSMutableDictionary dictionary]; folderName = [folder nameInContainer]; fDisplayName = [folder displayName]; + if (fDisplayName == nil) + fDisplayName = @""; if ([fDisplayName isEqualToString: [co defaultFolderName]]) fDisplayName = [self labelForKey: fDisplayName]; [calendar setObject: [NSString stringWithFormat: @"/%@", folderName] diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index e2114a42f..668b5e456 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -2542,7 +2542,11 @@ function updateCalendarProperties(calendarID, calendarName, calendarColor) { // log("nodeID: " + nodeID); var calendarNode = $(nodeID); var childNodes = calendarNode.childNodes; - childNodes[childNodes.length-1].nodeValue = calendarName; + var textNode = childNodes[childNodes.length-1]; + if (textNode.tagName == 'DIV') + calendarNode.appendChild(document.createTextNode(calendarName)); + else + childNodes[childNodes.length-1].nodeValue = calendarName; appendStyleElement(nodeID, calendarColor); } diff --git a/UI/WebServerResources/UIxCalendarProperties.js b/UI/WebServerResources/UIxCalendarProperties.js index 19015ef5c..742cb856e 100644 --- a/UI/WebServerResources/UIxCalendarProperties.js +++ b/UI/WebServerResources/UIxCalendarProperties.js @@ -30,10 +30,17 @@ function onOKClick(event) { var originalTag = $("originalCalendarSyncTag"); var allTags = $("allCalendarSyncTags"); - if (allTags) + if (calendarName.value.blank()) { + alert(_("Please specify a calendar name.")); + save = false; + } + + if (save + && allTags) allTags = allTags.value.split(","); - if (tag + if (save + && tag && $("synchronizeCalendar").checked) { if (tag.value.blank()) { alert(_("tagNotDefined")); @@ -52,7 +59,8 @@ function onOKClick(event) { else save = confirm(_("tagWasAdded")); } - else if (originalTag + else if (save + && originalTag && !originalTag.value.blank()) save = confirm(_("tagWasRemoved"));