massive refactoring in preparation of release.
[clinton/lisp-on-lines.git] / src / standard-attributes.lisp
index 87b8620..a34a1f6 100644 (file)
 (defdisplay ((base base-attribute) object)
  (<:as-html (attribute-value object base)))
 
-;;;; Strings
 
-(defattribute string-attribute (base-attribute)
+(defattribute base-attribute ()
   ()
+  (:in-layer editor)
+  (:default-properties
+      :callback nil))
+
+(defdisplay
+    :in-layer editor :around ((string base-attribute) object)
+    (dletf (((callback string) (ucw::make-new-callback
+                               #'(lambda (val)
+                                   (setf (attribute-value object string) val)))))
+      (call-next-method)))
 
+;;;; Strings
+
+(defattribute string-attribute ()
+  ()
   (:type-name string)
   (:default-properties
       :escape-html-p t
     :size nil
     :max-length nil))
 
+(defdisplay
+    :in-layer editor ((string base-attribute) object)
+ (<:input
+  :type "text"
+  :id (id string)
+  :name (callback string)
+  :value (or (attribute-value object string) "")))
+
+
 (defdisplay :in-layer omit-nil-attributes
            :around ((attribute string-attribute) object)
  (when (< 0 (length  (attribute-value object attribute)))
    (call-next-method)))
 
-
 ;;;; default
-(defdisplay ((string string-attribute) object)
+(defdisplay :in-layer viewer
+           ((string string-attribute) object)
   (if (escape-html-p string)
       (<:as-html (attribute-value object string))
       (<:as-is (attribute-value object string))))
   (:default-properties
       :callback nil))
 
-(defdisplay
-   :in-layer editor :around ((string string-attribute) object)
- (dletf (((callback string) (ucw::make-new-callback
-                            #'(lambda (val)
-                                (setf (attribute-value object string) val)))))
-   (call-next-method)))
-
-(defdisplay :in-layer editor ((string string-attribute) object)
- (<:input
-  :type "text"
-  :id (id string)
-  :name (callback string)
-  :value (or (attribute-value object string) "")))         
-
+           
 (defattribute string-search-attribute (string-attribute)
   ()
   (:default-properties
 
 (defdisplay
    :in-layer editor :after ((search string-search-attribute) object)
-     (IT.BESE.YACLML.TAGS:INPUT
-      :TYPE "submit"
-      :VALUE "search"
-      :ONCLICK
-      (JS:JS-INLINE*
-       `(PROGN
-        (IT.BESE.UCW::SET-ACTION-PARAMETER
-         ,(IT.BESE.UCW::MAKE-NEW-ACTION
-           (IT.BESE.UCW::CONTEXT.CURRENT-FRAME *CONTEXT*)
-           (search-action search)))
-        (RETURN T)))))
+   (<:input 
+    :TYPE "submit"
+    :VALUE "search"
+    :ONCLICK
+    (JS:JS-INLINE*
+     `(PROGN
+       (IT.BESE.UCW::SET-ACTION-PARAMETER
+       ,(IT.BESE.UCW::MAKE-NEW-ACTION
+         (IT.BESE.UCW::CONTEXT.CURRENT-FRAME *CONTEXT*)
+         (search-action search)))
+       (RETURN T)))))
 
 ;;;; textarea
 
 (defattribute text-attribute (string-attribute)
-  ()
-  (:type-name text))
+      ()
+      (:type-name text))
 
 (defdisplay :in-layer editor ((string text-attribute) object)
  (<:textarea
   :id (id string)
   :name (callback string)
- (or (attribute-value object string) "")))
 (or (attribute-value object string) "")))
 
 
 
 
 
 (defattribute image ()
-  ())
+  ()
+  (:default-properties
+      :css-class "lol-image"
+    :prefix "images/"))
 
 (defdisplay ((buttons (eql 'image-editor-buttons)) object)
   (<ucw:a :action (ok component object)
 
 (defdisplay ((image image) object)
   (<:img
-   :class (or (.get :css-class) "lol-image") 
+   :class (or (css-class image) "lol-image") 
    :src (arnesi:strcat
-        (or (.get :prefix) "images/")
+        (or (prefix image) "images/")
         (escape-as-uri
          (attribute-value object image)))))
 
 
     (<:div
      :class "lol-image-thumbnails"
-   
-     (dolist* (i (or (.get :directory)
-                    (cl-fad:list-directory (strcat *default-pathname-defaults* "wwwroot/images/"))))
-       (<:div
-       :style "border: 1px solid black;width:100px;"
-       (<:img
-        :width "90px"
-        :src (strcat (or (.get :prefix) "images/")
-                     (file-namestring i)))
-       (display-using-description* 'image-editor-buttons (file-namestring i) (.properties)))
-       (<:p :style "clear:both;"))))
+     (<:as-html "imagie")))