(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 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 the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
later version. 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 WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details. License for more details.

View File

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

View File

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

View File

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