]> err.no Git - scalable-opengroupware.org/commitdiff
finished proposal's edit
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 25 Aug 2004 11:53:11 +0000 (11:53 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 25 Aug 2004 11:53:11 +0000 (11:53 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@266 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxAppointmentProposal.m
SOGo/UI/Scheduler/Version

index 5885bd304cbedd6587d6049f225ce163eb612589..7db31e9e377a099543596d264f998491d61e22af 100644 (file)
@@ -1,3 +1,13 @@
+2004-08-25  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.69
+
+       * UIxAppointmentProposal.m: completed edit functionality. Resources and
+         participants are now passed as query parameters.
+       
+       * UIxAppointmentEditor.m: Resources and Participants are now properly
+         constructed from existing query parameters.
+
 2004-08-24  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.68
index d06a662ee4d73706661f506bb29534831e80a205..f27a0fe453e8d76f160c32bdf890ba9f207d904b 100644 (file)
 - (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
   treatAsResource:(BOOL)_isResource;
 
+- (NSString *)iCalParticipantsAndResourcesStringFromQueryParameters;
+- (NSString *)iCalParticipantsStringFromQueryParameters;
+- (NSString *)iCalResourcesStringFromQueryParameters;
+- (NSString *)iCalStringFromQueryParameter:(NSString *)_qp
+              format:(NSString *)_format;
 @end
 
 #include "common.h"
     @"DTEND:%@\n"
     @"TRANSP:OPAQUE\n"
     @"SEQUENCE:1\n"
+    @"%@"
     @"END:VEVENT\n"
     @"END:VCALENDAR";
+
   NSCalendarDate *lStartDate, *lEndDate;
   NSString       *template, *s;
   unsigned       minutes;
   else {
     minutes = 60;
   }
-  
   lStartDate = [self selectedDate];
   lEndDate   = [lStartDate dateByAddingYears:0 months:0 days:0
-                         hours:0 minutes:minutes seconds:0];
+                           hours:0 minutes:minutes seconds:0];
   
+  s = [self iCalParticipantsAndResourcesStringFromQueryParameters];
   template = [NSString stringWithFormat:iCalStringTemplate,
                         [[self clientObject] nameInContainer],
                         [[NSCalendarDate date] icalString],
                         [lStartDate icalString],
-                        [lEndDate   icalString]];
+             [lEndDate icalString],
+             s];
   return template;
 }
 
+- (NSString *)iCalParticipantsAndResourcesStringFromQueryParameters {
+  NSString *s;
+  
+  s = [self iCalParticipantsStringFromQueryParameters];
+  return [s stringByAppendingString:
+            [self iCalResourcesStringFromQueryParameters]];
+}
+
+- (NSString *)iCalParticipantsStringFromQueryParameters {
+  static NSString *iCalParticipantString = \
+    @"ATTENDEE;ROLE=REQ-PARTICIPANT;CN=\"%@\":mailto:%@\n";
+  
+  return [self iCalStringFromQueryParameter:@"ps"
+               format:iCalParticipantString];
+}
+
+- (NSString *)iCalResourcesStringFromQueryParameters {
+  static NSString *iCalResourceString = \
+    @"ATTENDEE;ROLE=NON-PARTICIPANT;CN=\"%@\":mailto:%@\n";
+
+  return [self iCalStringFromQueryParameter:@"rs"
+               format:iCalResourceString];
+}
+
+- (NSString *)iCalStringFromQueryParameter:(NSString *)_qp
+              format:(NSString *)_format
+{
+  AgenorUserManager *um;
+  NSMutableString *iCalRep;
+  NSString *s;
+
+  um = [AgenorUserManager sharedUserManager];
+  iCalRep = (NSMutableString *)[NSMutableString string];
+  s = [self queryParameterForKey:_qp];
+  if(s && [s length] > 0) {
+    NSArray *es;
+    unsigned i, count;
+    
+    es = [s componentsSeparatedByString:@","];
+    count = [es count];
+    for(i = 0; i < count; i++) {
+      NSString *email, *cn;
+      
+      email = [es objectAtIndex:i];
+      cn = [um getCNForUID:[um getUIDForEmail:email]];
+      [iCalRep appendFormat:_format, cn, email];
+    }
+  }
+  return iCalRep;
+}
+
 /* helper */
 
 - (NSString *)_completeURIForMethod:(NSString *)_method {
index 47bd022f5463377b72de1f6fdf0a0cf3c5b812ac..99858480481acc02eb613dcd1c4cfec78173ae36 100644 (file)
 
 - (NSMutableDictionary *)currentQueryParameters;
 - (NSDictionary *)currentHourQueryParametersForFirstHalf:(BOOL)_first;
+
+- (void)setICalPersons:(NSArray *)_ps asQueryParameter:(NSString *)_qp;
 @end
 
 #include <SoObjects/Appointments/SOGoAppointmentFolder.h>
 #include <NGExtensions/NGCalendarDateRange.h>
+#include "iCalPerson+UIx.h"
 #include "common.h"
 
 @implementation UIxAppointmentProposal
   if(!self->currentQueryParameters) {
     self->currentQueryParameters = [[self queryParameters] mutableCopy];
     [self->currentQueryParameters setObject:[self duration] forKey:@"dur"];
-    // TODO: add participants
+    [self setICalPersons:[self resources] asQueryParameter:@"rs"];
+    [self setICalPersons:[self participants] asQueryParameter:@"ps"];
   }
   return self->currentQueryParameters;
 }
 
+- (void)setICalPersons:(NSArray *)_ps asQueryParameter:(NSString *)_qp {
+  NSMutableString *s;
+  unsigned i, count;
+  
+  s = [[NSMutableString alloc] init];
+  count = [_ps count];
+  for(i = 0; i < count; i++) {
+    iCalPerson *p = [_ps objectAtIndex:i];
+    [s appendString:[p rfc822Email]];
+    if(i != (count - 1))
+      [s appendString:@","];
+  }
+  [[self currentQueryParameters] setObject:s forKey:_qp];
+  [s release];
+}
+
 - (NSDictionary *)currentHourQueryParametersForFirstHalf:(BOOL)_first {
   NSMutableDictionary *qp;
   NSString *hmString;
index e5294622fd6fe57ed83cce2638611e44f47e3213..daa21696827167923d01d2affb2871a4720ec3b5 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-SUBMINOR_VERSION:=68
+SUBMINOR_VERSION:=69
 
 # v0.9.67 requires SOPE 4.3
 # v0.9.61 requires libNGExtensions v4.2.102