Author: hhubner Date: 2006-01-24 05:55:10 -0600 (Tue, 24 Jan 2006) New Revision: 1807
Removed: trunk/projects/bknr-website/src/bknr-website.asd trunk/projects/bknr-website/src/config.lisp trunk/projects/bknr-website/src/handlers.lisp trunk/projects/bknr-website/src/init.lisp trunk/projects/bknr-website/src/load.lisp trunk/projects/bknr-website/src/packages.lisp trunk/projects/bknr-website/src/tags.lisp trunk/projects/bknr-website/src/webserver.lisp Log: This is no longer needed with the XSL based website
Deleted: trunk/projects/bknr-website/src/bknr-website.asd =================================================================== --- trunk/projects/bknr-website/src/bknr-website.asd 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/bknr-website.asd 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,26 +0,0 @@ -;;;; -*- Mode: LISP -*- - -(in-package :cl-user) - -(defpackage :bknr-website.system - (:use :cl :asdf)) - -(in-package :bknr-website.system) - -(defsystem :bknr-website - :name "BKNR" - :author "Hans Huebner hans@huebner.org" - :version "0" - :maintainer "Hans Huebner hans@huebner.org" - :licence "BSD" - :description "BKNR Web Server" - :long-description "" - - :depends-on (:bknr-modules :klammerscript) - - :components ((:file "packages") - (:file "config" :depends-on ("packages")) - (:file "tags" :depends-on ("config")) - (:file "handlers" :depends-on ("config")) - (:file "webserver" :depends-on ("handlers")) - (:file "init" :depends-on ("webserver"))))
Deleted: trunk/projects/bknr-website/src/config.lisp =================================================================== --- trunk/projects/bknr-website/src/config.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/config.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,16 +0,0 @@ -(in-package :bknr-website.config) - -;; URL für BASE HREFs -(defparameter *website-url* "http://bknr.net") - -(defparameter *root-directory* #p"home:bknr-svn/bknr-website/") - -(defparameter *store-directory* (merge-pathnames #p"datastore/" *root-directory*)) - -(defparameter *website-directory* (merge-pathnames #p"website/" *root-directory*)) - -(defparameter *webserver-port* 8082) - -(defparameter *default-mail-from* "postmaster@bknr.net") -(defparameter *default-mail-subject* "Mail from the BKNR Website") -(defparameter *smtp-server* "127.0.0.1") \ No newline at end of file
Deleted: trunk/projects/bknr-website/src/handlers.lisp =================================================================== --- trunk/projects/bknr-website/src/handlers.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/handlers.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,56 +0,0 @@ -(in-package :bknr-website) - -(enable-interpol-syntax) - -(define-persistent-class pdf (blob) - ((name :read - :index-type string-unique-index - :index-reader pdf-with-name))) - -(defclass pdf-handler (object-handler) - () - (:default-initargs :class 'pdf :query-function #'pdf-with-name)) - -(defmethod handle-object ((handler pdf-handler) (pdf (eql nil)) req) - (with-bknr-page (req :title "PDF not found") - )) - -(defmethod handle-object ((handler pdf-handler) pdf req) - (with-http-response (req *ent* :content-type "application/pdf") - (with-http-body (req *ent* :external-format '(unsigned-byte 8)) - (blob-to-stream pdf net.html.generator:*html-stream*)))) - -(defclass upload-pdf-handler (page-handler) - ()) - -(defmethod handle ((handler upload-pdf-handler) req) - (case (request-method req) - (:get - (with-bknr-page (req :title "Upload a PDF file") - (html - ((:form :method "post" :enctype "multipart/form-data") - "Upload your file: " ((:input :type "file" :name "upload")) - (submit-button "upload" "upload"))))) - (:post - (with-bknr-page (req :title "Upload PDF file results") - (let* ((file-name (request-uploaded-file *req* "upload")) - (name (pathname-name file-name))) - (cond - ((pdf-with-name name) - (html (:h1 "Duplicate name") - "A PDF document with this name already exists")) - ((with-open-file (pdf file-name) - (not (cl-ppcre:scan "^%PDF-" (read-line pdf)))) - (html (:h1 "Invalid uploaded document") - "The uploaded document does not appear to be a PDF file")) - (t - (let ((pdf (make-blob-from-file file-name 'pdf :name name))) - (html (:h1 "Upload successful") - "Your upload was successful. The URL of your PDF file is " - ((:a :href (format nil "/pdf/~A" (store-object-id pdf))) - (:princ-safe (format nil "/pdf/~A" (store-object-id pdf))) ".")))))))))) - - -(define-bknr-webserver-module pdf - ("/upload-pdf" upload-pdf-handler) - ("/pdf" pdf-handler))
Deleted: trunk/projects/bknr-website/src/init.lisp =================================================================== --- trunk/projects/bknr-website/src/init.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/init.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,18 +0,0 @@ -(in-package :bknr-website) - -(defun startup () - (when *store* - (close-store)) - (make-instance 'store - :directory *store-directory* - :subsystems (list (make-instance 'store-object-subsystem) - (make-instance 'blob-subsystem - :n-blobs-per-directory 1000))) - (unless (find-user "anonymous") - (make-user "anonymous") ; used for all anonymous sessions - (make-user "admin" :password "admin" :full-name "Administrator" :flags '(:admin)) - (import-image "bknr-logo.png" :keywords '(:banner :bknr))) - - (bknr.cron:start-cron) - - (publish-bknr-website))
Deleted: trunk/projects/bknr-website/src/load.lisp =================================================================== --- trunk/projects/bknr-website/src/load.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/load.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,9 +0,0 @@ -(push :cl-gd-gif *features*) - -(asdf:oos 'asdf:load-op :bknr-website) -(asdf:oos 'asdf:load-op :swank) - -(ignore-errors (swank::create-swank-server 4005 :spawn #'swank::simple-announce-function t)) -(bknr-website::startup) - -(mp::startup-idle-and-top-level-loops)
Deleted: trunk/projects/bknr-website/src/packages.lisp =================================================================== --- trunk/projects/bknr-website/src/packages.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/packages.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,57 +0,0 @@ -(in-package :cl-user) - -(defpackage :bknr-website.config - (:use :cl - :cl-user) - (:export #:*website-url* - #:*website-directory* - #:*webserver-port* - #:*store-directory* - #:*default-mail-from* - #:*default-mail-subject* - #:*smtp-server*)) - -(defpackage :bknr-website.imageproc - (:use :cl - :cl-user - :bknr.web - :cl-gd - :bknr-website.config) - (:export)) - -(defpackage :bknr-website - (:use :cl - :cl-user - :ext - :cl-interpol - :cl-ppcre - :bknr.utils - :bknr.web - :bknr.datastore - :bknr.indices - :bknr.user - :bknr.images - :bknr-website.config - :net.aserve - :net.post-office - :xhtml-generator - :js) - (:shadowing-import-from :cl-interpol #:quote-meta-chars) - (:export )) - -(defpackage :bknr-website.tags - (:use :cl - :cl-user - :ext - :bknr.web - :bknr.utils - :bknr.datastore - :bknr.user - :bknr.images - :net.aserve - :xhtml-generator - :bknr-website.config - :bknr-website) - (:shadowing-import-from :cl-interpol #:quote-meta-chars) - (:shadowing-import-from :acl-compat.mp #:process-kill #:process-wait) - (:export #:hello)) \ No newline at end of file
Deleted: trunk/projects/bknr-website/src/tags.lisp =================================================================== --- trunk/projects/bknr-website/src/tags.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/tags.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,41 +0,0 @@ -(in-package :bknr-website.tags) - -(defun object-to-template-vars (object) - (dolist (slot-name (mapcar #'mop:slot-definition-name (mop:class-slots (class-of object)))) - (when (and (slot-boundp object slot-name) - (slot-value object slot-name)) - (setf (get-template-var (make-keyword-from-string (symbol-name slot-name))) - (format nil "~A" (slot-value object slot-name)))))) - -(defun format-object-id (format object &rest args) - (apply #'format nil format (store-object-id object) args)) - -(define-bknr-tag login-widget () - (let ((user (bknr-request-user *req*))) - (cond - ((anonymous-p user) - (when (query-param *req* "__username") - (html ((:div :id "logfail") "Login failed"))) - (html ((:form :method "post") - "Login" :br - ((:input :type "text" :name "__username")) - "Password" :br - ((:input :type "password" :name "__password")) - ((:button :type "submit" :name "action" :value "login") "login")))) - (t - (html ((:form :method "post" :action "/logout") - ((:input :type "hidden" :name "url" :value (puri:uri-path (request-uri *req*)))) - (:div "Logged in as " :br - ((:a :href (format-object-id "/user/~A" user)) - (:princ-safe (user-full-name user)))) - (:div ((:button :type "submit" :name "action" :value "logout") "logout")))))))) - -(defun object-from-request () - (find-store-object (parse-integer (get-template-var :*path-arg*)))) - -(define-bknr-tag load-argument-object (&key children) - (let* ((object (object-from-request))) - (object-to-template-vars object) - (setf (get-template-var :object-id) (store-object-id object)) - (mapc #'emit-template-node children))) -
Deleted: trunk/projects/bknr-website/src/webserver.lisp =================================================================== --- trunk/projects/bknr-website/src/webserver.lisp 2006-01-24 11:21:39 UTC (rev 1806) +++ trunk/projects/bknr-website/src/webserver.lisp 2006-01-24 11:55:10 UTC (rev 1807) @@ -1,43 +0,0 @@ -(in-package :bknr-website) - -(enable-interpol-syntax) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun make-daily-statistics () - (bknr.stats::make-yesterdays-stats :delete-events t :remove-referer-hosts '("bknr-website.bknr.net"))) - -(defun publish-bknr-website (&key (port *webserver-port*) (listeners 20)) - - (unless (bknr.cron:cron-job-with-name "daily webserver statistics") - (bknr.cron:make-cron-job "daily webserver statistics" 'make-daily-statistics - 1 0 :every :every)) - - (make-instance 'website - :name "LISP ECOOP 2005 CMS" - :handler-definitions `(("/" redirect-handler - :to "/home") - ("/" template-handler - :destination ,(namestring (merge-pathnames #p"templates/" *website-directory*)) - :command-packages ((:bknr-website . :bknr-website.tags) - (:bknr . :bknr.web) - (:menu . :bknr.site-menu))) - ("/static" directory-handler - :destination ,(unix-namestring (merge-pathnames #p"static/" *website-directory*)))) - :modules '(user images stats mailinglist mailinglist-registration pdf) - - :admin-navigation '(("user" . "/user/") - ("stats" . "/stats") - ("post mailinglists" . "/post-mailinglist") - ("logout" . "/logout")) - - :authorizer (make-instance 'bknr-authorizer) - :style-sheet-urls '("/static/styles.css") - :javascript-urls '("/static/javascript.js")) - - (publish-file :path "/snapshots/bknr.tar.bz2" :file "/home/bknr/bknr-snapshot.tar.bz2" :content-type "application/binary") - (publish-file :path "/snapshots/bknr-thirdparty.tar.bz2" :file "/home/bknr/bknr-thirdparty.tar.bz2" :content-type "application/binary") - - - (start :port port :listeners listeners))