]> err.no Git - scalable-opengroupware.org/commitdiff
general enhancements
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sat, 14 Aug 2004 15:37:04 +0000 (15:37 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sat, 14 Aug 2004 15:37:04 +0000 (15:37 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@207 d1b88da0-ebda-0310-925b-ed51d893ca5b

19 files changed:
SOGo/SOGo.xcode/project.pbxproj
SOGo/UI/SOGoUI/ChangeLog
SOGo/UI/SOGoUI/README [new file with mode: 0644]
SOGo/UI/SOGoUI/UIxComponent.h
SOGo/UI/SOGoUI/UIxComponent.m
SOGo/UI/SOGoUI/Version
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxAppointmentEditor.wox
SOGo/UI/Scheduler/UIxAppointmentView.h
SOGo/UI/Scheduler/UIxAppointmentView.m
SOGo/UI/Scheduler/UIxAppointmentView.wox
SOGo/UI/Scheduler/Version
SOGoLogic/AgenorUserManager.h
SOGoLogic/AgenorUserManager.m
SOGoLogic/ChangeLog
SOGoLogic/SOGoAppointment.h
SOGoLogic/SOGoAppointment.m
SOGoLogic/Version

index 312d1459fa41d548d0000856b7a008e68f98d025..d051677a2fd0e1e028b46116ae8fec21f7be4780 100644 (file)
                        refType = 4;
                        sourceTree = "<group>";
                };
+               AD071F6606CE66DF00A9EEF4 = {
+                       fileEncoding = 4;
+                       indentWidth = 8;
+                       isa = PBXFileReference;
+                       lastKnownFileType = text;
+                       path = README;
+                       refType = 4;
+                       sourceTree = "<group>";
+                       tabWidth = 8;
+               };
                AD152B6F06AC159A002375D2 = {
                        fileEncoding = 4;
                        isa = PBXFileReference;
                                AD6BCF12069D77E9003664CD,
                                AD6BCF0E069D77E9003664CD,
                                AD6BCF0F069D77E9003664CD,
+                               AD071F6606CE66DF00A9EEF4,
                                AD6BCF10069D77E9003664CD,
                                AD6BCF11069D77E9003664CD,
                                AD0712CA06C917A600A9EEF4,
index 392ec75dbbdee9f4e32d42469629bd770aee4bd8..cffab75b330a53863420044207acf9e9dc7a363f 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-14  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxComponent.m: new method -isUIxDebugEnabled, triggered by new
+         default "SOGoUIxDebugEnabled" (v0.9.9)
+
 2004-08-13  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.8
diff --git a/SOGo/UI/SOGoUI/README b/SOGo/UI/SOGoUI/README
new file mode 100644 (file)
index 0000000..18dafff
--- /dev/null
@@ -0,0 +1,7 @@
+Defaults
+========
+
+
+Name                   Value   Synopsis
+------------------------------------------------------------------------------
+SOGoUIxDebugEnabled    BOOL    Trigger display of debug UI. Default is NO.
index 359c7c8539bb76e137e8a19d39c93653e77dcd6d..0676cd2792a7b11ac3c145afaa5636c5b53260c8 100644 (file)
@@ -67,6 +67,9 @@
 /* locale */
 - (NSDictionary *)locale;
 
+/* Debugging */
+- (BOOL)isUIxDebugEnabled;
+
 @end
 
 #endif /* __UIxComponent_H_ */
index ccbcba10ef25b46b2628a5c518828a1f06cbae25..e581e5a577c7394e613d6d19e0aa1f4e694834e0 100644 (file)
@@ -42,7 +42,13 @@ static NSMutableArray *abbrDayLabelKeys = nil;
 static NSMutableArray *monthLabelKeys = nil;
 static NSMutableArray *abbrMonthLabelKeys = nil;
 
+static BOOL uixDebugEnabled = NO;
+
 + (void)initialize {
+    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+    
+    uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"];
+
     if (MET == nil) {
         MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain];
         GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain];
@@ -368,4 +374,10 @@ static NSMutableArray *abbrMonthLabelKeys = nil;
     return [[self context] valueForKey:@"locale"];
 }
 
+/* Debugging */
+
+- (BOOL)isUIxDebugEnabled {
+    return uixDebugEnabled;
+}
+
 @end /* UIxComponent */
index 28292b549059af8a6800e33ac74ed5ab727067ed..81be7eb6e79defb0b93e0ca78f8a44c310c033c2 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=8
+SUBMINOR_VERSION:=9
index 317a88bdd25b47548d61195e3d61c578b84f97dd..a90e2abf9b340a2dc80c62958ae02c75430ef0bd 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-14  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxAppointmentView.[h,m,wox], UIxAppointmentEditor.[h,m,wox]:
+         general enhancements, use new API. (v0.9.35)
+
 2004-08-13  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.34
index dce7694d57830b12a336c3cd594b5c43bda60fad..7f4e6619b653ca8993172b371bb9ce96d0909f49 100644 (file)
@@ -24,8 +24,7 @@
 
 /* TODO: CLEAN UP */
 
-@class NSString;
-@class SOGoAppointment;
+@class NSString, SOGoAppointment, iCalPerson;
 
 @interface UIxAppointmentEditor : UIxComponent
 {
 - (NSString *)iCalStringTemplate;
 - (NSString *)iCalString;
 
+- (NSString *)emailForUser;
+- (NSString *)cnForUser;
+
 - (NSString *)_completeURIForMethod:(NSString *)_method;
 
+- (iCalPerson *)getOrganizer;
+- (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
+                          treatAsResource:(BOOL)_isResource;
 @end
 
+#include "common.h"
 #include <SOGoUI/SOGoDateFormatter.h>
 #include <SOGoLogic/SOGoAppointment.h>
 #include <Appointments/SOGoAppointmentFolder.h>
 #include <Appointments/SOGoAppointmentObject.h>
-#include "iCalPerson+UIx.h"
-#include "common.h"
 #include <NGiCal/NGiCal.h>
+#include <SOGoLogic/AgenorUserManager.h>
+#include "iCalPerson+UIx.h"
 
 @interface NSDate(UsedPrivates)
 - (NSString *)icalString; // TODO: this is in NGiCal
 
 /* backend */
 
-
 - (SOGoAppointment *)appointment {
   if (self->appointment == nil) {
     self->appointment = [[SOGoAppointment alloc]
   return self->appointment;
 }
 
-- (BOOL)hasParticipants {
-    return [[self participants] count] != 0;
-}
-
-- (NSArray *)participants {
-#warning TODO: FILTER ROLE!
-    return [self->appointment attendees];
-}
-
-- (NSArray *)resources {
-#warning TODO: FILTER ROLE!
-    return [self->appointment attendees];
-}
-
-
 /* JavaScript */
 
 - (NSString *)jsCode {
     return [self completeHrefForMethod:uri];
 }
 
-/* HACK: this is for agenor only */
+
+/* email, cn */
+
 - (NSString *)emailForUser {
     NSString *uid;
-    NSRange r;
 
-#warning !! USE USER MANAGER INSTEAD!
     uid = [[self user] login];
-    r = [uid rangeOfString:@"@"];
-    if(r.length > 0)
-        return uid;
-    return [NSString stringWithFormat:@"%@@equipement.gouv.fr", uid];
+    return [[AgenorUserManager sharedUserManager] getEmailForUID:uid];
+}
+
+- (NSString *)cnForUser {
+    NSString *uid;
+    
+    uid = [[self user] login];
+    return [[AgenorUserManager sharedUserManager] getCNForUID:uid];
 }
 
 - (NSString *)combinedCNAndEmailForUser {
     return [NSString stringWithFormat:@"%@;%@",
         [self emailForUser],
-        [self shortUserNameForDisplay]];
+        [self cnForUser]];
 }
 
 - (NSString *)combinedCNAndEmail {
   return date;
 }
 
+- (iCalPerson *)getOrganizer {
+    iCalPerson *p;
+    NSString *emailProp;
+
+    emailProp = [NSString stringWithFormat:@"mailto:%@",
+        [self emailForUser]];
+    p = [[iCalPerson alloc] init];
+    [p setEmail:emailProp];
+    [p setCn:[self cnForUser]];
+    return [p autorelease];
+}
+
+- (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
+                          treatAsResource:(BOOL)_isResource
+{
+    unsigned i, count;
+    NSMutableArray *result;
+
+    count = [_values count];
+    result = [[NSMutableArray alloc] initWithCapacity:count];
+    for (i = 0; i < count; i++) {
+        NSString   *pString, *email, *cn;
+        NSRange r;
+        iCalPerson *p;
+        
+        pString = [_values objectAtIndex:i];
+        if([pString length] == 0)
+            continue;
+        
+        /* delimiter between email and cn */
+        r = [pString rangeOfString:@";"];
+        if(r.length > 0) {
+            email = [pString substringToIndex:r.location];
+            if(r.location + 1 < [pString length]) {
+                cn = [pString substringFromIndex:r.location + 1];
+            }
+            else {
+                cn = nil;
+            }
+        }
+        else {
+            email = pString;
+            cn = nil;
+        }
+        if(cn == nil) {
+            /* fallback */
+            AgenorUserManager *um = [AgenorUserManager sharedUserManager];
+            cn = [um getCNForUID:[um getUIDForEmail:email]];
+        }
+        p = [[iCalPerson alloc] init];
+        [p setEmail:[@"mailto:" stringByAppendingString:email]];
+        if(cn)
+            [p setCn:cn];
+
+        /* see RFC2445, sect. 4.2.16 for details */
+        if(_isResource) {
+            [p setRole:@"X-OGo-RESOURCE"];
+        }
+        else {
+            [p setRole:@"REQ-PARTICIPANT"];
+        }
+        [result addObject:p];
+        [p release];
+    }
+    return [result autorelease];
+}
+
 /* for testing only */
 - (id)testAction {
     WORequest      *req;
   NSString       *iCalString;
   NSString       *summary, *location, *uri;
   NSCalendarDate *sd, *ed;
-  NSArray        *ps;
-  unsigned       i, count;
+  NSArray        *attendees;
   WORequest      *req;
 
   
   [apt setLocation:location];
 
   [apt removeAllAttendees]; /* clean up */
-  ps = [req formValuesForKey:@"participants"];
-  count = [ps count];
-  for (i = 0; i < count; i++) {
-    NSString   *pString, *email, *cn;
-    NSRange r;
-    iCalPerson *p;
-    
-    pString = [ps objectAtIndex:i];
-    if([pString length] == 0)
-      continue;
-
-    /* delimiter between email and cn */
-    r = [pString rangeOfString:@";"];
-    if(r.length > 0) {
-        email = [pString substringToIndex:r.location];
-        if(r.location + 1 < [pString length]) {
-            cn = [pString substringFromIndex:r.location + 1];
-        }
-        else {
-            cn = nil;
-        }
-    }
-    else {
-        email = pString;
-        cn = nil;
-    }
-    if(cn == nil) {
-        /* construct a fake CN if possible */
-        r = [email rangeOfString:@"@"];
-        if (r.length > 0)
-            cn = [email substringToIndex:r.location];
-    }
-    p = [[iCalPerson alloc] init];
-    [p setEmail:[@"mailto:" stringByAppendingString:email]];
-    if(cn)
-      [p setCn:cn];
-    [apt addToAttendees:p];
-    [p release];
-  }
-  
+  attendees = \
+      [self getICalPersonsFromFormValues:[req formValuesForKey:@"participants"]
+            treatAsResource:NO];
+  [apt appendAttendees:attendees];
+  attendees = \
+      [self getICalPersonsFromFormValues:[req formValuesForKey:@"resources"]
+                         treatAsResource:YES];
+  [apt appendAttendees:attendees];
+  [apt setOrganizer:[self getOrganizer]];
+
   /* receive current representation for save operation */
   iCalString = [apt iCalString];
   [apt release]; apt = nil;
index e054b63c70ca33cc6dbe3919a841192bac28cf60..3ac73b49bd3861b2d0001c0551632ae2663568a9 100644 (file)
                   />
                   <hr />
                   <table id="participants">
-                    <var:if condition="hasParticipants" const:negate="YES">
+                    <var:if condition="appointment.hasParticipants"
+                            const:negate="YES"
+                    >
                       <tr>
                         <td><input type="checkbox"
                                    checked="YES"
                                    var:id="emailForUser"
                                    name="participants"
                             /></td>
-                        <td><var:string value="shortUserNameForDisplay" /></td>
+                        <td><var:string value="cnForUser" /></td>
                       </tr>
                     </var:if>
-                    <var:if condition="hasParticipants">
-                      <var:foreach list="participants" item="item">
+                    <var:if condition="appointment.hasParticipants">
+                      <var:foreach list="appointment.participants"
+                                   item="item"
+                      >
                         <tr>
                           <td><input type="checkbox"
                                      checked="YES"
                   />
                   <hr />
                   <table id="resources">
-                    <var:foreach list="resources" item="item">
+                    <var:foreach list="appointment.resources"
+                                 item="item"
+                    >
                       <tr>
                         <td><input type="checkbox"
                                    checked="YES"
       </tr>
     </table>
   </form>
-  <!-- -->
-  <hr />
-  clientObject: <var:string value="clientObject" />
+  <var:if condition="isUIxDebugEnabled">
+    <hr />
+    clientObject: <var:string value="clientObject" />
+  </var:if>
 </var:component>
index 02f1b0c39aa401941455a3222c41cccda23e9246..c068b5b769dc7e5c674d36e5df9a25138242c972 100644 (file)
@@ -5,11 +5,14 @@
 
 #include <SOGoUI/UIxComponent.h>
 
+@class SOGoDateFormatter;
+
 @interface UIxAppointmentView : UIxComponent
 {
   NSString *tabSelection;
   id appointment;
   id attendee;
+  SOGoDateFormatter *dateFormatter;
 }
 
 - (id)appointment;
index 68f41da4b9c49215356b5a5a0d45e03853eef358..e04dd8668e387cceb59b7a92163fd9edc8d73dca 100644 (file)
@@ -1,15 +1,17 @@
 // $Id$
 
 #include "UIxAppointmentView.h"
-#include "common.h"
 #include <NGiCal/NGiCal.h>
 #include <SOGoLogic/SOGoAppointment.h>
+#include <SOGoUI/SOGoDateFormatter.h>
+#include "common.h"
 
 @implementation UIxAppointmentView
 
 - (void)dealloc {
   [self->appointment release];
   [self->attendee    release];
+  [self->dateFormatter release];
   [super dealloc];
 }
 
   return self->attendee;
 }
 
-/* backend */
-
-- (SOGoAppointment *)appointment {
-  NSString *iCalString;
-  
-  if (self->appointment)
-    return self->appointment;
-  
-  iCalString = [[self clientObject] valueForKey:@"iCalString"];
-  if (![iCalString isNotNull] || [iCalString length] == 0) {
-    [self debugWithFormat:@"ERROR(%s): missing iCal string!", 
-         __PRETTY_FUNCTION__];
-    return nil;
-  }
-  
-  self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
-  return self->appointment;
+- (SOGoDateFormatter *)dateFormatter {
+    if(self->dateFormatter == nil) {
+        self->dateFormatter = \
+        [[SOGoDateFormatter alloc] initWithLocale:[self locale]];
+        [self->dateFormatter setFullWeekdayNameAndDetails];
+    }
+    return self->dateFormatter;
 }
 
-- (NSString *)formattedAptStartTime {
+- (NSCalendarDate *)startTime {
   NSCalendarDate *date;
     
   date = [[self appointment] startDate];
   [date setTimeZone:[self viewTimeZone]];
-  return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+  return date;
 }
 
-- (NSString *)formattedAptEndTime {
+- (NSCalendarDate *)endTime {
   NSCalendarDate *date;
   
   date = [[self appointment] endDate];
   [date setTimeZone:[self viewTimeZone]];
-  return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+  return date;
+}
+
+- (NSString *)resourcesAsString {
+    NSArray *resources, *cns;
+
+    resources = [[self appointment] resources];
+    cns = [resources valueForKey:@"cnForDisplay"];
+    return [cns componentsJoinedByString:@"<br />"];
+}
+
+
+/* backend */
+
+- (SOGoAppointment *)appointment {
+    NSString *iCalString;
+    
+    if (self->appointment)
+        return self->appointment;
+    
+    iCalString = [[self clientObject] valueForKey:@"iCalString"];
+    if (![iCalString isNotNull] || [iCalString length] == 0) {
+        [self debugWithFormat:@"ERROR(%s): missing iCal string!", 
+            __PRETTY_FUNCTION__];
+        return nil;
+    }
+    
+    self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
+    return self->appointment;
 }
 
 
index b7a226db9457b0fe58b3de58a2402967317c4eaf..9b7138cf6817a6918c7683d3afd24a97318f3f8e 100644 (file)
         <table border="0" cellpadding="2" width="100%" cellspacing="0">
           <tr bgcolor="#e8e8e0">
             <td align="left">
-              <span class="aptview_title"><var:string value="formattedAptStartTime" /></span>
+              <span class="aptview_title"
+              ><var:string value="startTime"
+                           formatter="dateFormatter"
+               /></span>
             </td>
             <td align="right" >
                 <table border='0' cellpadding='0' cellspacing='1'>
                     <tr>
-                        <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+                        <td class="button_auto_env"
+                            nowrap="true"
+                            valign='middle'
+                            align='center'
+                        >
                             <a class="button_auto"
                                href="printview"
                                var:queryDictionary="queryParameters"
                                target="SOGoPrintView"
                             >printview</a>
                         </td>
-                        <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+                        <td class="button_auto_env"
+                            nowrap="true"
+                            valign='middle'
+                            align='center'
+                        >
                             <a class="button_auto"
                                href="edit"
                                var:queryDictionary="queryParameters"
                             >edit</a>
                         </td>
-                        <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+                        <td class="button_auto_env"
+                            nowrap="true"
+                            valign='middle'
+                            align='center'
+                        >
                             <a class="button_auto"
                                href="delete"
                                var:queryDictionary="queryParameters"
         >
           <uix:tab const:key="attributes"
                    const:label="attributes"
-                   var:href="attributesTabLink">
-              <table width="100%" border="0" cellpadding="4" cellspacing="0">
+                   var:href="attributesTabLink"
+          >
+            <table width="100%" border="0" cellpadding="4" cellspacing="0">
               <tr valign="top">
                 <td align="right" width="15%" bgcolor="#E8E8E0">
                     <span class="aptview_text">Start time:</span>
                 </td>
                 <td align="left" bgcolor="#FFFFF0">
                     <span class="aptview_text">
-                      <var:string value="formattedAptStartTime" />
+                      <var:string value="startTime"
+                                  formatter="dateFormatter"
+                      />
                     </span>
                 </td>
               </tr>
                 </td>
                 <td align="left" bgcolor="#FFFFF0">
                   <span class="aptview_text">
-                    <var:string value="formattedAptEndTime" />
+                    <var:string value="endTime"
+                                formatter="dateFormatter"
+                    />
                   </span>
                 </td>
               </tr>
-              </table>
+              <tr valign="top">
+                <td align="right" width="15%" bgcolor="#E8E8E0">
+                  <span class="aptview_text">Resources:</span>
+                </td>
+                <td align="left" bgcolor="#FFFFF0">
+                  <span class="aptview_text">
+                    <var:string value="resourcesAsString"
+                                const:escapeHTML="NO"
+                    />
+                  </span>
+                </td>
+              </tr>
+              <tr valign="top">
+                <td align="right" width="15%" bgcolor="#E8E8E0">
+                  <span class="aptview_text">Organizer:</span>
+                </td>
+                <td align="left" bgcolor="#FFFFF0">
+                  <span class="aptview_text">
+                    <var:string value="appointment.organizer.cnForDisplay" />
+                  </span>
+                </td>
+              </tr>
+              <tr valign="top">
+                <td align="right" width="15%" bgcolor="#E8E8E0">
+                  <span class="aptview_text">Comment:</span>
+                </td>
+                <td align="left" bgcolor="#FFFFF0">
+                  <span class="aptview_text">
+                    <var:string value="appointment.comment" />
+                  </span>
+                </td>
+              </tr>
+            </table>
           </uix:tab>
           <uix:tab const:key="participants"
                    const:label="participants"
                     <span class="aptview_title">Email</span>
                 </td>
               </tr>
-              <var:foreach list="appointment.attendees" item="attendee">
+              <var:foreach list="appointment.participants"
+                           item="attendee"
+              >
               <tr valign="top">
                 <td align="left" bgcolor="#FFFFF0">
                   <span class="aptview_text">
                 <td align="left" bgcolor="#FFFFF0">
                   <span class="aptview_text">
                     <a var:href="attendee.email"
-                       ><var:string value="attendee.rfc822Email" /></a>
+                    ><var:string value="attendee.rfc822Email" /></a>
                   </span>
                 </td>
               </tr>
               </var:foreach>
               </table>
           </uix:tab>
-          <uix:tab const:key="debug"
-                   const:label="DEBUG"
-                   var:href="debugTabLink">
-            SOGo Server - <var:string value="name"/>
-            <br />
-            Client: <var:string value="clientObject"/>
-            <br />
-            Group:      <var:string value="clientObject.group"/><br />
-            Deletable:  <var:string value="clientObject.isDeletionAllowed"/><br />
-            Generation: <var:string value="clientObject.zlGenerationCount"/><br />
-            MsgClass:   <var:string value="clientObject.outlookMessageClass"/><br />
-
-            <hr />
-            As iCal:<br />
-            <pre><var:string value="clientObject.iCalString"/></pre>
-
-            <hr />
-            As Mail:<br />
-            <pre><var:string value="clientObject.iCalMailString"/></pre>
-
-          </uix:tab>
+          <var:if condition="isUIxDebugEnabled">
+            <uix:tab const:key="debug"
+                     const:label="DEBUG"
+                     var:href="debugTabLink">
+              SOGo Server - <var:string value="name"/>
+              <br />
+              Client: <var:string value="clientObject"/>
+              <br />
+              Group:      <var:string value="clientObject.group"
+                          /><br />
+              Deletable:  <var:string value="clientObject.isDeletionAllowed"
+                          /><br />
+              Generation: <var:string value="clientObject.zlGenerationCount"
+                          /><br />
+              MsgClass:   <var:string value="clientObject.outlookMessageClass"
+                          /><br />
+  
+              <hr />
+              As iCal:<br />
+              <pre><var:string value="clientObject.iCalString"/></pre>
+  
+              <hr />
+              As Mail:<br />
+              <pre><var:string value="clientObject.iCalMailString"/></pre>
+  
+            </uix:tab>
+          </var:if>
         </uix:tabview>
     </td>
   </tr>
index 8c14e0bf3a706d3f64a618e0092a0155527e6233..cd172534a3075a5605700afbc00158a14ada0704 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-SUBMINOR_VERSION:=33
+SUBMINOR_VERSION:=35
 
 # v0.9.31 requires libWEExtensions v4.2.52
 # v0.9.29 requires libWEExtensions v4.2.51
index 6dff70ec639814a923ea572ef3e202cedf1a758a..2d9177e285e3eeb24d4ff12c40ccb5c52589b6b3 100644 (file)
 
 + (id)sharedUserManager;
 
-- (NSString *)getUIDForEMail:(NSString *)_email;
+- (NSString *)getUIDForEmail:(NSString *)_email;
 - (NSString *)getEmailForUID:(NSString *)_uid;
 
+- (NSString *)getCNForUID:(NSString *)_uid;
+
 @end
 
 #endif /* __AgenorUserManager_H_ */
index aec2deb4f6df5eeede80862b1622c7e626ab5454..240bf544e803fc4326b067182b3a614aab04356b 100644 (file)
@@ -46,7 +46,7 @@
 }
 
 
-- (NSString *)getUIDForEMail:(NSString *)_email {
+- (NSString *)getUIDForEmail:(NSString *)_email {
     NSRange r;
     NSString *domain;
 
index d92abf7f7bff76dccba48858f1e1ae460f8decc9..f332091bd6773532b3b7f8ac195d23c1f6641b87 100644 (file)
@@ -1,3 +1,16 @@
+2004-08-14  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.4
+
+       * AgenorUserManager.[hm]: fixed typo, exposed new method
+         -getCNForUID:. This is very naive and should be fixed to use
+         LDAP instead.
+
+       * SOGoAppointment.[hm]: ROLE is set properly now. Added
+         -participants and -resources to differentiate between specific
+         roles in a UI convenient way. Resources are indentified via a
+         custom ROLE dubbed "X-OGo-RESOURCE".
+
 2004-08-13  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * AgenorUserManager.[hm]: new singleton object to manage Agenor
@@ -19,4 +32,4 @@
 
 2004-06-25  Marcus Mueller  <znek@mulle-kybernetik.com>
 
-       * created.
\ No newline at end of file
+       * created.
index 1b17ed4c9d37b5a52e82d7ec3961987c870dff4b..1f72436ae3e06b4ad675f5e34f8840da29426b2f 100644 (file)
@@ -34,6 +34,7 @@
 {
     id calendar;
     id event;
+    id participants;
 }
 
 - (id)initWithICalString:(NSString *)_iCal;
 
 - (void)removeAllAttendees;
 - (void)addToAttendees:(iCalPerson *)_person;
+- (void)appendAttendees:(NSArray *)_persons;
 - (NSArray *)attendees;
 
-/* generating iCal */
+/* attendees -> role != X-OGo-RESOURCE */
+- (NSArray *)participants;
+/* attendees -> role == X-OGo-RESOURCE */
+- (NSArray *)resources;
 
+/* TODO: should have coder instead */
 - (NSString *)iCalString;
 
 /* do we really need these? */
-
 - (id)calendar;
 - (id)event;
 
index da48bd4bfb247b30edf45fab34cc7584a86281ce..419aa0bb6d2590e8916c7ca327c0a081cf65fc01 100644 (file)
 #include "SOGoAppointment.h"
 #include <SaxObjC/SaxObjC.h>
 #include <NGiCal/NGiCal.h>
+#include <EOControl/EOControl.h>
 #include "common.h"
 
 @interface NSDate(UsedPrivates)
 - (NSString *)icalString; // declared in NGiCal
 @end
 
+@interface SOGoAppointment (PrivateAPI)
+- (NSArray *)_filteredAttendeesThinkingOfPersons:(BOOL)_persons;
+@end
+
 @implementation SOGoAppointment
 
 static id<NSObject,SaxXMLReader> parser = nil;
@@ -185,7 +190,13 @@ static SaxObjectDecoder          *sax   = nil;
         NSString *x;
 
         p = [persons objectAtIndex:i];
-        [s appendString:@"\nATTENDEE;CN=\""];
+        [s appendString:@"\nATTENDEE;"];
+        if((x = [p role])) {
+            [s appendString:@"ROLE="];
+            [s appendString:x];
+            [s appendString:@";"];
+        }
+        [s appendString:@"CN=\""];
         if((x = [p cn])) {
             [s appendString:x];
         }
@@ -276,8 +287,44 @@ static SaxObjectDecoder          *sax   = nil;
 - (void)addToAttendees:(iCalPerson *)_person {
     [self->event addToAttendees:_person];
 }
+- (void)appendAttendees:(NSArray *)_persons {
+    unsigned i, count;
+    
+    count = [_persons count];
+    for(i = 0; i < count; i++) {
+        [self addToAttendees:[_persons objectAtIndex:i]];
+    }
+}
 - (NSArray *)attendees {
     return [self->event attendees];
 }
 
+- (BOOL)hasParticipants {
+    return [[self participants] count] != 0;
+}
+
+- (NSArray *)participants {
+    if(self->participants == nil) {    
+        ASSIGN(self->participants,
+               [self _filteredAttendeesThinkingOfPersons:YES]);
+    }
+    return self->participants;
+}
+
+- (NSArray *)resources {
+    return [self _filteredAttendeesThinkingOfPersons:NO];
+}
+
+- (NSArray *)_filteredAttendeesThinkingOfPersons:(BOOL)_persons {
+    EOQualifier *q;
+    NSString *qs;
+    
+    if(_persons)
+        qs = @"role != X-OGo-RESOURCE";
+    else
+        qs = @"role = X-OGo-RESOURCE";
+    q = [EOQualifier qualifierWithQualifierFormat:qs];
+    return [[self attendees] filteredArrayUsingQualifier:q];
+}
+
 @end
index fc795f55c1387b14d99ba68f17adc4f527276f1f..749d66dc7109fb3f49932aae8e0c044ad7d4e6c0 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=3
+SUBMINOR_VERSION:=4