<%inherit file="channel.tmpl" />
<%def name="paginate(url, count, skip, max, _more=None, **args)">
## update max?
% if more :
<% max = h.max(max, skip) %>
% else :
<% max = skip %>
% endif
## number of pages
<% page_count = max / count + 1 %>
<div class="paginate">
<ul>
<li>
% if skip :
<a href="${h.build_url(url, count=count, skip=h.skip_prev(count, skip), max=max, **args)}">« Prev</a>
% else :
<span>« Prev</span>
%endif
</li>
% for page in xrange(page_count) :
<li>
% if page == skip / count :
<strong>${page + 1}</strong>
% else :
<a href="${h.build_url(url, count=count, skip=h.skip_page(count, page), max=max, **args)}">${page + 1}</a>
% endif
</li>
% endfor
<li>
% if _more :
<a href="${h.build_url(url, count=count, skip=h.skip_next(count, max), **args)}">More »</a>
% elif False :
<a href="${h.build_url(url, count=count, skip=h.skip_next(count, max), **args)}">Next »</a>
% else : ## last page
<span>Next »</span>
% endif
</li>
</ul>
</div>
</%def>
% if not search_query :
<div id="title">${channel.title} :: Search</div>
<div id="search">
<form action="${h.build_url(urls.channel_search, channel=channel)}" method="GET">
<input type="text" name="q" />
<input type="submit" value="Search" />
Results/page: <select name="count">
% for cc, cc_label in config.SEARCH_LINE_COUNT_OPTIONS :
<option value="${cc if cc else ''}"${' selected="selected"' if cc == count else ''}>${cc_label}</option>
% endfor
</select>
</form>
<div id="search-help">
<p>Search powered by <a href="http://hyperestraier.sourceforge.net/">Hyper Estraier</a>:</p>
<ul>
<li>Group words together using quotes: <tt>"united nations"</tt></li>
<li>Searching for multiple words is AND: <tt>internet security</tt></li>
<li>To exclude terms, use <strong>!</strong> : <tt>hacker ! cracker</tt></li>
<li>Union (i.e. <q>or</q>) using <strong>|</strong> : <tt>proxy | firewall</tt></li>
<li>Search is case-insensitive</li>
</ul>
</div>
</div>
% else :
<div id="title">${channel.title} :: Search '${search_query}'</div>
${paginate(urls.channel_search, count, skip, max, channel=channel, q=search_query, _more=bool(lines))}
% if lines :
<%include file="lines.tmpl" />
% else :
<div id="search-error">No results found</div>
% endif
${paginate(urls.channel_search, count, skip, max, channel=channel, q=search_query, _more=bool(lines))}
% endif