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]
]
[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 |debug)
+ ]
$(AUTHOR && printf '[a .button href="edit" edit]')
[h1 .videos Videos]
[div .videos . $(
left: 0; top: 0; right: 0; bottom: 0;
line-height: 1.375em;
}
+
+button, a.button {
+ margin-top: .375em;
+}
+
+body.channel .authors h3 {
+ display: inline-block;
+}
+body.channel.edit .authors h3 {
+ margin-bottom: 0;
+ display: block;
+}
+body.channel .authors span:after {
+ content: ',';
+}
+body.channel .authors span:last-child:after {
+ content: '';
+}
+
+body.channel.edit .authors input[name=author] {
+ margin-left: .5em;
+}
+body.channel.edit .authors input[name=author] {
+ z-index: 1;
+}
+body.channel.edit .authors input[name=author] + label {
+ padding: .25em .5em .125em .25em;
+ margin: 0 0 .5em 0;
+ padding-left: 1.25em;
+ margin-left: -1.25em;
+ border: .5pt solid;
+ background-color: rgba(255, 255, 255, .75);
+}
+body.channel.edit .authors input[name=author],
+body.channel.edit .authors input[name=author] + label {
+ display: none;
+}
+body.channel.edit .authors input[name=author]:checked,
+body.channel.edit .authors input[name=author]:checked + label {
+ display: inline-block;
+}
+body.channel.edit .authors input[id^=newauthor] + label {
+ background-color: #FFF;
+ border: 1pt solid;
+ width: 1.5em; height: 1.5em;
+ text-align: center;
+}
+
+body.channel.edit .authors input[id^=newauthor] + label + input {
+ vertical-align: middle;
+}
+body.channel.edit .authors input[id^=newauthor],
+body.channel.edit .authors input[id^=newauthor] + label,
+body.channel.edit .authors input[id^=newauthor] + label + input {
+ display: none;
+}
+body.channel.edit .authors input[id^=newauthor0] + label {
+ display: inline-block;
+}
+body.channel.edit .authors input[id^=newauthor]:checked + label + input,
+body.channel.edit .authors input[id^=newauthor]:checked + label + input + input + label {
+ display: inline-block;
+}
+body.channel.edit .authors input[id^=newauthor]:checked + label,
+body.channel.edit .authors input[id^=newauthor]:checked + label + input + input:checked + label {
+ display: none;
+}