[Convert bee-page to golgonooza-db:cacheable-persistent-object clinton@unknownlamer.org**20081217090520 Note that this requires a manual database upgrade! The database must be hotbackedup, opened by a new lisp instance with the **OLD** code loaded, the new code then loaded after connecting to the database, and then: (elephant:ensure-transaction () (mapc (lambda (i) (make-instance 'beesknees.pages:bee-page :name (slot-value i 'beesknees.web::name) :content (slot-value i 'beesknees.web::content))) (elephant:get-instances-by-class 'beesknees.web::bee-page))) ] hunk ./beesknees.asd 15 - (:file "web-common" :depends-on ("packages")) + (:file "bee-page" :depends-on ("packages")) + (:file "web-common" :depends-on ("packages" "bee-page")) hunk ./src/packages.lisp 11 +(defpackage :beesknees.pages + (:use :cl :markdown :elephant + :org.unknownlamer.golgonooza.elephant) + (:export + :bee-page + :page-name + :page-content + :page->html)) + hunk ./src/packages.lisp 22 - :org.unknownlamer.golgonooza.forms :beesknees.weblog) + :org.unknownlamer.golgonooza.forms + :beesknees.weblog :beesknees.pages) hunk ./src/web-admin.lisp 200 - :index-slot 'name + :index-slot 'beesknees.pages::name hunk ./src/web-common.lisp 29 -(markdown:defextension (image :arguments ((name :required) alt float) - :insertp t) - (ecase phase - (:parse nil) - (:render (yaclml:with-yaclml-output-to-string - ;; fixme: use url-prefix - (<:img :src (format nil "/static/img/uploaded/~A" name) - :alt (or alt "image") - :style (if (eq float :float) "float: right;" "")))))) - -(pushnew 'cl-markdown-user:image markdown:*render-active-functions*) - -(defpclass bee-page (golgonooza-db:cacheable-persistent-object) - ((name :accessor page-name :initarg :name :index t) - (hash :reader page-content-hash :initform nil) - (content :accessor page-content :initarg :content))) - -(defmethod initialize-instance :after ((page bee-page) - &key (content nil content-supplied-p) - &allow-other-keys) - (when content-supplied-p - (setf (page-content page) content))) - -(defmethod (setf page-content) :after (content (page bee-page)) - (setf (slot-value page 'hash) (md5:md5sum-sequence content))) - -(defcomponent bee-page-component (bee-widget cache-component-mixin) +(defcomponent bee-page-component (bee-widget ) hunk ./src/web-common.lisp 44 - (cl-markdown:markdown (page-content - (get-instance-by-value 'bee-page - 'name (page-name c))) - :stream yaclml:*yaclml-stream* - :format :html)) + (<:as-is (page->html (get-instance-by-value 'bee-page + 'beesknees.pages::name + (page-name c))))) + +(defcomponent bee-video (bee-widget) + ((video-id :initarg :video-id :accessor video-id))) + +(defmethod render ((video bee-video)) + (let ((id (ps:ps-gensym))) + (<:p :class "video-object" + :id id + (<:as-html "It would appear that you do not have flash.")) + (