fi
;;
update_channel)
+ authors="${USER_ID}"
+ n="$(POST_COUNT author)"
+ while [ $n -gt 0 ]; do
+ newauthor="$(POST author $n |checkid)"
+ user_idmap "$newauthor" && authors="${authors}${BR}${newauthor}" >&-
+ n=$((n - 1))
+ done
+ n="$(POST_COUNT newauthor)"
+ while [ $n -gt 0 ]; do
+ newauthor="$(POST newauthor $n)"
+ newauthor="$(user_idof "$newauthor")" \
+ && authors="${authors}${BR}${newauthor}"
+ n=$((n - 1))
+ done
+
if [ ! "$CHANNEL_ID" ]; then
REDIRECT "${_BASE}/channel/#ERROR_NOCHANNEL"
elif [ ! "$USER_ID" ]; then
REDIRECT "${_BASE}/channel/$CHANNEL_ID/#ERROR_UPDATE_NOTALLOWED"
elif update_channel "$CHANNEL_ID" "name=$(POST name)" \
"description=$(POST description)" \
- "authors=$USER_ID"; then
+ "authors=${authors}"; then
REDIRECT "${_BASE}/channel/$CHANNEL_ID/"
else
REDIRECT "${_BASE}/channel/$CHANNEL_ID/#ERROR_UPDATE_NOLOCK"
if [ "$CHANNEL_ID" -a "$action" = edit ]; then
AUTHOR || REDIRECT "${_BASE}/$CHANNEL_ID/#ERROR_EDIT_NOTALLOWED"
yield_page "$CHANNEL_NAME - Edit" "channel edit" <<-EOF
+ [datalist #list_authors
+ $(user_idmap |cut -f2 |UNSTRING |while read name; do
+ printf '[option value="%s"]' "$(HTML "$name")"
+ done)
+ ]
[form .channel .edit method=POST
[input name="name" value="$(HTML "$CHANNEL_NAME")" placeholder="Channel Name" autocomplete=off]
[textarea name="description" placeholder="Description" . $(HTML "$CHANNEL_DESCRIPTION")]
+ [div .authors [h3 Authors:]
+ $(for each in $CHANNEL_AUTHORS; do
+ printf '[checkbox "author" "%s" id="author_%s" %s %s][label for="author_%s" . %s]\n' \
+ "$each" "$each" "checked=checked" "$([ "$each" = "$USER_ID" ] && printf 'disabled=disabled')" \
+ "$each" "$(user_idmap "$each" |UNSTRING |HTML)"
+ done
+ for n in 0 1 2 3 4 5 6 7 8 9; do
+ printf '[checkbox "" "" #newauthor%i][label for=newauthor%i . +]
+ [input name=newauthor value="" placeholder="Author" list=list_authors]' \
+ $n $n
+ done)
+ ]
[submit "action" "update_channel" . Update]
[submit "action" "update_channel_cancel" . Cancel]
]
EOF
elif [ "$CHANNEL_ID" ]; then
- vid_db="$_DATA/$CHANNEL_ID/videos.db"
yield_page "$CHANNEL_NAME" "channel" <<-EOF
[nav [a href="../" Channels] - [span $(HTML "${CHANNEL_NAME:-(Unnamed Channel)}")]]
[h1 .name $(HTML "$CHANNEL_NAME")]
[div .description . ${CHANNEL_DESCR_CACHE}]
+ [div .authors [h3 Authors:]
+ $(for each in $CHANNEL_AUTHORS; do
+ printf '[span .author . %s]\n' "$(user_idmap "$each" |UNSTRING |HTML)"
+ done |sort)
+ ]
$(AUTHOR && printf '[a .button href="edit" edit]')
[h1 .videos Videos]
[div .videos . $(
[hidden "video" "%s"]
[submit "action" "newvideo" New Video]
]' "$(timeid)"
- [ -f "$vid_db" -a -r "$vid_db" ] \
- && while w_video; do :; done <"$vid_db"
+ list_videos |while w_video; do :; done
)]
EOF
else