Cleanud up some defaults and made slots accessable by name.
[clinton/lisp-on-lines.git] / src / mewa / presentations.lisp
index 39a6647..62e93d1 100644 (file)
@@ -12,7 +12,8 @@
   (or (meta-model:list-keys (instance self))))
 
 ;;;objects
-(defcomponent mewa-object-presentation (mewa ucw:object-presentation) ())
+(defcomponent mewa-object-presentation (mewa ucw:object-presentation) 
+  ((ucw::instance :accessor instance :initarg :instance :initform nil)))
 
 (defcomponent two-column-presentation (mewa-object-presentation) ())
 
@@ -39,7 +40,9 @@
   ((ucw::instances :accessor instances :initarg :instances :initform nil)
    (instance :accessor instance)
    (select-label :accessor select-label :initform "select" :initarg :select-label)
-   (selectablep :accessor selectablep :initform t :initarg :selectablep)))
+   (selectablep :accessor selectablep :initform t :initarg :selectablep)
+   (ucw::deleteablep :accessor deletablep :initarg :deletablep :initform nil)
+   (viewablep :accessor viewablep :initarg :viewablep :initform nil)))
 
 (defaction select-from-listing ((listing mewa-list-presentation) object index)
   (answer object))
        (let ((index index))
          (<ucw:input :type "submit"
                      :action (select-from-listing listing object index)
-                     :value (select-label listing)))))
+                     :value (select-label listing))))
+      (when (viewablep listing)
+       (let ((index index))
+         (<ucw:input :type "submit"
+                     :action (call-component listing  (make-presentation object))
+                     :value "view"))))
     (dolist (slot (slots listing))
       (<:td :class "data-cell" (present-slot slot object)))
     (<:td :class "index-number-cell")
                                (if (listp e) e (list e))))
                  (ucw::criteria self))))
 
-
 (defmethod search-query ((self mewa:mewa-presentation-search))
   (search-expr self (instance self)))
 
 
 (defmethod ok ((self mewa-presentation-search) &optional arg)
   (declare (ignore arg))
-  (setf (ucw::list-presentation self) (valid-instances self))
+  (setf (ucw::instances (ucw::list-presentation self)) (valid-instances self))
   (setf (display-results-p self) t))
 
+
 (defmethod render-on ((res response) (self mewa-presentation-search))
+  ;(<:as-html (search-query self))
   (ucw::render-criteria res self)
   (<ucw:input :type "submit" :value "Search" :action (ok self))
   (when (display-results-p self)