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 | cut -d= -f2- |tr , '\n' | sort -u)"
13 w_tags="$(UNSTRING "$w_tags")"
14 w_tagcategories="$(printf %s "$w_tags" |cut -sd: -f1 |sort -u)"
16 CHECK(){ [ "$1" = "$2" ] && printf checked; }
20 bm="$_DATA/.index/bookmarks"
22 printf '[form #bookmarks action=?a=bookmarks method=POST
27 name="$(grep -m1 -F " $(STRING "${REQUEST_URI}")" "$bm")"
28 printf '[hidden "link" "%s"][input name="name" value="%s"]' \
29 "$(HTML "$link")" "$(HTML "$name")"
31 sort "$bm" |while read -r name link; do
32 name="$(UNSTRING "$name")"
33 link="$(UNSTRING "$link")"
34 if [ "$link" != "$REQUEST_URI" ]; then
35 printf '[a href="%s"\n%s]' "$(HTML "$link")" "$(HTML "$name")"
43 [form #search method=GET action=?
45 [option disabled=disabled Order By]
46 [option value=Name %s Name]
47 [option value=Date %s Date]
48 [option value=Length %s Length]
50 [input name=s placeholder=Search value="%s"]
53 "$(CHECK "$ORDER" Name)" \
54 "$(CHECK "$ORDER" Date)" \
55 "$(CHECK "$ORDER" Length)" \
61 fakemp4="$(COOKIE fakemp4)"
64 [form #prefs method="POST" action="?a=setprefs"
67 [label for=prefs_ps Pagesize]
68 [input #prefs_ps type=number name=pagesize value="%s"][br]
69 [radio "mode" "browse" %s #prefs_modebrowse] [label for=prefs_modebrowse Browse Folders][br]
70 [radio "mode" "index" %s #prefs_modeindex ] [label for=prefs_modeindex View Full Index][br]
71 [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
72 [submit "store" "store" Set Cookie]
75 "$w_refuri" "$LISTSIZE" \
76 "$([ "$mode" = index ] || CHECK)" \
77 "$(CHECK "$mode" index)" \
78 "$(CHECK "$fakemp4" yes)"
82 [ -d "$_DATA/$ITEM/.index" ] || printf '
83 [form #index method="POST" action="?a=spawnindex"
85 [label Set up for Index view: ]
86 [checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
87 [submit "spawn" "spawn" Set up]
93 local n lbid tag category tn filter f
96 printf '[form #advsearch action=?a=advsearch method=POST
98 [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
99 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 lbid="$(HTML "cat_${n}_(none)")"
106 printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
108 [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
109 [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
110 [label .head Category:]' \
111 $n "$([ "$f" ] && printf checked)" $n \
112 $n "$([ "$f" -a ! "${f%%~*}" ] || printf checked)" $n $n \
113 $n "$([ "$f" -a ! "${f%%~*}" ] && printf checked)" $n $n
116 printf '*\n%s\n' "$w_tagcategories" \
117 | while read -r category; do
118 catn="$(HTML "$category")"
119 lbid="cat_${n}_${catn}"
120 printf '[radio "cat_%i" "%s" .cat id="%s" %s][label for="%s" %s]
121 [select name=tag_%s size=10 multiple' \
123 "$([ ! "${f%%*|${category}:*}" -o ! "${category%\*}" ] && printf checked)" \
126 printf %s "$w_tags" \
127 | { [ "$category" = '*' ] && grep -vF ':' || grep -wF "${category}"; } \
128 | while read -r tag; do
129 [ ! "$tag" ] && continue
130 tg="$(HTML "$tag")"; tn="${tg#*:}"
131 printf '[option %s value="%s"\n%s]' \
132 "$([ ! "${f%%*|${tag}|*}" ] && printf selected)" \
140 printf '[fieldset .submit [select name=order
141 [option disabled=disabled Order By]
142 [option value=Name %s Name]
143 [option value=Date %s Date]
144 [option value=Length %s Length]
145 ][button type=submit Apply Filter]]
147 "$(CHECK "$ORDER" Name)" \
148 "$(CHECK "$ORDER" Date)" \
149 "$(CHECK "$ORDER" Length)"
154 printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
155 printf '[a href="#" Hide][br]'
157 printf 'Tags\n%s\n' "$w_tagcategories" \
158 | while read -r category; do
159 printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$(HTML "$category")"
160 printf %s "$w_tags" \
161 | { [ "$category" = 'Tags' ] && grep -vF ':' || grep -wF "${category}"; } \
162 | while read -r tag; do
163 [ ! "$tag" ] && continue
164 tag="$(HTML "$tag")"; tn="${tag#*:}"
165 printf '[option value="%s"\n%s]' "$tag" "$tn"
170 printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'