+(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)))
"")
: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")
(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)
(defslot-presentation clsql-wall-time-slot-presentation (mewa-relation-slot-presentation)
((input-id :accessor input-id :initform (arnesi:random-string 10 arnesi:+ascii-alphabet+))
- (trigger-id :accessor trigger-id :initform (arnesi:random-string 10 arnesi:+ascii-alphabet+)))
+ (trigger-id :accessor trigger-id :initform (arnesi:random-string 10 arnesi:+ascii-alphabet+))
+ (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)
(unless (or (eql old-time new-time)
(when (and new-time old-time)
(equal :equal (clsql:time-compare new-time old-time))))
- (setf (presentation-slot-value slot instance) new-time ))))
+ (setf (presentation-slot-value slot instance) new-time))))
(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)))
+ ;; Default values
+ (when (and (not date) (default-to-now-p slot))
+ (setf (presentation-slot-value slot instance) (clsql:get-time)))
+ ;;simple viewer
(if (and date (not (editablep slot)))
(<:as-html date))
+ ;; editor
(when (editablep slot)
(<ucw:input :accessor (presentation-slot-value slot instance) :id (input-id slot) :style "display:inline")
(<:button :id (trigger-id slot) (<:as-html "[...]"))
:initargs
`(:attributes ,(attributes slot)))
))
- (<:as-html "--"))))
+ (<:as-html "--"))))
(defslot-presentation many-to-many-slot-presentation (mewa-relation-slot-presentation)
((list-view :accessor list-view :initarg :list-view :initform :one-line)