TITLE="List by $order"
fi
-quicklinks(){
- output=''
- tac ${_DATA}/meta/recent \
- | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do
- printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
- done
- printf %s "$output" |while read line; do
- linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g')
- lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g')
- printf '<input type="checkbox"><a href="%s">by %s: %s</a>' "$line" "${lineo}" "$(present_filter "$linef")"
- done
-}
-
category_selected(){
cat="${1}:"
filter="$2"
--- /dev/null
+#!/bin/zsh
+
+# Copyright 2014 - 2016 Paul Hänsch
+#
+# This file is part of Serve0.
+#
+# Serve0 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Serve0 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Serve0. If not, see <http://www.gnu.org/licenses/>.
+
+. $_EXEC/pages/common.sh
+
+LF='
+'
+filters="${_GET[f]}"
+debug "FILTERS: $filters"
+
+present_filter(){
+ printf %s\\n "$*" \
+ | sed -r 's;(^|!|\^|\|)([^!\^\|:]+:);\1;g;s;\^;\n;g' \
+ | sort -r \
+ | sed -r '$q;s;$; \&\; ;g'
+}
+
+quicklinks(){
+ output=''
+ tac ${_DATA}/meta/recent \
+ | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do
+ printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
+ done
+ printf %s "$output" |while read line; do
+ linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g')
+ lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g')
+ printf '<input type="checkbox"><a target="blank" href="%s">by %s: %s</a>' \
+ "$line" "${lineo}" "$(present_filter "$linef")"
+ done
+}
+
+category_selected(){
+ cat="${1}:"
+ filter="$2"
+ [ "$cat" = "none:" ] && cat=''
+
+ printf %s "$taglist" \
+ | sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \
+ | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \
+ | sed 's;^0 ;<option>;;s;^1 ;<option selected>;;s;$;</option>;'
+}
+
}
#advfilter .quicklinks {width: 100%;}
-#advfilter .quicklinks :first-child {width: 100%;}
-#advfilter .quicklinks input { display: none; }
-#advfilter .quicklinks a {
- display: none;
+
+.quicklinks :first-child {width: 100%;}
+.quicklinks input { display: block; }
+.quicklinks a {
+ display: block;
word-wrap: break-word;
margin-left: 10%;
margin-bottom: .75em;
margin-top: -1.5em;
}
-#advfilter .quicklinks:hover input,
-#advfilter .quicklinks:hover a {display: block;}
-#advfilter .quicklinks input:checked,
-#advfilter .quicklinks input:checked + a { display: none;}
+.quicklinks input:checked,
+.quicklinks input:checked + a { display: none;}
/* == Thumblist == */
<input type="submit" value="Filter!">
</p>
- <p class="quicklinks">
- <label class="quicklinks">Most recent</label>
- $(quicklinks)
- </p>
+ <a class="quicklinks" href="?p=quicklinks">Most recent</a>
</form>
EOF
--- /dev/null
+# Copyright 2014 - 2016 Paul Hänsch
+#
+# This file is part of Serve0
+#
+# Serve0 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Serve0 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Serve0 If not, see <http://www.gnu.org/licenses/>.
+
+cat <<EOF
+ <form class="panel" id="search" action="?" method="get" accept-charset="UTF-8">
+ <input type="text" name="s" value="$search" placeholder="Search">
+
+ <select class="order" size="1" name="o" id="o1">
+ <option class="label" selected disabled>Order by</option>
+ <option>Name</option>
+ <option>Date</option>
+ <option>Length</option>
+ </select>
+ <!-- input type="submit" name="submit" value="Find" -->
+
+ <a class="panel clearsearch" href="?">Clear All</a>
+ <a class="panel toggle" href="#advfilter">Advanced</a>
+ <a class="panel toggle" href="#playctl">Player</a>
+ </form>
+
+ $(. $_EXEC/templates/playpanel.html.sh)
+
+ <p class="quicklinks">
+ <label class="quicklinks">Most recent</label>
+ $(quicklinks)
+ </p>
+
+ <div class="panel" id="foot">
+ <a class="panel toggle" href="#preferences">Preferences</a>
+ <a class="panel treeview" href="?p=tree">Browse Folders</a>
+ </div>
+
+ $(. $_EXEC/templates/preferences.html.sh)
+ $(. $_EXEC/templates/advfilter.html.sh)
+EOF
+
+# vi:set filetype=html: