diff --git a/NEWS b/NEWS index 9839af190..2962afb08 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Enhancements SOGoMaximumMessageSubmissionCount, SOGoMaximumRecipientCount, SOGoMaximumSubmissionInterval and SOGoMessageSubmissionBlockInterval defaults - now possible to send or not event notifications on a per-event basis + - now possible to see who created an event/task in a delegated calendar Bug fixes - Fixed decoding of the charset parameter when using single quotes (#2306) diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.h b/SoObjects/Appointments/iCalEntityObject+SOGo.h index 6d1545dcc..8963a1d69 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.h +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.h @@ -1,8 +1,6 @@ /* iCalEntityObject+SOGo.h - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-2013 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +46,8 @@ extern NSNumber *iCalDistantFutureNumber; - (NSMutableDictionary *) quickRecord; - (int) priorityNumber; +- (NSString *) createdBy; + - (NSNumber *) quickRecordDateAsNumber: (NSCalendarDate *) _date withOffset: (int) offset forAllDay: (BOOL) allDay; diff --git a/SoObjects/Appointments/iCalEntityObject+SOGo.m b/SoObjects/Appointments/iCalEntityObject+SOGo.m index 831ac3d3a..70aeffaf0 100644 --- a/SoObjects/Appointments/iCalEntityObject+SOGo.m +++ b/SoObjects/Appointments/iCalEntityObject+SOGo.m @@ -242,4 +242,19 @@ NSNumber *iCalDistantFutureNumber = nil; return priorityNumber; } +- (NSString *) createdBy +{ + NSString *created_by; + + created_by = [[self firstChildWithTag: @"X-SOGo-Component-Created-By"] flattenedValuesForKey: @""]; + + // We consider "SENT-BY" in case our custom header isn't found + if (![created_by length]) + { + created_by = [[self organizer] sentBy]; + } + + return created_by; +} + @end diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index 2ed1b1cf8..e1737cd2f 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2011 Inverse inc. + Copyright (C) 2006-2013 Inverse inc. Copyright (C) 2005 SKYRIX Software AG This file is part of SOGo. diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index aa320b168..03cf78e62 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -1,6 +1,6 @@ /* SOGoUserManager.m - this file is part of SOGo * - * Copyright (C) 2007-2011 Inverse inc. + * Copyright (C) 2007-2013 Inverse inc. * * Author: Wolfgang Sourdeau * Francis Lachapelle diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 119c6b90e..6378e645e 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -179,6 +179,8 @@ "Reminder:" = "Reminder:"; "General:" = "General:"; "Reply:" = "Reply:"; +"Created by:" = "Created by:"; + "Target:" = "Target:"; diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 377ee460a..3c4b92b76 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -48,6 +48,7 @@ #import #import #import +#import #import #import #import @@ -467,6 +468,8 @@ NSTimeZone *timeZone; SOGoUserDefaults *ud; SOGoCalendarComponent *co; + NSString *created_by; + BOOL resetAlarm; unsigned int snoozeAlarm; @@ -512,6 +515,8 @@ } } + created_by = [event createdBy]; + data = [NSDictionary dictionaryWithObjectsAndKeys: [componentCalendar displayName], @"calendar", [event tag], @"component", @@ -523,6 +528,7 @@ ([event isAllDay] ? @"1": @"0"), @"isAllDay", [event summary], @"summary", [event location], @"location", + created_by, @"created_by", [event comment], @"description", nil]; diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 4e292b8ea..ed7b38d5a 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -143,6 +143,10 @@ - (NSString *) attach; - (BOOL) hasAttendees; +- (BOOL) hasCreatedBy; +- (NSString *) createdBy; +- (NSString *) createdByLink; +- (NSString *) createdByName; - (NSString *) jsonAttendees; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 07728523c..398c2cd15 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -834,6 +834,41 @@ iRANGE(2); return organizerProfile; } + +- (BOOL) hasCreatedBy +{ + return ([[[component firstChildWithTag: @"X-SOGo-Component-Created-By"] flattenedValuesForKey: @""] length] > 0); +} + +- (NSString *) createdBy +{ + return [[component firstChildWithTag: @"X-SOGo-Component-Created-By"] flattenedValuesForKey: @""]; +} + +- (NSString *) createdByLink +{ + return [NSString stringWithFormat: @"mailto:%@", + [[component firstChildWithTag: @"X-SOGo-Component-Created-By"] flattenedValuesForKey: @""]]; +} + +- (NSString *) createdByName +{ + NSString *login; + SOGoUser *user; + + login = [[SOGoUserManager sharedUserManager] getUIDForEmail: [self createdBy]]; + + if (login) + { + user = [SOGoUser userWithLogin: login]; + + if (user) + return [user cn]; + } + + return @""; +} + - (NSString *) organizerName { NSDictionary *profile; @@ -1834,7 +1869,7 @@ RANGE(2); - (void) _handleOrganizer { - NSString *owner, *login; + NSString *owner, *login, *currentEmail; BOOL isOwner, hasAttendees; //owner = [[self clientObject] ownerInContext: context]; @@ -1842,8 +1877,8 @@ RANGE(2); login = [[context activeUser] login]; isOwner = [owner isEqualToString: login]; hasAttendees = [self hasAttendees]; + currentEmail = [[[context activeUser] allEmails] objectAtIndex: 0]; -#if 1 if (hasAttendees) { SOGoUser *user; @@ -1859,9 +1894,8 @@ RANGE(2); if (!isOwner) { - NSString *currentEmail, *quotedEmail; + NSString *quotedEmail; - currentEmail = [[[context activeUser] allEmails] objectAtIndex: 0]; quotedEmail = [NSString stringWithFormat: @"\"MAILTO:%@\"", currentEmail]; [organizer setValue: 0 ofAttribute: @"SENT-BY" @@ -1873,30 +1907,17 @@ RANGE(2); organizer = nil; } [component setOrganizer: organizer]; -#else - NSString *organizerEmail; - BOOL hasOrganizer; - organizerEmail = [[component organizer] email]; - hasOrganizer = ([organizerEmail length] > 0); - if (hasOrganizer) + + // In case of a new component, if the current user isn't the owner of the calendar, we + // add the "X-SOGo-Component-Created-By: " attribute + if ([[self clientObject] isNew] && + !isOwner && + [currentEmail length]) { - if (isOwner && !hasAttendees) - { - ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); - [component setOrganizer: organizer]; - } + [component addChild: [CardElement simpleElementWithTag: @"X-SOGo-Component-Created-By" + value: currentEmail]]; } - else - { - if (!isOwner || hasAttendees) - { - ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); - [organizer setCn: [organizerIdentity objectForKey: @"fullName"]]; - [organizer setEmail: [organizerIdentity objectForKey: @"email"]]; - [component setOrganizer: organizer]; - } - } -#endif + } - (void) _handleCustomRRule: (iCalRecurrenceRule *) theRule diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index 8b5e2e556..2b34302c6 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -100,6 +100,7 @@

+

diff --git a/UI/Templates/SchedulerUI/UIxComponentEditor.wox b/UI/Templates/SchedulerUI/UIxComponentEditor.wox index 586f86150..45af34b81 100644 --- a/UI/Templates/SchedulerUI/UIxComponentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxComponentEditor.wox @@ -73,6 +73,12 @@ > + +