]> err.no Git - scalable-opengroupware.org/commitdiff
moved partstat modification from UI to SoObject
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 2 Aug 2005 10:26:15 +0000 (10:26 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 2 Aug 2005 10:26:15 +0000 (10:26 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@936 d1b88da0-ebda-0310-925b-ed51d893ca5b

SoObjects/Appointments/ChangeLog
SoObjects/Appointments/SOGoAppointmentObject.h
SoObjects/Appointments/SOGoAppointmentObject.m
SoObjects/Appointments/Version
UI/Scheduler/ChangeLog
UI/Scheduler/UIxAppointmentEditor.m
UI/Scheduler/UIxComponent+Agenor.m
UI/Scheduler/Version
UI/Templates/MailerUI/UIxMailTree.wox

index 7dd19f549733ef92a2de8a9432543b70d6d4e04f..fed2c28bf666fb9dcd1949d1c3616834fc80a961 100644 (file)
@@ -1,3 +1,8 @@
+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
index e7cedb724d661de6ac9dc0aafa1f3961df91320b..ef2280c80b76ff7f44ea8891ed30ff8f992db336 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2004 SKYRIX Software AG
+  Copyright (C) 2004-2005 SKYRIX Software AG
 
   This file is part of OpenGroupware.org.
 
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #ifndef __Appointments_SOGoAppointmentObject_H__
 #define __Appointments_SOGoAppointmentObject_H__
@@ -65,6 +64,9 @@
 - (NSException *)saveContentString:(NSString *)_iCalString;
 - (NSException *)delete;
 
+- (NSException *)changeParticipationStatus:(NSString *)_status
+  inContext:(id)_ctx;
+
 @end
 
 #endif /* __Appointments_SOGoAppointmentObject_H__ */
index 7c1779f8d026742847a7504c85af5c14d7084f2d..a563ceed2159c11f50851f98ea4f2499c4d10a19 100644 (file)
@@ -492,6 +492,52 @@ static NSString                  *mailTemplateDefaultLanguage = nil;
   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 {
index c0a8a3e89c8efe865544bed831505ae2924362b0..58ecf6d2ca3a9c304c5dfa56ae2105adef3ac772 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=49
+SUBMINOR_VERSION:=50
 
 # v0.9.42 requires libSOGo            v0.9.54
 # v0.9.32 requires libGDLContentStore v4.5.26
index 77d57ed6587c54d0c1dc87aa016f7fd7f30cb6ed..9138165121833a807522af45c9fab2b2471fe99e 100644 (file)
@@ -1,3 +1,11 @@
+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
index d0a12451c419c5c953c8a1d52734524658467f5c..676a125d007b61e167758809238752e51c7b6a15 100644 (file)
                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"]];
 }
index 9e3ae2733403e956653c5e22032e92f5c4c919cf..216dbc02119d4a8336ac54a304d21df24ba96ebf 100644 (file)
 #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 {
index 6a20f8b871e06ac0364c4a5272c238183e46e028..03b6d38520738e1634215f0872d3f0cdeca7ce89 100644 (file)
@@ -1,7 +1,8 @@
 # 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
index f88e16ff6eb9859104fa4e495af2b23f4821dfcc..5f940b32fc604e26aa9701d62ae7296ccd28c94b 100644 (file)
@@ -22,7 +22,8 @@
     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">