1 (in-package :lisp-on-lines
)
3 ;;;;; Wrap a display in "back buttons"
4 (deflayer wrap-back-buttons
)
6 (defvar *back-buttons-wrapped-p
* nil
)
9 :in-layer wrap-back-buttons
:around
11 (if *back-buttons-wrapped-p
*
13 (let ((*back-buttons-wrapped-p
* t
))
15 (<ucw
:a
:class
"wiz-button previous" :action
(ok self t
)
16 (<:as-html
"Go Back"))
17 (<:div
:style
"clear:both;"
19 (<ucw
:a
:class
"wiz-button previous" :action
(ok self t
)
20 (<:as-html
"Go Back")))))
22 ;;;; Wrap an object display in with a link to the object
26 (defvar *link-wrapped-p
* nil
)
28 (define-layered-class description
29 :in-layer wrap-link
()
30 ((link :initarg
:link-action
32 :initform nil
:special t
:accessor link-action
)))
34 (defaction call-action-with-component-and-object
((self component
) action-id object
)
35 (funcall (ucw::find-action
(ucw::context.current-frame
*context
*) action-id
)
40 :in-layer wrap-link
:around
(description object
)
41 (let ((link (link-action description
)))
43 (with-inactive-layers (wrap-link)
46 (let ((*link-wrapped-p
* t
))
47 (<ucw
:a
:action
(call-action-with-component-and-object
50 (ucw::context.current-frame
*context
*)
55 (call-next-method)))))))
60 (defvar *in-form-p
* nil
)
62 (define-layered-class description
63 :in-layer wrap-form
()
64 ((form-buttons :initarg
:form-buttons
:initform nil
:special t
:accessor form-buttons
)
65 (form-type :initarg
:form-type
:initform
'<ucw
:simple-form
:special t
:accessor form-type
)))
67 (defattribute form-button-attribute
()
68 ((form-buttons :initarg
:form-buttons
:initform nil
:special t
:accessor form-buttons
)))
70 (defdisplay ((description form-button-attribute
) object
)
71 (macrolet ((submit (&key action value
)
73 :action
(funcall ,action self object
)
76 (loop for button in
(form-buttons description
)
78 (let ((button button
))
79 (with-properties (button)
80 (let ((action (.get
:action
)))
81 (submit :value
(.get
:value
)
82 :action
(if (consp action
)
89 :around
(description object
)
91 (with-inactive-layers (wrap-form)
93 (with-inactive-layers (show-attribute-labels)
96 'form-button-attribute
98 (form-buttons description
))
100 (ecase (form-type description
)
103 :action
(refresh-component self
)
107 :action
(refresh-component self
)
115 (define-layered-class description
116 :in-layer wrap-div
()
117 ((div-attributes :accessor div-attributes
:initarg
:div
:special t
:initform nil
)))
119 (defdisplay :in-layer wrap-div
:wrap-around
(description object
)
120 (let ((args (div-attributes description
)))
121 (with-inactive-layers (wrap-div)
122 (yaclml::funcall-with-tag
125 (call-next-method))))))