]> err.no Git - scalable-opengroupware.org/commitdiff
rewrote mail iCal viewer not to use SOGoAppointment (but iCalEvent)
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 15 Jul 2005 10:01:29 +0000 (10:01 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 15 Jul 2005 10:01:29 +0000 (10:01 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@774 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/MailPartViewers/ChangeLog
SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m
SOGo/UI/MailPartViewers/Version
SOGo/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox

index 62bfd39fa6c933753ae66ea16b575d044f41e627..852facbf9a2dd8384ca19d470ff727a1fbb3b3e6 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-15  Helge Hess  <helge.hess@opengroupware.org>
+
+       * UIxMailPartICalViewer.m: rewrote not to use SOGoAppointment and to
+         use iCalCalendar instead (v0.9.9)
+
 2005-07-15  Helge Hess  <helge.hess@opengroupware.org>
 
        * UIxMailSizeFormatter.m, UIxMailPartMixedViewer.m, 
index 46b07ca3212ce390e95ffe29ee08dbffb62be720..0cc49e0b76895ef7e6caa96e34d459ab08a1ad39 100644 (file)
   Show plain/calendar mail parts.
 */
 
-@class SOGoDateFormatter, SOGoAppointment;
-@class iCalEvent;
+@class SOGoDateFormatter;
+@class iCalEvent, iCalCalendar;
 
 @interface UIxMailPartICalViewer : UIxMailPartViewer
 {
-  SOGoAppointment   *appointment;
+  iCalCalendar      *inCalendar;
+  iCalEvent         *inEvent;
   id                attendee;
   SOGoDateFormatter *dateFormatter;
   id                item;
@@ -57,7 +58,8 @@
   [self->storedEvent   release];
   [self->attendee      release];
   [self->item          release];
-  [self->appointment   release];
+  [self->inCalendar    release];
+  [self->inEvent       release];
   [self->dateFormatter release];
   [super dealloc];
 }
@@ -66,7 +68,8 @@
 
 - (void)resetPathCaches {
   [super resetPathCaches];
-  [self->appointment       release]; self->appointment       = nil;
+  [self->inEvent           release]; self->inEvent           = nil;
+  [self->inCalendar        release]; self->inCalendar        = nil;
   [self->storedEventObject release]; self->storedEventObject = nil;
   [self->storedEvent       release]; self->storedEvent       = nil;
   
 
 /* accessors */
 
-- (SOGoAppointment *)appointment {
+- (iCalCalendar *)inCalendar {
   NSString *iCalString;
-    
-  if (self->appointment != nil)
-    return self->appointment;
+  
+  if (self->inCalendar != nil)
+    return [self->inCalendar isNotNull] ? self->inCalendar : nil;
   
   iCalString = [self flatContentAsString];
   
-  self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
-  return self->appointment;
+  self->inCalendar = 
+    [[iCalCalendar parseCalendarFromSource:iCalString] retain];
+  if (self->inCalendar == nil) {
+    [self warnWithFormat:@"Could not parse a vcalendar string."];
+    self->inCalendar = [[NSNull null] retain];
+    return nil;
+  }
+  else
+    return self->inCalendar;
+}
+- (BOOL)couldParseCalendar {
+  return [[self inCalendar] isNotNull];
+}
+
+- (iCalEvent *)inEvent {
+  NSArray *events;
+  
+  if (self->inEvent != nil)
+    return [self->inEvent isNotNull] ? self->inEvent : nil;
+  
+  events = [[self inCalendar] events];
+  if ([events count] > 0) {
+    self->inEvent = [[events objectAtIndex:0] retain];
+    return self->inEvent;
+  }
+  else {
+    self->inEvent = [[NSNull null] retain];
+    return nil;
+  }
 }
 
 /* formatters */
 
 - (NSCalendarDate *)startTime {
   NSCalendarDate *date;
-    
-  date = [[self appointment] startDate];
+  
+  date = [[self inEvent] startDate];
   [date setTimeZone:[self viewTimeZone]];
   return date;
 }
 - (NSCalendarDate *)endTime {
   NSCalendarDate *date;
   
-  date = [[self appointment] endDate];
+  date = [[self inEvent] endDate];
   [date setTimeZone:[self viewTimeZone]];
   return date;
 }
   else {
     NSString *filename;
     
-    filename = [calendar resourceNameForEventUID:[[self appointment] uid]];
+    filename = [calendar resourceNameForEventUID:[[self inEvent] uid]];
     if (filename != nil) {
       // TODO: When we get an exception, this might be an auth issue meaning
       //       that the UID indeed exists but that the user has no access to
     return [[self storedEvent] isOrganizer:loginEMail];
   }
   
-  return [[self appointment] isOrganizer:loginEMail];
+  return [[self inEvent] isOrganizer:loginEMail];
 }
 
 - (BOOL)isLoggedInUserAnAttendee {
     return [[self storedEvent] isParticipant:loginEMail];
   }
   
-  return [[self appointment] isParticipant:loginEMail];
+  return [[self inEvent] isParticipant:loginEMail];
 }
 
 @end /* UIxMailPartICalViewer */
index 612c754bdd99da993776f97e0b18e6cbf86648a8..390fe45fc19948121f3e066e36366968e0ae8a12 100644 (file)
@@ -1,5 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=8
+SUBMINOR_VERSION:=9
 
+# v0.9.0 requires libNGiCal v4.5.53
 # v0.9.1 requires libNGMime v4.5.213
index b8752952a65664ea616a618fa348bae02e765769..7edac79e0265a6160aa1173534737ff80a51ab55 100644 (file)
@@ -8,11 +8,13 @@
 >
   <!-- TODO: add iMIP actions -->
 
-  <div class="linked_attachment_body">
-    <var:string label:value="Appointment"/>:
-    <var:string value="appointment.summary" /><br />
-
-    Method: <var:string value="appointment.method" /><br/>
+  <fieldset>
+    <legend>
+      <var:string label:value="Appointment"/>:
+      <var:string value="inEvent.summary" />
+    </legend>
+    
+    Method: <var:string value="inCalendar.method" /><br/>
     
     TODO: Storage:
     <var:if condition="isEventStoredInCalendar">
@@ -61,7 +63,7 @@
     </var:if>
     <br />
     
-    <div class="linked_attachment_meta">
+    <div class="linked_attachment_meta" style="background-color: white;">
       <table border="0" class="linked_attachment_meta">
         <tr>
           <td><var:string label:value="Time"/>:</td>
         <tr>
           <td><var:string label:value="Organizer"/>:</td>
           <td>
-            <var:string value="appointment.organizer.cnForDisplay" />
-            (<a var:href="appointment.organizer.email"
-                ><var:string value="appointment.organizer.rfc822Email" /></a>),
+            <a var:href="inEvent.organizer.email"
+                ><var:string value="inEvent.organizer.cnForDisplay" /></a>
           </td>
         </tr>
         
         <tr>
           <td valign="top"><var:string label:value="Attendees"/>:</td>
           <td>
-            <var:foreach list="appointment.participants" item="attendee">
+            <var:foreach list="inEvent.participants" item="attendee">
               <a var:href="attendee.email"
                  ><var:string value="attendee.cnForDisplay" /></a>
               (<var:string value="attendee.partStat" />)
         </tr>
         
         <tr>
-          <td><var:string label:value="Comment"/>:</td>
+          <td valign="top"><var:string label:value="User Comment"/>:</td>
+          <td>
+            <var:string value="inEvent.userComment" const:insertBR="1" />
+          </td>
+        </tr>
+        
+        <tr> <!-- description in iCal -->
+          <td valign="top"><var:string label:value="Comment"/>:</td>
           <td>
-            <var:string value="appointment.comment" const:insertBR="1" />
+            <var:string value="inEvent.comment" const:insertBR="1" />
           </td>
         </tr>
       </table>
     </div>
-  </div>
+  </fieldset>
 
 <!--
   <var:string value="appointment" />