X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/e9454185bda3d35420ad39ae2817260bd222e789..4e2ecf695f074d4ed79c1099fa56b1d6fce08bfb:/src/mewa/slot-presentations.lisp diff --git a/src/mewa/slot-presentations.lisp b/src/mewa/slot-presentations.lisp index 4e69bd8..f501b71 100644 --- a/src/mewa/slot-presentations.lisp +++ b/src/mewa/slot-presentations.lisp @@ -1,9 +1,11 @@ (in-package :it.bese.ucw) (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)) @@ -85,12 +87,6 @@ When T, only the default value for primary keys and the joins are updated.")) (linkedp :accessor linkedp :initarg :linkedp :initform t)) (:type-name relation)) -(defun get-fkey-data (instance slot-name) - "ugly workaround b/c UCW does not like M-V-B" - (multiple-value-bind (finstance foreign-slot-name) - (meta-model:explode-foreign-key instance slot-name) - (cons finstance foreign-slot-name))) - (defaction search-records ((slot mewa-relation-slot-presentation) instance) (multiple-value-bindf (finstance foreign-slot-name) (meta-model:explode-foreign-key instance (slot-name slot)) @@ -106,7 +102,7 @@ When T, only the default value for primary keys and the joins are updated.")) (mewa:make-presentation finstance :type :listing))))) (setf (slot-value instance (slot-name slot)) (slot-value new-instance foreign-slot-name)) - (meta-model:sync-instance instance :fill-gaps-only t)))) + (meta-model:sync-instance instance :fill-gaps-only-p (fill-gaps-only-p self))))) (defaction create-record ((slot mewa-relation-slot-presentation) instance) (multiple-value-bindf (finstance foreign-slot-name) @@ -148,18 +144,24 @@ When T, only the default value for primary keys and the joins are updated.")) (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 '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)))