[bknr-cvs] hans changed trunk/projects/hello-web/

BKNR Commits bknr at bknr.net
Fri Jun 4 06:59:34 UTC 2010


Revision: 4553
Author: hans
URL: http://bknr.net/trac/changeset/4553

More fixes to make HELLO-WEB behave better.

U   trunk/projects/hello-web/src/tags.lisp
U   trunk/projects/hello-web/src/webserver.lisp
A   trunk/projects/hello-web/website/templates/login.xml

Modified: trunk/projects/hello-web/src/tags.lisp
===================================================================
--- trunk/projects/hello-web/src/tags.lisp	2010-06-04 05:37:39 UTC (rev 4552)
+++ trunk/projects/hello-web/src/tags.lisp	2010-06-04 06:59:34 UTC (rev 4553)
@@ -2,4 +2,11 @@
 
 (define-bknr-tag test-tag (&key arg)
   (html (:p "hi there, this is from a application-defined tag function, and the argument was "
-	    (:b (:princ-safe arg)))))
\ No newline at end of file
+	    (:b (:princ-safe arg)))))
+
+(define-bknr-tag login-page ()
+  (if (and (hunchentoot:session-value :login-redirect-uri)
+           (not (bknr.user:anonymous-p (bknr-session-user))))
+      (redirect (puri:render-uri (hunchentoot:session-value :login-redirect-uri) nil))
+      (emit-tag-children)))
+

Modified: trunk/projects/hello-web/src/webserver.lisp
===================================================================
--- trunk/projects/hello-web/src/webserver.lisp	2010-06-04 05:37:39 UTC (rev 4552)
+++ trunk/projects/hello-web/src/webserver.lisp	2010-06-04 06:59:34 UTC (rev 4553)
@@ -22,10 +22,9 @@
                                         images
                                         user
 					("/static" directory-handler
-                                                   :destination ,(namestring (merge-pathnames #p"static/" *website-directory*))))	       
+                                                   :destination ,(namestring (merge-pathnames #p"static/" *website-directory*))))
 		 :admin-navigation '(("user" . "/user/")
 				     ("images" . "/edit-images")
-				     ("import" . "/import")
 				     ("logout" . "/logout"))
 		 :authorizer (make-instance 'bknr-authorizer)
 		 :style-sheet-urls '("/static/styles.css")

Added: trunk/projects/hello-web/website/templates/login.xml
===================================================================
--- trunk/projects/hello-web/website/templates/login.xml	                        (rev 0)
+++ trunk/projects/hello-web/website/templates/login.xml	2010-06-04 06:59:34 UTC (rev 4553)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:bknr="http://bknr.net"
+  xmlns:hello-web="http://hello-web.bknr.net"
+  >
+  <head>
+    <link rel="stylesheet" href="/static/styles.css" />
+    <script src="/static/javascript.js" type="text/javascript"><!-- x -->	
+    </script> 
+    <title>Please log in</title>
+  </head>
+  <hello-web:login-page>
+    <body>
+      <h1>BKNR hello-web login</h1>
+      <form method="post">
+        <table>
+          <tr><td>Username</td><td><input name="__username"/></td></tr>
+          <tr><td>Password</td><td><input name="__password" type="password"/></td></tr>
+        </table>
+        <button type="submit">Log in</button>
+      </form>
+    </body>
+  </hello-web:login-page>
+</html>





More information about the Bknr-cvs mailing list