preferences.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. {% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle %}
  2. {% extends "oscar/base.html" %}
  3. {% block title %}{{ _('preferences') }} - {% endblock %}
  4. {% block site_alert_warning_nojs %}
  5. <noscript>
  6. {% include 'oscar/messages/js_disabled.html' %}
  7. </noscript>
  8. {% endblock %}
  9. {% block content %}
  10. <div>
  11. <h1>{{ _('Preferences') }}</h1>
  12. <form method="post" action="{{ url_for('preferences') }}" id="search_form">
  13. <!-- Nav tabs -->
  14. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  15. <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
  16. <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
  17. <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li>
  18. <li><a href="#tab_cookies" role="tab" data-toggle="tab">{{ _('Cookies') }}</a></li>
  19. </ul>
  20. <!-- Tab panes -->
  21. <noscript>
  22. <h3>{{ _('General') }}</h3>
  23. </noscript>
  24. <div class="tab-content">
  25. <div class="tab-pane active" id="tab_general">
  26. <fieldset>
  27. <div class="container-fluid">
  28. <div class="row form-group">
  29. {% if rtl %}
  30. <div class="col-sm-11 col-md-10">
  31. {% include 'oscar/categories.html' %}
  32. </div>
  33. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  34. {% else %}
  35. <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
  36. <div class="col-sm-11 col-md-10 search-categories">
  37. {% include 'oscar/categories.html' %}
  38. </div>
  39. {% endif %}
  40. </div>
  41. {% set language_label = _('Search language') %}
  42. {% set language_info = _('What language do you prefer for search?') %}
  43. {{ preferences_item_header(language_info, language_label, rtl) }}
  44. <select class="form-control" name='language'>
  45. <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option>
  46. {% for lang_id,lang_name,country_name in language_codes | sort(attribute=1) %}
  47. <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option>
  48. {% endfor %}
  49. </select>
  50. {{ preferences_item_footer(language_info, language_label, rtl) }}
  51. {% set locale_label = _('Interface language') %}
  52. {% set locale_info = _('Change the language of the layout') %}
  53. {{ preferences_item_header(locale_info, locale_label, rtl) }}
  54. <select class="form-control" name='locale'>
  55. {% for locale_id,locale_name in locales.items() | sort %}
  56. <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
  57. {% endfor %}
  58. </select>
  59. {{ preferences_item_footer(locale_info, locale_label, rtl) }}
  60. {% set autocomplete_label = _('Autocomplete') %}
  61. {% set autocomplete_info = _('Find stuff as you type') %}
  62. {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
  63. <select class="form-control" name="autocomplete">
  64. <option value=""> - </option>
  65. {% for backend in autocomplete_backends %}
  66. <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
  67. {% endfor %}
  68. </select>
  69. {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}
  70. {% set image_proxy_label = _('Image proxy') %}
  71. {% set image_proxy_info = _('Proxying image results through searx') %}
  72. {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
  73. <select class="form-control" name='image_proxy'>
  74. <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
  75. <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
  76. </select>
  77. {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}
  78. {% set method_label = _('Method') %}
  79. {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %}
  80. {{ preferences_item_header(method_info, method_label, rtl) }}
  81. <select class="form-control" name='method'>
  82. <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
  83. <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
  84. </select>
  85. {{ preferences_item_footer(method_info, method_label, rtl) }}
  86. {% set safesearch_label = _('SafeSearch') %}
  87. {% set safesearch_info = _('Filter content') %}
  88. {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
  89. <select class="form-control" name='safesearch'>
  90. <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
  91. <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
  92. <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
  93. </select>
  94. {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}
  95. {% set theme_label = _('Themes') %}
  96. {% set theme_info = _('Change searx layout') %}
  97. {{ preferences_item_header(theme_info, theme_label, rtl) }}
  98. <select class="form-control" name="theme">
  99. {% for name in themes %}
  100. <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
  101. {% endfor %}
  102. </select>
  103. {{ preferences_item_footer(theme_info, theme_label, rtl) }}
  104. {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl) }}
  105. <select class="form-control" name='oscar-style'>
  106. <option value="logicodev" >Logicodev</option>
  107. <option value="pointhi" {% if cookies['oscar-style'] == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
  108. </select>
  109. {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }}
  110. </div>
  111. </fieldset>
  112. </div>
  113. <div class="tab-pane active_if_nojs" id="tab_engine">
  114. <!-- Nav tabs -->
  115. <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
  116. {% for categ in all_categories %}
  117. <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
  118. {% endfor %}
  119. </ul>
  120. <noscript>
  121. <h3>{{ _('Engines') }}</h3>
  122. </noscript>
  123. <!-- Tab panes -->
  124. <div class="tab-content">
  125. {% for categ in all_categories %}
  126. <noscript><label>{{ _(categ) }}</label>
  127. </noscript>
  128. <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
  129. <div class="container-fluid">
  130. <fieldset>
  131. <div class="table-responsive">
  132. <table class="table table-hover table-condensed table-striped">
  133. <tr>
  134. {% if not rtl %}
  135. <th>{{ _("Allow") }}</th>
  136. <th>{{ _("Engine name") }}</th>
  137. <th>{{ _("Shortcut") }}</th>
  138. <th>{{ _("SafeSearch") }}</th>
  139. <th>{{ _("Avg. time") }}</th>
  140. <th>{{ _("Max time") }}</th>
  141. {% else %}
  142. <th>{{ _("Max time") }}</th>
  143. <th>{{ _("Avg. time") }}</th>
  144. <th>{{ _("SafeSearch") }}</th>
  145. <th>{{ _("Shortcut") }}</th>
  146. <th>{{ _("Engine name") }}</th>
  147. <th>{{ _("Allow") }}</th>
  148. {% endif %}
  149. </tr>
  150. {% for search_engine in engines_by_category[categ] %}
  151. {% if not search_engine.private %}
  152. <tr>
  153. {% if not rtl %}
  154. <td>{{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}</td>
  155. <th>{{ search_engine.name }}</th>
  156. <td>{{ shortcuts[search_engine.name] }}</td>
  157. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  158. <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td>
  159. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  160. {% else %}
  161. <td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
  162. <td class="{{ 'danger' if stats[search_engine.name]['warn_time'] else '' }}">{{ 'N/A' if stats[search_engine.name].time==None else stats[search_engine.name].time }}</td>
  163. <td><input type="checkbox" {{ "checked" if search_engine.safesearch==True else ""}} readonly="readonly" disabled="disabled"></td>
  164. <td>{{ shortcuts[search_engine.name] }}</td>
  165. <th>{{ search_engine.name }}</th>
  166. <td>{{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}</td>
  167. {% endif %}
  168. </tr>
  169. {% endif %}
  170. {% endfor %}
  171. </table>
  172. </div>
  173. </fieldset>
  174. </div>
  175. </div>
  176. {% endfor %}
  177. </div>
  178. </div>
  179. <div class="tab-pane active_if_nojs" id="tab_plugins">
  180. <noscript>
  181. <h3>{{ _('Plugins') }}</h3>
  182. </noscript>
  183. <fieldset>
  184. <div class="container-fluid">
  185. {% for plugin in plugins %}
  186. <div class="panel panel-default">
  187. <div class="panel-heading">
  188. <h3 class="panel-title">{{ _(plugin.name) }}</h3>
  189. </div>
  190. <div class="panel-body">
  191. <div class="col-xs-6 col-sm-4 col-md-6">{{ _(plugin.description) }}</div>
  192. <div class="col-xs-6 col-sm-4 col-md-6">
  193. {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
  194. </div>
  195. </div>
  196. </div>
  197. {% endfor %}
  198. </div>
  199. </fieldset>
  200. </div>
  201. <div class="tab-pane active_if_nojs" id="tab_cookies">
  202. <noscript>
  203. <h3>{{ _('Cookies') }}</h3>
  204. </noscript>
  205. <p class="text-muted" style="margin:20px 0;">
  206. {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
  207. {{ _('With that list, you can assess searx transparency.') }}<br />
  208. </p>
  209. {% if cookies %}
  210. <table class="table table-striped">
  211. <tr>
  212. <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
  213. <th class="text-muted">{{ _('Value') }}</th>
  214. </tr>
  215. {% for cookie in cookies %}
  216. <tr>
  217. <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
  218. <td class="text-muted">{{ cookies[cookie] }}</td>
  219. </tr>
  220. {% endfor %}
  221. </table>
  222. {% else %}
  223. {% include 'oscar/messages/no_cookies.html' %}
  224. {% endif %}
  225. </div>
  226. </div>
  227. <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }}
  228. <br />
  229. {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
  230. </p>
  231. <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
  232. <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
  233. <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
  234. </form>
  235. </div>
  236. {% endblock %}