X-Git-Url: http://git.plutz.net/?p=serve0;a=blobdiff_plain;f=list.sh;h=d0868baffeda9c0af2b778c85a048f05f618b3dc;hp=324d8eb29007e6e548b63da225b25595ac723a90;hb=fac83e5789b5b68484ba8bdf7830c462a722d000;hpb=f99cce3548251966cd0b7c9ead81460e2f14466c diff --git a/list.sh b/list.sh index 324d8eb..d0868ba 100644 --- a/list.sh +++ b/list.sh @@ -15,11 +15,13 @@ list_item() { printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"][label %s]] [span .time %i:%imin] [span .dim %ix%i] %s + [checkbox "select" "%s" id="select_%s" form="multitag"][label for="select_%s" +] ]' \ "$path" "$path" "$name" \ "$((length / 60))" "$((length % 60))" \ "$width" "$height" \ - "$(printf %s\\n "${tags#tags=}" |tr , ' ' |xargs printf '[span .tag %s]')" + "$(printf %s\\n "${tags#tags=}" |tr , ' ' |xargs printf '[span .tag %s]')" \ + "$path" "$path" "$path" else printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"][label %s]]]' \ "$path" "$path" "$name" @@ -119,6 +121,23 @@ list_paginate() { printf ']' } +w_tagging(){ + printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$(HTML "$REQUEST_URI")" + printf '[a href="#" Hide][br]' + find "$_DATA/$ITEM" -path '*/.index/meta' \ + -exec cut -f4 '{}' + \ + | cut -d= -f2- |tr , '\n' | sort -u \ + | while read tag; do + cat_old="${category}"; category="${tag%%:*}" + [ "$category" = "$tag" ] && category="(none)" + [ "$cat_old" -a "$cat_old" != "$category" ] && printf ']]' + [ "$cat_old" != "$category" ] \ + && printf '[fieldset [legend %s:][select name="tag" size=4 multiple' $(HTML "$category") + printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "${tag#*:}")" + done + printf ']][fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]' +} + printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' "$_EXEC/cgilite/html-sh.sed" <<-EOF @@ -134,11 +153,14 @@ printf 'Content-Type: text/html;charset=utf-8\r\n\r\n' ] $(w_prefs) - $(list_items \ - | list_paginate - ) - [div #editing - $(w_index) + [form method=POST action="?a=multitag" + $(list_items \ + | list_paginate + ) + [div #editing + [a href="#multitag" Add Tags] $(w_tagging) + $(w_index) + ] ] ] ] EOF