[claw-cvs] r179 - in trunk/site/src: . components docroot pages

Andrea Chiumenti achiumenti at common-lisp.net
Tue Dec 30 17:37:12 UTC 2008


Author: achiumenti
Date: Tue Dec 30 17:37:12 2008
New Revision: 179

Log:


Added:
   trunk/site/src/docroot/
Modified:
   trunk/site/src/commons.lisp
   trunk/site/src/components/template.lisp
   trunk/site/src/main.lisp
   trunk/site/src/packages.lisp
   trunk/site/src/pages/index.lisp

Modified: trunk/site/src/commons.lisp
==============================================================================
--- trunk/site/src/commons.lisp	(original)
+++ trunk/site/src/commons.lisp	Tue Dec 30 17:37:12 2008
@@ -1,2 +1,7 @@
 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: src/commons.lisp $
\ No newline at end of file
+;;; $Header: src/commons.lisp $
+
+(in-package :claw-site)
+
+(defmacro js-goto (href)
+  `(ps:ps* `(location.replace ,(format nil "~a/~a" *root-path* ,href))))
\ No newline at end of file

Modified: trunk/site/src/components/template.lisp
==============================================================================
--- trunk/site/src/components/template.lisp	(original)
+++ trunk/site/src/components/template.lisp	Tue Dec 30 17:37:12 2008
@@ -1,2 +1,23 @@
 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: src/components/template.lisp $
\ No newline at end of file
+;;; $Header: src/components/template.lisp $
+
+(in-package :claw-site)
+
+(defclass site-template (wcomponent)
+  ((title :accessor site-template-title
+          :initarg :title))
+  (:metaclass metacomponent))
+
+(defmethod wcomponent-template ((obj site-template))
+  (html>
+   (head>
+    (title> (site-template-title obj)))
+   (djbody>
+    :class "thudra clawSite"
+    (wcomponent-informal-parameters obj)
+    (div> :class "header"
+          (div> :class "logo"))
+    (htcomponent-body obj))))
+
+(defmethod htcomponent-stylesheet-files ((obj site-template))
+  (list (format nil "~a/docroot/screen.css" *root-path*)))

Modified: trunk/site/src/main.lisp
==============================================================================
--- trunk/site/src/main.lisp	(original)
+++ trunk/site/src/main.lisp	Tue Dec 30 17:37:12 2008
@@ -1,2 +1,69 @@
 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: src/main.lisp $
\ No newline at end of file
+;;; $Header: src/main.lisp $
+
+(in-package :claw-site)
+
+
+(defvar *main-file* (load-time-value
+                     (or #.*compile-file-pathname* *load-pathname*)))
+
+(defvar *claw-site-lisplet*
+  (make-instance 'lisplet :realm 'claw-site
+                 :redirect-protected-resources-p t
+                 :base-path ""))
+
+(defvar *ht-connector* 
+  (make-instance 'hunchentoot-connector
+                 :address "localhost"
+                 :port 4242
+                 :sslport nil;4343
+                 #|
+                 :ssl-certificate-file #P "/etc/apache2/ssl/server.crt"
+                 :ssl-privatekey-file #P "/etc/apache2/ssl/server.key"
+                 |#))
+
+(defvar *sm* (make-instance 'default-session-manager))
+
+(defvar *ht-log-manager* (make-instance 'hunchentoot-logger))
+
+(defvar *claw-site-server* 
+  (make-instance 'claw-server
+                 :connector *ht-connector*
+                 :log-manager *ht-log-manager*
+                 :session-manager *sm*
+                 :base-path ""
+                 :reverse-proxy-path ""))
+
+(claw-server-register-lisplet *claw-site-server* *claw-site-lisplet*)
+
+
+(defclass site-principal (principal)
+  ((firstname :initarg :firstname
+              :accessor demo-principal-firstname)
+   (surname :initarg :surname
+            :accessor demo-principal-surname))
+  (:default-initargs :firstname "" :surname ""))
+
+(defclass site-configuration (configuration)
+  ()
+  (:documentation "Authorization configuration for application
+atuhentication and authorization management."))
+
+;;TODO
+(defmethod configuration-login ((configuration site-configuration)))
+
+(claw-server-register-configuration *claw-site-server* 
+                                    'claw-site (make-instance 'site-configuration))
+
+(let ((path (make-pathname :directory (append (pathname-directory *main-file*) '("docroot"))))
+      (*claw-server* *claw-site-server*))
+  (log-message :info "Registering resource ~a" path)
+  (lisplet-register-resource-location *claw-site-lisplet*
+                                      path
+                                      "docroot/"))
+
+(defun site-start ()
+  (claw-server-start *claw-site-server*))
+
+(defun site-stop ()
+  (claw-server-stop *claw-site-server*))
\ No newline at end of file

Modified: trunk/site/src/packages.lisp
==============================================================================
--- trunk/site/src/packages.lisp	(original)
+++ trunk/site/src/packages.lisp	Tue Dec 30 17:37:12 2008
@@ -1,2 +1,15 @@
 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: src/packages.lisp $
\ No newline at end of file
+;;; $Header: src/packages.lisp $
+
+(in-package :cl-user)
+
+
+(defpackage :claw-site
+  (:use :cl 
+        :local-time 
+        :claw-as 
+        :claw-hunchentoot-connector 
+        :claw-html 
+        :claw-html.dojo
+        :split-sequence)
+  (:documentation "Package for claw-central.org site"))
\ No newline at end of file

Modified: trunk/site/src/pages/index.lisp
==============================================================================
--- trunk/site/src/pages/index.lisp	(original)
+++ trunk/site/src/pages/index.lisp	Tue Dec 30 17:37:12 2008
@@ -1,2 +1,21 @@
 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
-;;; $Header: src/pages/index.lisp $
\ No newline at end of file
+;;; $Header: src/pages/index.lisp $
+
+(in-package :claw-site)
+
+(defclass index-page (page) 
+  ())
+
+(defmethod page-content ((o index-page))
+  (site-template> :title "The Claw Central - Home page"
+                  (djtoolbar> :id "manuBar" :class "topMenu"
+                              (djbutton>
+                               :on-click (js-goto "index.html")
+                               (span> "Home")))
+                  (div> :class "content" "Hello world")))
+
+(lisplet-register-function-location 
+ *claw-site-lisplet* 
+ (make-page-renderer 'index-page #'claw-post-parameters #'claw-get-parameters) 
+ "index.html" 
+ :welcome-page-p t)
\ No newline at end of file




More information about the Claw-cvs mailing list