| 1 | {% extends "telemeta/base.html" %} |
|---|
| 2 | {% load telemeta_utils %} |
|---|
| 3 | {% load i18n %} |
|---|
| 4 | |
|---|
| 5 | {% block head_title %}{% trans "Advanced Search" %} - {{ block.super }}{% endblock %} |
|---|
| 6 | |
|---|
| 7 | {% block stylesheets %} |
|---|
| 8 | {{ block.super }} |
|---|
| 9 | <link rel="stylesheet" type="text/css" href="{% url telemeta-css "jquery.autocomplete.css" %}" /> |
|---|
| 10 | {% endblock %} |
|---|
| 11 | |
|---|
| 12 | {% block extra_javascript %} |
|---|
| 13 | <script src="{% url telemeta-js "jquery.bgiframe.js" %}" type="text/javascript"></script> |
|---|
| 14 | <script src="{% url telemeta-js "jquery.autocomplete.js" %}" type="text/javascript"></script> |
|---|
| 15 | <script type="text/javascript"> |
|---|
| 16 | function update_period(source, from_field, to_field) { |
|---|
| 17 | var from_year = $(from_field); |
|---|
| 18 | var to_year = $(to_field); |
|---|
| 19 | |
|---|
| 20 | if (from_year.val() == "0") { |
|---|
| 21 | to_year.attr('disabled', '1'); |
|---|
| 22 | to_year.val('0'); |
|---|
| 23 | } else { |
|---|
| 24 | to_year.removeAttr('disabled'); |
|---|
| 25 | if ($(source).is(to_field)) { |
|---|
| 26 | if (parseInt(from_year.val()) > parseInt(to_year.val())) |
|---|
| 27 | from_year.val(to_year.val()); |
|---|
| 28 | } else if (parseInt(from_year.val()) > parseInt(to_year.val())) { |
|---|
| 29 | to_year.val(from_year.val()); |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | $(document).ready(function () { |
|---|
| 35 | $('#location').autocomplete('{% url telemeta-complete-location %}', { |
|---|
| 36 | max: 20, |
|---|
| 37 | formatResult: function(data) { |
|---|
| 38 | return data[0].replace(/ *\([0-9]+.*\) *$/, ''); |
|---|
| 39 | } |
|---|
| 40 | }); |
|---|
| 41 | update_period('#rec_year_from', '#rec_year_to'); |
|---|
| 42 | $('#rec_year_from, #rec_year_to').change(function () { |
|---|
| 43 | update_period(this, '#rec_year_from', '#rec_year_to'); |
|---|
| 44 | }); |
|---|
| 45 | update_period('#pub_year_from', '#pub_year_to'); |
|---|
| 46 | $('#pub_year_from, #pub_year_to').change(function () { |
|---|
| 47 | update_period(this, '#pub_year_from', '#pub_year_to'); |
|---|
| 48 | }); |
|---|
| 49 | }); |
|---|
| 50 | |
|---|
| 51 | </script> |
|---|
| 52 | {% endblock %} |
|---|
| 53 | |
|---|
| 54 | {% block title %} |
|---|
| 55 | <img src="{% url telemeta-images "adv_search_red.png" %}" alt="advanced-search" style="vertical-align:middle" /> {% trans "Advanced Search" %} |
|---|
| 56 | {% endblock %} |
|---|
| 57 | |
|---|
| 58 | {% block content %} |
|---|
| 59 | <form action="{% url telemeta-search %}" id="searchform">{% csrf_token %} |
|---|
| 60 | <fieldset> |
|---|
| 61 | |
|---|
| 62 | <p> |
|---|
| 63 | <label for="location">{% field_label "Location" %}</label> |
|---|
| 64 | <input type="text" name="location" id="location" value="{{ criteria.location }}" /> |
|---|
| 65 | </p> |
|---|
| 66 | |
|---|
| 67 | <p> |
|---|
| 68 | <label for="ethnic_group">{% field_label "EthnicGroup" %}</label> |
|---|
| 69 | <select id="ethnic_group" name="ethnic_group"> |
|---|
| 70 | <option value="">All ethnic groups</option> |
|---|
| 71 | {% for group in ethnic_groups %} |
|---|
| 72 | <option value="{{group.id}}" {% ifequal criteria.ethnic_group.id group.id %}selected {% endifequal %}>{{group|escape}}</option> |
|---|
| 73 | {% endfor %} |
|---|
| 74 | </select> |
|---|
| 75 | </p> |
|---|
| 76 | |
|---|
| 77 | <p> |
|---|
| 78 | <label for="title">{% trans "Title" %}</label> |
|---|
| 79 | <input type="text" id="title" name="title" /> |
|---|
| 80 | </p> |
|---|
| 81 | |
|---|
| 82 | <p> |
|---|
| 83 | <label for="creator">{% field_label "MediaCollection" "creator" %}</label> |
|---|
| 84 | <input type="text" id="creator" name="creator" /> |
|---|
| 85 | </p> |
|---|
| 86 | |
|---|
| 87 | <p> |
|---|
| 88 | <label for="collector">{% field_label "MediaCollection" "collector" %}</label> |
|---|
| 89 | <input type="text" id="collector" name="collector" /> |
|---|
| 90 | </p> |
|---|
| 91 | |
|---|
| 92 | {% if rec_years %} |
|---|
| 93 | <p> |
|---|
| 94 | <label for="rec_date_from">{% trans "Year of recording" %}</label> |
|---|
| 95 | <select id="rec_year_from" name="rec_year_from" class="tiny"> |
|---|
| 96 | <option value="0"></option> |
|---|
| 97 | {% for year in rec_years %} |
|---|
| 98 | <option value="{{ year }}" {% ifequal criteria.rec_year_from year %}selected {% endifequal %}>{{year}}</option> |
|---|
| 99 | {% endfor %} |
|---|
| 100 | </select> |
|---|
| 101 | {% trans "to" %} |
|---|
| 102 | <select id="rec_year_to" name="rec_year_to" class="tiny"> |
|---|
| 103 | <option value="0"></option> |
|---|
| 104 | {% for year in rec_years %} |
|---|
| 105 | <option value="{{ year }}" {% ifequal criteria.rec_year_to year %}selected {% endifequal %}>{{year}}</option> |
|---|
| 106 | {% endfor %} |
|---|
| 107 | </select> |
|---|
| 108 | </p> |
|---|
| 109 | {% endif %} |
|---|
| 110 | |
|---|
| 111 | {% if pub_years %} |
|---|
| 112 | <p> |
|---|
| 113 | <label for="pub_date_from">{% trans "Year of publication" %}</label> |
|---|
| 114 | <select id="pub_year_from" name="pub_year_from" class="tiny"> |
|---|
| 115 | <option value="0"></option> |
|---|
| 116 | {% for year in pub_years %} |
|---|
| 117 | <option value="{{ year }}" {% ifequal criteria.pub_year_from year %}selected {% endifequal %}>{{year}}</option> |
|---|
| 118 | {% endfor %} |
|---|
| 119 | </select> |
|---|
| 120 | {% trans "to" %} |
|---|
| 121 | <select id="pub_year_to" name="pub_year_to" class="tiny"> |
|---|
| 122 | <option value="0"></option> |
|---|
| 123 | {% for year in pub_years %} |
|---|
| 124 | <option value="{{ year }}" {% ifequal criteria.pub_year_to year %}selected {% endifequal %}>{{year}}</option> |
|---|
| 125 | {% endfor %} |
|---|
| 126 | </select> |
|---|
| 127 | </p> |
|---|
| 128 | {% endif %} |
|---|
| 129 | <!-- |
|---|
| 130 | <p><label for="sound">{% trans "Sound" %}</label> |
|---|
| 131 | <input type="checkbox" name="sound" value="True" align="left" /> |
|---|
| 132 | </p> |
|---|
| 133 | --> |
|---|
| 134 | </fieldset> |
|---|
| 135 | |
|---|
| 136 | <p class="input"> |
|---|
| 137 | <a href="#" class="component_icon button icon_search" |
|---|
| 138 | onclick="document.getElementById('searchform').submit(); return false;">{% trans 'Search' %}</a> |
|---|
| 139 | </p> |
|---|
| 140 | |
|---|
| 141 | </form> |
|---|
| 142 | {% endblock %} |
|---|