debian-koji/www/kojiweb/templates/search.html.j2
2025-05-07 14:07:04 +02:00

116 lines
5.2 KiB
Django/Jinja

{% include "header.html.j2" %}
{% from 'macros.html.j2' import rowToggle %}
<h4>Search</h4>
<form action="search">
<table>
<tr>
{% if error %}
<tr><td colspan="5" class="error">{{ error }}</td></tr>
{% endif %}
<th>Search</th>
<td><input type="text" name="terms" value="{{ terms }}"/></td>
<td>
<select name="type">
<option {{ toggleSelected(type, "package") }} value="package">Packages</option>
<option {{ toggleSelected(type, "build") }} value="build">Builds</option>
<option {{ toggleSelected(type, "tag") }} value="tag">Tags</option>
<option {{ toggleSelected(type, "target") }} value="target">Build Targets</option>
<option {{ toggleSelected(type, "user") }} value="user">Users</option>
<option {{ toggleSelected(type, "host") }} value="host">Hosts</option>
<option {{ toggleSelected(type, "rpm") }} value="rpm">RPMs</option>
{%- if mavenEnabled %}
<option {{ toggleSelected(type, "maven") }} value="maven">Maven Artifacts</option>
{%- endif %}
{%- if winEnabled %}
<option {{ toggleSelected(type, "win") }} value="win">Windows Artifacts</option>
{%- endif %}
</select>
</td>
<td>
{%- if match is not defined %}
{%- set match='glob' %}
{%- endif %}
<input type="radio" name="match" value="glob" {{ toggleSelected(match, "glob", True) }} id="radioglob"/><abbr title="? will match any single character, * will match any sequence of zero or more characters" id="abbrglob">glob</abbr>
<input type="radio" name="match" value="regexp" {{ toggleSelected(match, "regexp", True) }} id="radioregexp"/><abbr title="full POSIX regular expressions" id="abbrregexp">regexp</abbr>
<input type="radio" name="match" value="exact" {{ toggleSelected(match, "exact", True) }} id="radioexact"/><abbr title="exact matches only" id="abbrexact">exact</abbr>
</td>
<td colspan="2"><input type="submit" value="Search"/></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</form>
{% if results is defined %}
<table class="data-list">
<tr>
<td class="paginate" colspan="2">
{%- if resultPages|length > 1 %}
<form class="pageJump" action="">
Page:
<select onchange="javascript: window.location = 'search?start=' + this.value * {{ resultRange }} + '{{ passthrough('order', 'terms', 'type', 'match') }}';">
{% for pageNum in resultPages %}
<option value="{{ pageNum }}"{{ ' selected' if pageNum == resultCurrentPage else '' }}>{{ pageNum + 1 }}</option>
{% endfor %}
</select>
</form>
{%- endif %}
{%- if resultStart > 0 %}
<a href="search?start={{ resultStart - resultRange }}{{ passthrough('order', 'terms', 'type', 'match') }}">&lt;&lt;&lt;</a>
{%- endif %}
{%- if totalResults %}
<strong>Results {{ resultStart + 1 }} through {{ resultStart + resultCount }} of {{ totalResults }}</strong>
{%- endif %}
{%- if resultStart + resultCount < totalResults %}
<a href="search?start={{ resultStart + resultRange }}{{ passthrough('order', 'terms', 'type', 'match') }}">&gt;&gt;&gt;</a>
{%- endif %}
</td>
</tr>
<tr class="list-header">
<th><a href="search?order={{ toggleOrder('id') }}{{ passthrough('terms', 'type', 'match') }}">ID</a> {{ sortImage('id') }}</th>
<th><a href="search?order={{ toggleOrder('name') }}{{ passthrough('terms', 'type', 'match') }}">Name</a> {{ sortImage('name') }}</th>
</tr>
{%- if results %}
{%- for result in results %}
<tr class="{{ rowToggle(loop) }}">
<td>{{ result.id }}</td>
<td><a href="{{ infoURL % result }}">{{ result.name }}</a></td>
</tr>
{%- endfor %}
{%- else %}
<tr class="row-odd">
<td colspan="2">No search results</td>
</tr>
{%- endif %}
<tr>
<td class="paginate" colspan="2">
{% if resultPages|length > 1 %}
<form class="pageJump" action="">
Page:
<select onchange="javascript: window.location = 'search?start=' + this.value * {{ resultRange }} + '{{ passthrough('order', 'terms', 'type', 'match') }}';">
{% for pageNum in resultPages %}
<option value="{{ pageNum }}"{{ ' selected' if pageNum == resultCurrentPage }}>{{ pageNum + 1 }}</option>
{% endfor %}
</select>
</form>
{% endif %}
{% if resultStart > 0 %}
<a href="search?start={{ resultStart - resultRange }}{{ passthrough('order', 'terms', 'type', 'match') }}">&lt;&lt;&lt;</a>
{% endif %}
{% if totalResults != 0 %}
<strong>Results {{ resultStart + 1 }} through {{ resultStart + resultCount }} of {{ totalResults }}</strong>
{% endif %}
{% if resultStart + resultCount < totalResults %}
<a href="search?start={{ resultStart + resultRange }}{{ passthrough('order', 'terms', 'type', 'match') }}">&gt;&gt;&gt;</a>
{% endif %}
</td>
</tr>
</table>
{% endif %}
{% include "footer.html.j2" %}