]> git.plutz.net Git - serve0/blob - templates/filter.html.sh
rename p attribute to pn, and use p for cgi page name instead
[serve0] / templates / filter.html.sh
1 # Copyright 2014 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   <form class="panel" id="advfilter"
20         action="?action=filter" method="post" accept-charset="UTF-8">
21     <input disabled type="text" name="s" value="$search" placeholder="Search">
22     <label for="o2" class="order">Order by:</label>
23     <select disabled class="order" size="1" name="o" id="o2">
24       <option>Name</option>
25       <option>Date</option>
26       <option>Length</option>
27     </select>
28     <input disabled type="submit" name="submit" value="Find">
29
30     <a class="panel clearsearch" href="?">Clear All</a>
31     <a class="panel advanced hide" href="?p=list">Hide</a>
32     <hr>
33
34     <p class="help">Up to <strong>10</strong> filter boxes will appear as you start selecting tags. You can select <strong>multiple</strong> tags in each box by holding down the <strong>Ctrl</strong>-key. Click the "<strong>Filter!</strong>" button when you are ready.</p>
35
36   $(for n in {0..9}; do
37     hideall="$(echo "$taglist" |sed -rn "s;^([^:]+):.*$;hide('${n}_\\1')\\;;p" |sort -u)hide('${n}_none');"
38     echo "
39     <p class="filter" id=\"filter$n\" $([ $n -gt 0 ] && echo 'style="display:none;"')>
40       <span class=\"help conjunction\">and</span>
41       <label class=\"conjunction\"><input type=\"radio\" name=\"type$n\" value=\"pos\" checked>Any</label>
42       <label class=\"conjunction\"><input type=\"radio\" name=\"type$n\" value=\"neg\">None</label>
43       <span class=\"help\">of the tags selected here:</span>
44       <label for=\"category$n\" class=\"category\">Category:</label>
45       <select class=\"input category\" name=\"category$n\" size=\"1\" id=\"category$n\"
46               onchange=\"${hideall}show_block('${n}_'+this.options[this.options.selectedIndex].value)\">
47         <option>none</option>
48         $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' |sort -u)
49       </select>
50       <select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_none\"
51               onchange=\"show_iblock('filter$((1+$n))')\">
52          $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option>\1</option>;p')
53       </select>
54       $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo "
55       <select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_$cat\" style=\"display:none;\"
56               onchange=\"show_iblock('filter$((1+$n))')\">
57          $(echo "$taglist" |sed -rn 's;^'"$cat"':(.*)$;<option>\1</option>;p')
58       </select>"
59       done)
60     </p>"
61   done)
62
63     <p class="filter final">
64       <label for="o3" class="order">Order by:</label>
65       <select class="edit order" size="1" name="o" id="o3">
66         <option>Name</option>
67         <option>Date</option>
68         <option>Length</option>
69       </select>
70       <input type="submit" value="Filter!">
71     </p>
72
73     <p class="quicklinks">
74       <label class="quicklinks">Most recent</label>
75       $(output=''
76         tac ${_DATA}/meta/recent |while [ "$(echo "$output" |wc -l)" -lt 10 ] && read line; do
77           line="<a href="$line">$line</a>"
78           echo "$output" |grep -qF "$line" || output="$output$line\n"
79         done
80         echo $output
81       )
82     </p>
83   </form>
84
85   <form>
86     <ul id="thumblist">
87       $(thumblist)
88     </ul>
89
90     <div class="panel footer" id="foot">
91       <div class="pagination_nav">
92         <label>Page:</label>
93         <a href="?${page_prev}">&lt;&lt;</a>
94         <a href="?${page_this}">$(($page + 1))</a>
95         <a href="?${page_next}">&gt;&gt;</a>
96       </div>
97     </div>
98   </form>
99 EOF
100
101 # vi:set filetype=html: