X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=templates%2Fadvfilter.html.sh;h=3f8c6207bde7e153719e3a7a7bd5e8716bfd2abd;hb=5667597778145b23dc04aa65e1e9ea3ac0b7fd97;hp=f63d4dc7f328c3a4168594203f1426b18f733bda;hpb=18eaa57ea874a8bf1ebae2a0d758a4bb7632cf37;p=serve0 diff --git a/templates/advfilter.html.sh b/templates/advfilter.html.sh index f63d4dc..3f8c620 100755 --- a/templates/advfilter.html.sh +++ b/templates/advfilter.html.sh @@ -1,4 +1,4 @@ -# Copyright 2014,2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of Serve0 # @@ -15,103 +15,66 @@ # You should have received a copy of the GNU Affero General Public License # along with Serve0 If not, see . -quicklinks(){ - output='' - tac ${_DATA}/meta/recent |while [ "$(echo "$output" |wc -l)" -lt 10 ] && read line; do - line="$line" - echo "$output" |grep -qF "$line" || output="$output$line\n" - done - echo $output -} - -list_categories(){ - echo none - printf %s "$taglist" |sed -rn 's;^([^:]+):.*$;\1;p' |sort -u -} - -category_selected(){ - cat="$1" - filter="$2" - - printf %s "$taglist" \ - | sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \ - | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \ - | sed 's;^0 ;;' -} - category_tabs(){ for cat in "$@"; do cat < - +
+ -
+ EOF done } filterbox(){ - n=$1 - filter="$(printf '%s^' "$filters" |cut -d^ -f$(($n+1)))" - fneg="${filter%%[a-zA-Z]*}" - filter="${filter#!}" - fcat="${filter%%:*}" - [ "$fcat" = "$filter" ] && fcat=none - - debug "fneg: $fneg fcat: $fcat filter: $filter" - - cat < - -
- - - of the items selected here: - - -
- $(category_tabs $(list_categories) ) -
-
-EOF + for n in "$@"; do + filter="$(printf '%s^' "$filters" |cut -d^ -f$(($n+1)))" + fneg="${filter%%[a-zA-Z]*}" + filter="${filter#!}" + fcat="${filter%%:*}" + [ "$fcat" = "$filter" ] && fcat=none + + debug "fneg: $fneg fcat: $fcat filter: $filter" + + cat <<-EOF + + +
+ + + of the items selected here: + + +
+ $(category_tabs $(list_categories) ) +
+
+ EOF + done } cat < - - - - - Clear All - Hide -
+ Hide + Most recent

Up to 10 filter boxes will appear as you start selecting tags. You can select multiple tags in each box by holding down the Ctrl-key. Click the "Filter!" button when you are ready.

- $(for n in {0..9}; do filterbox "$n"; done) + $(filterbox {0..9}) -

+

-

- - +
EOF