4 (defcomponent mewa-one-line-presentation
(mewa one-line-presentation
)
6 (:default-initargs
:attributes-getter
#'one-line-attributes-getter
))
8 (defmethod one-line-attributes-getter ((self mewa
))
9 (or (meta-model:list-keys
(instance self
))))
12 (defcomponent mewa-object-presentation
(mewa ucw
:object-presentation
) ())
14 (defcomponent two-column-presentation
(mewa-object-presentation) ())
16 (defmethod present ((pres two-column-presentation
))
18 (<:table
:class
(css-class pres
)
19 (loop for slot on
(slots pres
) by
#'cddr
21 (<:tr
:class
"presentation-slot-row"
22 (<:td
:class
"presentation-slot-label"
23 (<:as-html
(label (first slot
))))
24 (<:td
:class
"presentation-slot-value"
25 (present-slot (first slot
) (instance pres
)))
27 (<:td
:class
"presentation-slot-label"
28 (<:as-html
(label (second slot
))))
29 (<:td
:class
"presentation-slot-value"
30 (present-slot (second slot
) (instance pres
))))))
31 (render-options pres
(instance pres
))))
35 (defcomponent mewa-list-presentation
(mewa ucw
:list-presentation
)
36 ((ucw::instances
:accessor instances
:initarg
:instances
:initform nil
)
37 (instance :accessor instance
)
38 (select-label :accessor select-label
:initform
"select" :initarg
:select-label
)
39 (selectablep :accessor selectablep
:initform t
:initarg
:selectablep
)))
41 (defaction select-from-listing
((listing mewa-list-presentation
) object index
)
44 (defmethod render-list-row ((listing mewa-list-presentation
) object index
)
45 (<:tr
:class
"item-row"
46 (<:td
:align
"center" :valign
"top"
47 (when (ucw::editablep listing
)
48 (let ((object object
))
49 (<ucw
:input
:type
"submit"
50 :action
(edit-from-listing listing object index
)
51 :value
(ucw::edit-label listing
))))
53 (when (ucw::deleteablep listing
)
55 (<ucw
:input
:type
"submit"
56 :action
(delete-from-listing listing object index
)
57 :value
(ucw::delete-label listing
))))
58 (when (selectablep listing
)
60 (<ucw
:input
:type
"submit"
61 :action
(select-from-listing listing object index
)
62 :value
(select-label listing
)))))
63 (dolist (slot (slots listing
))
64 (<:td
:class
"data-cell" (present-slot slot object
)))
65 (<:td
:class
"index-number-cell")
68 (defmethod get-all-instances ((self mewa-list-presentation
))
74 (defcomponent mewa-presentation-search
(ucw::presentation-search
)
75 ((display-results-p :accessor display-results-p
:initarg
:display-results-p
:initform nil
)))
77 (defmethod ok ((self mewa-presentation-search
) &optional arg
)
78 (declare (ignore arg
))
79 (setf (display-results-p self
) t
))
81 (defmethod get-all-instances ((self mewa-presentation-search
))
82 (clsql:select
(class-name (class-of (instance (ucw::search-presentation self
)))) :flatp t
))
84 (defmethod render-on ((res response
) (self mewa-presentation-search
))
85 (ucw::render-criteria res self
)
86 (when (display-results-p self
)
87 (let ((listing (ucw::list-presentation self
)))
88 (setf (instances listing
) (ucw::valid-instances self
)
89 (slot-value listing
'ucw
::calling-component
) (slot-value self
'ucw
::calling-component
)
90 (slot-value listing
'ucw
::place
) (slot-value self
'ucw
::place
)
91 (slot-value listing
'ucw
::continuation
) (slot-value self
'ucw
::continuation
))
93 (render-on res listing
))))