[Initial video gallery implementation clinton@unknownlamer.org**20090521195911 Ignore-this: 197f657d5083c388f7503d48ecf5391b Very basic, but it does what is needed. Eventually this will all be replaced by my fancy Oothoon based youtube syndication magic, but I have to finish writing Oothoon first and whatnot... ] hunk ./beesknees.asd 15 + (:file "video-gallery" :depends-on ("packages")) hunk ./beesknees.asd 20 + (:file "frontend-videos" :depends-on ("packages" "video-gallery" "web-common")) hunk ./beesknees.asd 22 - "frontend-weblog")) + "frontend-weblog" "frontend-videos")) hunk ./beesknees.asd 25 + (:file "admin-videos" :depends-on ("packages" "admin-common" + "video-gallery")) hunk ./beesknees.asd 30 - "admin-weblog" "markdown-editor" - "image-manager")) + "admin-weblog" "admin-videos" + "markdown-editor" "image-manager")) addfile ./src/admin-videos.lisp hunk ./src/admin-videos.lisp 1 - +(in-package :beesknees.web) + +(define-html-form video-editor () + ((title (string-field :input-size 80 + :validators (make-validators 'not-empty-validator))) + (youtube-id (string-field :input-size 11 + :validators (make-validators 'not-empty-validator))) + (thumbnail (image-selector-field + :image-directory (merge-pathnames + "wwwroot/img/thumbnails/*.*" + beesknees.site-control::*bee-data-root*)))) + ((video :initarg :video :accessor edited-video :initform nil))) + +(defmethod initialize-instance :after ((editor video-editor) &rest keys) + (declare (ignore keys)) + (when-bind video (edited-video editor) + (with-slots (title youtube-id thumbnail) + editor + (setf (value title) (beesknees.videos:title video) + (value youtube-id) (beesknees.videos:youtube-id video) + (value thumbnail) (beesknees.videos:thumbnail video))))) + +(defaction process-form ((editor video-editor)) + (elephant:ensure-transaction () + (let ((video (or (edited-video editor) + (make-instance 'beesknees.videos:youtube-video)))) + (with-slots (title youtube-id thumbnail) + editor + (setf (beesknees.videos:title video) (value title) + (beesknees.videos:youtube-id video) (value youtube-id) + (beesknees.videos:thumbnail video) (value thumbnail))) + (answer video)))) + +(defcomponent video-list (bee-admin-list) + () + (:default-initargs + :index-class 'beesknees.videos:youtube-video + :index-slot 'beesknees.videos:youtube-id + :page-size 10 + :reverse t)) + +(defmethod golgonooza:render-query-view-result ((video beesknees.videos:youtube-video) + (list video-list)) + (