Commit 6910c88d authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Use global admin config variables from recoll config file: webui_nojsoncsv,...

Use global admin config variables from recoll config file: webui_nojsoncsv, webui_nosettings, webui_maxperpage
parent 4e748d65
%include header title=""
%include search query=query, dirs=dirs, sorts=sorts
%include search query=query, dirs=dirs, sorts=sorts, config=config
%include footer
%include header title=": " + query['query']+" ("+str(nres)+")"
%include search query=query, dirs=dirs, sorts=sorts
%include search query=query, dirs=dirs, sorts=sorts, config=config
<div id="status">
<div id="found">
Found <b>{{nres}}</b> matching: <b><i>{{qs}}</i></b>
<small class="gray">({{time.seconds}}.{{time.microseconds/10000}}s)</small>
</div>
%if len(res) > 0:
%if len(res) > 0 and not config['rclc_nojsoncsv']:
<div id="downloads">
<a href="./json?{{query_string}}">JSON</a>
<a href="./csv?{{query_string}}">CSV</a>
......
......@@ -9,7 +9,9 @@
<input tabindex="0" type="search" name="query" value="{{query['query']}}" autofocus><br><br>
<input type="submit" value="Search">&nbsp;
<a href="./" tabindex="-1"><input type="button" value="Reset"></a>&nbsp;
<a href="settings" tabindex="-1"><input type="button" value="Settings"></a>
%if not config['rclc_nosettings']:
<a href="settings" tabindex="-1"><input type="button" value="Settings"></a>
%end
</td>
<td width="30%">
<b>Folder</b><br>
......
......@@ -124,6 +124,16 @@ def get_config():
for d in config['dirs']:
name = 'mount_%s' % urllib.quote(d,'')
config['mounts'][d] = select([bottle.request.get_cookie(name), 'file://%s' % d], [None, ''])
# Parameters set by the admin in the recoll configuration
# file. These override anything else, so read them last
config['rclc_nojsoncsv'] = bool(int(rclconf.getConfParam('webui_nojsoncsv')))
val = rclconf.getConfParam('webui_maxperpage')
val = 0 if val is None else int(val)
if val:
if config['perpage'] == 0 or config['perpage'] > val:
config['perpage'] = val
config['rclc_nosettings'] = int(rclconf.getConfParam('webui_nosettings'))
return config
#}}}
#{{{ get_dirs
......@@ -240,7 +250,7 @@ def server_static(path):
def main():
config = get_config()
return { 'dirs': get_dirs(config['dirs'], config['dirdepth']),
'query': get_query(), 'sorts': SORTS }
'query': get_query(), 'sorts': SORTS, 'config': config}
#}}}
#{{{ results
@bottle.route('/results')
......@@ -258,7 +268,7 @@ def results():
get_dirs(config['dirs'], config['dirdepth']),
'qs': qs, 'sorts': SORTS, 'config': config,
'query_string': bottle.request.query_string, 'nres': nres,
'hasrclextract': hasrclextract }
'hasrclextract': hasrclextract, 'config': config}
#}}}
#{{{ preview
@bottle.route('/preview/<resnum:int>')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment