See ChangeLog.

Monotone-Parent: 29cd46d91b0c0d1156ea93feaa77eb114a1dc1bc
Monotone-Revision: c1fbc1eec0e204f82627f44220958a6f0f63ffe9

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-07-28T20:19:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2010-07-28 20:19:08 +00:00
parent dc342f2805
commit 98970b7b9b
6 changed files with 145 additions and 47 deletions
+12
View File
@@ -1,3 +1,15 @@
2010-07-28 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/UIxComponentEditor.js (getCalendarOwner):
new function that returns the event organizer or the calendar
owner in case of an event with no organizer yet.
* UI/Scheduler/UIxComponentEditor.m (-organizerProfile): was
jsonOrganizer. Now caches the resulting dictionary in an ivar.
(-calendarOwnerList): new method called from the wox template and
use to display the event organizer in the edition window of the
attendees.
2010-07-27 Francis Lachapelle <flachapelle@inverse.ca>
* UI/WebServerResources/SOGoAutoCompletion.js
+2 -1
View File
@@ -1,6 +1,6 @@
/* UIxComponentEditor.h - this file is part of SOGo
*
* Copyright (C) 2006-2009 Inverse inc.
* Copyright (C) 2006-2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -44,6 +44,7 @@
NSMutableArray *calendarList;
//NSMutableArray *organizerList;
//NSDictionary *organizerIdentity;
NSDictionary *organizerProfile;
/* individual values */
NSCalendarDate *cycleUntilDate;
+108 -43
View File
@@ -169,6 +169,7 @@ iRANGE(2);
componentOwner = @"";
organizer = nil;
//organizerIdentity = nil;
organizerProfile = nil;
ownerAsAttendee = nil;
attendee = nil;
jsonAttendees = nil;
@@ -202,6 +203,7 @@ iRANGE(2);
[location release];
[organizer release];
//[organizerIdentity release];
[organizerProfile release];
[ownerAsAttendee release];
[comment release];
[priority release];
@@ -812,63 +814,76 @@ iRANGE(2);
return [jsonAttendees jsonRepresentation];
}
- (NSString *) jsonOrganizer
- (NSDictionary *) organizerProfile
{
NSMutableDictionary *jsonOrganizer;
NSMutableDictionary *profile;
NSDictionary *ownerIdentity;
NSString *uid, *name, *email, *partstat, *role;
SOGoUserManager *um;
SOGoCalendarComponent *co;
SOGoUser *ownerUser;
jsonOrganizer = [NSMutableDictionary dictionary];
email = [organizer rfc822Email];
role = nil;
partstat = nil;
if ([email length])
if (organizerProfile == nil)
{
um = [SOGoUserManager sharedUserManager];
profile = [NSMutableDictionary dictionary];
email = [organizer rfc822Email];
role = nil;
partstat = nil;
name = [organizer cn];
uid = [um getUIDForEmail: email];
if ([email length])
{
um = [SOGoUserManager sharedUserManager];
name = [organizer cn];
uid = [um getUIDForEmail: email];
partstat = [[organizer partStat] lowercaseString];
role = [[organizer role] lowercaseString];
}
else
{
// No organizer defined in vEvent; use calendar owner
co = [self clientObject];
uid = [[co container] ownerInContext: context];
ownerUser = [SOGoUser userWithLogin: uid roles: nil];
ownerIdentity = [ownerUser defaultIdentity];
name = [ownerIdentity objectForKey: @"fullName"];
email = [ownerIdentity objectForKey: @"email"];
}
partstat = [[organizer partStat] lowercaseString];
role = [[organizer role] lowercaseString];
}
else
{
// No organizer defined in vEvent
co = [self clientObject];
uid = [[co container] ownerInContext: context];
ownerUser = [SOGoUser userWithLogin: uid roles: nil];
ownerIdentity = [ownerUser defaultIdentity];
if (uid != nil)
[profile setObject: uid
forKey: @"uid"];
else
uid = email;
name = [ownerIdentity objectForKey: @"fullName"];
email = [ownerIdentity objectForKey: @"email"];
[profile setObject: name
forKey: @"name"];
[profile setObject: email
forKey: @"email"];
if (partstat == nil || ![partstat length])
partstat = @"accepted";
[profile setObject: partstat
forKey: @"partstat"];
if (role == nil || ![role length])
role = @"chair";
[profile setObject: role
forKey: @"role"];
organizerProfile = [NSDictionary dictionaryWithObject: profile forKey: uid];
[organizerProfile retain];
}
if (uid != nil)
[jsonOrganizer setObject: uid
forKey: @"uid"];
return organizerProfile;
}
[jsonOrganizer setObject: name
forKey: @"name"];
[jsonOrganizer setObject: email
forKey: @"email"];
if (partstat == nil || ![partstat length])
partstat = @"accepted";
[jsonOrganizer setObject: partstat
forKey: @"partstat"];
if (role == nil || ![role length])
role = @"chair";
[jsonOrganizer setObject: role
forKey: @"role"];
return [jsonOrganizer jsonRepresentation];
- (NSString *) jsonOrganizer
{
return [[[[self organizerProfile] allValues] lastObject] jsonRepresentation];
}
- (void) setLocation: (NSString *) _value
@@ -1136,6 +1151,56 @@ iRANGE(2);
return calendarList;
}
/**
* This method is called from the wox template and uses to display the event
* organizer in the edition window of the attendees.
* Returns an array of the two elements :
* - array of calendar owners
* - dictionary of owners profiles
*/
- (NSArray *) calendarOwnerList
{
NSArray *calendars;
NSMutableArray *owners;
NSDictionary *currentOwnerIdentity;
NSMutableDictionary *profiles, *currentOwnerProfile;
NSString *currentOwner;
SOGoAppointmentFolder *currentCalendar;
SOGoUser *currentUser;
unsigned i;
calendars = [self calendarList];
owners = [NSMutableArray arrayWithCapacity: [calendars count]];
profiles = [NSMutableDictionary dictionaryWithDictionary: [self organizerProfile]];
for (i = 0; i < [calendars count]; i++)
{
currentCalendar = [calendars objectAtIndex: i];
currentOwner = [currentCalendar ownerInContext: context];
[owners addObject: currentOwner];
if ([profiles objectForKey: currentOwner] == nil)
{
currentUser = [SOGoUser userWithLogin: currentOwner roles: nil];
currentOwnerIdentity = [currentUser defaultIdentity];
currentOwnerProfile = [NSMutableDictionary dictionary];
[currentOwnerProfile setObject: [currentOwnerIdentity objectForKey: @"fullName"]
forKey: @"name"];
[currentOwnerProfile setObject: [currentOwnerIdentity objectForKey: @"email"]
forKey: @"email"];
[currentOwnerProfile setObject: @"accepted"
forKey: @"partstat"];
[currentOwnerProfile setObject: @"chair"
forKey: @"role"];
[profiles setObject: currentOwnerProfile forKey: currentOwner];
}
}
return [NSArray arrayWithObjects: owners, profiles, nil];
}
- (NSString *) calendarDisplayName
{
NSString *fDisplayName;
@@ -21,8 +21,10 @@
const:negate="YES">false</var:if>;
var attendees = <var:string value="jsonAttendees" const:escapeHTML="NO"/>;
var ownerLogin = '<var:string value="ownerLogin"/>';
var organizer = <var:string value="jsonOrganizer" const:escapeHTML="NO"/>;
</script>
<var:if condition="eventIsReadOnly" const:negate="YES"
><var:if condition="hasOrganizer">var organizer = <var:string value="jsonOrganizer" const:escapeHTML="NO"/>;</var:if
>var owners = <var:string value="calendarOwnerList.jsonRepresentation" const:escapeHTML="NO"/>;</var:if
></script>
<var:if condition="eventIsReadOnly" const:negate="YES">
<div class="menu" id="privacy-menu">
+1 -1
View File
@@ -1487,7 +1487,7 @@ function prepareTableRows() {
function prepareAttendees() {
var tableAttendees = $("freeBusyAttendees");
var tableData = $("freeBusyData");
var organizer = window.opener.organizer;
var organizer = window.opener.getCalendarOwner();
var attendees = window.opener.attendees;
var attendeesKeys = (attendees ? attendees.keys() : null);
@@ -10,6 +10,24 @@ function getOwnerLogin() {
return ownerLogin;
}
function getCalendarOwner() {
var ownerProfile;
if (typeof organizer == "undefined") {
var calendarIndex = $("calendarList").value;
var ownersList = owners[0];
var profiles = owners[1];
var ownerUid = ownersList[calendarIndex];
ownerProfile = profiles[ownerUid];
ownerProfile["uid"] = ownerUid;
}
else {
ownerProfile = organizer;
}
return ownerProfile;
}
function onPopupAttendeesWindow(event) {
if (event)
preventDefault(event);