<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		<ul id="msgops">
		  <li><a href="#" id="listsender">${_('Add sender to list')}</a></li>
		% if c.msg.isquarantined:
		  <li>${h.link_to(_('Preview message'), url('message-archive-preview', msgid=c.msg.id) if c.archived else url('message-preview', msgid=c.msg.id))}</li>
		  <li>${h.link_to(_('Release message'), url.current(anchor="q"))}</li>
		% endif
		</ul>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="space-6"></div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		<div class="row-fluid">
			<h3 class="head smaller lighter blue">${_('Message Details')}</h3>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Message ID')}</div>
			<div class="span6 real-half">${h.wrap_paragraphs(c.msg.messageid, 60)}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('From address')}</div>
			<div class="span6 real-half" id="from_addr">${c.msg.from_address or '---'}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('To address')}</div>
			<div class="span6 real-half" id="to_addr">${h.do_breaks(c.msg.to_address or '---')}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Subject')}</div>
			<div class="span6 real-half">${c.msg.subject or '---'}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Received on')}</div>
			<div class="span6 real-half">${h.datetimeformat(h.format_date(c.msg.timestamp, c.tzinfo), format='%Y-%m-%d %H:%M:%S %z (%Z)')}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Received by')}</div>
			<div class="span6 real-half">${c.msg.hostname}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Received from')}</div>
			<div class="span6 real-half" id="clientip">${c.msg.clientip}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Received via')}</div>
			<div class="span6 real-half">
				% if c.show_trail:
				<%include file="includes/relayedvia.html"/>
				% endif
				<div class="toggle" id="rvtoggle">
					<small>
						${h.link_to(h.literal('<i class="icon-arrow-up"></i>') + h.literal('&nbsp;') + _('Hide hosts'), url.current()) if c.show_trail else h.link_to(h.literal('<i class="icon-arrow-down"></i>') + h.literal('&nbsp;') + _('Show hosts'), url.current(t='y'))}
					</small>
				</div>
			</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Size')}</div>
			<div class="span6 real-half">${h.format_byte_size(c.msg.size)}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Message Headers')}</div>
			<div class="span6 real-half">
				<div id="mail-headers" style="display:${'block' if c.show_trail else 'none'};">
				<%include file="includes/mailheaders.html"/>
				</div>
				<div class="toggle" id="mhtoggle">
					<small>
						${h.link_to(h.literal('<i class="icon-arrow-up"></i>') + h.literal('&nbsp;') + _('Hide headers'), url.current()) if c.show_trail else h.link_to(h.literal('<i class="icon-arrow-down"></i>') + h.literal('&nbsp;') + _('Show headers'), url.current(t='y'))}
					</small>
				</div>
			</div>
		</div>
		% if 'deliver' in c.msg.actions.split(','):
		<div class="row-fluid">
			<div class="span6 real-half">${_('Copy Stored')}</div>
			<div class="span6 real-half">${functions.yes_no(c.msg.isquarantined)}</div>
		</div>
		% else:
		<div class="row-fluid">
			<div class="span6 real-half">${_('Quarantined')}</div>
			<div class="span6 real-half">${functions.yes_no(c.msg.isquarantined)}</div>
		</div>
		% endif:
		<div class="row-fluid">
			<div class="span6 real-half">${_('Virus infected')}</div>
			<div class="span6 real-half">${functions.yes_no(c.msg.virusinfected)}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Prohibited File')}</div>
			<div class="span6 real-half">${functions.yes_no(c.msg.nameinfected)}</div>
		</div>
		<div class="row-fluid">
			<div class="span6 real-half">${_('Other infection')}</div>
			<div class="span6 real-half">${functions.yes_no(c.msg.otherinfected)}</div>
		</div>
		<div class="row-fluid">
			<h3 class="head smaller lighter blue">${_('Spam checks results')}</h3>
		</div>
		<div class="row-fluid">
			<div class="span5">
				<h3 class="head smaller lighter blue">${_('Results')}</h3>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Message Score')}</div>
					<div class="span4 real-half">${c.msg.sascore}</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Identified as Spam')}</div>
					<div class="span4 real-half">${functions.spam_actions(c.msg, 1)}</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Definite Spam')}</div>
					<div class="span4 real-half">${functions.spam_actions(c.msg, 2)}	</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Sender in RBL')}</div>
					<div class="span4 real-half">${functions.yes_no(c.msg.rblspam)}\
					% if c.msg.rblspam:
					RBL's: ${h.get_rbl_name(c.msg.spamreport)}
					% endif
					</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Approved Sender')}</div>
					<div class="span4 real-half">${functions.yes_no(c.msg.whitelisted)}</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Blocked Sender')}</div>
					<div class="span4 real-half">${functions.yes_no(c.msg.blacklisted)}</div>
				</div>
				<div class="row-fluid">
					<div class="span8 real-half">${_('Bayesian Auto Learned')}</div>
					<div class="span4 real-half">${h.sa_learned(c.msg.spamreport)}</div>
				</div>
			</div>
			<div class="span7 hidden-phone">
				<div class="row-fluid">
					<h3 class="head smaller lighter blue">${_('Rules matched')}</h3>
				</div>
				<div class="row-fluid bold">
					<div class="span2">${_('Score')}</div>
					<div class="span4">${_('Rule name')}</div>
					<div class="span6">${_('Rule description')}</div>
				</div>
				% for rule in h.spam_report(c.msg.spamreport):
				<div class="row-fluid">
					<div class="span2">${rule['score']}</div>
					<div class="span4">${h.link_to(rule['rule'], url('edit-local-scores', score_id=rule['rule']))}</div>
					<div class="span6">${rule['description']}</div>
				</div>
				% endfor
			</div>
		</div>
		% if c.msg.isquarantined:
		<div class="row-fluid">
			<h3 class="head smaller lighter blue" id="q">${_('Quarantine')}</h3>
		</div>
		<!-- <div class="row-fluid">
			<div class="span1">${c.form.release.label}</div>
			<div class="span1">${c.form.delete.label}</div>
			<div class="span2">${c.form.learn.label}</div>
			<div class="span2">${c.form.usealt.label}</div>
		</div> -->
			% if c.msg.virusinfected or c.msg.nameinfected or c.msg.otherinfected:
			  % if c.user.account_type != 3:
			     <%include file="includes/enabledform.html"/>
			  % else:
			     <%include file="includes/disabledform.html"/>
			  % endif
			% else:
			  <%include file="includes/enabledform.html"/>
			% endif
		% endif
		<div class="row-fluid">
			<h3 class="head smaller lighter blue">${_('Delivery information')}</h3>
		</div>
		% if c.msgstatus:
		<div class="row-fluid bold">
			<div class="span1 real-half">${_('Status')}</div>
			<div class="span3 real-half">${_('Hostname')}</div>
			<div class="span5 hidden-phone">${_('Message')}</div>
			<div class="span3 hidden-phone">${_('Date/Time')}</div>
		</div>
		% else:
		<div class="row-fluid">
			<div class="span12">
    		    <% message_actions = c.msg.actions.split(',') %>\
				% if 'store' in message_actions and 'deliver' not in message_actions:
    			${_('The message was quarantined')}
    			% elif 'delete' in message_actions:
    			${_('The message was deleted')}
    			% else:
    		    ${_('No delivery status information available')}
    		    % endif
			</div>
		</div>
		% endif
		% for status in c.msgstatus:
		<div class="row-fluid">
			<div class="span1 real-half">${h.literal('<i class="icon-ok green"></i>') if status.errorno == 0 else h.literal('<i class="icon-remove red"></i>')}</div>
			<div class="span3 real-half">${status.hostname}</div>
			<div class="span5 hidden-phone">${status.confirmation if status.errorno == 0 else status.errorstr}</div>
			<div class="span3 hidden-phone">${h.datetimeformat(h.format_date(status.timestamp, c.tzinfo), format='%Y-%m-%d %H:%M:%S %z (%Z)')}</div>
		</div>
		% endfor
	</div>
	<div class="span1 hidden-phone"></div>
</div>

<%def name="headers()">\
</%def>
<%def name="title()">\
 ${_('Showing message :: %(i)s') % dict(i=h.wrap_paragraphs(c.msg.messageid, 60))}
</%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">${h.link_to(_('Full message list'), url(controller='messages', action='listing'))}</li>
				<li class="nav_item">${h.link_to(_('Quarantine'), url(controller='messages', action='quarantine'))}</li>
				<li class="nav_item">${h.link_to(_('Archive'), url(controller='messages', action='archive'))}</li>
            </ul>
        </div>
    </div>
</div>
</%def>
<%def name="heading()">\
${self.title()}
</%def>
<%def name="localscripts()">\
<script type="text/javascript">
var list_add_url = "${url('lists-add')}";
var relayedvia_url = "${url('messages-archived-ajax-relayedvia', msgid=c.msg.id) if c.archived else url('messages-ajax-relayedvia', msgid=c.msg.id)}";
</script>
${h.javascript_link(h.media_url() + 'js/baruwa/messages.detail.min.js')}
</%def>
<%inherit file="../base.html"/>
<%namespace name="functions" file="functions.html"/>



