3 [ -n "$include_widgets" ] && return 0
6 . "$_EXEC/cgilite/storage.sh"
8 w_refuri="$(HTML "$REQUEST_URI")"
10 w_tags="$(find "$_DATA/" -path '*/.index/meta' -print0 \
12 s;^.*\t.*\t.*\ttags=(.*)\tcomment=.*\t.*\r$;\1;;
13 s;,;\n;g;'"$UNSTRING" \
14 | sort -u |HTML |sed 's;:\;;:;g; s;
\;;\n;g;')"
15 w_tagcategories="$(printf %s "$w_tags" | cut -sd: -f1 | uniq)"
17 [ "$ORDER" = Name ] && w_coname=checked
18 [ "$ORDER" = Date ] && w_codate=checked
19 [ "$ORDER" = Length ] && w_colength=checked
23 bm="$_DATA/.index/bookmarks"
25 printf '[form #bookmarks action=?a=bookmarks method=POST
30 name="$(grep -m1 -F " $(STRING "${REQUEST_URI}")" "$bm")"
31 printf '[hidden "link" "%s"][input name="name" value="%s"]' \
32 "$(HTML "$link")" "$(HTML "$name")"
34 sort "$bm" |while read -r name link; do
35 name="$(UNSTRING "$name")"
36 link="$(UNSTRING "$link")"
37 if [ "$link" != "$REQUEST_URI" ]; then
38 printf '[a href="%s"\n%s]' "$(HTML "$link")" "$(HTML "$name")"
46 [form #search method=GET action=?
48 [option disabled=disabled Order By]
49 [option value=Name %s Name]
50 [option value=Date %s Date]
51 [option value=Length %s Length]
53 [input name=s placeholder=Search value="%s"]
56 "$w_coname" "$w_codate" "$w_colength" \
63 tm=''; [ "$(COOKIE mode)" = index ] && tm=' '
64 tf=''; [ "$(COOKIE fakemp4)" = yes ] && tf=checked
67 [form #prefs method="POST" action="?a=setprefs"
70 [label for=prefs_ps Pagesize]
71 [input #prefs_ps type=number name=pagesize value="%s"][br]
72 [radio "mode" "browse" %s #prefs_modebrowse] [label for=prefs_modebrowse Browse Folders][br]
73 [radio "mode" "index" %s #prefs_modeindex ] [label for=prefs_modeindex View Full Index][br]
74 [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
75 [submit "store" "store" Set Cookie]
78 "$w_refuri" "$LISTSIZE" \
79 "${tm:-checked}" "${tm:+checked}" "$tf"
83 [ -d "$_DATA/$ITEM/.index" ] || printf '
84 [form #index method="POST" action="?a=spawnindex"
86 [label Set up for Index view: ]
87 [checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
88 [submit "spawn" "spawn" Set up]
94 local n lbid tag category filter f t
95 filter="$(HTML "${FILTER}^" |sed 's;~\;;~;g; s;^\;;^;g; s;|\;;|;g; s;:\;;:;g;')"
97 printf '[form #advsearch action=?a=advsearch method=POST
99 [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
100 Refine the search further by setting additional search tags using the [strong "+and"] button.]'
102 for n in 1 2 3 4 5 6 7 8 9 10; do
103 f="${filter%%^*}"; filter="${filter#*^}"
105 t=''; [ "$f" -a ! "${f%%~*}" ] && t=" "
107 lbid="cat_${n}_(none)"
108 printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
110 [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
111 [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
112 [label .head Category:]' \
113 $n "${f:+checked}" $n \
114 $n "${t:-checked}" $n $n \
115 $n "${t:+checked}" $n $n
118 printf '*\n%s\n' "$w_tagcategories" \
119 | while read -r category; do
120 lbid="cat_${n}_${category}"
123 [ "$category" = '*' -a "${f%%|${category}:*}" ] && t=checked
124 [ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked
126 printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s]
127 [select name=tag_%s size=10 multiple' \
128 $n "$category" "$t" "$lbid" "$lbid" "$category" $n
130 printf '%s\n' "$w_tags" \
131 | { [ "$category" = '*' ] && grep -avF ':' |grep -avxF '' || grep -awF "${category}"; } \
132 | while read -r tag; do
133 t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked
134 printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}"
141 printf '[fieldset .submit [select name=order
142 [option disabled=disabled Order By]
143 [option value=Name %s Name]
144 [option value=Date %s Date]
145 [option value=Length %s Length]
146 ][button type=submit Apply Filter]]
155 printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
156 printf '[a href="#" Hide][br]'
158 printf 'Tags\n%s\n' "$w_tagcategories" \
159 | while read -r category; do
160 printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$category"
161 printf %s "$w_tags" \
162 | { [ "$category" = 'Tags' ] && grep -avF ':' | grep -avxF '' || grep -awF "${category}"; } \
163 | while read -r tag; do
164 printf '[option value="%s"\n%s]' "$tag" "${tag#*:}"
169 printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'