X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/e9454185bda3d35420ad39ae2817260bd222e789..d5e996b3f1e6f25053a3b13f661ab34697085c5c:/src/mewa/slot-presentations.lisp?ds=sidebyside diff --git a/src/mewa/slot-presentations.lisp b/src/mewa/slot-presentations.lisp index 4e69bd8..82893a5 100644 --- a/src/mewa/slot-presentations.lisp +++ b/src/mewa/slot-presentations.lisp @@ -1,13 +1,35 @@ -(in-package :it.bese.ucw) +(in-package :mewa) (defun multiple-value-funcall->list (function &rest args) + "The function to be called by m-v-bf" (multiple-value-call #'list (apply function args))) (defmacro multiple-value-bindf (vars form &body body) + "Like M-V-B, only it works in actions. form must be a function call" `(destructuring-bind ,vars (multiple-value-funcall->list #',(car form) ,@(cdr form)) ,@body)) + +;;;; ** Textarea Slot Presentation + +(defslot-presentation text-slot-presentation () + ((rows :initarg :rows :accessor rows :initform 25) + (columns :initarg :columns :accessor columns :initform 40) + (escape-html-p :initarg :escape-html-p :accessor escape-html-p :initform nil)) + (:type-name text)) + +(defmethod present-slot ((slot text-slot-presentation) instance) + (if (editablep slot) + ( " (foreign-instance slot) " from " instance ) @@ -142,54 +184,87 @@ When T, only the default value for primary keys and the joins are updated.")) (:default-initargs)) (defaction view-instance ((self component) instance &rest initargs) - (call-component (parent self) (apply #'mewa:make-presentation instance initargs)) + (call-component (ucw::parent self) (apply #'mewa:make-presentation instance initargs)) ;; the viewed instance could have been changed/deleted, so we sync this instance - (meta-model:sync-instance (instance (parent self)))) - - -(defmethod present-slot :around ((slot foreign-key-slot-presentation) instance) - (setf (foreign-instance slot) (when (presentation-slot-value slot instance) (meta-model:explode-foreign-key instance (slot-name slot)))) - (flet ((render () (call-next-method))) - (cond - ((editablep slot) - (render) - (>")) - (call-next-method) - (<:as-html "total :" (len slot))) + (if (slot-boundp slot 'ucw::place) + (progn + (>")) + (call-next-method) + (<:as-html "total :" (len slot))) + (call-next-method))) (defmethod get-foreign-instances :around ((slot has-very-many-slot-presentation) instance) (let ((f (call-next-method))) @@ -256,3 +333,10 @@ When T, only the default value for primary keys and the joins are updated.")) (setf (instance (presentation slot)) (presentation-slot-value slot instance)) (present (presentation slot))) (<:as-html "--")))) + + + + + + +