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 [form #search method=GET action=?
22 [option disabled=disabled Order By]
23 [option value=Name %s Name]
24 [option value=Date %s Date]
25 [option value=Length %s Length]
27 [input name=s placeholder=Search value="%s"]
30 "$(CHECK "$ORDER" Name)" \
31 "$(CHECK "$ORDER" Date)" \
32 "$(CHECK "$ORDER" Length)" \
38 fakemp4="$(COOKIE fakemp4)"
41 [form #prefs method="POST" action="?a=setprefs"
44 [label for=prefs_ps Pagesize]
45 [input #prefs_ps type=number name=pagesize value="%s"][br]
46 [radio "mode" "browse" %s #prefs_modebrowse] [label for=prefs_modebrowse Browse Folders][br]
47 [radio "mode" "index" %s #prefs_modeindex ] [label for=prefs_modeindex View Full Index][br]
48 [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
49 [submit "store" "store" Set Cookie]
52 "$w_refuri" "$LISTSIZE" \
53 "$([ "$mode" = index ] || CHECK)" \
54 "$(CHECK "$mode" index)" \
55 "$(CHECK "$fakemp4" yes)"
59 [ -d "$_DATA/$ITEM/.index" ] || printf '
60 [form #index method="POST" action="?a=spawnindex"
62 [label Set up for Index view: ]
63 [checkbox "recursive" "yes" #spawn_recursive] [label for=spawn_recursive Include subdirectories]
64 [submit "spawn" "spawn" Set up]
70 local n lbid tag category tn filter f
73 printf '[form #advsearch action=?a=advsearch method=POST
75 [p .help Select multiple tags from each category by holding down the [strong Ctrl] key on your keyboard.[br]
76 Refine the search further by setting additional search tags using the [strong "+and"] button.]
80 for n in 1 2 3 4 5 6 7 8 9 10; do
81 f="${filter%%^*}"; filter="${filter#*^}"
83 lbid="$(HTML "cat_${n}_(none)")"
84 printf '[input .and type=checkbox name=and id="and_%i" %s][label for="and_%i" +and
86 [radio "pol_%i" "pos" .pol %s #pol_pos_%i"][label for=pol_pos_%i Any]
87 [radio "pol_%i" "neg" .pol %s #pol_neg_%i"][label for=pol_neg_%i None]
88 [label .head Category:]' \
89 $n "$([ "$f" ] && printf checked)" $n \
90 $n "$([ "$f" -a ! "${f%%~*}" ] || printf checked)" $n $n \
91 $n "$([ "$f" -a ! "${f%%~*}" ] && printf checked)" $n $n
94 printf '*\n%s\n' "$w_tagcategories" \
95 | while read -r category; do
96 catn="$(HTML "$category")"
97 lbid="cat_${n}_${catn}"
98 printf '[radio "cat_%i" "%s" .cat id="%s" %s][label for="%s" %s]
99 [select name=tag_%s size=10 multiple' \
101 "$([ ! "${f%%*|${category}:*}" -o ! "${category%\*}" ] && printf checked)" \
104 printf %s "$w_tags" \
105 | { [ "$category" = '*' ] && grep -vF ':' || grep -wF "${category}"; } \
106 | while read -r tag; do
107 [ ! "$tag" ] && continue
108 tg="$(HTML "$tag")"; tn="${tg#*:}"
109 printf '[option %s value="%s"\n%s]' \
110 "$([ ! "${f%%*|${tag}|*}" ] && printf selected)" \
118 printf '[fieldset .submit [select name=order
119 [option disabled=disabled Order By]
120 [option value=Name %s Name]
121 [option value=Date %s Date]
122 [option value=Length %s Length]
123 ][button type=submit Apply Filter]]
125 "$(CHECK "$ORDER" Name)" \
126 "$(CHECK "$ORDER" Date)" \
127 "$(CHECK "$ORDER" Length)"
132 printf '[div #multitag [input type="hidden" name="ref" value="%s"]' "$w_refuri"
133 printf '[a href="#" Hide][br]'
135 printf 'Tags\n%s\n' "$w_tagcategories" \
136 | while read -r category; do
137 printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$(HTML "$category")"
138 printf %s "$w_tags" \
139 | { [ "$category" = 'Tags' ] && grep -vF ':' || grep -wF "${category}"; } \
140 | while read -r tag; do
141 [ ! "$tag" ] && continue
142 tag="$(HTML "$tag")"; tn="${tag#*:}"
143 printf '[option value="%s"\n%s]' "$tag" "$tn"
148 printf '[fieldset [legend New:][textarea name=newtag\n][button type=Submit Add Tags]]]'