#!/bin/sh
. "$_EXEC/indexmeta.sh"
+. "$_EXEC/widgets.sh"
list_item() {
name="$(HTML "$1")"
) | cut -d/ -f2- | sort
sort -n "$meta" | cut -f6- \
| while f="$(line)"; do
- [ -e "$_DATA/$ITEM/$f" ] && printf '%s\n' "$f"
+ fn="$(UNSTRING "${f#* }")"; fn="${fn%${CR}}";
+ file="$(printf '%s\n' "$_DATA/$ITEM/${fn}".*)"
+ file="${file##*/}"
+ [ -e "$_DATA/$ITEM/$base/${file}" ] \
+ && printf '%s\n' "${file}"
done
}
+
list_index(){
(cd "$_DATA/$ITEM";
find ./ -path '*/.index/meta'
meta_dir "$_DATA/$ITEM/$base"
cut -f1,6- <"$_DATA/$ITEM/$meta" \
| while f="$(line)"; do
- fn="$(printf '%s\n' "$_DATA/$ITEM/$base/${f#* }".*)"
- fn="${fn%%${BR}*}"; fn="${fn##*/}"
- [ -e "$_DATA/$ITEM/$base/${fn}" ] \
- && printf '%s %s\n' "${f%% *}" "${base}/${fn}"
+ fn="$(UNSTRING "${f#* }")"; fn="${fn%${CR}}";
+ file="$(printf '%s\n' "$_DATA/$ITEM/$base/${fn}".*)"
+ file="${file##*/}"
+ [ -e "$_DATA/$ITEM/$base/${file}" ] \
+ && printf '%s %s\n' "${f%% *}" "${base}/${file}"
done
done \
| sort -n \
printf ']'
}
-w_tagging(){
- printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$(HTML "$REQUEST_URI")"
- printf '[a href="#" Hide][br]'
- tags="$(find "$_DATA/$ITEM" -path '*/.index/meta' -exec cut -f4 '{}' + \
- | cut -d= -f2- |tr , '\n' | sort -u)"
- tags="$(UNSTRING "$tags")"
-
- printf '[fieldset [legend %s:][select name=tag size=4 multiple' "Tags"
- printf %s "$tags" |grep -vF ":" |grep -vxF '' \
- | while read -r tag; do
- printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "$tag")"
- done
- printf ']]'
-
- printf %s "$tags" |cut -sd: -f1 |sort -u \
- | while read -r category; do
- printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$(HTML "$category")"
- printf %s "$tags" |grep -wF "${category}" \
- | while read -r tag; do
- printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "${tag#*:}")"
- done
- printf ']]'
- 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
#!/bin/sh
+[ -n "$include_widgets" ] && return 0
+include_widgets="$0"
+
+. "$_EXEC/cgilite/storage.sh"
+
+w_tags="$(find "$_DATA/" -path '*/.index/meta' -exec cut -f4 '{}' + \
+ | cut -d= -f2- |tr , '\n' | sort -u)"
+w_tags="$(UNSTRING "$w_tags")"
+
w_search(){
printf '
[form #search method=GET action=?
]
' "$(HTML "$REQUEST_URI")"
}
+
+w_tagging(){
+ printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$(HTML "$REQUEST_URI")"
+ printf '[a href="#" Hide][br]'
+
+ printf '[fieldset [legend %s:][select name=tag size=4 multiple' "Tags"
+ printf %s "$w_tags" |grep -vF ":" |grep -vxF '' \
+ | while read -r tag; do
+ printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "$tag")"
+ done
+ printf ']]'
+
+ printf %s "$w_tags" |cut -sd: -f1 |sort -u \
+ | while read -r category; do
+ printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$(HTML "$category")"
+ printf %s "$w_tags" |grep -wF "${category}" \
+ | while read -r tag; do
+ printf '[option value="%s" %s]' "$(HTML "$tag")" "$(HTML "${tag#*:}")"
+ done
+ printf ']]'
+ done
+
+ printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'
+}