(fix) properly handle subparts compilation for message/rfc822 message parts
parent
d3a233b222
commit
16885f4ebf
|
@ -31,6 +31,8 @@
|
|||
#import <UI/MailerUI/WOContext+UIxMailer.h>
|
||||
#import "UIxMailRenderingContext.h"
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import "UIxMailPartViewer.h"
|
||||
|
||||
/*
|
||||
|
@ -205,4 +207,48 @@
|
|||
return [@"mailto:" stringByAppendingString:[_address baseEMail]];
|
||||
}
|
||||
|
||||
- (id) renderedPart
|
||||
{
|
||||
id info, viewer;
|
||||
NSArray *parts;
|
||||
NSMutableArray *renderedParts;
|
||||
NSUInteger i, max;
|
||||
|
||||
parts = [[self contentInfo] objectForKey: @"parts"];
|
||||
renderedParts = [NSMutableArray array];
|
||||
max = [parts count];
|
||||
|
||||
// Might get a multipart/*
|
||||
if (max)
|
||||
{
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
info = [parts objectAtIndex: i];
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [[self contentPartPath] arrayByAddingObject: [NSString stringWithFormat: @"%d", i+1]]];
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = [self contentInfo];
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [self contentPartPath]];
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
|
||||
// We inject the output of our UIxMailPartMessageViewer template
|
||||
// in order to pretty-format the parts following it.
|
||||
info = [NSDictionary dictionaryWithObjectsAndKeys: @"text/plain", @"contentType", @"UIxMailPartTextViewer", @"type",
|
||||
[[self generateResponse] contentAsString], @"content", nil];
|
||||
[renderedParts insertObject: info atIndex: 0];
|
||||
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self className], @"type",
|
||||
renderedParts, @"content",
|
||||
nil];
|
||||
}
|
||||
|
||||
@end /* UIxMailPartMessageViewer */
|
||||
|
|
|
@ -4,36 +4,42 @@
|
|||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:label="OGo:label"
|
||||
class="linked_attachment_frame">
|
||||
<div class="linked_attachment_body">
|
||||
<hr/>
|
||||
<!-- TODO: the table is a DUP to UIxMailView, own component? -->
|
||||
<div class="bodyFields">
|
||||
<span class="fieldName"><var:string label:value="Subject"/>:</span>
|
||||
<var:string value="messageSubject"/><br/>
|
||||
<span class="fieldName"><var:string label:value="From"/>:</span>
|
||||
<var:string value="fromAddresses"/><br/>
|
||||
<span class="fieldName"><var:string label:value="Date"/>:</span>
|
||||
<var:string value="envelope.date"
|
||||
formatter="context.mailDateFormatter"/><br/>
|
||||
<span class="fieldName"><var:string label:value="To"/>:</span>
|
||||
<var:string value="toAddresses"/><br/>
|
||||
<div class="bodyAdditionalFields">
|
||||
<var:if condition="envelope.hasCC">
|
||||
<span class="fieldName"><var:string label:value="CC"/>:</span>
|
||||
<var:string value="ccAddresses"/>
|
||||
</var:if>
|
||||
</div>
|
||||
|
||||
<div class="pseudo-input-container">
|
||||
<label class="pseudo-input-label"><var:string label:value="Subject"/></label>
|
||||
<div>
|
||||
<var:string value="messageSubject"/>
|
||||
</div>
|
||||
|
||||
<div class="bodyMailContent">
|
||||
<var:component value="contentViewerComponent"
|
||||
bodyInfo="contentInfo"
|
||||
partPath="contentPartPath" />
|
||||
</div>
|
||||
|
||||
<!-- debug
|
||||
<pre><var:string value="envelope"/></pre>
|
||||
<pre><var:string value="bodyInfo.body"/></pre>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div class="pseudo-input-container">
|
||||
<label class="pseudo-input-label"><var:string label:value="From"/></label>
|
||||
<div>
|
||||
<var:string value="fromAddresses"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pseudo-input-container">
|
||||
<label class="pseudo-input-label"><var:string label:value="Date"/></label>
|
||||
<div>
|
||||
<var:string value="envelope.date" formatter="context.mailDateFormatter"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pseudo-input-container">
|
||||
<label class="pseudo-input-label"><var:string label:value="To"/></label>
|
||||
<div>
|
||||
<var:string value="toAddresses"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<var:if condition="envelope.hasCC">
|
||||
<div class="pseudo-input-container">
|
||||
<label class="pseudo-input-label"><var:string label:value="CC"/></label>
|
||||
<div>
|
||||
<var:string value="ccAddresses"/>
|
||||
</div>
|
||||
</div>
|
||||
</var:if>
|
||||
<br/>
|
||||
</div>
|
||||
|
|
|
@ -179,6 +179,7 @@
|
|||
return part.preferredPart == alternatePart.contentType;
|
||||
}));
|
||||
}
|
||||
// Can be used for UIxMailPartMixedViewer and UIxMailPartMessageViewer
|
||||
else if (angular.isArray(part.content)) {
|
||||
_.each(part.content, function(mixedPart) {
|
||||
_visit(mixedPart);
|
||||
|
|
Loading…
Reference in New Issue