3 [ -n "$include_widgets" ] && return 0
6 . "$_EXEC/cgilite/storage.sh"
8 w_refuri="$(URL "$PATH_INFO")?$(HTML "$QUERY_STRING")"
11 find "$_DATA/" -path '*/.index/meta' -print0 \
13 s;^.*\t.*\t.*\ttags=(.*)\tcomment=.*\t.*\r$;\1;;
14 s;,;\n;g;'"$UNSTRING" \
17 [ "$tag" = "$otag" ] \
18 && cn=$((${cn:-0} + 1)) \
20 printf "%i %s\n" "$cn" "$otag"
25 printf "%i %s\n" "$cn" "$otag"
26 } |sort -rn |cut -f2- )"
27 w_tagcategories="$(printf %s "$w_tags" | cut -sd: -f1 | sort -u \
28 |HTML |sed 's;:\;;:;g; s;
\;;\n;g;')"
29 w_tags="$( printf %s "$w_tags" |HTML |sed 's;:\;;:;g; s;
\;;\n;g;')"
31 [ "$ORDER" = Name ] && w_coname=checked
32 [ "$ORDER" = Date ] && w_codate=checked
33 [ "$ORDER" = Length ] && w_colength=checked
36 local name='' cf='' cs='' bm="$_DATA/.index/bookmarks" proposed_name=''
37 [ ! -d "${bm%/*}" ] && return 0
38 [ ! -f "$bm" ] && touch "$bm"
40 [ "$SEARCH" ] && cs="$(STRING "$SEARCH")"
41 [ "$FILTER" ] && cf="$(STRING "$FILTER")"
43 name="$(grep -m1 -aF " search=$cs filter=$cf${CR}" "$bm" |cut -f1 |UNSTRING)"
44 [ ! "$name" ] && proposed_name="$(
45 printf '%s\t%s' "$SEARCH" "$FILTER" \
46 |sed -r '/^\t$/{ s;\t;All;; q;}
49 :x; s;(^|[~^|])([^|^~:]+):;\1;; tx;
50 s;\^; and ;g; s;\|;,;g; s;~;not ;g; q;}'
53 printf '[form #bookmarks action=?a=bookmark method=POST
56 [hidden "search" "%s"][hidden "filter" "%s"]
57 [label Name for current page:]
58 [input name="name" value="%s" placeholder="Name" ]
59 [button type="submit" %s]' \
61 "$(HTML "$SEARCH")" "$(HTML "$FILTER")" \
62 "$(HTML "${name:-${proposed_name}}")" \
63 "${name:+Update}${proposed_name:+Add}"
64 [ "$name" ] && printf ' [submit "delete" "delete" Delete]'
66 sort "$bm" |while read -r name search filter; do
67 search="${search#search=}" filter="${filter#filter=}" filter="${filter%${CR}}"
68 [ "$search" = "${cs}" -a "$filter" = "${cf}" ] && continue
70 name="$(UNSTRING "$name")";
71 search="$(UNSTRING "${search}" |URL)";
72 filter="$(UNSTRING "${filter}" |URL)";
73 printf '[label .link %s]
74 [a .link target=blank href="?o=Name&s=%s&f=%s" by Name]
75 [a .link target=blank href="?o=Date&s=%s&f=%s" by Date]
76 [a .link target=blank href="?o=Length&s=%s&f=%s" by Length]
78 "$(HTML "$name" |sed 's;,\;;&[wbr];g;')" \
88 [form #search method=GET action=?
90 [option disabled=disabled Order By]
91 [option value=Name %s Name]
92 [option value=Date %s Date]
93 [option value=Length %s Length]
95 [input name=s placeholder=Search value="%s"]
98 "$w_coname" "$w_codate" "$w_colength" \
105 tm=''; [ "$(COOKIE mode)" = index ] && tm=' '
106 tf=''; [ "$(COOKIE fakemp4)" = yes ] && tf=checked
109 [form #prefs method="POST" action="?a=setprefs"
112 [label for=prefs_ps Pagesize]
113 [input #prefs_ps type=number name=pagesize value="%s"][br]
114 [radio "mode" "browse" %s #prefs_modebrowse] [label for=prefs_modebrowse Browse Folders][br]
115 [radio "mode" "index" %s #prefs_modeindex ] [label for=prefs_modeindex View Full Index][br]
116 [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
117 [submit "store" "store" Set Cookie]
120 "$w_refuri" "$LISTSIZE" \
121 "${tm:-checked}" "${tm:+checked}" "$tf"
125 [ -d "$_DATA/$ITEM/.index" ] || printf '
126 [form #index method="POST" action="?a=spawnindex"
128 [label Set up for Index view: ]
129 [checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
130 [submit "spawn" "spawn" Set up]
136 local n lbid tag category filter f t
137 filter="$(HTML "${FILTER}^" |sed 's;~\;;~;g; s;^\;;^;g; s;|\;;|;g; s;:\;;:;g;')"
139 printf '[form #advsearch action=?a=advsearch method=POST
141 [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
142 Refine the search further by setting additional search tags using the [strong "+and"] button.]'
144 for n in 1 2 3 4 5 6 7 8 9 10; do
145 f="${filter%%^*}"; filter="${filter#*^}"
147 t=''; [ "$f" -a ! "${f%%~*}" ] && t=" "
149 lbid="cat_${n}_(none)"
150 printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
152 [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
153 [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
154 [label .head Category:]' \
155 $n "${f:+checked}" $n \
156 $n "${t:-checked}" $n $n \
157 $n "${t:+checked}" $n $n
160 printf '*\n%s\n' "$w_tagcategories" \
161 | while read -r category; do
162 lbid="cat_${n}_${category}"
165 [ "$category" = '*' -a "${f%%|${category}:*}" ] && t=checked
166 [ "$category" != '*' -a ! "${f%%|${category}:*}" ] && t=checked
168 printf '[radio "cat_%i" "%s" .cat %s id="%s"][label for="%s" %s]
169 [select name=tag_%s size=10 multiple' \
170 $n "$category" "$t" "$lbid" "$lbid" "$category" $n
172 printf '%s\n' "$w_tags" \
173 | { [ "$category" = '*' ] && grep -avF ':' |grep -avxF '' || grep -awF "${category}"; } \
174 | while read -r tag; do
175 t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked
176 printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}"
183 printf '[fieldset .submit [select name=order
184 [option disabled=disabled Order By]
185 [option value=Name %s Name]
186 [option value=Date %s Date]
187 [option value=Length %s Length]
188 ][button type=submit Apply Filter]]
197 printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
198 printf '[a href="#" Hide][br]'
200 printf 'Tags\n%s\n' "$w_tagcategories" \
201 | while read -r category; do
202 printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$category"
203 printf %s "$w_tags" \
204 | { [ "$category" = 'Tags' ] && grep -avF ':' | grep -avxF '' || grep -awF "${category}"; } \
205 | while read -r tag; do
206 printf '[option value="%s"\n%s]' "$tag" "${tag#*:}"
211 printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'