${functions.search('listing')}
<div class="clear"></div>
<div class="sp10"></div>
<div class="alpos">
	<div class="toolbar">
		<p></p>
		<div class="limiter">
		${_('Show:')}
		${h.pager_select('num_items', str(c.num_items))}
		${_('items per page')}
		</div>
		<div class="pages">-</div>
	</div>
</div>
<div class="clear"></div>
<div id="content">
<table class="messages">
<thead>
<tr class="grid">
	<th class="date_heading">${_('Date/Time')}</th>
	<th>${_('From')}</th>
	<th>${_('To')}</th>
	<th>${_('Subject')}</th>
	<th>${_('Size')}</th>
	<th>${_('Score')}</th>
	<th class="status_heading">${_('Status')}</th>
</tr>
</thead>
% if not c.messages:
<tbody>
	<tr>
	<td colspan="7" class="spanrow">${_('No messages found')}</td>
	</td>
</tbody>
% endif
<tbody>
% for msg in c.messages:
<%
value = 'white'
if (msg.spam and not msg.highspam and not msg.blacklisted
	and not msg.nameinfected and not msg.otherinfected 
	and not msg.virusinfected):
	value = 'spam'
if msg.highspam and (not msg.blacklisted):
	value = 'highspam'
if msg.whitelisted:
	value = 'whitelisted'
if msg.blacklisted:
	value = 'blacklisted'
if msg.nameinfected or msg.virusinfected or msg.otherinfected:
    value = 'infected'
if not msg.scaned:
       value = 'gray'
view_url = url(controller='messages', action='detail', id=msg.id)

if (msg.spam and (not msg.blacklisted) 
	and (not msg.virusinfected) 
	and (not msg.nameinfected) 
	and (not msg.otherinfected)):
       status = _('Spam')
if msg.blacklisted:
       status = _('BL')
if (msg.virusinfected or 
       msg.nameinfected or 
       msg.otherinfected):
       status = _('Infected')
if ((not msg.spam) and (not msg.virusinfected) 
       and (not msg.nameinfected) 
       and (not msg.otherinfected) 
       and (not msg.whitelisted)):
       status = _('Clean')
if msg.whitelisted:
       status = _('WL')
if not msg.scaned:
       status = _('NS')
if msg.from_address == '':
	from_addr = '<>'
else:
	from_addr =  msg.from_address
%>
<tr class="${value}_row">
	<td class="date_td">${h.link_to(h.datetimeformat(h.format_date(msg.timestamp, c.tzinfo), format='%Y-%m-%d %H:%M:%S'), view_url)}</td>
	<td class="from_td">${h.link_to(h.wrap_paragraphs(from_addr,32), view_url)}</td>
	<td class="to_td">${h.link_to(h.wrap_paragraphs(msg.to_address or '---', 32), view_url)}</td>
	<td class="subject_td">${h.link_to(h.truncate((msg.subject and msg.subject.strip()) or '---', 50), view_url)}</td>
	<td class="size_td">${h.link_to(h.format_byte_size(msg.size), view_url)}</td>
	<td class="score_td">${h.link_to(msg.sascore, view_url)}</td>
	<td class="status_td">${h.link_to(status, view_url)}</td>                        
</tr>
% endfor
</tbody>
</table>
</div>

<%def name="heading()">\
${_('Messages :: Showing the %s most recent messages') % c.num_items}
</%def>

<%def name="title()">\
${_('Messages :: Showing the %s most recent messages') % c.num_items}\
</%def>

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

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

<%def name="localscripts()">\
<script type="text/javascript">
var setitems_url = "${url(controller='messages', action='setnum')}";
</script>
${h.javascript_link(h.media_url() + 'js/baruwa/dates.js',
h.media_url() + 'js/baruwa/messages.recent.js')}
</%def>

<%namespace name="functions" file="functions.html"/>
<%inherit file="/base.html"/>