mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-03 04:37:16 +00:00
Monotone-Parent: 2e935ec1865c679003a2c06cc903ea9f832eff1a
Monotone-Revision: a076c996d78b991c19ee3a0672b590902d108362 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-02-15T20:59:02 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
2007-02-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||
([SOGoCalendarComponent -componentTag]): new template method that
|
||||
returns the vcalendar tag of the current object.
|
||||
([SOGoCalendarComponent -component]): new method that returns the
|
||||
first object matching [self componentTag] within the current
|
||||
calendar object. This method replaces 'firstEventInCalendar:' as
|
||||
well as "firstTaskInCalendar:".
|
||||
([SOGoCalendarComponent -roleOfUser:logininContext:context]):
|
||||
moved method from SOGoAppointmentObject.m.
|
||||
|
||||
2007-02-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxCalMulticolumnDayView.[hm]: new daily view
|
||||
|
||||
@@ -46,11 +46,6 @@
|
||||
|
||||
@interface SOGoAppointmentObject : SOGoCalendarComponent
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (iCalEvent *) event;
|
||||
- (iCalEvent *) firstEventFromCalendar: (iCalCalendar *) calendar;
|
||||
|
||||
/* folder management */
|
||||
|
||||
- (id) lookupHomeFolderForUID: (NSString *) _uid inContext: (id)_ctx;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#import <SOGo/AgenorUserManager.h>
|
||||
#import <SOGo/SOGoObject.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "iCalEntityObject+Agenor.h"
|
||||
|
||||
@@ -37,11 +38,9 @@
|
||||
|
||||
@implementation SOGoAppointmentObject
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (iCalEvent *) event
|
||||
- (NSString *) componentTag
|
||||
{
|
||||
return [self firstEventFromCalendar: [self calendar]];
|
||||
return @"vevent";
|
||||
}
|
||||
|
||||
/* iCal handling */
|
||||
@@ -77,22 +76,23 @@
|
||||
|
||||
/* add attendees */
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
iCalPerson *person;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
iCalPerson *person;
|
||||
|
||||
person = [attendees objectAtIndex:i];
|
||||
email = [person rfc822Email];
|
||||
if (![email isNotNull]) continue;
|
||||
person = [attendees objectAtIndex:i];
|
||||
email = [person rfc822Email];
|
||||
if (![email isNotNull]) continue;
|
||||
|
||||
uid = [um getUIDForEmail:email];
|
||||
if (![uid isNotNull]) {
|
||||
[self logWithFormat:@"Note: got no uid for email: '%@'", email];
|
||||
continue;
|
||||
uid = [um getUIDForEmail:email];
|
||||
if (![uid isNotNull]) {
|
||||
[self logWithFormat:@"Note: got no uid for email: '%@'", email];
|
||||
continue;
|
||||
}
|
||||
if (![uids containsObject:uid])
|
||||
[uids addObject:uid];
|
||||
}
|
||||
if (![uids containsObject:uid])
|
||||
[uids addObject:uid];
|
||||
}
|
||||
|
||||
|
||||
return uids;
|
||||
}
|
||||
|
||||
@@ -186,21 +186,6 @@
|
||||
return allErrors;
|
||||
}
|
||||
|
||||
- (iCalEvent *) firstEventFromCalendar: (iCalCalendar *) aCalendar
|
||||
{
|
||||
iCalEvent *event;
|
||||
NSArray *events;
|
||||
|
||||
events = [aCalendar childrenWithTag: @"vevent"];
|
||||
if ([events count])
|
||||
event = (iCalEvent *) [[events objectAtIndex: 0]
|
||||
groupWithClass: [iCalEvent class]];
|
||||
else
|
||||
event = nil;
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/* "iCal multifolder saves" */
|
||||
|
||||
- (NSException *) saveContentString: (NSString *) _iCal
|
||||
@@ -252,7 +237,7 @@
|
||||
oldApt = nil;
|
||||
}
|
||||
else
|
||||
oldApt = [self firstEventFromCalendar: [self calendar]];
|
||||
oldApt = (iCalEvent *) [self component];
|
||||
|
||||
/* compare sequence if requested */
|
||||
|
||||
@@ -264,7 +249,7 @@
|
||||
/* handle new content */
|
||||
|
||||
newCalendar = [iCalCalendar parseSingleFromSource: _iCal];
|
||||
newApt = [self firstEventFromCalendar: newCalendar];
|
||||
newApt = (iCalEvent *) [newCalendar firstChildWithTag: [self componentTag]];
|
||||
if (newApt == nil) {
|
||||
return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
|
||||
reason:@"could not parse iCalendar content!"];
|
||||
@@ -408,7 +393,7 @@
|
||||
|
||||
/* load existing content */
|
||||
|
||||
apt = [self event];
|
||||
apt = (iCalEvent *) [self component];
|
||||
|
||||
/* compare sequence if requested */
|
||||
|
||||
@@ -460,7 +445,7 @@
|
||||
ex = nil;
|
||||
|
||||
// TODO: do we need to use SOGoAppointment? (prefer iCalEvent?)
|
||||
apt = [self event];
|
||||
apt = (iCalEvent *) [self component];
|
||||
|
||||
if (apt)
|
||||
{
|
||||
@@ -520,7 +505,7 @@
|
||||
else
|
||||
{
|
||||
eventCalendar = [iCalCalendar parseSingleFromSource: contentString];
|
||||
event = [self firstEventFromCalendar: eventCalendar];
|
||||
event = (iCalEvent *) [eventCalendar firstChildWithTag: [self componentTag]];
|
||||
organizers = [event childrenWithTag: @"organizer"];
|
||||
if ([organizers count])
|
||||
newContentString = contentString;
|
||||
@@ -535,29 +520,6 @@
|
||||
baseVersion: baseVersion];
|
||||
}
|
||||
|
||||
- (NSString *) roleOfUser: (NSString *) login
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
AgenorUserManager *um;
|
||||
iCalEvent *event;
|
||||
NSString *role, *email;
|
||||
|
||||
um = [AgenorUserManager sharedUserManager];
|
||||
email = [um getEmailForUID: login];
|
||||
|
||||
event = [self event];
|
||||
if ([event isOrganizer: email])
|
||||
role = @"Organizer";
|
||||
else if ([event isParticipant: email])
|
||||
role = @"Participant";
|
||||
else if ([[[self container] ownerInContext: nil] isEqualToString: login])
|
||||
role = @"SoRole_Owner";
|
||||
else
|
||||
role = nil;
|
||||
|
||||
return role;
|
||||
}
|
||||
|
||||
@end /* SOGoAppointmentObject */
|
||||
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
iCalCalendar *calendar;
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (NSString *) componentTag;
|
||||
- (iCalCalendar *) calendar;
|
||||
- (iCalRepeatableEntityObject *) component;
|
||||
|
||||
- (NSException *) primarySaveContentString: (NSString *) _iCalString;
|
||||
- (NSException *) primaryDelete;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#import <NGMail/NGSendMail.h>
|
||||
|
||||
#import <SOGo/AgenorUserManager.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
|
||||
#import "common.h"
|
||||
|
||||
@@ -83,6 +84,13 @@ static BOOL sendEMailNotifications = NO;
|
||||
return @"text/calendar";
|
||||
}
|
||||
|
||||
- (NSString *) componentTag
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (iCalCalendar *) calendar
|
||||
{
|
||||
NSString *iCalString;
|
||||
@@ -100,6 +108,13 @@ static BOOL sendEMailNotifications = NO;
|
||||
return calendar;
|
||||
}
|
||||
|
||||
- (iCalRepeatableEntityObject *) component
|
||||
{
|
||||
return (iCalRepeatableEntityObject *)
|
||||
[[self calendar]
|
||||
firstChildWithTag: [self componentTag]];
|
||||
}
|
||||
|
||||
/* raw saving */
|
||||
|
||||
- (NSException *) primarySaveContentString: (NSString *) _iCalString
|
||||
@@ -229,7 +244,7 @@ static BOOL sendEMailNotifications = NO;
|
||||
|
||||
/* construct message */
|
||||
headerMap = [NGMutableHashMap hashMapWithCapacity: 5];
|
||||
|
||||
|
||||
/* NOTE: multipart/alternative seems like the correct choice but
|
||||
* unfortunately Thunderbird doesn't offer the rich content alternative
|
||||
* at all. Mail.app shows the rich content alternative _only_
|
||||
@@ -279,4 +294,27 @@ static BOOL sendEMailNotifications = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) roleOfUser: (NSString *) login
|
||||
inContext: (WOContext *) context
|
||||
{
|
||||
AgenorUserManager *um;
|
||||
iCalRepeatableEntityObject *component;
|
||||
NSString *role, *email;
|
||||
|
||||
um = [AgenorUserManager sharedUserManager];
|
||||
email = [um getEmailForUID: login];
|
||||
|
||||
component = [self component];
|
||||
if ([component isOrganizer: email])
|
||||
role = SOGoRole_Organizer;
|
||||
else if ([component isParticipant: email])
|
||||
role = SOGoRole_Participant;
|
||||
else if ([[[self container] ownerInContext: nil] isEqualToString: login])
|
||||
role = SoRole_Owner;
|
||||
else
|
||||
role = nil;
|
||||
|
||||
return role;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -44,11 +44,6 @@
|
||||
|
||||
@interface SOGoTaskObject : SOGoCalendarComponent
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (iCalToDo *) task;
|
||||
- (iCalToDo *) firstTaskFromCalendar: (iCalCalendar *) calendar;
|
||||
|
||||
/* folder management */
|
||||
|
||||
- (id)lookupHomeFolderForUID:(NSString *)_uid inContext:(id)_ctx;
|
||||
|
||||
@@ -58,11 +58,9 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
||||
mailTemplateDefaultLanguage = @"French";
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (iCalToDo *) task
|
||||
- (NSString *) componentTag
|
||||
{
|
||||
return [self firstTaskFromCalendar: [self calendar]];
|
||||
return @"vtodo";
|
||||
}
|
||||
|
||||
/* iCal handling */
|
||||
@@ -206,21 +204,6 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
||||
return allErrors;
|
||||
}
|
||||
|
||||
- (iCalToDo *) firstTaskFromCalendar: (iCalCalendar *) aCalendar
|
||||
{
|
||||
iCalToDo *task;
|
||||
NSArray *tasks;
|
||||
|
||||
tasks = [aCalendar childrenWithTag: @"vtodo"];
|
||||
if ([tasks count])
|
||||
task = (iCalToDo *) [[tasks objectAtIndex: 0]
|
||||
groupWithClass: [iCalToDo class]];
|
||||
else
|
||||
task = nil;
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
/* "iCal multifolder saves" */
|
||||
|
||||
- (NSException *) saveContentString: (NSString *) _iCal
|
||||
@@ -430,7 +413,7 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
||||
|
||||
/* load existing content */
|
||||
|
||||
task = [self task];
|
||||
task = (iCalToDo *) [self component];
|
||||
|
||||
/* compare sequence if requested */
|
||||
|
||||
@@ -479,7 +462,7 @@ static NSString *mailTemplateDefaultLanguage = nil;
|
||||
NSString *myEMail;
|
||||
|
||||
// TODO: do we need to use SOGoTask? (prefer iCalToDo?)
|
||||
task = [self task];
|
||||
task = (iCalToDo *) [self component];
|
||||
|
||||
if (task == nil) {
|
||||
return [NSException exceptionWithHTTPStatus:500 /* Server Error */
|
||||
|
||||
Reference in New Issue
Block a user