]> git.plutz.net Git - serve0/blob - templates/filterdiag.html.sh
initial commit
[serve0] / templates / filterdiag.html.sh
1 #!/bin/zsh    
2
3 cat <<FilterEnd
4   <div class="panel" id="search" style="display: block;">
5     <form action="index.cgi" method="get" accept-charset="UTF-8">
6       <input type="text" name="s" value="$search" placeholder="Search">
7       Order by:<select size="1" name="o">
8         <option>Name</option>
9         <option>Date</option>
10         <option>Length</option>
11       </select>
12       <input type="submit" name="submit" value="Find">
13       <a class="panel" href="?">Clear All</a>
14       <a class="panel" href="#" onclick="javascript:hide_block('search');show_block('advfilter');">Advanced</a>
15     <span style="float:right;">
16       <b>Page:</b> <a href="?i=$info&o=$order&p=$([ "$page" != 0 ] && echo $(($page - 1)) || echo 0)&f=$filter&s=$search#$anchor">&lt;&lt;</a>
17       <a href="?i=&o=$order&p=$page&f=$filter&s=$search#$anchor">$(($page + 1))</a>
18       <a href="?i=$info&o=$order&p=$(($page + 1))&f=$filter&s=$search#$anchor">&gt;&gt;</a>
19     </span>
20     </form>
21   </div>
22
23
24   <div class="panel" id="advfilter" style="display: none;">
25     <input disabled type="text" name="s" value="$search" placeholder="Search">
26     <input disabled type="submit" name="submit" value="Find">
27     <a class="panel" href="?">Clear All</a>
28     <a class="panel" href="#" onclick="javascript:hide_block('advfilter');$(for n in {1..9}; do echo "hide_inline('filter$n');"; done)show_block('search')">Hide</a>
29     <hr>
30     Up to <b>10</b> filter boxes will appear as you start selecting tags. You can select <b>multiple</b> tags in each box by holding down the <b>Ctrl</b>-key. Click the "<b>Filter!</b>" button when you are ready.
31     <form action="filter.cgi" method="post" accept-charset="UTF-8">
32     $(for n in {0..9}; do
33       hideall="$(sed -rn "s;^([^:]+):.*$;hide_inline('${n}_\\1')\\;;p" <<<"$taglist" |sort -u)hide_inline('${n}_none');"
34       echo "
35       <div id=\"filter$n\" $([ $n -gt 0 ] && echo 'style="display:none;"')><b>and</b><br>
36         <input type=\"radio\" name=\"type$n\" value=\"pos\" checked><b>Any</b><br>
37         <input type=\"radio\" name=\"type$n\" value=\"neg\"><b>None</b><br>
38         of the tags selected here:<br> Category:
39         <select name=\"category\" size=\"1\" onchange=\"${hideall}show_inline('${n}_'+this.options[this.options.selectedIndex].value)\">
40           <option>none</option>
41           $(sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' <<<"$taglist" |sort -u)
42         </select><br>
43         <select name=\"filter\" size=\"12\" multiple id=\"${n}_none\" onchange=\"show_inline('filter$((1+$n))')\">
44            $(sed -rn 's;^([^:]+)$;<option>\1</option>;p' <<<"$taglist")
45         </select>
46         $(sed -rn 's;^([^:]+):.*$;\1;p' <<<"$taglist" |sort -u |while read cat; do echo "
47         <select name=\"cfilter\" size=\"12\" multiple id=\"${n}_$cat\" style=\"display:none;\" onchange=\"show_inline('filter$((1+$n))')\">
48            $(sed -rn "s;^$cat:(.*)$;<option>\\1</option>;p" <<<"$taglist")
49         </select>"
50         done)
51       </div>"
52     done)
53       <div>
54         Order by:<select size="1" name="o">
55           <option>Name</option>
56           <option>Date</option>
57           <option>Length</option>
58         </select><br>
59         <input type="submit" value="Filter!">
60       </div>
61     </form>
62
63     <br/>
64     <h2>Most recent</h2>
65     $(uniq meta/recent |tail -n 10 |sed -r 's:^(.*)$:<a href="\1">\1</a><br/>:g')
66   </div>
67 FilterEnd
68
69 # vi:set filetype=html:
70