From: Drew Crampsie Date: Tue, 13 Dec 2005 09:44:28 +0000 (-0800) Subject: fixes, enhancements, and more update-to-latest-ucw stuff. minor, all of it. X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/commitdiff_plain/bf12489aa5ecb02b7be66367e0b2ec1cd9c35bae fixes, enhancements, and more update-to-latest-ucw stuff. minor, all of it. darcs-hash:20051213094428-5417e-eed38060c4605447ce9c2aba300bd48251fddcdc.gz --- diff --git a/src/mewa.lisp b/src/mewa.lisp index 203fdf3..1dea1fe 100644 --- a/src/mewa.lisp +++ b/src/mewa.lisp @@ -57,9 +57,11 @@ Attributes are the metadata used to display, validate, and otherwise manipulate (setf (attribute-map occurence) (make-hash-table))) (defgeneric find-occurence (name) + (:method (thing) + nil) (:method ((name symbol)) (find-or-create-occurence name)) - (:method (instance) + (:method ((instance standard-object)) (find-or-create-occurence (class-name (class-of instance))))) diff --git a/src/slot-presentations.lisp b/src/slot-presentations.lisp index 02fb818..89492aa 100644 --- a/src/slot-presentations.lisp +++ b/src/slot-presentations.lisp @@ -300,7 +300,8 @@ Calendar.setup({ (defmethod get-foreign-instances ((slot has-many-slot-presentation) instance) - (slot-value instance (slot-name slot))) + (sort (slot-value instance (slot-name slot)) #'< + :key #'(lambda (x) (funcall (car (list-keys instance)) x)))) (defmethod lol::presentation-slot-value ((slot has-many-slot-presentation) instance) (get-foreign-instances slot instance)) diff --git a/src/slot-presentations/date.lisp b/src/slot-presentations/date.lisp index 04d93ff..161b31c 100644 --- a/src/slot-presentations/date.lisp +++ b/src/slot-presentations/date.lisp @@ -42,15 +42,38 @@ -(defcomponent %integer-range-field (ucw::integer-range-field) +(defcomponent %integer-range-field (integer-range-field) ()) (defmethod (setf lisp-value) :after (value (self %integer-range-field)) ()) - - +(defclass date-field (form-element) + ((day :component (integer-range-field :min-value 1 :max-value 31)) + (month :component (integer-range-field :min-value 1 :max-value 12)) + (year :component integer-range-field)) + (:metaclass standard-component-class)) + +(defmethod shared-initialize :after ((field date-field) slot-names + &key (year-min 1960) (year-max 2010)) + (declare (ignore slot-names)) + (setf (min-value (slot-value field 'year)) year-min + (max-value (slot-value field 'year)) year-max + (max-value (slot-value field 'day)) 31 + (max-value (slot-value field 'month)) 12)) + +(defmethod read-client-value ((date date-field)) + (with-slots (year month day) + date + (read-client-value year) + (read-client-value month) + (read-client-value day) + (setf (lisp-value date) (encode-universal-time 0 0 0 + (lisp-value day) + (lisp-value month) + (lisp-value year))))) -(defclass %date-field (ucw::date-field) + +(defclass %date-field (date-field) ((day :component (%integer-range-field :min-value 1 :max-value 31)) (month :component (%integer-range-field :min-value 1 :max-value 12)) (year :component (%integer-range-field :min-value 2005 :max-value 2015) )) @@ -73,3 +96,149 @@ "/" (