<%def name="print_rows(route, isqtne=None)">\ % if isqtne: <% ids = [field(class_='selector') for field in c.form.message_id] %> % endif % if c.page.items: % for index, msg in enumerate(c.page.items): <% 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(route, id=msg.id) #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 = _('BS') 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 = _('AS') if not msg.scaned: status = _('NS') if msg.from_address == '': from_addr = '<>' else: from_addr = msg.from_address %> % if isqtne: ${ids[index]} ${h.link_to(h.datetimeformat(h.format_date(msg.timestamp, c.tzinfo), format='%Y-%m-%d %H:%M:%S'), view_url)} ${h.link_to(h.wrap_paragraphs(from_addr,32), view_url)} ${h.link_to(h.wrap_paragraphs(msg.to_address or '---', 32), view_url)} ${h.link_to(h.truncate((msg.subject and msg.subject.strip()) or '---', 50), view_url)} ${h.link_to(msg.sascore, view_url)} ${h.link_to(status, view_url)} % else: ${h.link_to(h.datetimeformat(h.format_date(msg.timestamp, c.tzinfo), format='%Y-%m-%d %H:%M:%S'), view_url)} ${h.link_to(h.wrap_paragraphs(from_addr,32), view_url)} ${h.link_to(h.wrap_paragraphs(msg.to_address or '---', 32), view_url)} ${h.link_to(h.truncate((msg.subject and msg.subject.strip()) or '---', 50), view_url)} ${h.link_to(h.format_byte_size(msg.size), view_url)} ${h.link_to(msg.sascore, view_url)} ${h.link_to(status, view_url)} % endif % endfor % else: ${_('No messages found')} % endif <%def name="grid_heading(action, isqtne=None)"> % if isqtne: % if c.order_by == 'timestamp': ${_('Date/Time')} ${self.sorter(action)} % else: ${self.heading_links(_('Date/Time'), 'timestamp', action)}\ % endif % if c.order_by == 'from_address': ${_('From')} ${self.sorter(action)} % else: ${self.heading_links(_('From'), 'from_address', action)} % endif % if c.order_by == 'to_address': ${_('To')} ${self.sorter(action)} % else: ${self.heading_links(_('To'), 'to_address', action)} % endif % if c.order_by == 'subject': ${_('Subject')} ${self.sorter(action)} % else: ${self.heading_links(_('Subject'), 'subject', action)} % endif % if c.order_by == 'sascore': ${_('Score')} ${self.sorter(action)} % else: ${self.heading_links(_('Score'), 'sascore', action)} % endif ${_('Status')} % else: % if c.order_by == 'timestamp': ${_('Date/Time')} ${self.sorter(action)} % else: ${self.heading_links(_('Date/Time'), 'timestamp', action)} % endif % if c.order_by == 'from_address': ${_('From')} ${self.sorter(action)} % else: ${self.heading_links(_('From'), 'from_address', action)} % endif % if c.order_by == 'to_address': ${_('To')} ${self.sorter(action)} % else: ${self.heading_links(_('To'), 'to_address', action)} % endif % if c.order_by == 'subject': ${_('Subject')} ${self.sorter(action)} % else: ${self.heading_links(_('Subject'), 'subject', action)} % endif % if c.order_by == 'size': ${_('Size')} ${self.sorter(action)} % else: ${self.heading_links(_('Size'), 'size', action)} % endif % if c.order_by == 'sascore': ${_('Score')} ${self.sorter(action)} % else: ${self.heading_links(_('Score'), 'sascore', action)} % endif ${_('Status')} % endif <%def name="sorter(action)">\ % if c.direction == 'dsc': % if hasattr(c, 'section') and c.section: ${h.link_to(h.literal('↑'), url('messages-qtn-paging', action=action, page=c.page.page, direction='asc', order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.literal('↑'), url('messages-paging', action=action, page=c.page.page, direction='asc', order_by=c.order_by))} % endif % else: % if hasattr(c, 'section') and c.section: ${h.link_to(h.literal('↓'), url('messages-qtn-paging', action=action, page=c.page.page, direction='dsc', order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.literal('↓'), url('messages-paging', action=action, page=c.page.page, direction='dsc', order_by=c.order_by))} % endif % endif <%def name="heading_links(link_text, order_by, action)"> % if hasattr(c, 'section') and c.section: ${h.link_to(link_text, url('messages-qtn-paging', action=action, page=c.page.page, direction=c.direction, order_by=order_by, section=c.section))} % else: ${h.link_to(link_text, url('messages-paging', action=action, page=c.page.page, direction=c.direction, order_by=order_by))} % endif <%def name="paging(page_nums, action, fieldname)"> % if c.page.page_count != 0:

${_('Showing items %(i)d to %(l)d of %(count)d') % dict(i=c.page.first_item, l=c.page.last_item, count=c.page.item_count)}.

${_('Show items:')} ${h.pager_select(fieldname, str(c.page.items_per_page))} ${_('per page')}
% if c.page.page_count == 1: - % endif % else:

${_('No items found')}

% endif % if c.page.next_page != c.page.first_page and c.page.page != c.page.first_page: % if hasattr(c, 'section') and c.section: ${h.link_to(h.pager_img('first'), url('messages-qtn-paging', action=action, page=c.page.first_page, direction=c.direction, order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.pager_img('first'), url('messages-paging', action=action, page=c.page.first_page, direction=c.direction, order_by=c.order_by))} % endif ... % endif % if c.page.previous_page: % if hasattr(c, 'section') and c.section: ${h.link_to(h.pager_img('previous'), url('messages-qtn-paging', action=action, page=c.page.previous_page, direction=c.direction, order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.pager_img('previous'), url('messages-paging', action=action, page=c.page.previous_page, direction=c.direction, order_by=c.order_by))} % endif % endif % for linkpage in page_nums: % if linkpage == c.page.page: ${linkpage} % else: % if hasattr(c, 'section') and c.section: ${h.link_to(h.literal(linkpage), url('messages-qtn-paging', action=action, page=linkpage, direction=c.direction, order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.literal(linkpage), url('messages-paging', action=action, page=linkpage, direction=c.direction, order_by=c.order_by))} % endif % endif % endfor % if c.page.next_page: % if hasattr(c, 'section') and c.section: ${h.link_to(h.pager_img('next'), url('messages-qtn-paging', action=action, page=c.page.next_page, direction=c.direction, order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.pager_img('next'), url('messages-paging', action=action, page=c.page.next_page, direction=c.direction, order_by=c.order_by))} % endif % endif % if c.page.next_page != c.page.page_count and c.page.page != c.page.page_count and c.page.page_count != 0: ... % if hasattr(c, 'section') and c.section: ${h.link_to(h.pager_img('last'), url('messages-qtn-paging', action=action, page=c.page.page_count, direction=c.direction, order_by=c.order_by, section=c.section))} % else: ${h.link_to(h.pager_img('last'), url('messages-paging', action=action, page=c.page.page_count, direction=c.direction, order_by=c.order_by))} % endif % endif % if c.page.page_count != 0:
% else:
-
% endif <%def name="search(action, q=None)">
${h.form(url(controller='messages', action='search'), method='get', id='msgsearch')}
% if q:
${_('About %(n)s results (%(t)s seconds)') % dict(n=c.total_found, t=c.search_time)}
% else:
 
% endif
${h.end_form()}