<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		<ul id="msgops">
			<li>${h.link_to(_('Inbound Queue'), url('mailq-status-directed', queue='inbound'))}</li>
		    <li>${h.link_to(_('Outbound Queue'), url('mailq-status-directed', queue='outbound'))}</li>
			% if c.message and c.message['is_multipart']:
			% if c.richformat:
			<li>${h.link_to(_('Text Alternative'), url('mailq-preview', queueid=c.queueid), id='altformat', class_='textformat')}</li>
			% else:
			<li>${h.link_to(_('HTML Alternative'), url('mailq-preview-html', queueid=c.queueid), id='altformat', class_='htmlformat')}</li>
			% endif
			% endif
		    <li>${h.link_to(_('Return to message'), url('mailq-detail', queueid=c.queueid))}</li>
		</ul>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		% if c.message:
		<div class="row-fluid">
			<div class="span12">
				<h3 class="head smaller lighter blue">${_('Message headers')}</h3>
			</div>
		</div>
		<div class="row-fluid">
			<div class="span12">
				<table class="table table-hover table-condensed table-striped">
				% for header in c.message['headers']:
					<tr>
						<td><strong>${header.capitalize()}:</strong></td>
						<td class="lh">${h.wrap_paragraphs(c.message['headers'][header], 60) if c.message['headers'][header] else ''}</td>
					</tr>
				% endfor
				</table>
			</div>
		</div>
		% if c.message['attachments']:
		<div class="row-fluid">
			<div class="span2">
				${_('Attachments')}:
			</div>
			<div class="span10">
				% for index, name in enumerate(c.message['attachments']):
				<% counter = index + 1 %>
					${h.link_to(h.literal('<i class="icon-download"></i>') + h.literal('&nbsp;') + name['filename'], url('queue-attach-dw', queueid=c.queueid, attachid=counter))}&nbsp;
				% endfor
			</div>
		</div>
		% endif
		<div class="row-fluid">
			<div class="span12">
				<h3 class="head smaller lighter blue">${_('Message content')}</h3>
			</div>
		</div>
		<div class="row-fluid">
			% if c.message['has_html']:
			% for m in c.message['parts']:
			% if m['is_body'] and m['type'] == 'text/html' and m['style']:
			<style type="text/css">\
			${m['style']|n}
			</style>
			<% break %>
			% endif
			% endfor
			% endif
			<div class="span12" id="mailpreview">
				% if c.message['has_text'] and c.message['has_html']:
				<div id="email-text-part" class="${'hide' if c.richformat else 'show'}">
					% for m in c.message['parts']:
					% if m['type'] == 'text/plain' and m['is_body']:
					${h.linebreaksbr(m['content'])}
					<% break %>
					% endif
					% endfor
				</div>
				<div id="email-html-part" class="${'show' if c.richformat else 'hide'}">
					% for m in c.message['parts']:
					% if m['type'] == 'text/html' and m['is_body']:
					${m['content']|n}
					<% break %>
					% endif
					% endfor
				</div>
				% elif c.message['has_text']:
				<div id="email-text-part">
					% for m in c.message['parts']:
					% if m['type'] == 'text/plain' and m['is_body']:
					${h.linebreaksbr(m['content'])}
					<% break %>
					% endif
					% endfor
				</div>
				% elif c.message['has_html']:
				<div id="email-html-part">
					% for m in c.message['parts']:
					% if m['type'] == 'text/html' and m['is_body']:
					${m['content']|n}
					<% break %>
					% endif
					% endfor
				</div>
				% else:
				${_('Message has no content')}
				% endif
				% for m in c.message['parts']:
				% if not m['is_body'] and m['type'] == 'text/plain' and m['content']:
				<hr/>
				${h.linebreaksbr(m['content'])}
				% elif not m['is_body'] and m['type'] == 'text/html' and m['content']:
				% if m['style']:
				<style type="text/css">
				${m['style']}
				</style>
				% endif
				<hr/>
				<div class="span12">
					${m['content']|n}
				</div>
				% endif
				% endfor
			</div>
		</div>
		% else:
		<div class="row-fluid">
			<div class="span12">
				${_('Queued Message: %(msgid)s could not be previewed') % dict(msgid=c.messageid)}
			</div>
		</div>
		% endif
	</div>
	<div class="span1 hidden-phone"></div>
</div>


<%def name="title()">
 ${_('Status :: Mail Queue :: Previewing Queued message : %(msgid)s') % dict(msgid=c.messageid)}
</%def>

<%def name="heading()">
${_('Status :: Mail Queue :: Previewing Queued message : %(msgid)s') % dict(msgid=h.wrap_paragraphs(c.messageid, 70))}
</%def>

<%def name="headers()">\
</%def>

<%def name="submenu()">
<div class="navbar navbar-static-top">
    <div class="navbar-inner">
        <div class="nav-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="nav_item"><a href="${url('mailq-status')}">${_("Mail Queues")}</a></li>
				% if c.user.is_superadmin:
				<li class="nav_item"><a href="${url('status-audit-logs')}">${_("Audit Logs")}</a></li>
				% endif
            </ul>
        </div>
    </div>
</div>
</%def>

<%def name="localscripts()">\
<script type="text/javascript">
var preview_with_imgs_url = "${url('queue-preview-with-imgs', queueid=c.queueid)}";
</script>
${h.javascript_link(h.media_url() + 'js/vendor/trunk8.min.js',
h.media_url() + 'js/baruwa/status.preview.min.js')}
</%def>
<%inherit file="../base.html"/>
