Monotone-Parent: 5b113d87d41aa66996f2576f03064d17a7402102
Monotone-Revision: 12549cc7c7155429d8ed02fc7a43758a474142a8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-11T18:57:54 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
12da674da2
commit
1b0a74d9db
|
@ -1,5 +1,10 @@
|
||||||
2007-04-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-04-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||||
|
([SOGoCalendarComponent -changeParticipationStatus:_status]):
|
||||||
|
moved method from SOGoTaskObject and SOGoAppointmentObject up to
|
||||||
|
their parent class.
|
||||||
|
|
||||||
* UI/Scheduler/UIxCalSelectTab.m: removed module.
|
* UI/Scheduler/UIxCalSelectTab.m: removed module.
|
||||||
|
|
||||||
2007-04-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-04-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
#import <NGMail/NGMail.h>
|
#import <NGMail/NGMail.h>
|
||||||
#import <NGMail/NGSendMail.h>
|
#import <NGMail/NGSendMail.h>
|
||||||
|
|
||||||
#import <SOGo/AgenorUserManager.h>
|
#import <SoObjects/SOGo/AgenorUserManager.h>
|
||||||
#import <SOGo/SOGoPermissions.h>
|
#import <SoObjects/SOGo/SOGoPermissions.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SoObjects/SOGo/SOGoUser.h>
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
|
||||||
|
@ -113,7 +113,6 @@ static BOOL sendEMailNotifications = NO;
|
||||||
NSString *tmpContent, *email;
|
NSString *tmpContent, *email;
|
||||||
iCalCalendar *tmpCalendar;
|
iCalCalendar *tmpCalendar;
|
||||||
iCalRepeatableEntityObject *tmpComponent;
|
iCalRepeatableEntityObject *tmpComponent;
|
||||||
WOContext *context;
|
|
||||||
|
|
||||||
if (!calContent)
|
if (!calContent)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +124,6 @@ static BOOL sendEMailNotifications = NO;
|
||||||
tmpComponent = (iCalRepeatableEntityObject *) [tmpCalendar firstChildWithTag: [self componentTag]];
|
tmpComponent = (iCalRepeatableEntityObject *) [tmpCalendar firstChildWithTag: [self componentTag]];
|
||||||
if (![tmpComponent isPublic])
|
if (![tmpComponent isPublic])
|
||||||
{
|
{
|
||||||
context = [[WOApplication application] context];
|
|
||||||
email = [[context activeUser] email];
|
email = [[context activeUser] email];
|
||||||
if (!([tmpComponent isOrganizer: email]
|
if (!([tmpComponent isOrganizer: email]
|
||||||
|| [tmpComponent isParticipant: email]))
|
|| [tmpComponent isParticipant: email]))
|
||||||
|
@ -231,14 +229,12 @@ static BOOL sendEMailNotifications = NO;
|
||||||
{
|
{
|
||||||
NSString *baseURL;
|
NSString *baseURL;
|
||||||
NSString *uid;
|
NSString *uid;
|
||||||
WOContext *ctx;
|
|
||||||
NSArray *traversalObjects;
|
NSArray *traversalObjects;
|
||||||
|
|
||||||
/* generate URL from traversal stack */
|
/* generate URL from traversal stack */
|
||||||
ctx = [[WOApplication application] context];
|
traversalObjects = [context objectTraversalStack];
|
||||||
traversalObjects = [ctx objectTraversalStack];
|
|
||||||
if ([traversalObjects count] > 0)
|
if ([traversalObjects count] > 0)
|
||||||
baseURL = [[traversalObjects objectAtIndex:0] baseURLInContext:ctx];
|
baseURL = [[traversalObjects objectAtIndex:0] baseURLInContext: context];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
baseURL = @"http://localhost/";
|
baseURL = @"http://localhost/";
|
||||||
|
@ -252,11 +248,66 @@ static BOOL sendEMailNotifications = NO;
|
||||||
: nil);
|
: nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSException *) changeParticipationStatus: (NSString *) _status
|
||||||
|
{
|
||||||
|
iCalRepeatableEntityObject *component;
|
||||||
|
iCalPerson *p;
|
||||||
|
NSString *newContent;
|
||||||
|
NSException *ex;
|
||||||
|
NSString *myEMail;
|
||||||
|
|
||||||
|
ex = nil;
|
||||||
|
|
||||||
|
component = [self component: NO];
|
||||||
|
if (component)
|
||||||
|
{
|
||||||
|
myEMail = [[context activeUser] email];
|
||||||
|
p = [component findParticipantWithEmail: myEMail];
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
// TODO: send iMIP reply mails?
|
||||||
|
[p setPartStat: _status];
|
||||||
|
newContent = [[component parent] versitString];
|
||||||
|
if (newContent)
|
||||||
|
{
|
||||||
|
ex = [self saveContentString:newContent];
|
||||||
|
if (ex)
|
||||||
|
// TODO: why is the exception wrapped?
|
||||||
|
/* Server Error */
|
||||||
|
ex = [NSException exceptionWithHTTPStatus: 500
|
||||||
|
reason: [ex reason]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ex
|
||||||
|
= [NSException exceptionWithHTTPStatus: 500 /* Server Error */
|
||||||
|
reason: @"Could not generate iCalendar data ..."];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ex = [NSException exceptionWithHTTPStatus: 404 /* Not Found */
|
||||||
|
reason: @"user does not participate in this "
|
||||||
|
@"calendar component"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ex = [NSException exceptionWithHTTPStatus: 500 /* Server Error */
|
||||||
|
reason: @"unable to parse component record"];
|
||||||
|
|
||||||
|
return ex;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) sendEMailNotifications
|
- (BOOL) sendEMailNotifications
|
||||||
{
|
{
|
||||||
return sendEMailNotifications;
|
return sendEMailNotifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSTimeZone *) timeZoneForUser: (NSString *) email
|
||||||
|
{
|
||||||
|
NSString *uid;
|
||||||
|
|
||||||
|
uid = [[AgenorUserManager sharedUserManager] getUIDForEmail: email];
|
||||||
|
|
||||||
|
return [[SOGoUser userWithLogin: uid andRoles: nil] timeZone];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) sendEMailUsingTemplateNamed: (NSString *) _pageName
|
- (void) sendEMailUsingTemplateNamed: (NSString *) _pageName
|
||||||
forOldObject: (iCalRepeatableEntityObject *) _oldObject
|
forOldObject: (iCalRepeatableEntityObject *) _oldObject
|
||||||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||||
|
@ -264,7 +315,7 @@ static BOOL sendEMailNotifications = NO;
|
||||||
{
|
{
|
||||||
NSString *pageName;
|
NSString *pageName;
|
||||||
iCalPerson *organizer;
|
iCalPerson *organizer;
|
||||||
NSString *cn, *sender, *iCalString;
|
NSString *cn, *email, *sender, *iCalString;
|
||||||
NGSendMail *sendmail;
|
NGSendMail *sendmail;
|
||||||
WOApplication *app;
|
WOApplication *app;
|
||||||
unsigned i, count;
|
unsigned i, count;
|
||||||
|
@ -308,12 +359,12 @@ static BOOL sendEMailNotifications = NO;
|
||||||
|
|
||||||
/* construct recipient */
|
/* construct recipient */
|
||||||
cn = [attendee cn];
|
cn = [attendee cn];
|
||||||
|
email = [attendee rfc822Email];
|
||||||
if (cn)
|
if (cn)
|
||||||
recipient = [NSString stringWithFormat: @"%@ <%@>",
|
recipient = [NSString stringWithFormat: @"%@ <%@>",
|
||||||
cn,
|
cn, email];
|
||||||
[attendee rfc822Email]];
|
|
||||||
else
|
else
|
||||||
recipient = [attendee rfc822Email];
|
recipient = email;
|
||||||
|
|
||||||
/* create page name */
|
/* create page name */
|
||||||
// TODO: select user's default language?
|
// TODO: select user's default language?
|
||||||
|
@ -321,11 +372,11 @@ static BOOL sendEMailNotifications = NO;
|
||||||
mailTemplateDefaultLanguage,
|
mailTemplateDefaultLanguage,
|
||||||
_pageName];
|
_pageName];
|
||||||
/* construct message content */
|
/* construct message content */
|
||||||
p = [app pageWithName: pageName inContext: [WOContext context]];
|
p = [app pageWithName: pageName inContext: context];
|
||||||
[p setNewApt: _newObject];
|
[p setNewApt: _newObject];
|
||||||
[p setOldApt: _oldObject];
|
[p setOldApt: _oldObject];
|
||||||
[p setHomePageURL: [self homePageURLForPerson: attendee]];
|
[p setHomePageURL: [self homePageURLForPerson: attendee]];
|
||||||
[p setViewTZ: [self userTimeZone: cn]];
|
[p setViewTZ: [self timeZoneForUser: email]];
|
||||||
subject = [p getSubject];
|
subject = [p getSubject];
|
||||||
text = [p getBody];
|
text = [p getBody];
|
||||||
|
|
||||||
|
@ -375,14 +426,13 @@ static BOOL sendEMailNotifications = NO;
|
||||||
|
|
||||||
/* send the damn thing */
|
/* send the damn thing */
|
||||||
[sendmail sendMimePart: msg
|
[sendmail sendMimePart: msg
|
||||||
toRecipients: [NSArray arrayWithObject: [attendee rfc822Email]]
|
toRecipients: [NSArray arrayWithObject: email]
|
||||||
sender: [organizer rfc822Email]];
|
sender: [organizer rfc822Email]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) rolesOfUser: (NSString *) login
|
- (NSArray *) rolesOfUser: (NSString *) login
|
||||||
inContext: (WOContext *) context
|
|
||||||
{
|
{
|
||||||
AgenorUserManager *um;
|
AgenorUserManager *um;
|
||||||
iCalRepeatableEntityObject *component;
|
iCalRepeatableEntityObject *component;
|
||||||
|
@ -403,15 +453,14 @@ static BOOL sendEMailNotifications = NO;
|
||||||
[sogoRoles addObject: SOGoRole_Organizer];
|
[sogoRoles addObject: SOGoRole_Organizer];
|
||||||
else if ([component isParticipant: email])
|
else if ([component isParticipant: email])
|
||||||
[sogoRoles addObject: SOGoRole_Participant];
|
[sogoRoles addObject: SOGoRole_Participant];
|
||||||
else if ([[container ownerInContext: nil] isEqualToString: login])
|
else if ([[container ownerInContext: context] isEqualToString: login])
|
||||||
[sogoRoles addObject: SoRole_Owner];
|
[sogoRoles addObject: SoRole_Owner];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user = [[SOGoUser alloc] initWithLogin: login roles: nil];
|
user = [SOGoUser userWithLogin: login andRoles: nil];
|
||||||
[sogoRoles addObjectsFromArray: [user rolesForObject: container
|
[sogoRoles addObjectsFromArray: [user rolesForObject: container
|
||||||
inContext: context]];
|
inContext: context]];
|
||||||
[user release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sogoRoles;
|
return sogoRoles;
|
||||||
|
@ -431,7 +480,7 @@ static BOOL sendEMailNotifications = NO;
|
||||||
= ([organizerEmail caseInsensitiveCompare: email] == NSOrderedSame);
|
= ([organizerEmail caseInsensitiveCompare: email] == NSOrderedSame);
|
||||||
else
|
else
|
||||||
isOrganizerOrOwner
|
isOrganizerOrOwner
|
||||||
= [[container ownerInContext: nil] isEqualToString: login];
|
= [[container ownerInContext: context] isEqualToString: login];
|
||||||
|
|
||||||
return isOrganizerOrOwner;
|
return isOrganizerOrOwner;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue