+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)
UIxMailPartMixedViewer.m \
UIxMailPartAlternativeViewer.m \
UIxMailPartMessageViewer.m \
+ UIxMailPartICalViewer.m \
+ UIxMailPartHTMLViewer.m \
MailPartViewers_RESOURCE_FILES += \
Version \
--- /dev/null
+/*
+ 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 */
--- /dev/null
+/*
+ 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 */
--- /dev/null
+/*
+ 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__ */
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
/*
- Copyright (C) 2004 SKYRIX Software AG
+ Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
WOComponent *imageViewer;
WOComponent *linkViewer;
WOComponent *messageViewer;
+ WOComponent *iCalViewer;
+ WOComponent *htmlViewer;
}
- (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx;
- (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];
# version file
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
# v0.9.1 requires libNGMime v4.5.213
}
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;
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;
+}
- (SOGoAppointment *)appointment {
NSString *iCalString;
- if (self->appointment)
+ if (self->appointment != nil)
return self->appointment;
iCalString = [[self clientObject] valueForKey:@"iCalString"];
--- /dev/null
+<?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>
--- /dev/null
+<?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>