[Initial admin framework clinton@unknownlamer.org**20070619030617] { move ./cms-src ./src addfile ./src/admin.lisp hunk ./cms.asd 17 - :depends-on (:fiveam :cl-utilities)) + :depends-on (:fiveam :cl-utilities :metatilities :elephant :ucw)) hunk ./src/admin.lisp 1 - +(in-package :org.unknownlamer.cms.admin) + +;;; Tiny admin tool system. This is a temporary bit of +;;; code. Eventually the system will be converted to use +;;; ucw-presentations, and this will probably be scrapped, or at least +;;; used only as legacy glue to avoid rewriting existing applications. + +;;; Generic Admin Tool Protocol + +(defcomponent admin-component (lame-cms-component) + ((operations :initform nil :reader admin-operations + :documentation "List of names of operation classes supported by the component")) + (:documentation "Lame-CMS application adminstration component")) + +(defcomponent admin-operation-component (admin-component) + () + (:documentation "Admin tool operation mixin")) + +(defgeneric run-operation-component (tool operation) + (:documentation "Invoke operation of component. The main method should only be overriden by an actual component class.")) + +(defgeneric allocate-operation-component (component operation) + (:documentation "Allocate an instance of operation")) + +;; Generic implementation scaffolding + +(defmethod run-operation-component ((component admin-component) + (operation-name symbol)) + (run-operation component (allocate-operation component + operation-name))) + +(defmethod allocate-operation-component ((component admin-component) + operation) + (make-instance operation)) + +(defmethod run-operation ((component admin-component) + (operation admin-operation-component)) + (call-component component operation)) + +;;; Object Editing Tool + +(defcomponent object-editor-component (admin-component) + ((edited-object :initform nil + :initarg :edited-instance + :accessor edited-instance)) + (:documentation "Admin tool that edits an object")) + +(defcomponent object-editor-operation-component (admin-operation-component + object-editor-component) + () + (:documentation "Operation that edits an object")) + +(defmethod allocate-operation ((component object-editor-component) + (operation object-editor-operation-component)) + (make-instance operation :edited-instance (edited-instance component))) + + +;;; CRUD Tools + +(defcomponent crud-admin-component (object-editor-component) + ()) + +(defmethod admin-operations ((component crud-admin-component)) + '(crud-create-operation crud-read-operation + crud-update-operation crud-delete-operation)) + +(defmethod run-operation ((component crud-admin-component) + (operation crud-operation-component)) + (run-operation component (allocate-operation component ))) hunk ./src/cms.lisp 1 -(in-package :org.unknownlamer.notifications.notifications) +(in-package :org.unknownlamer.cms.cms) + +(defclass lame-cms-application-module (modular-application-mixin) + ((admin-component :initarg :admin-component + :accessor admin-component-of + :documentation "UCW Component for application adminstration") + (user-component :initarg :user-component + :accessor user-component-of + :documentation "Main web site component")) + (:documentation "Mixin for UCW Lame-CMS applications")) + +(defcomponent lame-cms-component () + () + (:documentation "Mixin for Lame-CMS components")) + + }