now possible to see who created a event/task in a delegated calendar

pull/12/head
Ludovic Marcotte 2013-06-19 10:23:47 -04:00
parent 6b25f08943
commit 5304461e4c
13 changed files with 112 additions and 35 deletions

1
NEWS
View File

@ -10,6 +10,7 @@ Enhancements
SOGoMaximumMessageSubmissionCount, SOGoMaximumRecipientCount, SOGoMaximumMessageSubmissionCount, SOGoMaximumRecipientCount,
SOGoMaximumSubmissionInterval and SOGoMessageSubmissionBlockInterval defaults SOGoMaximumSubmissionInterval and SOGoMessageSubmissionBlockInterval defaults
- now possible to send or not event notifications on a per-event basis - 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 Bug fixes
- Fixed decoding of the charset parameter when using single quotes (#2306) - Fixed decoding of the charset parameter when using single quotes (#2306)

View File

@ -1,8 +1,6 @@
/* iCalEntityObject+SOGo.h - this file is part of SOGo /* iCalEntityObject+SOGo.h - this file is part of SOGo
* *
* Copyright (C) 2007 Inverse inc. * Copyright (C) 2007-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -48,6 +46,8 @@ extern NSNumber *iCalDistantFutureNumber;
- (NSMutableDictionary *) quickRecord; - (NSMutableDictionary *) quickRecord;
- (int) priorityNumber; - (int) priorityNumber;
- (NSString *) createdBy;
- (NSNumber *) quickRecordDateAsNumber: (NSCalendarDate *) _date - (NSNumber *) quickRecordDateAsNumber: (NSCalendarDate *) _date
withOffset: (int) offset withOffset: (int) offset
forAllDay: (BOOL) allDay; forAllDay: (BOOL) allDay;

View File

@ -242,4 +242,19 @@ NSNumber *iCalDistantFutureNumber = nil;
return priorityNumber; 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 @end

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2006-2011 Inverse inc. Copyright (C) 2006-2013 Inverse inc.
Copyright (C) 2005 SKYRIX Software AG Copyright (C) 2005 SKYRIX Software AG
This file is part of SOGo. This file is part of SOGo.

View File

@ -1,6 +1,6 @@
/* SOGoUserManager.m - this file is part of SOGo /* SOGoUserManager.m - this file is part of SOGo
* *
* Copyright (C) 2007-2011 Inverse inc. * Copyright (C) 2007-2013 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca> * Francis Lachapelle <flachapelle@inverse.ca>

View File

@ -179,6 +179,8 @@
"Reminder:" = "Reminder:"; "Reminder:" = "Reminder:";
"General:" = "General:"; "General:" = "General:";
"Reply:" = "Reply:"; "Reply:" = "Reply:";
"Created by:" = "Created by:";
"Target:" = "Target:"; "Target:" = "Target:";

View File

@ -48,6 +48,7 @@
#import <SOGo/SOGoPermissions.h> #import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h> #import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h> #import <SOGo/SOGoUserDefaults.h>
#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/iCalPerson+SOGo.h> #import <Appointments/iCalPerson+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h> #import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h> #import <Appointments/SOGoAppointmentObject.h>
@ -467,6 +468,8 @@
NSTimeZone *timeZone; NSTimeZone *timeZone;
SOGoUserDefaults *ud; SOGoUserDefaults *ud;
SOGoCalendarComponent *co; SOGoCalendarComponent *co;
NSString *created_by;
BOOL resetAlarm; BOOL resetAlarm;
unsigned int snoozeAlarm; unsigned int snoozeAlarm;
@ -512,6 +515,8 @@
} }
} }
created_by = [event createdBy];
data = [NSDictionary dictionaryWithObjectsAndKeys: data = [NSDictionary dictionaryWithObjectsAndKeys:
[componentCalendar displayName], @"calendar", [componentCalendar displayName], @"calendar",
[event tag], @"component", [event tag], @"component",
@ -523,6 +528,7 @@
([event isAllDay] ? @"1": @"0"), @"isAllDay", ([event isAllDay] ? @"1": @"0"), @"isAllDay",
[event summary], @"summary", [event summary], @"summary",
[event location], @"location", [event location], @"location",
created_by, @"created_by",
[event comment], @"description", [event comment], @"description",
nil]; nil];

View File

@ -143,6 +143,10 @@
- (NSString *) attach; - (NSString *) attach;
- (BOOL) hasAttendees; - (BOOL) hasAttendees;
- (BOOL) hasCreatedBy;
- (NSString *) createdBy;
- (NSString *) createdByLink;
- (NSString *) createdByName;
- (NSString *) jsonAttendees; - (NSString *) jsonAttendees;

View File

@ -834,6 +834,41 @@ iRANGE(2);
return organizerProfile; 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 - (NSString *) organizerName
{ {
NSDictionary *profile; NSDictionary *profile;
@ -1834,7 +1869,7 @@ RANGE(2);
- (void) _handleOrganizer - (void) _handleOrganizer
{ {
NSString *owner, *login; NSString *owner, *login, *currentEmail;
BOOL isOwner, hasAttendees; BOOL isOwner, hasAttendees;
//owner = [[self clientObject] ownerInContext: context]; //owner = [[self clientObject] ownerInContext: context];
@ -1842,8 +1877,8 @@ RANGE(2);
login = [[context activeUser] login]; login = [[context activeUser] login];
isOwner = [owner isEqualToString: login]; isOwner = [owner isEqualToString: login];
hasAttendees = [self hasAttendees]; hasAttendees = [self hasAttendees];
currentEmail = [[[context activeUser] allEmails] objectAtIndex: 0];
#if 1
if (hasAttendees) if (hasAttendees)
{ {
SOGoUser *user; SOGoUser *user;
@ -1859,9 +1894,8 @@ RANGE(2);
if (!isOwner) if (!isOwner)
{ {
NSString *currentEmail, *quotedEmail; NSString *quotedEmail;
currentEmail = [[[context activeUser] allEmails] objectAtIndex: 0];
quotedEmail = [NSString stringWithFormat: @"\"MAILTO:%@\"", quotedEmail = [NSString stringWithFormat: @"\"MAILTO:%@\"",
currentEmail]; currentEmail];
[organizer setValue: 0 ofAttribute: @"SENT-BY" [organizer setValue: 0 ofAttribute: @"SENT-BY"
@ -1873,30 +1907,17 @@ RANGE(2);
organizer = nil; organizer = nil;
} }
[component setOrganizer: organizer]; [component setOrganizer: organizer];
#else
NSString *organizerEmail; // In case of a new component, if the current user isn't the owner of the calendar, we
BOOL hasOrganizer; // add the "X-SOGo-Component-Created-By: <email address>" attribute
organizerEmail = [[component organizer] email]; if ([[self clientObject] isNew] &&
hasOrganizer = ([organizerEmail length] > 0); !isOwner &&
if (hasOrganizer) [currentEmail length])
{ {
if (isOwner && !hasAttendees) [component addChild: [CardElement simpleElementWithTag: @"X-SOGo-Component-Created-By"
{ value: currentEmail]];
ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]);
[component setOrganizer: organizer];
}
} }
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 - (void) _handleCustomRRule: (iCalRecurrenceRule *) theRule

View File

@ -100,6 +100,7 @@
<p><span><!-- space --></span></p> <p><span><!-- space --></span></p>
<p><span class="label"><var:string label:value="Calendar:" /></span> <span><!-- space --></span></p> <p><span class="label"><var:string label:value="Calendar:" /></span> <span><!-- space --></span></p>
<p><span class="label"><var:string label:value="Location:" /></span> <span><!-- space --></span></p> <p><span class="label"><var:string label:value="Location:" /></span> <span><!-- space --></span></p>
<p><span class="label"><var:string label:value="Created by:" /></span> <span><!-- space --></span></p>
<p class="description"><!-- space --></p> <p class="description"><!-- space --></p>
</div> </div>
</div> </div>

View File

@ -73,6 +73,12 @@
><var:string value="organizerName" /></a ><var:string value="organizerName" /></a
></span></label> ></span></label>
</var:if> </var:if>
<var:if condition="hasCreatedBy"
><label id="createdByLabel"><var:string label:value="Created by:"
/><span class="content"><a var:href="createdByLink" var:email="createdBy"
><var:string value="createdByName" /></a
></span></label>
</var:if>
<!--<var:if condition="canBeOrganizer" <!--<var:if condition="canBeOrganizer"
><label id="organizerListLabel"><var:string label:value="Organizer:" ><label id="organizerListLabel"><var:string label:value="Organizer:"
/><span class="content"><var:popup list="organizerList" /><span class="content"><var:popup list="organizerList"
@ -221,6 +227,13 @@
></span> ></span>
</label> </label>
</var:if> </var:if>
<var:if condition="hasCreatedBy">
<label id="createdByLabel"><var:string label:value="Created by:"/>
<span class="content"><a var:href="createdBy" var:email="createdBy"
><var:string value="createdByName" /></a
></span>
</label>
</var:if>
<var:if condition="userHasRSVP"> <var:if condition="userHasRSVP">
<label><var:string label:value="Reply:" /> <label><var:string label:value="Reply:" />
<span class="content"><var:popup list="replyList" item="item" <span class="content"><var:popup list="replyList" item="item"

View File

@ -760,7 +760,14 @@ function onViewEventCallback(http) {
} else } else
para.hide(); para.hide();
para = $(paras[3]); para = $(paras[3]);
if (data["created_by"].length) {
para.down("SPAN", 1).update(data["created_by"]);
para.show();
} else
para.hide();
para = $(paras[4]);
if (data["description"].length) { if (data["description"].length) {
para.update(data["description"].replace(/\r?\n/g, "<BR/>")); para.update(data["description"].replace(/\r?\n/g, "<BR/>"));
para.show(); para.show();

View File

@ -2,15 +2,17 @@
/* /*
Copyright (C) 2005 SKYRIX Software AG Copyright (C) 2005 SKYRIX Software AG
Copyright (C) 2006-2013 Inverse inc.
This file is part of OpenGroupware.org. This file is part of SOGo.
OGo is free software; you can redistribute it and/or modify it under SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
later version. later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details. License for more details.
@ -527,6 +529,11 @@ function onAppointmentEditorLoad() {
organizer.down("a").on("click", onMailTo); organizer.down("a").on("click", onMailTo);
} }
var createdBy = $("createdByLabel");
if (createdBy && createdBy.down("a")) {
createdBy.down("a").on("click", onMailTo);
}
// Extend JSON representation of attendees // Extend JSON representation of attendees
attendees = $H(attendees); attendees = $H(attendees);
initializeAttendeesHref(); initializeAttendeesHref();