]> err.no Git - scalable-opengroupware.org/commitdiff
started an iCal event viewer
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 21 Feb 2005 02:10:35 +0000 (02:10 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 21 Feb 2005 02:10:35 +0000 (02:10 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@598 d1b88da0-ebda-0310-925b-ed51d893ca5b

14 files changed:
SOGo/UI/MailPartViewers/ChangeLog
SOGo/UI/MailPartViewers/GNUmakefile
SOGo/UI/MailPartViewers/UIxMailPartHTMLViewer.m [new file with mode: 0644]
SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m [new file with mode: 0644]
SOGo/UI/MailPartViewers/UIxMailPartLinkViewer.h [new file with mode: 0644]
SOGo/UI/MailPartViewers/UIxMailPartLinkViewer.m
SOGo/UI/MailPartViewers/UIxMailPartMixedViewer.m
SOGo/UI/MailPartViewers/UIxMailRenderingContext.h
SOGo/UI/MailPartViewers/UIxMailRenderingContext.m
SOGo/UI/MailPartViewers/Version
SOGo/UI/Mailer/mailer.css
SOGo/UI/Scheduler/UIxAppointmentView.m
SOGo/UI/Templates/UIxMailPartHTMLViewer.wox [new file with mode: 0644]
SOGo/UI/Templates/UIxMailPartICalViewer.wox [new file with mode: 0644]

index 3ed4168a2c2974c4e315ca037d2cacc9f5870664..e6f3dc7bc23a0ebf2784ca5e1ab4aacdde287617 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-21  Helge Hess  <helge.hess@opengroupware.org>
+
+       * prepared HTML and iCal mail part viewers (0.9.3)
+
 2005-02-20  Helge Hess  <helge.hess@opengroupware.org>
 
        * moved in UIxMailSizeFormatter (v0.9.2)
index 9d1b8b973c9164b78b2c92583a387d829a8738af..5582b818ec4aff56432a475f0792d934196a50b4 100644 (file)
@@ -21,6 +21,8 @@ MailPartViewers_OBJC_FILES += \
        UIxMailPartMixedViewer.m        \
        UIxMailPartAlternativeViewer.m  \
        UIxMailPartMessageViewer.m      \
+       UIxMailPartICalViewer.m         \
+       UIxMailPartHTMLViewer.m         \
 
 MailPartViewers_RESOURCE_FILES += \
        Version                 \
diff --git a/SOGo/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/SOGo/UI/MailPartViewers/UIxMailPartHTMLViewer.m
new file mode 100644 (file)
index 0000000..ab7746d
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  Copyright (C) 2004-2005 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include "UIxMailPartLinkViewer.h"
+
+@interface UIxMailPartHTMLViewer : UIxMailPartLinkViewer
+@end
+
+#include "common.h"
+
+@implementation UIxMailPartHTMLViewer
+@end /* UIxMailPartHTMLViewer */
diff --git a/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m b/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m
new file mode 100644 (file)
index 0000000..089efca
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+  Copyright (C) 2004-2005 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include "UIxMailPartViewer.h"
+
+/*
+  UIxMailPartICalViewer
+  
+  Show plain/calendar mail parts.
+*/
+
+@class SOGoDateFormatter;
+
+@interface UIxMailPartICalViewer : UIxMailPartViewer
+{
+  id appointment;
+  id attendee;
+  SOGoDateFormatter *dateFormatter;
+  id item;
+}
+
+@end
+
+#include <SOGoUI/SOGoDateFormatter.h>
+#include <SOGo/SOGoAppointment.h>
+#include "common.h"
+
+@implementation UIxMailPartICalViewer
+
+- (void)dealloc {
+  [self->attendee      release];
+  [self->item          release];
+  [self->appointment   release];
+  [self->dateFormatter release];
+  [super dealloc];
+}
+
+// TODO: flush caches
+
+/* accessors */
+
+- (SOGoAppointment *)appointment {
+  NSString *iCalString;
+    
+  if (self->appointment != nil)
+    return self->appointment;
+  
+  iCalString = [self flatContentAsString];
+  
+  self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
+  return self->appointment;
+}
+
+/* formatters */
+
+- (SOGoDateFormatter *)dateFormatter {
+  if (self->dateFormatter == nil) {
+    self->dateFormatter =
+      [[SOGoDateFormatter alloc] initWithLocale:[self locale]];
+    [self->dateFormatter setFullWeekdayNameAndDetails];
+  }
+  return self->dateFormatter;
+}
+
+/* below is copied from UIxAppointmentView, can we avoid that? */
+
+- (NSString *)tabSelection {
+  NSString *selection;
+    
+  selection = [self queryParameterForKey:@"tab"];
+  if (selection == nil)
+    selection = @"attributes";
+  return selection;
+}
+
+- (void)setAttendee:(id)_attendee {
+  ASSIGN(self->attendee, _attendee);
+}
+- (id)attendee {
+  return self->attendee;
+}
+
+- (void)setItem:(id)_item {
+  ASSIGN(self->item, _item);
+}
+- (id)item {
+  return self->item;
+}
+
+- (NSCalendarDate *)startTime {
+  NSCalendarDate *date;
+    
+  date = [[self appointment] startDate];
+  [date setTimeZone:[self viewTimeZone]];
+  return date;
+}
+
+- (NSCalendarDate *)endTime {
+  NSCalendarDate *date;
+  
+  date = [[self appointment] endDate];
+  [date setTimeZone:[self viewTimeZone]];
+  return date;
+}
+
+- (NSString *)resourcesAsString {
+  NSArray *resources, *cns;
+
+  resources = [[self appointment] resources];
+  cns = [resources valueForKey:@"cnForDisplay"];
+  return [cns componentsJoinedByString:@"<br />"];
+}
+
+- (NSString *)categoriesAsString {
+  unsigned i, count;
+  NSArray *cats;
+  NSMutableString *s;
+  
+  s = [[NSMutableString alloc] init];
+  cats = [((SOGoAppointment *)self->appointment) categories];
+  count = [cats count];
+  for(i = 0; i < count; i++) {
+    NSString *cat, *label;
+
+    cat = [cats objectAtIndex:i];
+    label = [self labelForKey:cat];
+    [s appendString:label];
+    if(i != (count - 1))
+      [s appendString:@", "];
+  }
+  return s;
+}
+
+@end /* UIxMailPartICalViewer */
diff --git a/SOGo/UI/MailPartViewers/UIxMailPartLinkViewer.h b/SOGo/UI/MailPartViewers/UIxMailPartLinkViewer.h
new file mode 100644 (file)
index 0000000..a742218
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  Copyright (C) 2004-2005 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#ifndef __Mailer_UIxMailPartLinkViewer_H__
+#define __Mailer_UIxMailPartLinkViewer_H__
+
+#include "UIxMailPartViewer.h"
+
+/*
+  UIxMailPartLinkViewer
+  
+  The generic viewer for all kinds of attachments. Renders a link to download
+  the attachment.
+
+  TODO: show info based on the 'bodyInfo' dictionary:
+        { 
+          bodyId = ""; 
+          description = ""; 
+          encoding = BASE64; 
+          parameterList = { 
+            "x-unix-mode" = 0666; 
+             name = "IncoWEBOpenGroupwarepresentation.pdf"; 
+          }; 
+          size = 1314916; 
+          subtype = PDF; type = application; 
+        }
+*/
+
+@interface UIxMailPartLinkViewer : UIxMailPartViewer
+{
+}
+
+@end
+
+#endif /* __Mailer_UIxMailPartLinkViewer_H__ */
index 41d95c32cdbf6a1821f04ae890991fae559dd412..76968baccc4bc4a3174351f62c3e7b7f2d858c79 100644 (file)
   02111-1307, USA.
 */
 
-#include "UIxMailPartViewer.h"
-
-/*
-  UIxMailPartLinkViewer
-  
-  The generic viewer for all kinds of attachments. Renders a link to download
-  the attachment.
-
-  TODO: show info based on the 'bodyInfo' dictionary:
-        { 
-          bodyId = ""; 
-          description = ""; 
-          encoding = BASE64; 
-          parameterList = { 
-            "x-unix-mode" = 0666; 
-             name = "IncoWEBOpenGroupwarepresentation.pdf"; 
-          }; 
-          size = 1314916; 
-          subtype = PDF; type = application; 
-        }
-*/
-
-@interface UIxMailPartLinkViewer : UIxMailPartViewer
-{
-}
-
-@end
-
+#include "UIxMailPartLinkViewer.h"
 #include "common.h"
 
 @implementation UIxMailPartLinkViewer
index 27404c09da7f3f73ab0deedea81f914fd0ed2150..26d4fbba28334360f3ec4cd635c7c85ca371ea5d 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.
 
index 6e6ef48bf31f80588fa5c831fb24b9e65424caf2..fa1fbffcd2b0e6603fa1ecfeac53ab2d3d376d8f 100644 (file)
@@ -45,6 +45,8 @@
   WOComponent *imageViewer;
   WOComponent *linkViewer;
   WOComponent *messageViewer;
+  WOComponent *iCalViewer;
+  WOComponent *htmlViewer;
 }
 
 - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx;
index b8ceb214d537e52895596ef7fd855c94f6387e55..2ee998f59b4b7b13a1852c2bdedae1ee57c95ff5 100644 (file)
@@ -38,6 +38,8 @@
 
 - (void)dealloc {
   [self->alternativeViewer release];
+  [self->iCalViewer        release];
+  [self->htmlViewer        release];
   [self->mixedViewer   release];
   [self->textViewer    release];
   [self->imageViewer   release];
   [self->alternativeViewer release]; self->alternativeViewer = nil;
   [self->mixedViewer       release]; self->mixedViewer       = nil;
   [self->textViewer        release]; self->textViewer        = nil;
+  [self->htmlViewer        release]; self->htmlViewer        = nil;
   [self->imageViewer       release]; self->imageViewer       = nil;
   [self->linkViewer        release]; self->linkViewer        = nil;
   [self->messageViewer     release]; self->messageViewer     = nil;
+  [self->iCalViewer        release]; self->iCalViewer        = nil;
 }
 
 /* fetching */
   return self->linkViewer;
 }
 
+- (WOComponent *)htmlViewer {
+  if (self->htmlViewer == nil) {
+    self->htmlViewer = 
+      [[self->viewer pageWithName:@"UIxMailPartHTMLViewer"] retain];
+  }
+  return self->htmlViewer;
+}
+
 - (WOComponent *)messageViewer {
   if (self->messageViewer == nil) {
     self->messageViewer = 
   return self->messageViewer;
 }
 
+- (WOComponent *)iCalViewer {
+  if (self->iCalViewer == nil) {
+    self->iCalViewer = 
+      [[self->viewer pageWithName:@"UIxMailPartICalViewer"] retain];
+  }
+  return self->iCalViewer;
+}
+
 - (WOComponent *)viewerForBodyInfo:(id)_info {
   NSString *mt, *st;
 
   else if ([mt isEqualToString:@"text"]) {
     if ([st isEqualToString:@"plain"])
       return [self textViewer];
+    
     if ([st isEqualToString:@"html"])
-      return [self textViewer]; // TODO: temporary workaround
+      return [self htmlViewer]; // TODO: temporary workaround
+    
+    if ([st isEqualToString:@"calendar"])
+      return [self iCalViewer];
   }
   else if ([mt isEqualToString:@"image"])
     return [self imageViewer];
index ae165207189f31efb4aeba028f0337d66cb1c0f9..097483e1b2b235047f686a09f2e0ca2f813018e7 100644 (file)
@@ -1,5 +1,5 @@
 # version file
 
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
 
 # v0.9.1 requires libNGMime v4.5.213
index ccc2e063bf95180e8b1ca2d3571f42c6b94bc5f1..ff116df0ec90c41221cc9af4474416a452760ecc 100644 (file)
@@ -478,7 +478,7 @@ div.linked_attachment_frame {
 }
 
 div.linked_attachment_body {
-  font-family:  Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+  font-family:         Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
   font-size:           10pt;
   padding:             4px;
 
@@ -496,3 +496,9 @@ div.linked_attachment_meta {
   border-width: 0;
   padding:      2px;
 }
+table.linked_attachment_meta {
+  font-family:  Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+  font-size:    10pt;
+  color:        #444444;
+  font-style:   italic;
+}
index 4811c9d5a4707315d61e7d08cbab3c7066d985ab..8ecdabb59ecf46f2b4d6be663cb5fbd3ee38e715 100644 (file)
 - (SOGoAppointment *)appointment {
   NSString *iCalString;
     
-  if (self->appointment)
+  if (self->appointment != nil)
     return self->appointment;
     
   iCalString = [[self clientObject] valueForKey:@"iCalString"];
diff --git a/SOGo/UI/Templates/UIxMailPartHTMLViewer.wox b/SOGo/UI/Templates/UIxMailPartHTMLViewer.wox
new file mode 100644 (file)
index 0000000..8ca1d5f
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="yes"?>
+<div xmlns="http://www.w3.org/1999/xhtml"
+     xmlns:var="http://www.skyrix.com/od/binding"
+     xmlns:label="OGo:label"
+     class="linked_attachment_frame"
+>
+  <!-- TODO: make an optional iframe -->
+  <!-- TODO: add a server side 'safe' renderer -->
+  
+  <div class="linked_attachment_body">
+    <a var:href="pathToAttachment"
+       var:title="filenameForDisplay"
+       ><var:string value="filenameForDisplay" /></a>
+    <div class="linked_attachment_meta">
+      <var:string label:value="Type" />:
+      <var:string value="bodyInfo.type" /> / 
+      <var:string value="bodyInfo.subtype" />,
+
+      <var:string label:value="Size" />:
+      <var:string value="bodyInfo.size" formatter="sizeFormatter" />
+    </div>
+  </div>
+</div>
diff --git a/SOGo/UI/Templates/UIxMailPartICalViewer.wox b/SOGo/UI/Templates/UIxMailPartICalViewer.wox
new file mode 100644 (file)
index 0000000..3fff614
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" standalone="yes"?>
+<div xmlns="http://www.w3.org/1999/xhtml"
+     xmlns:var="http://www.skyrix.com/od/binding"
+     xmlns:label="OGo:label"
+     xmlns:const="http://www.skyrix.com/od/constant"
+     xmlns:rsrc="OGo:url"
+     class="linked_attachment_frame"
+>
+  <!-- TODO: add iMIP actions -->
+
+  <div class="linked_attachment_body">
+    <var:string label:value="Appointment"/>:
+    <var:string value="appointment.summary" /><br />
+    
+    <div class="linked_attachment_meta">
+      <table border="0" class="linked_attachment_meta">
+        <tr>
+          <td><var:string label:value="Time"/>:</td>
+          <td>
+            <!-- TODO: we need a better viewer for that -->
+            <var:string value="startTime" formatter="dateFormatter" />
+            -
+            <var:string value="endTime" formatter="dateFormatter" />
+          </td>
+        </tr>
+        <tr>
+          <td><var:string label:value="Categories"/>:</td>
+          <td><var:string value="categoriesAsString" /></td>
+        </tr>
+
+        <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>),
+          </td>
+        </tr>
+
+        <tr>
+          <td><var:string label:value="Attendees"/>:</td>
+          <td>
+            <var:foreach list="appointment.participants" item="attendee">
+              <var:string value="attendee.cnForDisplay" />
+              (<a var:href="attendee.email"
+                  ><var:string value="attendee.rfc822Email" /></a>),
+              <var:component className="UIxCalParticipationStatusView"
+                             partStat="attendee.participationStatus" />
+            </var:foreach>
+          </td>
+        </tr>
+
+        <tr>
+          <td><var:string label:value="Comment"/>:</td>
+          <td>
+            <var:string value="appointment.comment" const:insertBR="1" />
+          </td>
+        </tr>
+      </table>
+    </div>
+  </div>
+
+<!--
+  <var:string value="appointment" />
+  <br />
+  <br />
+  <br />
+-->
+  <pre style="display: none;"><var:string value="flatContentAsString" /></pre>
+</div>