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,
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)

View File

@ -1,8 +1,6 @@
/* iCalEntityObject+SOGo.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* 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;

View File

@ -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

View File

@ -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.

View File

@ -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 <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>

View File

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

View File

@ -48,6 +48,7 @@
#import <SOGo/SOGoPermissions.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <Appointments/iCalEntityObject+SOGo.h>
#import <Appointments/iCalPerson+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Appointments/SOGoAppointmentObject.h>
@ -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];

View File

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

View File

@ -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: <email address>" 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

View File

@ -100,6 +100,7 @@
<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="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>
</div>
</div>

View File

@ -73,6 +73,12 @@
><var:string value="organizerName" /></a
></span></label>
</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"
><label id="organizerListLabel"><var:string label:value="Organizer:"
/><span class="content"><var:popup list="organizerList"
@ -221,6 +227,13 @@
></span>
</label>
</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">
<label><var:string label:value="Reply:" />
<span class="content"><var:popup list="replyList" item="item"

View File

@ -760,7 +760,14 @@ function onViewEventCallback(http) {
} else
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) {
para.update(data["description"].replace(/\r?\n/g, "<BR/>"));
para.show();

View File

@ -2,15 +2,17 @@
/*
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
Free Software Foundation; either version 2, or (at your option) any
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
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
@ -527,6 +529,11 @@ function onAppointmentEditorLoad() {
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
attendees = $H(attendees);
initializeAttendeesHref();