mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-30 10:47:17 +00:00
Monotone-Parent: e80fcb63581735f3366500b850eb549e8db6292f
Monotone-Revision: cba2c1a4663c3def7a5d54e73def008d13226f40 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2007-12-12T17:48:19 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
#import <NGCards/iCalPerson.h>
|
||||
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoDateFormatter.h>
|
||||
@@ -308,21 +309,23 @@
|
||||
|
||||
- (WOResponse *) eventsListAction
|
||||
{
|
||||
NSArray *fields, *oldEvent;
|
||||
NSArray *fields, *oldEvent, *participants, *states;
|
||||
NSEnumerator *events;
|
||||
NSMutableArray *newEvents, *newEvent;
|
||||
unsigned int interval;
|
||||
unsigned int interval, i;
|
||||
BOOL isAllDay;
|
||||
NSString *sort, *ascending;
|
||||
NSString *sort, *ascending, *participant, *state;
|
||||
SOGoUser *user;
|
||||
|
||||
[self _setupContext];
|
||||
|
||||
newEvents = [NSMutableArray array];
|
||||
fields = [NSArray arrayWithObjects: @"c_name", @"c_folder", @"c_status",
|
||||
@"c_title", @"c_startdate", @"c_enddate", @"c_location",
|
||||
@"c_isallday", @"c_classification", nil];
|
||||
@"c_isallday", @"c_classification", @"c_partmails", @"c_partstates", nil];
|
||||
events = [[self _fetchFields: fields
|
||||
forComponentOfType: @"vevent"] objectEnumerator];
|
||||
user = [[self context] activeUser];
|
||||
oldEvent = [events nextObject];
|
||||
while (oldEvent)
|
||||
{
|
||||
@@ -340,6 +343,35 @@
|
||||
forAllDay: isAllDay]];
|
||||
[newEvent addObject: [self _formattedDateForSeconds: interval
|
||||
forAllDay: isAllDay]];
|
||||
|
||||
participants = state = nil;
|
||||
if ([[oldEvent objectAtIndex: 9] length] > 0 &&
|
||||
[[oldEvent objectAtIndex: 10] length] > 0) {
|
||||
participants = [[oldEvent objectAtIndex: 9] componentsSeparatedByString: @"\n"];
|
||||
states = [[oldEvent objectAtIndex: 10] componentsSeparatedByString: @"\n"];
|
||||
for (i = 0; i < [participants count]; i++) {
|
||||
participant = [participants objectAtIndex: i];
|
||||
if ([user hasEmail: participant]) {
|
||||
switch ([[states objectAtIndex: i] intValue]) {
|
||||
case iCalPersonPartStatNeedsAction:
|
||||
state = @"needs-action";
|
||||
break;
|
||||
case iCalPersonPartStatAccepted:
|
||||
state = @"accepted";
|
||||
break;
|
||||
case iCalPersonPartStatDeclined:
|
||||
state = @"declined";
|
||||
break;
|
||||
}
|
||||
[newEvent replaceObjectAtIndex: 9 withObject: state];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (participants == nil || i == [participants count])
|
||||
[newEvent replaceObjectAtIndex: 9 withObject: @""];
|
||||
[newEvent removeObjectAtIndex: 10];
|
||||
|
||||
[newEvents addObject: newEvent];
|
||||
|
||||
oldEvent = [events nextObject];
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
NSString *attendeesNames;
|
||||
NSString *attendeesUIDs;
|
||||
NSString *attendeesEmails;
|
||||
NSString *attendeesStates;
|
||||
}
|
||||
|
||||
- (NSString *) toolbar;
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
attendeesNames = nil;
|
||||
attendeesUIDs = nil;
|
||||
attendeesEmails = nil;
|
||||
attendeesStates = nil;
|
||||
calendarList = nil;
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@
|
||||
[attendeesNames release];
|
||||
[attendeesUIDs release];
|
||||
[attendeesEmails release];
|
||||
[attendeesStates release];
|
||||
[calendarList release];
|
||||
|
||||
[component release];
|
||||
@@ -107,13 +109,14 @@
|
||||
{
|
||||
NSEnumerator *attendees;
|
||||
iCalPerson *currentAttendee;
|
||||
NSMutableString *names, *uids, *emails;
|
||||
NSMutableString *names, *uids, *emails, *states;
|
||||
NSString *uid;
|
||||
LDAPUserManager *um;
|
||||
|
||||
names = [NSMutableString new];
|
||||
uids = [NSMutableString new];
|
||||
emails = [NSMutableString new];
|
||||
states = [NSMutableString new];
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
|
||||
attendees = [[component attendees] objectEnumerator];
|
||||
@@ -127,6 +130,7 @@
|
||||
[uids appendFormat: @"%@,", uid];
|
||||
else
|
||||
[uids appendString: @","];
|
||||
[states appendFormat: @"%@,", [[currentAttendee partStat] lowercaseString]];
|
||||
currentAttendee = [attendees nextObject];
|
||||
}
|
||||
|
||||
@@ -136,6 +140,7 @@
|
||||
ASSIGN (attendeesUIDs, [uids substringToIndex: [uids length] - 1]);
|
||||
ASSIGN (attendeesEmails,
|
||||
[emails substringToIndex: [emails length] - 1]);
|
||||
ASSIGN (attendeesStates, [states substringToIndex: [states length] - 1]);
|
||||
}
|
||||
|
||||
[names release];
|
||||
@@ -358,6 +363,16 @@
|
||||
return attendeesEmails;
|
||||
}
|
||||
|
||||
- (void) setAttendeesStates: (NSString *) newAttendeesStates
|
||||
{
|
||||
ASSIGN (attendeesStates, newAttendeesStates);
|
||||
}
|
||||
|
||||
- (NSString *) attendeesStates
|
||||
{
|
||||
return attendeesStates;
|
||||
}
|
||||
|
||||
- (void) setLocation: (NSString *) _value
|
||||
{
|
||||
ASSIGN (location, _value);
|
||||
|
||||
Reference in New Issue
Block a user