]> git.plutz.net Git - serve0/blob - templates/filterdiag.html.sh
ec2dee565f2e20dea390ef8c451925857ea77480
[serve0] / templates / filterdiag.html.sh
1 #!/bin/zsh    
2
3 cat <<FilterEnd
4   <form class="panel" id="search" style="display: block;"
5         action="?" method="get" accept-charset="UTF-8">
6     <input type="text" name="s" value="$search" placeholder="Search">
7
8     <label for="o1" class="order">Order by:</label>
9     <select class="order" size="1" name="o" id="o1">
10       <option>Name</option>
11       <option>Date</option>
12       <option>Length</option>
13     </select>
14     <input type="submit" name="submit" value="Find">
15
16     <a class="panel clearsearch" href="?">Clear All</a>
17     <a class="panel advanced show" href="#" onclick="javascript:hide('search');show_block('advfilter');">Advanced</a>
18
19     <div class="pagination_nav">
20       <label>Page:</label>
21       <a href="?${page_prev}">&lt;&lt;</a>
22       <a href="?${page_this}">$(($page + 1))</a>
23       <a href="?${page_next}">&gt;&gt;</a>
24     </div>
25   </form>
26
27   <form class="panel" id="advfilter" style="display: none;"
28         action="?action=filter" method="post" accept-charset="UTF-8">
29     <input disabled type="text" name="s" value="$search" placeholder="Search">
30     <label for="o2" class="order">Order by:</label>
31     <select disabled class="order" size="1" name="o" id="o2">
32       <option>Name</option>
33       <option>Date</option>
34       <option>Length</option>
35     </select>
36     <input disabled type="submit" name="submit" value="Find">
37
38     <a class="panel clearsearch" href="?">Clear All</a>
39     <a class="panel advanced hide" href="#" 
40      onclick="javascript:hide('advfilter');$(for n in {1..9}; do echo "hide('filter$n');"; done)show_block('search')"
41     >Hide</a>
42     <hr>
43
44     <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>
45
46   $(for n in {0..9}; do
47     hideall="$(echo "$taglist" |sed -rn "s;^([^:]+):.*$;hide('${n}_\\1')\\;;p" |sort -u)hide('${n}_none');"
48     echo "
49     <p class="filter" id=\"filter$n\" $([ $n -gt 0 ] && echo 'style="display:none;"')>
50       <span class=\"help conjunction\">and</span>
51       <label class=\"conjunction\"><input type=\"radio\" name=\"type$n\" value=\"pos\" checked>Any</label>
52       <label class=\"conjunction\"><input type=\"radio\" name=\"type$n\" value=\"neg\">None</label>
53       <span class=\"help\">of the tags selected here:</span>
54       <label for=\"category$n\" class=\"category\">Category:</label>
55       <select class=\"input category\" name=\"category$n\" size=\"1\" id=\"category$n\"
56               onchange=\"${hideall}show_block('${n}_'+this.options[this.options.selectedIndex].value)\">
57         <option>none</option>
58         $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;<option>\1</option>;p' |sort -u)
59       </select>
60       <select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_none\"
61               onchange=\"show_iblock('filter$((1+$n))')\">
62          $(echo "$taglist" |sed -rn 's;^([^:]+)$;<option>\1</option>;p')
63       </select>
64       $(echo "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u |while read cat; do echo "
65       <select class=\"input tagfilter\" name=\"cfilter${n}_\" size=\"12\" multiple id=\"${n}_$cat\" style=\"display:none;\"
66               onchange=\"show_iblock('filter$((1+$n))')\">
67          $(echo "$taglist" |sed -rn 's;^'"$cat"':(.*)$;<option>\1</option>;p')
68       </select>"
69       done)
70     </p>"
71   done)
72
73     <p class="filter final">
74       <label for="o3" class="order">Order by:</label>
75       <select class="edit order" size="1" name="o" id="o3">
76         <option>Name</option>
77         <option>Date</option>
78         <option>Length</option>
79       </select>
80       <input type="submit" value="Filter!">
81     </p>
82
83     <p class="quicklinks">
84       <label class="quicklinks">Most recent</label>
85       $(output=''
86         tac ${_DATA}/meta/recent |while [ "$(echo "$output" |wc -l)" -lt 10 ] && read line; do
87           line="<a href="$line">$line</a>"
88           echo "$output" |grep -qF "$line" || output="$output$line\n"
89         done
90         echo $output
91       )
92     </p>
93   </form>
94 FilterEnd
95
96 # vi:set filetype=html:
97