1 (in-package :lisp-on-lines
)
3 (deflayer omit-nil-attributes
)
5 (defdisplay :in-layer omit-nil-attributes
6 :around
((attribute standard-attribute
) object
)
7 (when (attribute-value object attribute
)
10 (deflayer label-attributes
)
12 (defdisplay :in-layer label-attributes
13 :around
((attribute standard-attribute
) object
)
17 (<:as-html
(or (label attribute
) (attribute.name attribute
))))
19 :class
"lol-attribute"
24 (defattribute base-attribute
()
27 (defdisplay ((base base-attribute
) object
)
28 (<:as-html
(attribute-value object base
)))
32 (defattribute string-attribute
(base-attribute)
41 (defdisplay :in-layer omit-nil-attributes
42 :around
((attribute string-attribute
) object
)
43 (when (< 0 (length (attribute-value object attribute
)))
48 (defdisplay ((string string-attribute
) object
)
49 (if (escape-html-p string
)
50 (<:as-html
(attribute-value object string
))
51 (<:as-is
(attribute-value object string
))))
55 (defattribute string-attribute
(base-attribute)
62 :in-layer editor
:around
((string string-attribute
) object
)
63 (dletf (((callback string
) (ucw::make-new-callback
65 (setf (attribute-value object string
) val
)))))
68 (defdisplay :in-layer editor
((string string-attribute
) object
)
72 :name
(callback string
)
73 :value
(or (attribute-value object string
) "")))
75 (defattribute string-search-attribute
(string-attribute)
78 ;; the func that find search results
80 :search-action
#'(lambda ()
83 ;; when chosing from a list of results, this function selects one.
84 :select-function
(constantly t
))
85 (:type-name string-search
))
88 :in-layer editor
:after
((search string-search-attribute
) object
)
89 (IT.BESE.YACLML.TAGS
:INPUT
95 (IT.BESE.UCW
::SET-ACTION-PARAMETER
96 ,(IT.BESE.UCW
::MAKE-NEW-ACTION
97 (IT.BESE.UCW
::CONTEXT.CURRENT-FRAME
*CONTEXT
*)
98 (search-action search
)))
103 (defattribute text-attribute
(string-attribute)
107 (defdisplay :in-layer editor
((string text-attribute
) object
)
110 :name
(callback string
)
111 (or (attribute-value object string
) "")))
117 (defattribute wall-time-attribute
(string-attribute)
119 (:type-name clsql-sys
:wall-time
))
121 (define-layered-method attribute-value
(object (attribute wall-time-attribute
))
122 (let ((date (call-next-method)))
123 (when date
(multiple-value-bind (y m d
) (clsql:time-ymd date
)
124 (format nil
"~a/~a/~a" m d y
)))))
127 ((time wall-time-attribute
) object
)
128 (<:as-html
(attribute-value object time
)))
132 (defattribute image
()
135 (defdisplay ((buttons (eql 'image-editor-buttons
)) object
)
136 (<ucw
:a
:action
(ok component object
)
137 (<:as-html
"select this image")))
139 (defdisplay ((image image
) object
)
141 :class
(or (.get
:css-class
) "lol-image")
143 (or (.get
:prefix
) "images/")
145 (attribute-value object image
)))))
148 :in-layer editor
((image image
) object
)
151 :class
"lol-image-thumbnails"
153 (dolist* (i (or (.get
:directory
)
154 (cl-fad:list-directory
(strcat *default-pathname-defaults
* "wwwroot/images/"))))
156 :style
"border: 1px solid black;width:100px;"
159 :src
(strcat (or (.get
:prefix
) "images/")
160 (file-namestring i
)))
161 (display-using-description* 'image-editor-buttons
(file-namestring i
) (.properties
)))
162 (<:p
:style
"clear:both;"))))