mirror of
https://github.com/koniu/recoll-webui.git
synced 2025-10-03 17:59:50 +02:00
Merge pull request #10 from biolds/master
'Add to browser' option, sort by relevancy by default
This commit is contained in:
commit
30c33c89c9
4 changed files with 35 additions and 1 deletions
|
@ -8,3 +8,15 @@ $(document).ready(function(){
|
||||||
$('input[name="after"]').jdPicker({});
|
$('input[name="after"]').jdPicker({});
|
||||||
$('input[name="before"]').jdPicker();
|
$('input[name="before"]').jdPicker();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function addOpenSearch()
|
||||||
|
{
|
||||||
|
if (window.external && ("AddSearchProvider" in window.external)) {
|
||||||
|
/* Build the url of the form http://host/osd.xml */
|
||||||
|
var url = document.URL;
|
||||||
|
var prefix = RegExp("^https\?://[^/]*/").exec(url);
|
||||||
|
window.external.AddSearchProvider(prefix + "osd.xml");
|
||||||
|
} else {
|
||||||
|
alert("Your browser does not support OpenSearch search plugins.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
10
views/osd.tpl
Normal file
10
views/osd.tpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
||||||
|
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
||||||
|
<ShortName>Recoll</ShortName>
|
||||||
|
<Description>Recoll</Description>
|
||||||
|
<Url type="text/html" template="{{url}}/results?query={searchTerms}"/>
|
||||||
|
<Image width="48" height="48">{{url}}/static/recoll.png</Image>
|
||||||
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
|
<moz:SearchForm>{{url}}/</moz:SearchForm>
|
||||||
|
</OpenSearchDescription>
|
|
@ -21,6 +21,10 @@
|
||||||
%for d in dirs:
|
%for d in dirs:
|
||||||
<small>{{d}}</small><input name="mount_{{d}}" value={{mounts[d]}}>
|
<small>{{d}}</small><input name="mount_{{d}}" value={{mounts[d]}}>
|
||||||
%end
|
%end
|
||||||
|
<hr>
|
||||||
|
<b>Add to browser</b>
|
||||||
|
<br>
|
||||||
|
<a href="#" onClick="addOpenSearch();return false">Register recoll into browser search engines</a>
|
||||||
<br><br><hr>
|
<br><br><hr>
|
||||||
<input type="submit" value="Save">
|
<input type="submit" value="Save">
|
||||||
<a href="./"><input type="button" value="Cancel"></a>
|
<a href="./"><input type="button" value="Cancel"></a>
|
||||||
|
|
10
webui.py
10
webui.py
|
@ -42,10 +42,10 @@ DEFAULTS = {
|
||||||
|
|
||||||
# sort fields/labels
|
# sort fields/labels
|
||||||
SORTS = [
|
SORTS = [
|
||||||
|
("relevancyrating", "Relevancy"),
|
||||||
("mtime", "Date",),
|
("mtime", "Date",),
|
||||||
("url", "Path"),
|
("url", "Path"),
|
||||||
("filename", "Filename"),
|
("filename", "Filename"),
|
||||||
("relevancyrating", "Relevancy"),
|
|
||||||
("fbytes", "Size"),
|
("fbytes", "Size"),
|
||||||
("author", "Author"),
|
("author", "Author"),
|
||||||
]
|
]
|
||||||
|
@ -357,5 +357,13 @@ def set():
|
||||||
bottle.response.set_cookie(cookie_name, str(bottle.request.query.get('mount_%s' % d)), max_age=3153600000)
|
bottle.response.set_cookie(cookie_name, str(bottle.request.query.get('mount_%s' % d)), max_age=3153600000)
|
||||||
bottle.redirect('./')
|
bottle.redirect('./')
|
||||||
#}}}
|
#}}}
|
||||||
|
#{{{ osd
|
||||||
|
@bottle.route('/osd.xml')
|
||||||
|
@bottle.view('osd')
|
||||||
|
def main():
|
||||||
|
#config = get_config()
|
||||||
|
url = bottle.request.urlparts
|
||||||
|
url = '%s://%s' % (url.scheme, url.netloc)
|
||||||
|
return {'url': url}
|
||||||
#}}}
|
#}}}
|
||||||
# vim: fdm=marker:tw=80:ts=4:sw=4:sts=4:et
|
# vim: fdm=marker:tw=80:ts=4:sw=4:sts=4:et
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue