[Add web frontend and initial refactoring
clinton@unknownlamer.org**20080104212256
 * Removed golf-navigator in favor of ucw tabbed-pane
 * Factored viewer and chooser into common and admin specific portions
 * Added a few utility components
   - golf-widget: widget with css class set to its class-name
   - composite-component: container that merely renders all children
 * Updated CSS for new style rules
] {
hunk ./src/web.lisp 11
-(defmacro render-controls (&body controls)
-  `(<:ul :class "golf-controls"
-     ,@(mapcar (lambda (control)
-		 `(<:li :class "control"
-			(<ucw:a :action-body ,(cadr control)
-				(<:as-html ,(car control)))))
-	       controls)))
+(defcomponent admin-show-chooser (show-chooser)
+  ()
+  (:default-initargs :viewer 'admin-compact-show-selector))
hunk ./src/web.lisp 15
-;; Chooser
+(defcomponent admin-show-selector (show-selector)
+  ()
+  (:default-initargs :viewer (make-instance 'admin-show-viewer)))
hunk ./src/web.lisp 19
-(defcomponent choose-show ()
+(defcomponent admin-compact-show-selector (admin-show-selector compact-show-viewer)
hunk ./src/web.lisp 22
-(defmethod shows ((chooser choose-show))
-  (elephant:get-instances-by-class 'radio-show))
+(defmethod render-controls :after ((self admin-show-selector))
+  (component-controls
+    ("Delete" (progn
+		(elephant:drop-instances (list (radio-show self)))
+		(refresh-show-cache (parent self))))))
+
+(defmethod render :after ((self admin-show-chooser))
+  (render-controls self))
+
+(defmethod render-controls ((self admin-show-chooser))
+  (component-controls ("New Show" (progn (call 'show-editor)
+					 (refresh-show-cache self)))))
hunk ./src/web.lisp 35
-(defmethod render ((self choose-show))
-  (<:div
-   :class "golf-chooser"
-   (<:ul
-    :class "chooser-list"
-    (mapc #'(lambda (show)
-	      (<:li (<ucw:a :class "show-title"
-			    :action-body (call 'show-view :show show)
-			    (<:as-html (if (slot-boundp show 'show-title)
-					   (show-title show)
-					   "[C]")))
-		    (<:as-html " ")
-		    (render-controls
-		      ("Delete" (elephant:drop-instances (list show))))))
-	  (shows self)))
-   (render-controls ("New Show" (call 'show-editor)))))
hunk ./src/web.lisp 38
-(defcomponent show-view ()
+(defcomponent admin-show-viewer (show-viewer)
hunk ./src/web.lisp 41
-(defmethod render ((self show-view))
+(defmethod render-controls :after ((self admin-show-viewer))
hunk ./src/web.lisp 43
-    (<:div :class "golf-show-viewer"
-	   (<:h1 (<:as-html (show-title show)))
-	   (<:p (<:as-html (transcript show)))
-	   (<:p (awhen (audio-data show)
-		  (format nil "Type: ~S" (audio-file-type it))))
-	   (render-controls ("Edit" (call 'show-editor :show show))
-			    ("Play" (play-file self show))
-			    ("Ok"   (ok self))
-			    ("Refresh" (refresh-component self))))))
+    (component-controls ("Edit" (call 'show-editor :show show))
+			("Play" (play-file self show))
+			("Refresh" (refresh-component self)))))
hunk ./src/web.lisp 121
-;; Audio file streaming
-
-(defcomponent audio-file-window (window-component)
-  ((audio-file :initarg :audio-file :accessor audio-file)))
-
-(defmethod window-component.content-type ((window audio-file-window))
-  (audio-file-type (audio-file window)))
-
-(defmethod render :before ((audio-window audio-file-window))
-  (setf (get-header (context.response *context*) "Content-Length")
-        (format nil "~D" (audio-file-length (audio-file audio-window)))))
-
-(defmethod render ((audio-window audio-file-window))
-  (send-headers (context.response *context*))
-  (write-sequence (audio-data (audio-file audio-window))
-		  (ucw::network-stream (context.response *context*))))
-
-(defaction play-file ((c t) (show radio-show))
-  (call 'audio-file-window :audio-file (audio-data show)))
-
hunk ./src/web.lisp 123
-(defcomponent golf-admin-window (standard-window-component-with-body)
+(defcomponent golf-admin-window (golf-window)
hunk ./src/web.lisp 126
-    :title "Admin Interface"
-    :dojo-debug-p nil
-    :stylesheet '("static/css/tee-it-up.css")))
+    :title "Admin Interface"))
hunk ./src/web.lisp 131
-	(make-instance 'switching-container
+	(make-instance 'tabbed-pane
hunk ./src/web.lisp 135
-		       `((chooser . ,(make-instance 'choose-show))
+		       `((chooser . ,(make-instance 'admin-show-chooser))
hunk ./src/web.lisp 137
-
-
-(defmethod render-html-body ((window golf-admin-window))
-  (<:div :id "golf-nav-menu"
-   (<:ul
-    (mapc (lambda (c) (<:li
-		  :class (if (eq (car c)
-				 (container.current-component-key
-				  (body-of window)))
-			     "current-component"
-			     "not-current-component")
-		  (<ucw:a :action-body (switch-component (body-of window)
-							 (car  c))
-			  (<:as-html (car c)))))
-	  (container.contents (body-of window)))))
-  (<:div :id "golf-nav-body" (call-next-method)))
addfile ./src/web-frontend.lisp
hunk ./src/web-frontend.lisp 1
-
+(in-package :com.tee-it-up-golf.web)
+
+(defcontainer golf-frontend-components (composite-component)
+  (chooser show-chooser :viewer 'compact-show-selector)
+  (list show-list))
+
+(defcomponent golf-frontend-window (golf-window)
+  ()
+  (:default-initargs :body (make-instance 'golf-frontend-components)))
+
+(defcomponent frontend-show-viewer (show-viewer)
+  ((show :initarg :show :accessor radio-show)))
hunk ./tee-it-up.asd 15
-			 (:file "web" :depends-on ("ucw-compat" "database" "util"))
+			 (:file "web-common"
+			  :depends-on ("ucw-compat" "database" "util"))
+			 (:file "web-admin" :depends-on ("web-common"))
+			 (:file "web-frontend" :depends-on ("web-common"))
hunk ./tee-it-up.asd 21
-  :depends-on (:elephant :ucw :flexi-streams :metatilities :rfc2388-binary))
+  :depends-on (:elephant :ucw :flexi-streams :cl-fad
+	       :metatilities :rfc2388-binary))
}