preferences.html 17 KB

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