X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=widgets.sh;h=4a64deb08df1957c4ff03eac7e2c1c1ad8f4d261;hb=72e1853bb0862b52d390657dd4847064194c5c3b;hp=ead4c7c88c2c40fc6807ab4f7997579399e17856;hpb=7068cdba834b18fd78cb48c3e0e1d72c40887a25;p=serve0 diff --git a/widgets.sh b/widgets.sh index ead4c7c..4a64deb 100644 --- a/widgets.sh +++ b/widgets.sh @@ -18,6 +18,29 @@ w_tagcategories="$(printf %s "$w_tags" | cut -sd: -f1 | uniq)" [ "$ORDER" = Date ] && w_codate=checked [ "$ORDER" = Length ] && w_colength=checked +w_bookmarks(){ + local name link bm + bm="$_DATA/.index/bookmarks" + + printf '[form #bookmarks action=?a=bookmarks method=POST + [a href="#" X] + [hidden "ref" "%s"] + ' "$w_refuri" + + name="$(grep -m1 -F " $(STRING "${REQUEST_URI}")" "$bm")" + printf '[hidden "link" "%s"][input name="name" value="%s"]' \ + "$(HTML "$link")" "$(HTML "$name")" + + sort "$bm" |while read -r name link; do + name="$(UNSTRING "$name")" + link="$(UNSTRING "$link")" + if [ "$link" != "$REQUEST_URI" ]; then + printf '[a href="%s"\n%s]' "$(HTML "$link")" "$(HTML "$name")" + fi + done + printf ']' +} + w_search(){ printf ' [form #search method=GET action=? @@ -105,7 +128,7 @@ w_advsearch(){ $n "$category" "$t" "$lbid" "$lbid" "$category" $n printf '%s\n' "$w_tags" \ - | { [ "$category" = '*' ] && grep -vF ':' |grep -vxF '' || grep -wF "${category}"; } \ + | { [ "$category" = '*' ] && grep -avF ':' |grep -avxF '' || grep -awF "${category}"; } \ | while read -r tag; do t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}" @@ -136,7 +159,7 @@ w_tagging(){ | while read -r category; do printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$category" printf %s "$w_tags" \ - | { [ "$category" = 'Tags' ] && grep -vF ':' | grep -vxF '' || grep -wF "${category}"; } \ + | { [ "$category" = 'Tags' ] && grep -avF ':' | grep -avxF '' || grep -awF "${category}"; } \ | while read -r tag; do printf '[option value="%s"\n%s]' "$tag" "${tag#*:}" done