summaryrefslogtreecommitdiff
path: root/searx/templates/oscar/preferences.html
blob: 5f85a9af6378e61c3fccdd1ee4e9a708124c8311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl, checkbox_toggle, support_toggle %}
{% extends "oscar/base.html" %}
{% block title %}{{ _('preferences') }} - {% endblock %}
{% block content %}

<div>

    <h1>{{ _('Preferences') }}</h1>
    <form method="post" action="{{ url_for('preferences') }}" id="search_form">

        <!-- Nav tabs -->
        <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
          <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li>
          <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li>
          <li><a href="#tab_plugins" role="tab" data-toggle="tab">{{ _('Plugins') }}</a></li>
          {% if answerers %}<li><a href="#tab_answerers" role="tab" data-toggle="tab">{{ _('Answerers') }}</a></li>{% endif %}
          <li><a href="#tab_cookies" role="tab" data-toggle="tab">{{ _('Cookies') }}</a></li>
        </ul>

        <!-- Tab panes -->
        <noscript>
            <h3>{{ _('General') }}</h3>
        </noscript>
        <div class="tab-content">
            <div class="tab-pane active" id="tab_general">
                <fieldset>
                <div class="container-fluid">
                    <div class="row form-group">
                        {% if rtl %}
                        <div class="col-sm-11 col-md-10">
                            {% include 'oscar/categories.html' %}
                        </div>
                        <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
                        {% else %}
                        <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label>
                        <div class="col-sm-11 col-md-10 search-categories">
                            {% include 'oscar/categories.html' %}
                        </div>
                        {% endif %}
                    </div>
                    {% set language_label = _('Search language') %}
                    {% set language_info = _('What language do you prefer for search?') %}
                    {{ preferences_item_header(language_info, language_label, rtl) }}
						{% include 'oscar/languages.html' %}
                    {{ preferences_item_footer(language_info, language_label, rtl) }}

                    {% set locale_label = _('Interface language') %}
                    {% set locale_info = _('Change the language of the layout') %}
                    {{ preferences_item_header(locale_info, locale_label, rtl) }}
                        <select class="form-control" name='locale'>
                            {% for locale_id,locale_name in locales.items() | sort %}
                            <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option>
                            {% endfor %}
                        </select>
                    {{ preferences_item_footer(locale_info, locale_label, rtl) }}

                    {% set autocomplete_label = _('Autocomplete') %}
                    {% set autocomplete_info = _('Find stuff as you type') %}
                    {{ preferences_item_header(autocomplete_info, autocomplete_label, rtl) }}
                        <select class="form-control" name="autocomplete">
                            <option value=""> - </option>
                            {% for backend in autocomplete_backends %}
                            <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option>
                            {% endfor %}
                        </select>
                    {{ preferences_item_footer(autocomplete_info, autocomplete_label, rtl) }}

                    {% set image_proxy_label = _('Image proxy') %}
                    {% set image_proxy_info = _('Proxying image results through searx') %}
                    {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl) }}
                        <select class="form-control" name='image_proxy'>
                            <option value="1" {% if image_proxy  %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
                            <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option>
                        </select>
                    {{ preferences_item_footer(image_proxy_info, image_proxy_label, rtl) }}

                    {% set method_label = _('Method') %}
                    {% 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>') %}
                    {{ preferences_item_header(method_info, method_label, rtl) }}
                        <select class="form-control" name='method'>
                            <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option>
                            <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option>
                        </select>
                    {{ preferences_item_footer(method_info, method_label, rtl) }}

                    {% set safesearch_label = _('SafeSearch') %}
                    {% set safesearch_info = _('Filter content') %}
                    {{ preferences_item_header(safesearch_info, safesearch_label, rtl) }}
                        <select class="form-control" name='safesearch'>
                            <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option>
                            <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option>
                            <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option>
                        </select>
                    {{ preferences_item_footer(safesearch_info, safesearch_label, rtl) }}

                    {% set theme_label = _('Themes') %}
                    {% set theme_info = _('Change searx layout') %}
                    {{ preferences_item_header(theme_info, theme_label, rtl) }}
                        <select class="form-control" name="theme">
                            {% for name in themes %}
                            <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option>
                            {% endfor %}
                        </select>
                    {{ preferences_item_footer(theme_info, theme_label, rtl) }}

                    {{ preferences_item_header(_('Choose style for this theme'), _('Style'), rtl) }}
                        <select class="form-control" name='oscar-style'>
                            <option value="logicodev" >Logicodev</option>
                            <option value="pointhi" {% if cookies['oscar-style'] == 'pointhi' %}selected="selected"{% endif %}>Pointhi</option>
                        </select>
                    {{ preferences_item_footer(_('Choose style for this theme'), _('Style'), rtl) }}

                    {% set label = _('Results on new tabs') %}
                    {% set info = _('Open result links on new browser tabs') %}
                    {{ preferences_item_header(info, label, rtl) }}
                        <select class="form-control" name='results_on_new_tab'>
                            <option value="1" {% if results_on_new_tab %}selected="selected"{% endif %}>{{ _('On') }}</option>
                            <option value="0" {% if not results_on_new_tab %}selected="selected"{% endif %}>{{ _('Off')}}</option>
                        </select>
                    {{ preferences_item_footer(info, label, rtl) }}

                    {% set label = _('Open Access DOI resolver') %}
                    {% set info = _('Redirect to open-access versions of publications when available (plugin required)') %}
                    {{ preferences_item_header(info, label, rtl) }}
                        <select class="form-control" id='doi_resolver' name='doi_resolver'>
                            {% for doi_resolver_name,doi_resolver_url in doi_resolvers.items() %}
                            <option value="{{ doi_resolver_name }}" {% if doi_resolver_name == current_doi_resolver %}selected="selected"{% endif %}>
                                    {{ doi_resolver_name }} - {{ doi_resolver_url }}
                            </option>
                             {% endfor %}
                         </select>
                    {{ preferences_item_footer(info, label, rtl) }}
                </div>
                </fieldset>
            </div>
            <div class="tab-pane active_if_nojs" id="tab_engine">

                <!-- Nav tabs -->
                <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;">
                    {% for categ in all_categories %}
                    <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li>
                    {% endfor %}
                </ul>

                <noscript>
                    <h3>{{ _('Engines') }}</h3>
                </noscript>

                <!-- Tab panes -->
                <div class="tab-content">
                    {% for categ in all_categories %}
                    <noscript><label>{{ _(categ) }}</label>
                    </noscript>
                    <div class="tab-pane{% if loop.first %} active{% endif %} active_if_nojs" id="tab_engine_{{ categ|replace(' ', '_') }}">
                        <div class="container-fluid">
                        <fieldset>
                          <div class="table-responsive">
			  <table class="table table-hover table-condensed table-striped">
			        <tr>
                                    {% if not rtl %}
				    <th>{{ _("Allow") }}</th>
				    <th>{{ _("Engine name") }}</th>
				    <th>{{ _("Shortcut") }}</th>
				    <th>{{ _("Selected language") }}</th>
				    <th>{{ _("SafeSearch") }}</th>
				    <th>{{ _("Time range") }}</th>
				    <th>{{ _("Avg. time") }}</th>
				    <th>{{ _("Max time") }}</th>
                                    {% else %}
				    <th>{{ _("Max time") }}</th>
				    <th>{{ _("Avg. time") }}</th>
				    <th>{{ _("Time range") }}</th>
				    <th>{{ _("SafeSearch") }}</th>
				    <th>{{ _("Selected language") }}</th>
				    <th>{{ _("Shortcut") }}</th>
				    <th>{{ _("Engine name") }}</th>
				    <th>{{ _("Allow") }}</th>
                                    {% endif %}
                                </tr>
                        {% for search_engine in engines_by_category[categ] %}
                            {% if not search_engine.private %}
                                <tr>
                                    {% if not rtl %}
                                    <td class="onoff-checkbox">
                                        {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
                                    </td>
                                    <th>{{ search_engine.name }}</th>
				    <td class="name">{{ shortcuts[search_engine.name] }}</td>
					<td>{{ support_toggle(current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages) }}</td>
					<td>{{ support_toggle(search_engine.safesearch==True) }}</td>
					<td>{{ support_toggle(search_engine.time_range_support==True) }}</td>
					<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>
					<td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
									{% else %}
					<td class="{{ 'danger' if stats[search_engine.name]['warn_timeout'] else '' }}">{{ search_engine.timeout }}</td>
					<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>
					<td>{{ support_toggle(search_engine.time_range_support==True) }}</td>
					<td>{{ support_toggle(search_engine.safesearch==True) }}</td>
					<td>{{ support_toggle(current_language == 'all' or current_language in search_engine.supported_languages or current_language.split('-')[0] in search_engine.supported_languages) }}</td>
					<td>{{ shortcuts[search_engine.name] }}</td>
                                    <th>{{ search_engine.name }}</th>
                                    <td class="onoff-checkbox">
                                        {{ checkbox_toggle('engine_' + search_engine.name|replace(' ', '_') + '__' + categ|replace(' ', '_'), (search_engine.name, categ) in disabled_engines) }}
                                    </td>
                                    {% endif %}
                                </tr>
                            {% endif %}
                        {% endfor %}
		          </table>
                          </div>
                        </fieldset>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
            <div class="tab-pane active_if_nojs" id="tab_plugins">
                <noscript>
                    <h3>{{ _('Plugins') }}</h3>
                </noscript>
                <fieldset>
                    <div class="container-fluid">
                        {% for plugin in plugins %}
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">{{ _(plugin.name) }}</h3>
                            </div>
                            <div class="panel-body">
                                <div class="col-xs-6 col-sm-4 col-md-6">{{ _(plugin.description) }}</div>
                                <div class="col-xs-6 col-sm-4 col-md-6">
                                    <div class="onoff-checkbox">
                                    {{ checkbox_toggle('plugin_' + plugin.id, plugin.id not in allowed_plugins) }}
                                    </div>
                                </div>
                            </div>
                        </div>
                        {% endfor %}
                    </div>
                </fieldset>
            </div>

            {% if answerers %}
            <div class="tab-pane active_if_nojs" id="tab_answerers">
                <noscript>
                    <h3>{{ _('Answerers') }}</h3>
                </noscript>
                <p class="text-muted" style="margin:20px 0;">
                    {{ _('This is the list of searx\'s instant answering modules.') }}
                </p>
                <table class="table table-striped">
                    <tr>
                        <th class="text-muted">{{ _('Name') }}</th>
                        <th class="text-muted">{{ _('Keywords') }}</th>
                        <th class="text-muted">{{ _('Description') }}</th>
                        <th class="text-muted">{{ _('Examples') }}</th>
                    </tr>

                    {% for answerer in answerers %}
                    <tr>
                        <td class="text-muted">{{ answerer.info.name }}</td>
                        <td class="text-muted">{{ answerer.keywords|join(', ') }}</td>
                        <td class="text-muted">{{ answerer.info.description }}</td>
                        <td class="text-muted">{{ answerer.info.examples|join(', ') }}</td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
            {% endif %}

            <div class="tab-pane active_if_nojs" id="tab_cookies">
                <noscript>
                    <h3>{{ _('Cookies') }}</h3>
                </noscript>
                <p class="text-muted" style="margin:20px 0;">
                    {{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br />
                    {{ _('With that list, you can assess searx transparency.') }}<br />
                </p>
                {% if cookies %}
                <table class="table table-striped">
                    <tr>
                        <th class="text-muted" style="padding-right:40px;">{{ _('Cookie name') }}</th>
                        <th class="text-muted">{{ _('Value') }}</th>
                    </tr>

                    {% for cookie in cookies %}
                    <tr>
                        <td class="text-muted" style="padding-right:40px;">{{ cookie }}</td>
                        <td class="text-muted">{{ cookies[cookie] }}</td>
                    </tr>
                    {% endfor %}
                </table>
                {% else %}
                    {% include 'oscar/messages/no_cookies.html' %}
                {% endif %}
            </div>
        </div>
        <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.') }}
        <br />
        {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }}
        </p>
        <p style="margin:20px 0;">{{ _('Search URL of the currently saved preferences') }} <small class="text-muted">({{ _('Note: specifying custom settings in the search URL can reduce privacy by leaking data to the clicked result sites.') }})</small>:<br/>
          <input readonly="" class="form-control select-all-on-click cursor-text" type="url" value="{{ url_for('index', _external=True) }}?preferences={{ preferences_url_params|e }}{% raw %}&amp;q=%s{% endraw %}">
        </p>

        <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
        <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
        <a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
    </form>
</div>
{% endblock %}