<div id="pkglist-search" class="box filter-criteria">
    <h2>{% trans %}Search Criteria{% endtrans %}</h2>
    <form action='/packages' method='get'>
        <p><input type='hidden' name='O' value='0'/></p>

        <fieldset>
            <legend>{{ "Enter search criteria" | tr }}</legend>
            <div>
                <label for="id_method">{{ "Search by" | tr }}</label>
                <select name='SeB'>
                    <option value="nd" {% if SeB == "nd" %}selected{% endif %}>{{ "Name, Description" | tr }}</option>
                    <option value="n" {% if SeB == "n" %}selected{% endif %}>{{ "Name Only" | tr }}</option>
                    <option value="b" {% if SeB == "b" %}selected{% endif%}>{{ "Package Base" | tr }}</option>
                    <option value="N" {% if SeB == "N" %}selected{% endif %}>{{ "Exact Name" | tr }}</option>
                    <option value="B" {% if SeB == "B" %}selected{% endif %}>{{ "Exact Package Base" | tr }}</option>
                    <option value="k" {% if SeB == "k" %}selected{% endif %}>{{ "Keywords" | tr }}</option>
                    <option value="m" {% if SeB == "m" %}selected{% endif %}>{{ "Maintainer" | tr }}</option>
                    <option value="c" {% if SeB == "c" %}selected{% endif %}>{{ "Co-maintainer" | tr }}</option>
                    <option value="M" {% if SeB == "M" %}selected{% endif %}>{{ "Maintainer, Co-maintainer" | tr }}</option>
                    <option value="s" {% if SeB == "s" %}selected{% endif %}>{{ "Submitter" | tr }}</option>
                </select>
            </div>
            <div>
                <label for="id_q">{{ "Keywords" | tr }}</label>
                <input type='text' name='K' size='30' value="{{ K or '' }}" maxlength='35'/>
            </div>
            <div>
                <label for="id_out_of_date">{{ "Out of Date" | tr }}</label>
                <select name='outdated'>
                    <option value=''>{{ "All" | tr }}</option>
                    <option value='on' {% if outdated == "on" %}selected{% endif %}>{{ "Flagged" | tr }}</option>
                    <option value='off' {% if outdated == "off" %}selected{% endif %}>{{ "Not Flagged" | tr }}</option>
                </select>
            </div>
            <div>
                <label for="id_sort_by">{{ "Sort by" | tr }}</label>
                {% if not SB %}
                    {% set SB = 'p' %}
                {% endif %}
                <select name='SB'>
                    <option value='n' {% if SB == "n" %}selected{% endif %}>{{ "Name" | tr }}</option>
                    <option value='v' {% if SB == "v" %}selected{% endif %}>{{ "Votes" | tr }}</option>
                    <option value='p' {% if SB == "p" %}selected{% endif %}>{{ "Popularity" | tr }}</option>
                    <option value='w' {% if SB == "w" %}selected{% endif %}>{{ "Voted" | tr }}</option>
                    <option value='o' {% if SB == "o" %}selected{% endif %}>{{ "Notify" | tr }}</option>
                    <option value='m' {% if SB == "m" %}selected{% endif %}>{{ "Maintainer" | tr }}</option>
                    <option value='l' {% if SB == "l" %}selected{% endif %}>{{ "Last modified" | tr }}</option>
                </select>
            </div>
            <div>
                <label for="id_order_by">{{ "Sort order" | tr }}</label>
                {% if not SO %}
                    {% set SO = 'd' %}
                {% endif %}
                <select name='SO'>
                    <option value='a' {% if SO == "a" %}selected{% endif %}>{{ "Ascending" | tr }}</option>
                    <option value='d' {% if SO == "d" %}selected{% endif %}>{{ "Descending" | tr }}</option>
                </select>
            </div>
            <div>
                <label for="id_per_page">{{ "Per page" | tr }}</label>
                <select name='PP'>
                    <option value="50" {% if PP == 50 %}selected{% endif %}>50</option>
                    <option value="100" {% if PP == 100 %}selected{% endif %}>100</option>
                    <option value="250" {% if PP == 250 %}selected{% endif %}>250</option>
                </select>
            </div>
            <div>
                <label>&nbsp;</label>
                <button type='submit' class='button' name='submit' value='Go'>
                    {{ "Go" | tr }}
                </button>
                <button type='submit' class='button' name='submit' value='Orphans'>
                    {{ "Orphans" | tr }}
                </button>
            </div>
        </fieldset>
    </form>
</div>
