Skip to content

Commit 4e748d6

Browse files
committed
restore open local file function (closes #54)
Signed-off-by: koniu <[email protected]>
1 parent cfb6564 commit 4e748d6

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

static/style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ body { margin: 0; font-family: sans-serif }
7676
.search-result-url { clear:left; }
7777
.search-result-url a { color: #5a5; font-size: 8pt; float: left; margin-right: 1em;}
7878
.search-result-links { color: #aaf; font-size: 8pt; float: left; margin-right: 1em; visibility: hidden }
79+
.search-result-links a { padding-right: 0.5em; }
80+
.search-result-links a:hover { text-decoration: underline }
7981
.search-result:hover > .search-result-links { visibility: visible }
8082
.search-result-date { color: #777; font-size: 8pt; float: right; margin-bottom: 7px; }
8183
.search-result-size { color: #777; font-size: 8pt; float: right; display: none; }
@@ -114,7 +116,7 @@ tr { vertical-align: top }
114116
#settings-box {
115117
padding: 1em;
116118
position: absolute;
117-
top: 10%;
119+
top: 5%;
118120
left: 30%;
119121
right: 30%;
120122
background: #eee;

views/result.tpl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
%url = url.replace(dr, prefix)
88
%end
99
<div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}">
10-
<a href="download/{{number-1}}?{{query_string}}">{{d['label']}}</a>
10+
%if config.has_key('title_link') and config['title_link'] != 'download':
11+
%if config['title_link'] == 'open':
12+
<a href="{{url}}">{{d['label']}}</a>
13+
%elif config['title_link'] == 'preview':
14+
<a href="preview/{{number-1}}?{{query_string}}">{{d['label']}}</a>
15+
%end
16+
%else:
17+
<a href="download/{{number-1}}?{{query_string}}">{{d['label']}}</a>
18+
%end
1119
</div>
1220
%if len(d['ipath']) > 0:
1321
<div class="search-result-ipath">[{{d['ipath']}}]</div>
@@ -22,11 +30,13 @@
2230
%end
2331
<a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
2432
</div>
25-
%if hasrclextract:
2633
<div class="search-result-links">
27-
<a href="preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
34+
<a href="{{url}}">Open</a>
35+
<a href="download/{{number-1}}?{{query_string}}">Download</a>
36+
%if hasrclextract:
37+
<a href="preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
38+
%end
2839
</div>
29-
%end
3040
<div class="search-result-date">{{d['time']}}</div>
3141
<div class="search-result-snippet">{{!d['snippet']}}</div>
3242
</div>

views/settings.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
<input name="timefmt" value={{timefmt}}>
1717
<b>Folder depth</b> <small class="gray">(number of levels of the folder dropdown)</small>
1818
<input name="dirdepth" value={{dirdepth}}>
19+
<b>Default action</b> <small class="gray">(action to take when clicking result title)</small>
20+
<select name="title_link">
21+
<option value="download" {{'selected' if title_link == 'download' else ''}}>Download</option>
22+
<option value="preview" {{'selected' if title_link == 'preview' else ''}}>Preview</option>
23+
<option value="open" {{'selected' if title_link == 'open' else ''}}>Open</option>
24+
</select>
1925
<hr>
2026
<b>Locations</b><br>
2127
%for d in dirs:

webui.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'maxresults': 0,
4040
'perpage': 25,
4141
'csvfields': 'filename title author size time mtype url',
42+
'title_link': 'download',
4243
}
4344

4445
# sort fields/labels

0 commit comments

Comments
 (0)