Something to get started with: http://paste.lisp.org/+236G

Intended to handle urls like /tags/foo/bar/baz, /author/author-name
(and /posts/post-name, /2009/Aug/01/ etc. can be added)

---- pasted ---

(in-package :simple-blog)

;; Define callback function to initialize new sessions
(defun init-user-session (comp)
  (setf (composite-widgets comp)
        (make-instance 'nunb-blog-toplevel)))

(defwidget nunb-blog-toplevel (on-demand-selector)
  ((menu-widget :documentation "Show a menu-standin .. TODO"))
  (:default-initargs :lookup-function #'blog-selector-choose-post))

(defmethod blog-selector-choose-post (selector tokens)
  "Given the selector and a set of tokens, return the blog post, or
carp if not found.
   Because of the way the toplevel is called, it will also  be the
resp. of this fn. to
   return a menu-ish widget that shows what url paths are available
(ie the monthly archive
   sidebar that most blogs have). We'll start with english, and as an
exercise see how hard
   it would be to add other languages."
  (break (format nil "TOKENS ~{~S, ~} ~%" tokens))
  (cond
    ((equal (first tokens) "tags")
     (values (make-instance 'funcall-widget :fun-designator (lambda
(&rest args)
                                                      (with-html (:div "Search 
posts by tags"))))
             tokens nil))
    ((equal (first tokens) "author")
          (values (make-instance 'funcall-widget :fun-designator
(lambda (&rest args)
                                                      (with-html (:div "Search 
posts by author"))))
             tokens nil))
    (t ;; Handle year/month/date and year/month/title
     (make-instance 'funcall-widget :fun-designator (lambda (&rest
args)
                                                      (with-html (:div "Fell 
through to year/month/date and year/
month/title case"))))
     ))
  )

(defclass* tagged-item ()
  ((tags :documentation "Use tags")))

(defclass* nunb-post (post)
  ((ts :documentation "I like timestamps")))

-- 
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en.

Reply via email to