]> git.plutz.net Git - serve0/blob - templates/browse.html.sh
basics for indexed browsing
[serve0] / templates / browse.html.sh
1 # Copyright 2017 Paul Hänsch
2 #
3 # This file is part of Serve0
4
5 # Serve0 is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # Serve0 is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Affero General Public License for more details.
14
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Serve0  If not, see <http://www.gnu.org/licenses/>. 
17
18 cat <<EOF
19
20   <input type=radio name=topmenu id=btn_search checked><label for=btn_search>Search</label>
21   <form class="panel" id="search" action="?" method="get" accept-charset="UTF-8">
22     <input type="text" name="s" value="$search" placeholder="Search">
23
24     <select class="order" size="1" name="o" id="o1">
25       <option class="label" selected disabled>Order by</option>
26       <option>Name</option>
27       <option>Date</option>
28       <option>Length</option>
29     </select>
30     <!-- input type="submit" name="submit" value="Find" -->
31
32     <a class="panel clearsearch" href="?">Clear</a>
33   </form>
34
35   <input type=radio name=topmenu id=btn_advfilter><label for=btn_advfilter>Advanced</label>
36   $(. $_EXEC/templates/advfilter.html.sh)
37
38   <input type=radio name=topmenu id=btn_preferences><label for=btn_preferences>Preferences</label>
39   $(. $_EXEC/templates/preferences.html.sh)
40
41   <input type=radio name=topmenu id=btn_morelinks><label for=btn_morelinks>{+}</label>
42   <div class="panel switchable top" id="morelinks">
43     <a class="panel toggle" href="#">Hide</a>
44
45     <a class="panel" href="?p=playctl">Player</a>
46   </div>
47
48   <form action="?action=multitag" method="post" accept-charset="UTF-8">
49     <input type="hidden" name="o" value="${order}">
50     <input type="hidden" name="s" value="${search}">
51     <input type="hidden" name="f" value="${filter}">
52     <input type="hidden" name="pn" value="${page}">
53
54     <ul id="thumblist">
55 EOF
56
57   filelist
58
59   pages="$(
60   seq 1 $(pagecount) \
61   | while read pn; do
62     plink="$(($pn * $pagesize - $pagesize + 1))"
63     
64     case "$plink" in
65       $(($page - $pagesize))) class=previous;;
66       $page) class=current;;
67       $(($page + $pagesize))) class=next;;
68       * ) class='';;
69     esac
70   
71     printf '<a class="%s" href="?%spn=%s">%s</a>\n' "$class" "$page_link" "$plink" "$pn"
72   done
73   )"
74
75 cat <<EOF
76     </ul>
77     $(. $_EXEC/templates/tagger.html.sh)
78   </form>
79
80   <div class="panel" id="foot">
81     $( $indexed \
82        && printf '<a class="panel toggle" href="#tagger">Add Tags</a>' \
83        || printf '<a class="panel" href="?action=dirindex&d=%s">Spawn Index</a>' "$(urlsafe "$directory")"
84     )
85     <a class="panel toggle" href="#">⇧</a>
86
87     <div class="pagination_nav">
88       <label>Page:</label>
89       ${pages}
90     </div>
91   </div>
92
93 EOF
94
95 # vi:set filetype=html: