3 (defaction edit-instance
((self mewa
))
4 (call-presentation (instance self
) :type
:editor
))
7 (defcomponent mewa-one-line-presentation
(mewa one-line-presentation
)
9 (:default-initargs
:attributes-getter
#'one-line-attributes-getter
))
11 (defmethod one-line-attributes-getter ((self mewa
))
12 (or (meta-model:list-keys
(instance self
))))
15 (defcomponent mewa-object-presentation
(mewa ucw
:object-presentation
) ())
17 (defcomponent two-column-presentation
(mewa-object-presentation) ())
19 (defmethod present ((pres two-column-presentation
))
21 (<:table
:class
(css-class pres
)
22 (loop for slot on
(slots pres
) by
#'cddr
24 (<:tr
:class
"presentation-slot-row"
25 (<:td
:class
"presentation-slot-label"
26 (<:as-html
(label (first slot
))))
27 (<:td
:class
"presentation-slot-value"
28 (present-slot (first slot
) (instance pres
)))
30 (<:td
:class
"presentation-slot-label"
31 (<:as-html
(label (second slot
))))
32 (<:td
:class
"presentation-slot-value"
33 (present-slot (second slot
) (instance pres
))))))
34 (render-options pres
(instance pres
))))
38 (defcomponent mewa-list-presentation
(mewa ucw
:list-presentation
)
39 ((ucw::instances
:accessor instances
:initarg
:instances
:initform nil
)
40 (instance :accessor instance
)
41 (select-label :accessor select-label
:initform
"select" :initarg
:select-label
)
42 (selectablep :accessor selectablep
:initform t
:initarg
:selectablep
)))
44 (defaction select-from-listing
((listing mewa-list-presentation
) object index
)
47 (defmethod render-list-row ((listing mewa-list-presentation
) object index
)
48 (<:tr
:class
"item-row"
49 (<:td
:align
"center" :valign
"top"
50 (when (ucw::editablep listing
)
51 (let ((object object
))
52 (<ucw
:input
:type
"submit"
53 :action
(edit-from-listing listing object index
)
54 :value
(ucw::edit-label listing
))))
56 (when (ucw::deleteablep listing
)
58 (<ucw
:input
:type
"submit"
59 :action
(delete-from-listing listing object index
)
60 :value
(ucw::delete-label listing
))))
61 (when (selectablep listing
)
63 (<ucw
:input
:type
"submit"
64 :action
(select-from-listing listing object index
)
65 :value
(select-label listing
)))))
66 (dolist (slot (slots listing
))
67 (<:td
:class
"data-cell" (present-slot slot object
)))
68 (<:td
:class
"index-number-cell")
71 (defmethod get-all-instances ((self mewa-list-presentation
))
77 (defcomponent mewa-presentation-search
(ucw::presentation-search
)
78 ((display-results-p :accessor display-results-p
:initarg
:display-results-p
:initform nil
)))
80 (defmethod ok ((self mewa-presentation-search
) &optional arg
)
81 (declare (ignore arg
))
82 (setf (display-results-p self
) t
))
84 (defmethod get-all-instances ((self mewa-presentation-search
))
85 (clsql:select
(class-name (class-of (instance (ucw::search-presentation self
)))) :flatp t
))
87 (defmethod render-on ((res response
) (self mewa-presentation-search
))
88 (ucw::render-criteria res self
)
89 (when (display-results-p self
)
90 (let ((listing (ucw::list-presentation self
)))
91 (setf (instances listing
) (ucw::valid-instances self
)
92 (slot-value listing
'ucw
::calling-component
) (slot-value self
'ucw
::calling-component
)
93 (slot-value listing
'ucw
::place
) (slot-value self
'ucw
::place
)
94 (slot-value listing
'ucw
::continuation
) (slot-value self
'ucw
::continuation
))
96 (render-on res listing
))))