${s.searchbox(url('accounts-search'), [('d', c.d)]) if c.d else s.searchbox(url('accounts-search'))}
<div class="clear"></div>
<div class="sp10"></div>
<div class="alpos">
	<div class="toolbar">${self.paging(h.do_pagination(c.page), 'saccountstop')}</div>
</div>
<div id="content">
${h.form(url(controller='accounts'), method='post')}
<div class="mkbox">
	<div class="grid_16 formcontrols">
	<div class="grid_2 prefix_7">${h.radio('whatdo', 'delete', label='Delete', class_='fieldcontrols')}</div>
	<div class="grid_2">${h.radio('whatdo', 'disable', label='Disable', class_='fieldcontrols')}</div>
	<div class="grid_2">${h.radio('whatdo', 'enable', label='Enable', class_='fieldcontrols')}</div>
	<div class="grid_2">${h.submit('submit', _('Submit'))}</div>
	</div>
</div>
<div class="clear"></div>
<div class="sp10"></div>
<table class="accounts">
<thead>
<tr class="grid">
    <th class="users_heading_hash domains_check">${h.checkbox('checkall')}</th>
    <th>&nbsp;</th>
    <th class="users_heading_username">${_('Username')}</th>
    <th class="users_heading_fullname">${_('Full names')}</th>
    <th class="users_heading_email">${_('Email address')}</th>
    <th class="users_heading_email">${_('Status')}</th>
	<th class="users_heading_del" colspan="2">${_('Actions')}</th>
</tr>
</thead>
<tbody>
% for user in c.page.items:
<% 
	if user.account_type == 1:
		user_icon = h.media_url() + 'imgs/user_admin.png'
	elif user.account_type == 2:
		user_icon = h.media_url() + 'imgs/user_dadmin.png'
	else:
		user_icon = h.media_url() + 'imgs/user.png'
%>
<tr id="account-id-${user.id}">
	<td class="domains_check">${h.checkbox('accountid', value=user.id)}</td>
    <td class="users_hash">${h.link_to(h.image(user_icon, 'x'), url('account-detail', userid=user.id))}</td>
    <td class="users_username">${h.link_to(user.username, url('account-detail', userid=user.id))}</td>
    <td class="users_fullname">${user.firstname} ${user.lastname}</td>
    <td class="users_email">${h.link_to(user.email, url('account-detail', userid=user.id))}</td>
    <td class="users_status">${h.enabled_or_not(user.active)}</td>
	<td class="users_delete">${h.link_to(h.portable_img('imgs/edit.png', 'Edit'), url('account-edit', userid=user.id))}</td>
	<td class="users_edit">${h.link_to(h.portable_img('imgs/action_delete.png', 'Delete'), url('account-delete', userid=user.id))}</td>
</tr>
% endfor
% if not c.page.items:
<tr><td class="spanrow" colspan="8">${_('No accounts found matching: %s') % c.q}</td></tr>
% endif
</tbody>
</table>
${h.end_form()}\
</div>
<div class="alpos">
	<div class="toolbar">${self.paging(h.do_pagination(c.page), 'saccountsbottom')}</div>
</div>
<div class="clear"></div>
<div class="sp10"></div>
<%def name="title()">
${_('Accounts :: Search results :: Showing page %(n)d of %(c)d pages.') % dict(n=c.page.page, c=c.page.page_count) if c.page.page_count != 0 else _('Accounts :: Search results')}
</%def>

<%def name="heading()">
${_('Accounts :: Search results :: Showing page %(n)d of %(c)d pages.') % dict(n=c.page.page, c=c.page.page_count) if c.page.page_count != 0 else _('Accounts :: Search results')}
</%def>

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

<%def name="paging(page_nums, fieldname)">
% if c.page.page_count != 0:
<%
kwd = {}
if c.d:
	kwd['d'] = c.d
%>
<p>${_('Showing results %(i)d to %(l)d of %(count)d') % dict(i=c.page.first_item, l=c.page.last_item, count=c.page.item_count)}.</p>
<div class="limiter">
${_('Show:')}
${h.pager_select(fieldname, str(c.page.items_per_page))}
${_('results per page')}
</div>
<div class="pages">
% if c.page.page_count == 1:
-
% endif
% else:
<p>${_('No items found matching: %s') % c.q}</p>
% endif
% if c.page.next_page != c.page.first_page and c.page.page != c.page.first_page:
<span>
	${h.link_to(h.pager_img('first'), url.current(p=c.page.first_page, q=c.q, **kwd))}
</span>
<span>...</span>
% endif
% if c.page.previous_page:
<span>
	${h.link_to(h.pager_img('previous'), url.current(p=c.page.previous_page, q=c.q, **kwd))}
</span>
% endif
% for linkpage in page_nums:
% 	if linkpage == c.page.page:
<span class="curpage">${linkpage}</span>
% 	else:
<span>
	${h.link_to(h.literal(linkpage), url.current(p=linkpage, q=c.q, **kwd))}
</span>
% 	endif
% endfor
% if c.page.next_page:
<span>
	${h.link_to(h.pager_img('next'), url.current(p=c.page.next_page, q=c.q, **kwd))}
</span>
% endif
% if c.page.next_page != c.page.page_count and c.page.page != c.page.page_count and c.page.page_count != 0:
<span>...</span>
<span>
	${h.link_to(h.pager_img('last'), url.current(p=c.page.page_count, q=c.q, **kwd))}
</span>
% endif
% if c.page.page_count != 0:
</div>
% else:
<div class="pages">-</div>
% endif
</%def>
<%def name="localscripts()">\
</%def>
<%namespace name="s" file="/includes/search.html"/>
<%inherit file="/base.html"/>