X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/db4fe3430ee9cc4190222e915e32d809928f64cb..b8c8985156e0ce7de77973d5899221116dcc3c96:/src/slot-presentations.lisp diff --git a/src/slot-presentations.lisp b/src/slot-presentations.lisp index d7e874d..02fb818 100644 --- a/src/slot-presentations.lisp +++ b/src/slot-presentations.lisp @@ -1,5 +1,11 @@ +;; i know this is horrible, but it works wonders. +(declaim (optimize (speed 0) (space 3) (safety 0))) + + (in-package :lisp-on-lines) + +;;;; I dont think i'm using these anymore. (defun multiple-value-funcall->list (function &rest args) "The function to be called by m-v-bf" (multiple-value-call #'list (apply function args))) @@ -41,11 +47,13 @@ "") :rows (rows slot) :cols (columns slot)) - (maybe-convert-newline-and-escape-html-then-print)))) + (when (presentation-slot-value slot instance) + (maybe-convert-newline-and-escape-html-then-print))))) (defcomponent mewa-slot-presentation () - ((slot-name :accessor slot-name + ((validate-functions :accessor validate-functions :initform (list (constantly t))) + (slot-name :accessor slot-name :initarg :slot-name :documentation "The name of the slot being accessed") @@ -59,6 +67,8 @@ When T, only the default value for primary keys and the joins are updated.") (creatablep :accessor creatablep :initarg :creatablep :initform t)) (:documentation "The superclass of all Mewa slot presentations")) + + ;;;; this has to be in the eval when i would think (eval-when (:compile-toplevel :load-toplevel :execute) (defun generate-slot-presentation-definition-for-type (type) @@ -88,12 +98,12 @@ When T, only the default value for primary keys and the joins are updated.") (default-to-now-p :accessor default-to-now-p :initarg :default-to-now-p :initform nil)) (:type-name clsql-sys:wall-time)) -(defmethod presentation-slot-value ((slot clsql-wall-time-slot-presentation) instance) +(defmethod lol::presentation-slot-value ((slot clsql-wall-time-slot-presentation) instance) (let ((date (call-next-method))) (when date (multiple-value-bind (y m d) (clsql:time-ymd date) (format nil "~a/~a/~a" m d y))))) -(defmethod (setf presentation-slot-value) ((value string) (slot clsql-wall-time-slot-presentation) instance) +(defmethod (setf lol::presentation-slot-value) ((value string) (slot clsql-wall-time-slot-presentation) instance) (let ((new-time (clsql:parse-date-time (remove #\Space value))) (old-time (when (slot-boundp instance (slot-name slot)) (slot-value instance (slot-name slot))))) @@ -105,17 +115,17 @@ When T, only the default value for primary keys and the joins are updated.") (defmethod label :around ((slot clsql-wall-time-slot-presentation)) (concatenate 'string (call-next-method) " (m/d/y)")) -(defmethod present-slot ((slot clsql-wall-time-slot-presentation) instance) - (let ((date (presentation-slot-value slot instance))) +(defmethod lol::present-slot ((slot clsql-wall-time-slot-presentation) instance) + (let ((date (lol::presentation-slot-value slot instance))) ;; Default values (when (and (not date) (default-to-now-p slot)) - (setf (presentation-slot-value slot instance) (clsql:get-time))) + (setf (lol::presentation-slot-value slot instance) (clsql:get-time))) ;;simple viewer (if (and date (not (editablep slot))) (<:as-html date)) ;; editor (when (editablep slot) - (