Add plain text of message body to email bounce view.

Also tweak some labels.
This commit is contained in:
Lance Edgar 2015-07-23 15:47:17 -05:00
parent f523146a4b
commit 0ddb5bffd7
2 changed files with 45 additions and 2 deletions

View file

@ -11,4 +11,41 @@
% endif
</%def>
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
#message {
border: 1px solid #000000;
height: 400px;
overflow: auto;
padding: 4px;
}
</style>
<script type="text/javascript">
function autosize_message(scrolldown) {
var msg = $('#message');
var height = $(window).height() - msg.offset().top - 50;
msg.height(height);
if (scrolldown) {
msg.animate({scrollTop: msg.get(0).scrollHeight - height}, 250);
}
}
$(function () {
autosize_message(true);
$('#message').focus();
});
$(window).resize(function() {
autosize_message(false);
});
</script>
</%def>
${parent.body()}
<pre id="message">
${message}
</pre>

View file

@ -158,19 +158,25 @@ class EmailBounceCrud(CrudView):
fs.config_key.label("Source"),
fs.message,
fs.bounced,
fs.intended_recipient_address.label("Intended For"),
fs.bounce_recipient_address.label("Bounced To"),
fs.intended_recipient_address.label("Intended For"),
fs.links,
fs.processed,
fs.processed_by,
],
readonly=True)
if not bounce.processed:
del fs.processed
del fs.processed_by
return fs
def template_kwargs(self, form):
kwargs = super(EmailBounceCrud, self).template_kwargs(form)
bounce = form.fieldset.model
kwargs['handler'] = self.get_handler(bounce)
handler = self.get_handler(bounce)
kwargs['handler'] = handler
with open(handler.msgpath(bounce), 'rb') as f:
kwargs['message'] = f.read()
return kwargs
def process(self):