[Lisppaste-cvs] CVS update: lisppaste2/lisppaste.lisp lisppaste2/variable.lisp lisppaste2/web-server.lisp

Brian Mastenbrook bmastenbrook at common-lisp.net
Thu Mar 11 14:21:34 UTC 2004


Update of /project/lisppaste/cvsroot/lisppaste2
In directory common-lisp.net:/tmp/cvs-serv23876

Modified Files:
	lisppaste.lisp variable.lisp web-server.lisp 
Log Message:
uptime, syndication options

Date: Thu Mar 11 09:21:34 2004
Author: bmastenbrook

Index: lisppaste2/lisppaste.lisp
diff -u lisppaste2/lisppaste.lisp:1.12 lisppaste2/lisppaste.lisp:1.13
--- lisppaste2/lisppaste.lisp:1.12	Sun Mar  7 13:16:27 2004
+++ lisppaste2/lisppaste.lisp	Thu Mar 11 09:21:33 2004
@@ -1,4 +1,4 @@
-;;;; $Id: lisppaste.lisp,v 1.12 2004/03/07 18:16:27 bmastenbrook Exp $
+;;;; $Id: lisppaste.lisp,v 1.13 2004/03/11 14:21:33 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
@@ -32,6 +32,7 @@
     (mapcar #'(lambda (channel) (irc:join connection channel)) channels)
     (araneida:start-listening *paste-listener*)
     (add-hook nickname)
+    (setf *boot-time* (get-universal-time))
     (irc:start-background-message-handler connection)))
 
 (defun join-new-channel (channel)


Index: lisppaste2/variable.lisp
diff -u lisppaste2/variable.lisp:1.12 lisppaste2/variable.lisp:1.13
--- lisppaste2/variable.lisp:1.12	Sun Mar  7 14:52:57 2004
+++ lisppaste2/variable.lisp	Thu Mar 11 09:21:34 2004
@@ -1,4 +1,4 @@
-;;;; $Id: variable.lisp,v 1.12 2004/03/07 19:52:57 bmastenbrook Exp $
+;;;; $Id: variable.lisp,v 1.13 2004/03/11 14:21:34 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
@@ -48,6 +48,9 @@
 (defparameter *rss-full-url*
   (araneida:merge-url *paste-external-url* "list-full.rss"))
 
+(defparameter *syndication-url*
+  (araneida:merge-url *paste-external-url* "syndication"))
+
 (defvar *paste-listener*
   (let ((fwd-url (araneida:copy-url *paste-url*)))
     (setf (araneida:url-port fwd-url) *internal-http-port*)
@@ -69,3 +72,5 @@
 (defvar *channels* nil)
 
 (defvar *paste-file* "pastes.lisp-expr")
+
+(defvar *boot-time* 0)


Index: lisppaste2/web-server.lisp
diff -u lisppaste2/web-server.lisp:1.42 lisppaste2/web-server.lisp:1.43
--- lisppaste2/web-server.lisp:1.42	Tue Mar  9 01:52:27 2004
+++ lisppaste2/web-server.lisp	Thu Mar 11 09:21:34 2004
@@ -1,4 +1,4 @@
-;;;; $Id: web-server.lisp,v 1.42 2004/03/09 06:52:27 bmastenbrook Exp $
+;;;; $Id: web-server.lisp,v 1.43 2004/03/11 14:21:34 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
@@ -28,6 +28,8 @@
 
 (defclass rss-full-handler (araneida:handler) ())
 
+(defclass syndication-handler (araneida:handler) ())
+
 (defmethod araneida:handle-request-response ((handler new-paste-handler) method request)
   (araneida:request-send-headers request :expires 0)
   (let* ((annotate-string (araneida:body-param "annotate" (araneida:request-body request)))
@@ -42,13 +44,13 @@
     " | "
     ((a :href ,(araneida:urlstring *list-paste-url*)) "List all pastes")
     " | "
-    ((a :href ,(araneida:urlstring *rss-url*)) "Syndicate (Basic RSS)")
-    " | "
-    ((a :href ,(araneida:urlstring *rss-full-url*)) "Syndicate (Full RSS)")
+    ((a :href ,(araneida:urlstring *syndication-url*)) "Syndication")
     " | "
     ((a :href "http://common-lisp.net/project/lisppaste/xml-rpc.html") "XML-RPC")
     " | "
-    ((a :href "http://common-lisp.net/project/lisppaste") "lisppaste home page")))
+    ((a :href "http://common-lisp.net/project/lisppaste") "lisppaste home page")
+    " | "
+    "Uptime: " ,(time-delta *boot-time* :ago-p nil)))
 
 (defun time-delta (time &key (level 2) (ago-p t))
   (let ((delta (- (get-universal-time) time)))
@@ -97,6 +99,40 @@
       (concatenate 'string (subseq str 0 (1- n)) "...")
     str))
 
+(defmethod araneida:handle-request-response ((handler syndication-handler) method request)
+  (araneida:request-send-headers request :expires 0)
+  (format (araneida:request-stream request) "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
+  (araneida:html-stream
+   (araneida:request-stream request)
+   `(html
+     (head (title "Syndication options")
+      ,(rss-link-header))
+     (body
+      (h2 "Syndication options")
+      "Lisppaste can be syndicated in a variety of RSS formats for use
+with your favorite RSS reader."
+      (p)
+      (table
+       (tr
+        ((th :align left) "All channels")
+        ((td :width 30))
+        (td ((a :href ,(araneida:urlstring *rss-url*)) "Basic"))
+        ((td :width 10))
+        (td ((a :href ,(araneida:urlstring *rss-full-url*)) "Full")))
+       ,@(mapcar #'(lambda (channel)
+                     `(tr
+                       ((th :align left) ,channel)
+                       ((td :width 30))
+                       (td ((a :href ,(concatenate 'string
+                                                   (araneida:urlstring *rss-url*)
+                                                   (substitute #\? #\# channel))) "Basic"))
+                       ((td :width 10))
+                       (td ((a :href ,(concatenate 'string
+                                                   (araneida:urlstring *rss-full-url*)
+                                                   (substitute #\? #\# channel))) "Full"))))
+                 *channels*))
+      ,@(bottom-links)))))
+
 (defmethod araneida:handle-request-response ((handler list-paste-handler) method request)
   (araneida:request-send-headers request :expires 0)
   (format (araneida:request-stream request) "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
@@ -222,7 +258,7 @@
      (head (title ,(if annotate "Annotate" "Paste"))
       ,(rss-link-header))
      (body
-      (h1 ,(if annotate "Enter your annotation" "Enter your paste"))
+      (h2 ,(if annotate "Enter your annotation" "Enter your paste"))
       ((font :color red) (h2 ,message))
       ((form :method post :action ,(araneida:urlstring *submit-paste-url*))
        (p "Enter a username, title, and paste contents into the fields below.  The
@@ -303,7 +339,7 @@
              (head (title "Paste number " ,*paste-counter*)
               ,(rss-link-header))
              (body
-              (h1 "Pasted!")
+              (h2 "Pasted!")
               (p ,(if annotate "Your annotation should be available at " "Your paste should be available at ") ((a :href ,url) ,url) ", and was also sent to " ,channel " @ " ,(irc:server-name *connection*))
               (p "If you wish to paste a correction or addendum to this paste, you can annotate the paste using the submission button on the " ((a :href ,url) "paste's page."))
               ,@(bottom-links))))))))))
@@ -433,3 +469,8 @@
  (araneida:http-listener-handler *paste-listener*)
  (make-instance 'rss-full-handler)
  (araneida:urlstring *rss-full-url*) nil)
+
+(araneida:install-handler
+ (araneida:http-listener-handler *paste-listener*)
+ (make-instance 'syndication-handler)
+ (araneida:urlstring *syndication-url*) nil)





More information about the Lisppaste-cvs mailing list