+2005-08-02 Helge Hess <helge.hess@skyrix.com>
+
+ * SOGoAppointmentObject.[hm]: added method to change participation
+ status of logged-in user (v0.9.50)
+
2005-07-21 Marcus Mueller <znek@mulle-kybernetik.com>
* SOGoAppointmentFolder.m: place a hint ('isRecurrent') into flattened
/*
- Copyright (C) 2004 SKYRIX Software AG
+ Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __Appointments_SOGoAppointmentObject_H__
#define __Appointments_SOGoAppointmentObject_H__
- (NSException *)saveContentString:(NSString *)_iCalString;
- (NSException *)delete;
+- (NSException *)changeParticipationStatus:(NSString *)_status
+ inContext:(id)_ctx;
+
@end
#endif /* __Appointments_SOGoAppointmentObject_H__ */
return [self deleteWithBaseSequence:0];
}
+
+- (NSException *)changeParticipationStatus:(NSString *)_status
+ inContext:(id)_ctx
+{
+ SOGoAppointment *apt;
+ iCalPerson *p;
+ NSString *newContent;
+ NSException *ex;
+ NSString *myEMail;
+
+ // TODO: do we need to use SOGoAppointment? (prefer iCalEvent?)
+ apt = [[SOGoAppointment alloc] initWithICalString:[self iCalString]];
+ if (apt == nil) {
+ return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+ reason:@"unable to parse appointment record"];
+ }
+
+ myEMail = [[_ctx activeUser] email];
+ if ((p = [apt findParticipantWithEmail:myEMail]) == nil) {
+ return [NSException exceptionWithHTTPStatus:404 /* Not Found */
+ reason:@"user does not participate in this "
+ @"appointment"];
+ }
+
+ [p setPartStat:_status];
+ newContent = [[[apt iCalString] copy] autorelease];
+
+ // TODO: send iMIP reply mails?
+
+ [apt release]; apt = nil;
+
+ if (newContent == nil) {
+ return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+ reason:@"Could not generate iCalendar data ..."];
+ }
+
+ if ((ex = [self saveContentString:newContent]) != nil) {
+ // TODO: why is the exception wrapped?
+ return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+ reason:[ex reason]];
+ }
+
+ return nil /* means: no error */;
+}
+
+
/* message type */
- (NSString *)outlookMessageClass {
# Version file
-SUBMINOR_VERSION:=49
+SUBMINOR_VERSION:=50
# v0.9.42 requires libSOGo v0.9.54
# v0.9.32 requires libGDLContentStore v4.5.26
+2005-08-02 Helge Hess <helge.hess@skyrix.com>
+
+ * v0.9.147
+
+ * UIxComponent+Agenor.m: use SOGoUser methods to get email/cn
+
+ * UIxAppointmentEditor.m: moved status change operation to SoObject
+
2005-07-23 Helge Hess <helge.hess@opengroupware.org>
* UIxAppointmentPrintview.m, UIxCalDayListview.m: fixed include pathes
respondsToSelector:@selector(saveContentString:)];
}
+- (NSException *)validateObjectForStatusChange {
+ BOOL ok;
+ id co;
+
+ co = [self clientObject];
+ ok = [co respondsToSelector:@selector(changeParticipationStatus:inContext:)];
+ if (!ok) {
+ return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
+ reason:
+ @"method cannot be invoked on the specified object"];
+ }
+ return nil;
+}
+
- (void)loadValuesFromAppointment:(SOGoAppointment *)_appointment {
NSString *s;
iCalRecurrenceRule *rrule;
- (id)acceptOrDeclineAction:(BOOL)_accept {
// TODO: this should live in the SoObjects
- SOGoAppointment *apt;
- iCalPerson *p;
- NSString *iCal, *content;
- NSException *ex;
-
- if (![self isWriteableClientObject]) {
- /* 400 == Bad Request */
- return [NSException exceptionWithHTTPStatus:400
- reason:@"method cannot be invoked on "
- @"the specified object"];
- }
- iCal = [[self clientObject] valueForKey:@"iCalString"];
- apt = [[SOGoAppointment alloc] initWithICalString:iCal];
- if (apt == nil) {
- /* 500 == Internal Server Error */
- return [NSException exceptionWithHTTPStatus:500
- reason:@"unable to parse appointment"];
- }
-
- if ((p = [apt findParticipantWithEmail:[self emailForUser]]) == nil) {
- /* 404 == Not found */
- return [NSException exceptionWithHTTPStatus:404
- reason:@"user does not participate in this "
- @"appointment"];
- }
+ NSException *ex;
- // TODO: add tentative
- if (_accept)
- [p setParticipationStatus:iCalPersonPartStatAccepted];
- else
- [p setParticipationStatus:iCalPersonPartStatDeclined];
-
- content = [apt iCalString];
- [apt release];
-
- if (content == nil) {
- /* 500 == Internal Server Error */
- return [NSException exceptionWithHTTPStatus:500
- reason:@"Could not create iCalendar data ..."];
- }
+ if ((ex = [self validateObjectForStatusChange]) != nil)
+ return ex;
- ex = [[self clientObject] saveContentString:content];
- if (ex != nil) {
- /* 500 == Internal Server Error */
- return [NSException exceptionWithHTTPStatus:500
- reason:[ex reason]];
- }
+ ex = [[self clientObject] changeParticipationStatus:
+ _accept ? @"ACCEPTED" : @"DECLINED"
+ inContext:[self context]];
+ if (ex != nil) return ex;
return [self redirectToLocation:[self _completeURIForMethod:@"../view"]];
}
#include "UIxComponent+Agenor.h"
#include <SOGo/AgenorUserManager.h>
#include <SOGo/WOContext+Agenor.h>
+#include <SOGo/SOGoUser.h>
#include "common.h"
@implementation UIxComponent(Agenor)
- (NSString *)emailForUser {
- NSString *uid;
-
- uid = [[self user] login];
- return [[AgenorUserManager sharedUserManager] getEmailForUID:uid];
+ return [[[self context] activeUser] email];
}
- (NSString *)cnForUser {
- NSString *uid;
-
- uid = [[self user] login];
- return [[AgenorUserManager sharedUserManager] getCNForUID:uid];
+ return [[[self context] activeUser] cn];
}
- (BOOL)isAccessRestricted {
# Version file
-SUBMINOR_VERSION:=146
+SUBMINOR_VERSION:=147
+# v0.9.147 requires Appointments v0.9.50
# v0.9.136 requires SOGoUI v0.9.30
# v0.9.123 requires Appointments v0.9.35
# v0.9.123 requires SOGoUI v0.9.24
const:spaceIcon = "tbtv_space_17x17.gif"
>
<var:tree-data const:isTreeElement="YES" const:treeLink=""
- var:icon="item.iconName" var:cornerIcon="item.iconName">
+ var:icon="item.iconName"
+ var:cornerIcon="item.iconName">
<a var:href="item.link">
<span class="treecell">
<var:if condition="item.isActiveNode">