(fix) Materalized link and image templates

pull/91/head
Ludovic Marcotte 2015-05-29 10:49:40 -04:00 committed by Francis Lachapelle
parent 34140e77fc
commit 4f75499439
5 changed files with 85 additions and 43 deletions

View File

@ -1,14 +1,15 @@
/*
Copyright (C) 2007-2015 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
This file is part of SOGo
OGo is free software; you can redistribute it and/or modify it under
SOGo 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
SOGo 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.

View File

@ -303,7 +303,7 @@
return [filename stringByEscapingURL];
}
- (NSString *) pathToAttachment
- (NSString *) _pathForAttachmentOrDownload: (BOOL) forDownload
{
NSMutableString *url;
NSString *s, *attachment;
@ -315,16 +315,29 @@
if (![url hasSuffix: @"/"])
[url appendString: @"/"];
// s = [[self partPath] componentsJoinedByString: @"/"];
if ([bodyPart isKindOfClass: [SOGoMailBodyPart class]])
attachment = [self _filenameForAttachment: bodyPart];
else
attachment = @"0";
if (forDownload)
[url appendString: @"asAttachment/"];
[url appendString: attachment];
return url;
}
- (NSString *) pathToAttachment
{
return [self _pathForAttachmentOrDownload: NO];
}
- (NSString *) pathForDownload
{
return [self _pathForAttachmentOrDownload: YES];
}
- (NSString *) mimeImageURL
{
NSString *mimeImageFile, *mimeImageUrl;

View File

@ -1,9 +1,23 @@
<?xml version="1.0" standalone="yes"?>
<img
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
var:src="pathToAttachment"
var:title="filenameForDisplay"
class="mailer_imagecontent"
></img>
<!DOCTYPE div>
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:label="OGo:label">
<md-card>
<img var:src="pathToAttachment"
var:title="filenameForDisplay"
class="md-card-image"></img>
<md-card-content>
<p>
<var:string value="filenameForDisplay" /><br/>
<var:string value="bodyInfo.size" formatter="sizeFormatter"/>
</p>
</md-card-content>
<div class="md-actions" layout="row" layout-align="end center">
<md-button var:href="pathForDownload">
<div class="md-icon-save md-icon-lg"><!-- save --></div>
</md-button>
</div>
</md-card>
</div>

View File

@ -3,37 +3,50 @@
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:label="OGo:label"
class="linked_attachment_frame file"
>
<div class="linked_attachment_body">
<a var:href="pathToAttachment"
var:title="filenameForDisplay"
const:absolute="YES"
><img var:src="mimeImageURL"/>
<div class="linked_attachment_meta">
<var:string value="filenameForDisplay"
/> <span class="muted">(<var:string value="bodyInfo.size" formatter="sizeFormatter" />)</span>
xmlns:label="OGo:label">
<md-whiteframe class="md-whiteframe-z1" layout="row" layout-align="space-between center">
<div layout="row">
<div>
<img var:src="mimeImageURL"/>
</div>
<div layout="column" layout-align="start start">
<div>
<var:string value="filenameForDisplay"/>
</div>
<div>
<var:string value="bodyInfo.size" formatter="sizeFormatter"/>
</div>
</div>
</div>
</a>
<!-- debug
<pre><var:string value="bodyInfo"/></pre>
<a var:href="pathToAttachment"
var:title="bodyInfo"
class="mailer_imagecontent"
>[<var:string value="pathToAttachment" />]</a>
<br />
Id: <var:string value="bodyInfo.bodyId" /><br />
Desc: <var:string value="bodyInfo.description" /><br />
Enc: <var:string value="bodyInfo.encoding" /><br />
Par: <var:string value="bodyInfo.parameterList" /><br />
Size: <var:string value="bodyInfo.size" /><br />
Type: <var:string value="bodyInfo.type" /><br />
Subtype: <var:string value="bodyInfo.subtype" /><br />
Path: <var:string value="pathToAttachment" /><br />
PartPath: <var:string value="partPath" /><br />
<div layout="row" layout-align="end end">
<md-button var:href="pathToAttachment">
<div class="md-icon-open-in-browser md-icon-lg"><!-- open --></div>
</md-button>
<md-button var:href="pathForDownload">
<div class="md-icon-save md-icon-lg"><!-- save --></div>
</md-button>
</div>
<!-- DEBUG
<pre><var:string value="bodyInfo"/></pre>
<a var:href="pathToAttachment"
var:title="bodyInfo"
class="mailer_imagecontent"
>[<var:string value="pathToAttachment" />]</a>
<br />
Id: <var:string value="bodyInfo.bodyId" /><br />
Desc: <var:string value="bodyInfo.description" /><br />
Enc: <var:string value="bodyInfo.encoding" /><br />
Par: <var:string value="bodyInfo.parameterList" /><br />
Size: <var:string value="bodyInfo.size" /><br />
Type: <var:string value="bodyInfo.type" /><br />
Subtype: <var:string value="bodyInfo.subtype" /><br />
Path: <var:string value="pathToAttachment" /><br />
PartPath: <var:string value="partPath" /><br />
-->
</div>
</md-whiteframe>
</div>

View File

@ -209,6 +209,7 @@
parts.push(part);
}
else if (part.type == 'UIxMailPartICalViewer' ||
part.type == 'UIxMailPartImageViewer' ||
part.type == 'UIxMailPartLinkViewer') {
// Trusted content that can be compiled (Angularly-speaking)
part.compile = true;