3 [ -n "$include_widgets" ] && return 0
6 . "$_EXEC/cgilite/storage.sh"
8 w_refuri="$(URL "$PATH_INFO")?$(HTML "$QUERY_STRING")"
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
22 local name='' cf='' cs='' bm="$_DATA/.index/bookmarks" proposed_name=''
23 [ ! -d "${bm%/*}" ] && return 0
24 [ ! -f "$bm" ] && touch "$bm"
26 [ "$SEARCH" ] && cs="$(STRING "$SEARCH")"
27 [ "$FILTER" ] && cf="$(STRING "$FILTER")"
29 name="$(grep -m1 -aF " search=$cs filter=$cf${CR}" "$bm" |cut -f1 |UNSTRING)"
30 [ ! "$name" ] && proposed_name="$(
31 printf '%s\t%s' "$SEARCH" "$FILTER" \
32 |sed -r '/^\t$/{ s;\t;All;; q;}
35 :x; s;(^|[~^|])([^|^~:]+):;\1;; tx;
36 s;\^; and ;g; s;\|;,;g; s;~;not ;g; q;}'
39 printf '[form #bookmarks action=?a=bookmark method=POST
42 [hidden "search" "%s"][hidden "filter" "%s"]
43 [label Name for current page:]
44 [input name="name" value="%s" placeholder="Name" ]
45 [button type="submit" %s]' \
47 "$(HTML "$SEARCH")" "$(HTML "$FILTER")" \
48 "$(HTML "${name:-${proposed_name}}")" \
49 "${name:+Update}${proposed_name:+Add}"
50 [ "$name" ] && printf ' [submit "delete" "delete" Delete]'
52 sort "$bm" |while read -r name search filter; do
53 search="${search#search=}" filter="${filter#filter=}" filter="${filter%${CR}}"
54 [ "$search" = "${cs}" -a "$filter" = "${cf}" ] && continue
56 name="$(UNSTRING "$name")";
57 search="$(UNSTRING "${search}" |URL)";
58 filter="$(UNSTRING "${filter}" |URL)";
59 printf '[label .link %s]
60 [a .link target=blank href="?o=Name&s=%s&f=%s" by Name]
61 [a .link target=blank href="?o=Date&s=%s&f=%s" by Date]
62 [a .link target=blank href="?o=Length&s=%s&f=%s" by Length]
64 "$(HTML "$name" |sed 's;,\;;&[wbr];g;')" \
74 [form #search method=GET action=?
76 [option disabled=disabled Order By]
77 [option value=Name %s Name]
78 [option value=Date %s Date]
79 [option value=Length %s Length]
81 [input name=s placeholder=Search value="%s"]
84 "$w_coname" "$w_codate" "$w_colength" \
91 tm=''; [ "$(COOKIE mode)" = index ] && tm=' '
92 tf=''; [ "$(COOKIE fakemp4)" = yes ] && tf=checked
95 [form #prefs method="POST" action="?a=setprefs"
98 [label for=prefs_ps Pagesize]
99 [input #prefs_ps type=number name=pagesize value="%s"][br]
100 [radio "mode" "browse" %s #prefs_modebrowse] [label for=prefs_modebrowse Browse Folders][br]
101 [radio "mode" "index" %s #prefs_modeindex ] [label for=prefs_modeindex View Full Index][br]
102 [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
103 [submit "store" "store" Set Cookie]
106 "$w_refuri" "$LISTSIZE" \
107 "${tm:-checked}" "${tm:+checked}" "$tf"
111 [ -d "$_DATA/$ITEM/.index" ] || printf '
112 [form #index method="POST" action="?a=spawnindex"
114 [label Set up for Index view: ]
115 [checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
116 [submit "spawn" "spawn" Set up]
122 local n lbid tag category filter f t
123 filter="$(HTML "${FILTER}^" |sed 's;~\;;~;g; s;^\;;^;g; s;|\;;|;g; s;:\;;:;g;')"
125 printf '[form #advsearch action=?a=advsearch method=POST
127 [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
128 Refine the search further by setting additional search tags using the [strong "+and"] button.]'
130 for n in 1 2 3 4 5 6 7 8 9 10; do
131 f="${filter%%^*}"; filter="${filter#*^}"
133 t=''; [ "$f" -a ! "${f%%~*}" ] && t=" "
135 lbid="cat_${n}_(none)"
136 printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
138 [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
139 [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
140 [label .head Category:]' \
141 $n "${f:+checked}" $n \
142 $n "${t:-checked}" $n $n \
143 $n "${t:+checked}" $n $n
146 printf '*\n%s\n' "$w_tagcategories" \
147 | while read -r category; do
148 lbid="cat_${n}_${category}"
151 [ "$category" = '*' -a "${f%%|${category}:*}" ] && t=checked
152 [ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked
154 printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s]
155 [select name=tag_%s size=10 multiple' \
156 $n "$category" "$t" "$lbid" "$lbid" "$category" $n
158 printf '%s\n' "$w_tags" \
159 | { [ "$category" = '*' ] && grep -avF ':' |grep -avxF '' || grep -awF "${category}"; } \
160 | while read -r tag; do
161 t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked
162 printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}"
169 printf '[fieldset .submit [select name=order
170 [option disabled=disabled Order By]
171 [option value=Name %s Name]
172 [option value=Date %s Date]
173 [option value=Length %s Length]
174 ][button type=submit Apply Filter]]
183 printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
184 printf '[a href="#" Hide][br]'
186 printf 'Tags\n%s\n' "$w_tagcategories" \
187 | while read -r category; do
188 printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$category"
189 printf %s "$w_tags" \
190 | { [ "$category" = 'Tags' ] && grep -avF ':' | grep -avxF '' || grep -awF "${category}"; } \
191 | while read -r tag; do
192 printf '[option value="%s"\n%s]' "$tag" "${tag#*:}"
197 printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'