update_video_cancel)
REDIRECT "${_BASE}/channel/${channel}/${video}/#CANCELED"
;;
+ delete)
+ if [ ! "$USER_ID" ]; then
+ REDIRECT "${_BASE}/channel/${channel}/${video}/#ERROR_NOTLOGGEDIN"
+ elif ! AUTHOR; then
+ REDIRECT "${_BASE}/channel/${channel}/${video}/#ERROR_UPDATE_NOTALLOWED"
+ elif [ "$(POST delconfirm)" != confirm ]; then
+ REDIRECT "${_BASE}/channel/${channel}/${video}/#ERROR_NOT_CONFIRMED"
+ elif LOCK "$vid_db"; then
+ while read -r id tail; do
+ [ "$id" != "$video" ] && printf '%s %s\n' "$id" "$tail"
+ done <"$vid_db" >"${vid_db}.$$"
+ mv -- "${vid_db}.$$" "$vid_db"
+ rm -- "${_DATA}/${channel}/${video}.mp4" "${_DATA}/${channel}/${video}_thumb.jpg"
+ RELEASE "$vid_db"
+ REDIRECT "${_BASE}/channel/${channel}/#DELETE_CONFIRM"
+ else
+ REDIRECT "${_BASE}/channel/${channel}/${video}/#ERROR_UPDATE_NOLOCK"
+ fi
+ ;;
esac
if [ "$REQUEST_METHOD" = POST -a "$channel" -a "$video" ]; then
[textarea name="description" placeholder="Description" . $(HTML "$VIDEO_DESCRIPTION")]
[submit "action" "update_video" . Update]
[submit "action" "update_video_cancel" . Cancel]
+ [fieldset .delete
+ [checkbox "delconfirm" "confirm" id="delconfirm"]
+ [label for=delconfirm Delete Video]
+ [submit "action" "delete" Delete Video]
+ ]
]
EOF
[ $VIDEO_STATUS = public -o $VIDEO_STATUS = hidden ] || AUTHOR || { . ${_EXEC}/page_404.sh; exit 0; }
yield_page "$VIDEO_NAME" "video" <<-EOF
- [nav [a href="../../" Channels] - [a href="../" $(HTML "${CHANNEL_NAME:-(Unnamed Channel)}")] - [span $(HTML "${VIDEO_NAME:-(Unnamed Video)}")]
- $(AUTHOR && printf ' - [a href="edit" edit]')
- ]
+ [nav [a href="../../" Channels] - [a href="../" $(HTML "${CHANNEL_NAME:-(Unnamed Channel)}")] - [span $(HTML "${VIDEO_NAME:-(Unnamed Video)}")]]
$( AUTHOR && [ $VIDEO_STATUS = void ] && printf '
[iframe src="frameuploadprogress" width="100%%" height="50"
[a href="freameuploadprogress" Iframe: Upload progress]
[source src="%s/video/%s/%s.mp4"]
]' "$_BASE" "$channel" "$video"
)
+ $(AUTHOR && printf '[a .button href="edit" edit]')
[h1 .name $(HTML "$VIDEO_NAME")]
[div .description . ${VIDEO_DESCR_CACHE}]
EOF
.video.thumb .description:hover {
max-height: 8em;
}
+
+.video.edit form > .delete {
+ text-align: right;
+}
+.video.edit form #delconfirm + label:after {
+ content: '\0A';
+ white-space: pre;
+}
+.video.edit form #delconfirm + label + button {
+ pointer-events: none;
+ color: #AAA;
+ border-color: #AAA;
+ left: -.75em;
+}
+.video.edit form #delconfirm:checked + label + button {
+ pointer-events: auto;
+ color: inherit;
+ border-color: inherit;
+ background-color: #FDD;
+}
+