<%
purl = '%s-pg' % c.policy
%>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10 toolbar">${self.paging(h.do_pagination(c.page), 'settingsnumitemstop')}</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">
		<table class="table table-bordered">
		<thead>
		<tr>
			<th>${_('Policy Name')}</th>
			<th>${_('Policy Type')}</th>
			<th class="hidden-phone">${_('Enabled')}</th>
			<th colspan="2">${_('Actions')}</th>
		</tr>
		</thead>
		<tbody>
		% if not c.page.items:
		<tr><td colspan="5">${_('No %(policy)s found') % dict(policy=c.policy_name)}</td></tr>
		% endif
		% for policy in c.page.items:
		<tr>
			<td>${h.literal('<em>') if not policy.enabled else ''}${h.link_to(policy.name, url('policy-rulesets', policy_id=policy.id))}${h.literal('</em>') if not policy.enabled else ''}</td>
			<td>${h.literal('<em>') if not policy.enabled else ''}${c.policy_name}${h.literal('</em>') if not policy.enabled else ''}</td>
			<td class="hidden-phone">
				${functions.item_status(policy.enabled)}
			</td>
			<td>${h.link_to(h.literal('<i class="icon-edit blue"></i>'), url('policy-edit', policy_id=policy.id), title=_("Edit Policy"))}</td>
			<td>${h.link_to(h.literal('<i class="icon-remove red"></i>'), url('policy-del', policy_id=policy.id), title=_("Delete Policy"))}</td>
		</tr>
		% endfor
		</tbody>
		</table>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10 toolbar">${self.paging(h.do_pagination(c.page), 'settingsnumitemsbottom')}</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="space-6"></div>

<%def name="paging(page_nums, fieldname)">
% if c.page.page_count != 0:
<p>${_('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)}.</p>
<div class="limiter">
${_('Show items:')}
${h.pager_select(fieldname, str(c.page.items_per_page))}
${_('per page')}
</div>
<div class="pages">
% if c.page.page_count == 1:
-
% endif
% else:
<p>No items found</p>
% endif
% if c.page.next_page != c.page.first_page and c.page.page != c.page.first_page:
<span>
	${h.link_to(h.literal('<i class="icon-double-angle-left"></i>'), url(purl, page=c.page.first_page))}
</span>
<span>...</span>
% endif
% if c.page.previous_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-left"></i>'), url(purl, page=c.page.previous_page))}
</span>
% endif
% for linkpage in page_nums:
% 	if linkpage == c.page.page:
<span><b>${linkpage}</b></span>
% 	else:
<span>
	${h.link_to(h.literal(linkpage), url(purl, page=linkpage))}
</span>
% 	endif
% endfor
% if c.page.next_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-right"></i>'), url(purl, page=c.page.next_page))}
</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.literal('<i class="icon-double-angle-right"></i>'), url(purl, page=c.page.page_count))}
</span>
% endif
% if c.page.page_count != 0:
</div>
% else:
<div class="pages">-</div>
% endif
</%def>

<%def name="title()">
${_('Settings :: Content Protection :: %(policy)s :: Showing page %(page)d of %(count)d pages.') % dict(page=c.page.page, count=c.page.page_count, policy=c.policy_name) if c.page.page_count != 0 else _('Settings :: Content Protection :: %(policy)s') % dict(policy=c.policy_name)}
</%def>

<%def name="heading()">
${_('Settings :: Content Protection :: %(policy)s :: Showing page %(page)d of %(count)d pages.') % dict(page=c.page.page, count=c.page.page_count, policy=c.policy_name) if c.page.page_count != 0 else _('Settings :: Content Protection :: %(policy)s') % dict(policy=c.policy_name)}
</%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">${h.link_to(_('Content Protection'), url('settings-rulesets'))}</li>
				<li class="nav_item">${h.link_to(_('System Default'), url('view-default-policy', policy_type=c.policy_type))}</li>
				<li class="nav_item">${h.link_to(_('Create Policy'), url('policy-add', policy_type=c.policy_type))}</li>
				<li class="nav_item">${h.link_to(_('Clone Policy'), url('clone-policy', policy_type=c.policy_type))}</li>
            </ul>
        </div>
    </div>
</div>
</%def>

<%def name="localscripts()">
<script type="text/javascript">
var setitems_url = "${url(controller='settings', action='setnum')}";
</script>
${h.javascript_link(h.media_url() + 'js/baruwa/settings.show.items.min.js')}
</%def>
<%namespace name="functions" file="../includes/functions.html"/>
<%inherit file="../base.html"/>

