From c6c01229291a89caf24a6a11b25bcdefee5f6246 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 19 Nov 2007 22:52:24 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1267 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 37 +++ .../Appointments/SOGoAppointmentObject.m | 8 +- .../SOGoMailEnglishForward.html | 2 + .../SOGoMailEnglishForward.wod | 5 + .../SOGoMailEnglishReply.html | 2 + .../SOGoMailEnglishReply.wod | 5 + SoObjects/Mailer/SOGoMailForward.m | 13 + .../SOGoMailFrenchForward.html | 2 + .../SOGoMailFrenchForward.wod | 5 + .../SOGoMailFrenchReply.html | 2 + .../SOGoMailFrenchReply.wod | 5 + .../SOGoMailGermanForward.html | 2 + .../SOGoMailGermanForward.wod | 5 + .../SOGoMailGermanReply.html | 2 + .../SOGoMailGermanReply.wod | 5 + SoObjects/Mailer/SOGoMailReply.m | 13 + SoObjects/SOGo/SOGoUser.h | 4 + SoObjects/SOGo/SOGoUser.m | 10 + UI/Common/UIxPageFrame.h | 2 + UI/Common/UIxPageFrame.m | 5 + UI/Common/product.plist | 2 +- UI/MailPartViewers/UIxMailPartHTMLViewer.m | 5 +- UI/MailerUI/UIxMailAccountActions.m | 27 +- UI/MainUI/product.plist | 2 +- UI/PreferencesUI/UIxPreferences.m | 25 +- UI/Scheduler/UIxAppointmentEditor.m | 6 + UI/Scheduler/UIxComponentEditor.h | 11 +- UI/Scheduler/UIxComponentEditor.m | 101 +++++-- UI/Scheduler/UIxTaskEditor.m | 16 +- UI/Templates/MailerUI/UIxMailToSelection.wox | 3 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 13 +- .../SchedulerUI/UIxComponentEditor.wox | 9 +- UI/Templates/UIxPageFrame.wox | 8 +- UI/WebServerResources/ContactsUI.js | 24 +- UI/WebServerResources/HTMLElement.js | 3 + UI/WebServerResources/SchedulerUI.js | 152 ++++++----- UI/WebServerResources/UIxAclEditor.js | 11 +- UI/WebServerResources/UIxAppointmentEditor.js | 5 - UI/WebServerResources/UIxComponentEditor.css | 3 + UI/WebServerResources/UIxComponentEditor.js | 252 +++++++++--------- UI/WebServerResources/UIxMailEditor.css | 3 + UI/WebServerResources/UIxPreferences.css | 8 + UI/WebServerResources/generic.js | 1 + 43 files changed, 581 insertions(+), 243 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8167605..fc894963 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,42 @@ 2007-11-19 Wolfgang Sourdeau + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences -signature]): + returns the signature for the default identity of the default + accouunt... + ([UIxPreferences -setSignature:newSignature]): accessor that sets + the default signature. + + * UI/MailerUI/UIxMailAccountActions.m ([UIxMailAccountActions + -composeAction]): append the message signature to the new draft. + + * SoObjects/Mailer/SOGoMailReply.m ([SOGoMailReply -signature]): + same as above. + + * SoObjects/Mailer/SOGoMailForward.m ([SOGoMailForward + -signature]): new method that takes the user's signature and put + it at the end of the message, if exists. + + * UI/Common/UIxPageFrame.m ([UIxPageFrame -isSuperUser]): new + accessor that forwards the call to the active user. + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser -signature]): returns the + user default signature. + ([SOGoUser -isSuperUser]): declares whether the user is listed + among the super users. + + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -setComponent:newComponent]): retain the component object. + ([UIxComponentEditor -organizerIdentity]): new accessor method to + handle list of possible organizers. + + * UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor + -event]): retain the returned event object. + + * SoObjects/Appointments/SOGoAppointmentObject.m + ([SOGoAppointmentObject -saveComponent:newEvent]): reset the + organizer only if there are no attendees AND the owner of the + component is not the organizer him-/herself. + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -toolbar]): rewrote in a way that ensures that each case is handled properly. diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 58de668a..dac2f254 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -230,9 +230,11 @@ { iCalEvent *oldEvent; NSArray *attendees; + SOGoUser *currentUser; [[newEvent parent] setMethod: @""]; - if ([newEvent userIsOrganizer: [context activeUser]]) + currentUser = [context activeUser]; + if ([newEvent userIsOrganizer: currentUser]) { oldEvent = [self component: NO secure: NO]; if (oldEvent) @@ -249,7 +251,9 @@ toAttendees: attendees]; } - if (![[newEvent attendees] count]) + if (![[newEvent attendees] count] + && [[self ownerInContext: context] + isEqualToString: [currentUser login]]) [[newEvent uniqueChildWithTag: @"organizer"] setValue: 0 to: @""]; } diff --git a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html index c1b652eb..3f50a3f6 100644 --- a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html +++ b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.html @@ -6,3 +6,5 @@ From: <#from/> <#hasCc>CC: <#cc/><#hasNewsGroups>Newsgroups: <#newsgroups/><#hasReferences>References: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod index 517bc8cc..df237286 100644 --- a/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod +++ b/SoObjects/Mailer/SOGoMailEnglishForward.wo/SOGoMailEnglishForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html index e0274ea0..0ccbf454 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html @@ -1,3 +1,5 @@ On <#date/>, <#from/> wrote: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod index 830cd7a7..7a66a17b 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailForward.m b/SoObjects/Mailer/SOGoMailForward.m index ce3545dd..e666f9b8 100644 --- a/SoObjects/Mailer/SOGoMailForward.m +++ b/SoObjects/Mailer/SOGoMailForward.m @@ -149,6 +149,19 @@ return [sourceMail contentForEditing]; } +- (NSString *) signature +{ + NSString *signature, *mailSignature; + + signature = [[context activeUser] signature]; + if ([signature length]) + mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature]; + else + mailSignature = @""; + + return mailSignature; +} + @end @implementation SOGoMailEnglishForward diff --git a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html index 3ae60f74..6ebbd459 100644 --- a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html +++ b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.html @@ -6,3 +6,5 @@ De: <#from/> <#hasCc>Copie: <#cc/><#hasNewsGroups>Forums de discussion: <#newsgroups/><#hasReferences>Références: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod index 517bc8cc..df237286 100644 --- a/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod +++ b/SoObjects/Mailer/SOGoMailFrenchForward.wo/SOGoMailFrenchForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html index 406f945d..d7f22510 100644 --- a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html @@ -1,3 +1,5 @@ Le <#date/>, <#from/> a écrit: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod index 830cd7a7..7a66a17b 100644 --- a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html index 26fa0803..1260988e 100644 --- a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html +++ b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.html @@ -6,3 +6,5 @@ Sender: <#from/> <#hasCc>Kopie: <#cc/><#hasNewsGroups>Newsgroup: <#newsgroups/><#hasReferences>Referenzen: <#references/> <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod index 517bc8cc..df237286 100644 --- a/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod +++ b/SoObjects/Mailer/SOGoMailGermanForward.wo/SOGoMailGermanForward.wod @@ -67,3 +67,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html index e0274ea0..0ccbf454 100644 --- a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html @@ -1,3 +1,5 @@ On <#date/>, <#from/> wrote: <#messageBody/> + +<#signature/> diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod index 830cd7a7..7a66a17b 100644 --- a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod @@ -12,3 +12,8 @@ messageBody: WOString { value = messageBody; escapeHTML = NO; } + +signature: WOString { + value = signature; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailReply.m b/SoObjects/Mailer/SOGoMailReply.m index f1758ed6..9016b469 100644 --- a/SoObjects/Mailer/SOGoMailReply.m +++ b/SoObjects/Mailer/SOGoMailReply.m @@ -73,6 +73,19 @@ return [[sourceMail contentForEditing] stringByApplyingMailQuoting]; } +- (NSString *) signature +{ + NSString *signature, *mailSignature; + + signature = [[context activeUser] signature]; + if ([signature length]) + mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature]; + else + mailSignature = @""; + + return mailSignature; +} + @end @implementation SOGoMailEnglishReply diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index 64e1f8a0..d8f80102 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -120,6 +120,10 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (NSString *) messageForwarding; - (NSString *) messageCheck; +- (NSString *) signature; + +- (BOOL) isSuperUser; + /* folders */ - (SOGoUserFolder *) homeFolderInContext: (id) context; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index e81214d5..ee123359 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -501,6 +501,11 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [[defaultAccount objectForKey: @"identities"] objectAtIndex: 0]; } +- (NSString *) signature +{ + return [[self primaryIdentity] objectForKey: @"signature"]; +} + - (NSString *) messageForwarding { NSString *messageForwarding; @@ -612,4 +617,9 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; && [login isEqualToString: [otherUser login]]); } +- (BOOL) isSuperUser +{ + return [superUsernames containsObject: login]; +} + @end /* SOGoUser */ diff --git a/UI/Common/UIxPageFrame.h b/UI/Common/UIxPageFrame.h index d87126f2..aeb378d1 100644 --- a/UI/Common/UIxPageFrame.h +++ b/UI/Common/UIxPageFrame.h @@ -65,6 +65,8 @@ - (void) setToolbar: (NSString *) newToolbar; - (NSString *) toolbar; +- (BOOL) isSuperUser; + - (BOOL) isCompatibleBrowser; - (BOOL) isIE7Compatible; - (BOOL) isMac; diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 9aaa5df6..fda77e28 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -335,6 +335,11 @@ return toolbar; } +- (BOOL) isSuperUser +{ + return [[context activeUser] isSuperUser]; +} + /* browser/os identification */ - (BOOL) isCompatibleBrowser diff --git a/UI/Common/product.plist b/UI/Common/product.plist index 157e7ace..ea75a393 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -56,7 +56,7 @@ pageName = "UIxUserRightsEditor"; }; saveUserRights = { - protectedBy = "ReadAcls"; + protectedBy = "SaveAcls"; pageName = "UIxUserRightsEditor"; actionName = "saveUserRights"; }; diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m index fbe39301..6be09e6d 100644 --- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m +++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m @@ -487,8 +487,9 @@ css = [handler css]; if ([css length]) - cssContent = [NSString stringWithFormat: @"", - [handler css]]; + cssContent + = [NSString stringWithFormat: @"", + [handler css]]; else cssContent = @""; diff --git a/UI/MailerUI/UIxMailAccountActions.m b/UI/MailerUI/UIxMailAccountActions.m index f9d4d2b8..69fe254d 100644 --- a/UI/MailerUI/UIxMailAccountActions.m +++ b/UI/MailerUI/UIxMailAccountActions.m @@ -24,16 +24,18 @@ #import #import -#import +#import #import #import #import + #import #import #import #import #import #import +#import #import "../Common/WODirectAction+SOGo.h" @@ -143,21 +145,34 @@ { SOGoDraftsFolder *drafts; SOGoDraftObject *newDraftMessage; - NSString *urlBase, *url, *value; + NSString *urlBase, *url, *value, *signature; NSArray *mailTo; - + BOOL save; drafts = [[self clientObject] draftsFolderInContext: context]; newDraftMessage = [drafts newDraft]; + save = NO; + value = [[self request] formValueForKey: @"mailto"]; if ([value length] > 0) { mailTo = [NSArray arrayWithObject: value]; - [newDraftMessage setHeaders: [NSDictionary dictionaryWithObject: mailTo - forKey: @"to"]]; - [newDraftMessage storeInfo]; + [newDraftMessage + setHeaders: [NSDictionary dictionaryWithObject: mailTo + forKey: @"to"]]; + save = YES; + } + + signature = [[context activeUser] signature]; + if ([signature length]) + { + [newDraftMessage + setText: [NSString stringWithFormat: @"\r\n--\r\n%@", signature]]; + save = YES; } + if (save) + [newDraftMessage storeInfo]; urlBase = [newDraftMessage baseURLInContext: context]; url = [urlBase composeURLWithAction: @"edit" diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 664e4cf5..3eb0a70d 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -24,7 +24,7 @@ "Access Contents Information" = ( "Owner", "ObjectReader" ); "Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" ); "Add Folders" = ( "Owner", "FolderCreator" ); - "ReadAcls" = ( "Owner", "AuthorizedSubscriber" ); + "ReadAcls" = ( "Owner" ); "SaveAcls" = ( "Owner" ); "Delete Objects" = ( "Owner", "ObjectEraser" ); }; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 95867533..192d8267 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -28,6 +28,7 @@ #import #import +#import #import #import @@ -472,7 +473,12 @@ static BOOL shouldDisplayPasswordChange = NO; // string="itemIdentityText" selection="defaultIdentity"/> - (NSArray *) identitiesList { - return [user allIdentities]; + NSDictionary *primaryAccount; + +#warning we manage only one account per user at this time... + primaryAccount = [[user mailAccounts] objectAtIndex: 0]; + + return [primaryAccount objectForKey: @"identities"]; } - (NSString *) itemIdentityText @@ -480,9 +486,9 @@ static BOOL shouldDisplayPasswordChange = NO; return [item keysWithFormat: @"%{fullName} <%{email}>"]; } -- (NSDictionary *) defaultIdentity +- (NSMutableDictionary *) defaultIdentity { - NSDictionary *currentIdentity, *defaultIdentity; + NSMutableDictionary *currentIdentity, *defaultIdentity; NSEnumerator *identities; defaultIdentity = nil; @@ -496,6 +502,19 @@ static BOOL shouldDisplayPasswordChange = NO; return defaultIdentity; } +- (NSString *) signature +{ + return [[self defaultIdentity] objectForKey: @"signature"]; +} + +- (void) setSignature: (NSString *) newSignature +{ + [[self defaultIdentity] setObject: newSignature + forKey: @"signature"]; + [userDefaults setObject: [user mailAccounts] + forKey: @"MailAccounts"]; +} + - (id ) defaultAction { id results; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index be23c936..23d89990 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -69,6 +69,12 @@ /* template values */ - (iCalEvent *) event { + if (!event) + { + event = (iCalEvent *) [[self clientObject] component: NO secure: NO]; + [event retain]; + } + return event; } diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index e9e478c6..12ff2c7b 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -41,6 +41,8 @@ NSString *saveURL; NSMutableArray *calendarList; + NSMutableArray *organizerList; + NSDictionary *organizerIdentity; /* individual values */ NSCalendarDate *cycleUntilDate; @@ -69,6 +71,9 @@ - (void) setSaveURL: (NSString *) newSaveURL; - (NSString *) saveURL; +- (void) setItem: (id) _item; +- (id) item; + - (NSArray *) categoryList; - (void) setCategories: (NSArray *) _categories; - (NSArray *) categories; @@ -89,16 +94,14 @@ - (NSString *) status; - (NSString *) itemStatusText; -- (void) setItem: (id) _item; -- (id) item; -- (NSString *) itemPriorityText; - - (void) setTitle: (NSString *) _value; - (NSString *) title; - (void) setLocation: (NSString *) _value; - (NSString *) location; +- (NSString *) location; + - (void) setComment: (NSString *) _value; - (NSString *) comment; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 3916100f..28afec22 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -49,6 +49,7 @@ #import #import #import +#import #import #import #import @@ -68,6 +69,7 @@ [self setIsCycleEndNever]; componentOwner = @""; organizer = nil; + organizerIdentity = nil; attendeesNames = nil; attendeesUIDs = nil; attendeesEmails = nil; @@ -84,6 +86,7 @@ [title release]; [location release]; [organizer release]; + [organizerIdentity release]; [comment release]; [priority release]; [categories release]; @@ -95,6 +98,8 @@ [attendeesEmails release]; [calendarList release]; + [component release]; + [super dealloc]; } @@ -160,7 +165,7 @@ if (!component) { - component = newComponent; + ASSIGN (component, newComponent); co = [self clientObject]; componentOwner = [co ownerInContext: nil]; @@ -248,14 +253,73 @@ return url; } +- (NSString *) organizerName +{ + return [organizer mailAddress]; +} + +- (BOOL) canBeOrganizer +{ + NSString *owner; + SOGoCalendarComponent *co; + SOGoUser *currentUser; + BOOL hasOrganizer; + + co = [self clientObject]; + owner = [co ownerInContext: context]; + currentUser = [context activeUser]; + + hasOrganizer = ([[organizer value: 0] length] > 0); + + return ([co isNew] + || ([owner isEqualToString: [currentUser login]] + && (!hasOrganizer || [component userIsOrganizer: currentUser]))); +} + - (BOOL) hasOrganizer { - return (![organizer isVoid]); + return ([[organizer value: 0] length] && ![self canBeOrganizer]); } -- (NSString *) organizerName +- (void) setOrganizerIdentity: (NSDictionary *) newOrganizerIdentity { - return [organizer mailAddress]; + ASSIGN (organizerIdentity, newOrganizerIdentity); +} + +- (NSDictionary *) organizerIdentity +{ + NSArray *allIdentities; + NSEnumerator *identities; + NSDictionary *currentIdentity; + NSString *orgEmail; + + orgEmail = [organizer rfc822Email]; + if (!organizerIdentity) + { + if ([orgEmail length]) + { + allIdentities = [[context activeUser] allIdentities]; + identities = [allIdentities objectEnumerator]; + while (!organizerIdentity + && ((currentIdentity = [identities nextObject]))) + if ([[currentIdentity objectForKey: @"email"] + caseInsensitiveCompare: orgEmail] + == NSOrderedSame) + ASSIGN (organizerIdentity, currentIdentity); + } + } + + return organizerIdentity; +} + +- (NSArray *) organizerList +{ + return [[context activeUser] allIdentities]; +} + +- (NSString *) itemOrganizerText +{ + return [item keysWithFormat: @"%{fullName} <%{email}>"]; } - (void) setAttendeesNames: (NSString *) newAttendeesNames @@ -852,19 +916,19 @@ - (void) _handleOrganizer { NSString *organizerEmail; - SOGoUser *activeUser; - NSDictionary *primaryIdentity; + NSString *owner, *login; organizerEmail = [[component organizer] email]; if ([organizerEmail length] == 0) { - if ([[component attendees] count] > 0) + owner = [[self clientObject] ownerInContext: context]; + login = [[context activeUser] login]; + if (![owner isEqualToString: login] + || [[component attendees] count] > 0) { ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); - activeUser = [context activeUser]; - primaryIdentity = [activeUser primaryIdentity]; - [organizer setCn: [activeUser cn]]; - [organizer setEmail: [primaryIdentity objectForKey: @"email"]]; + [organizer setCn: [organizerIdentity objectForKey: @"fullName"]]; + [organizer setEmail: [organizerIdentity objectForKey: @"email"]]; [component setOrganizer: organizer]; } } @@ -908,6 +972,7 @@ #warning the following methods probably share some code... - (NSString *) _toolbarForOwner: (SOGoUser *) ownerUser + andClientObject: (SOGoCalendarComponent *) clientObject { NSString *toolbarFilename; iCalPersonPartStat participationStatus; @@ -928,7 +993,7 @@ } else { - if ([component isKindOfClass: [iCalEvent class]]) + if ([clientObject isKindOfClass: [SOGoAppointmentObject class]]) toolbarFilename = @"SOGoAppointmentObject.toolbar"; else toolbarFilename = @"SOGoTaskObject.toolbar"; @@ -938,15 +1003,13 @@ } - (NSString *) _toolbarForDelegate: (SOGoUser *) ownerUser + andClientObject: (SOGoCalendarComponent *) clientObject { - SOGoCalendarComponent *clientObject; SoSecurityManager *sm; NSString *toolbarFilename, *adminToolbar; iCalPersonPartStat participationStatus; - clientObject = [self clientObject]; - - if ([component isKindOfClass: [iCalEvent class]]) + if ([clientObject isKindOfClass: [SOGoAppointmentObject class]]) adminToolbar = @"SOGoAppointmentObject.toolbar"; else adminToolbar = @"SOGoTaskObject.toolbar"; @@ -1001,9 +1064,11 @@ roles: nil]; if ([ownerUser isEqual: [context activeUser]]) - toolbarFilename = [self _toolbarForOwner: ownerUser]; + toolbarFilename = [self _toolbarForOwner: ownerUser + andClientObject: clientObject]; else - toolbarFilename = [self _toolbarForDelegate: ownerUser]; + toolbarFilename = [self _toolbarForDelegate: ownerUser + andClientObject: clientObject]; return toolbarFilename; diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m index 96d52081..8ea3b9ed 100644 --- a/UI/Scheduler/UIxTaskEditor.m +++ b/UI/Scheduler/UIxTaskEditor.m @@ -64,12 +64,19 @@ [statusDate release]; [status release]; [statusPercent release]; + [todo release]; [super dealloc]; } /* template values */ - (iCalToDo *) todo { + if (!todo) + { + todo = (iCalToDo *) [[self clientObject] component: NO secure: NO]; + [todo retain]; + } + return todo; } @@ -432,10 +439,11 @@ - (id) changeStatusAction { SOGoTaskObject *clientObject; - NSString *newStatus, *iCalString; + NSString *newStatus; clientObject = [self clientObject]; todo = (iCalToDo *) [clientObject component: NO secure: NO]; + [todo retain]; if (todo) { newStatus = [self queryParameterForKey: @"status"]; @@ -447,12 +455,10 @@ [todo setPercentComplete: @"0"]; [todo setStatus: @"IN-PROCESS"]; } - - iCalString = [[clientObject calendar: NO secure: NO] versitString]; - [clientObject saveContentString: iCalString]; + [clientObject saveComponent: todo]; } - return self; + return [self responseWith204]; } @end diff --git a/UI/Templates/MailerUI/UIxMailToSelection.wox b/UI/Templates/MailerUI/UIxMailToSelection.wox index c33c588a..fb5e6689 100644 --- a/UI/Templates/MailerUI/UIxMailToSelection.wox +++ b/UI/Templates/MailerUI/UIxMailToSelection.wox @@ -37,9 +37,8 @@ - +
  • - +
  • @@ -97,10 +97,13 @@ -->
    - + +
    +