#!/usr/bin/gosh
(set! *load-path*
(cons "/home/csw/wiliki/src"
*load-path*))
(use srfi-2)
(use util.list)
(use wiliki)
(use wiliki.format)
(use dbm.gdbm-ci)
(use wiliki.settings-css)
(use wiliki.settings-user-name)
(wiliki:register-settings-css '(("Default" "/css/default.css")
("Plain" "/css/plain.css")
("Empty" "/css/empty.css")))
(wiliki:register-settings-user-name)
(define (csw-page-head-elements page opts)
`((title ,(ref page 'title))
,@(cond
((wiliki)
=> (lambda (w)
`((base (@ (href ,((with-module wiliki full-script-path-of)
w))))
(link (@ (rel "alternate")
(type "application/rss+xml")
(title "RSS")
(href ,(wiliki:self-url "c=rss")))))))
(else
'()))
,(or (and-let* ((w (wiliki))
(ss (wiliki:settings-css-file (ref w 'style-sheet))))
`(link (@ (rel "stylesheet") (href ,ss) (type "text/css"))))
'(style (@ (type "text/css"))
"body { background-color: #eeeedd }"))
))
(define (csw-page-header page opts)
`(,@(wiliki:page-title page)
(div (@ (align "right"))
,@(cond-list
((wiliki:top-link page))
((wiliki:recent-link page))
((wiliki:all-link page))
((user-page-link))
((settings))
((category-link))
((howto)))
(br)
,@(cond-list
((wiliki:edit-link page))
((wiliki:history-link page)))
(br)
,@(wiliki:search-box))
(hr)))
(define (csw-page-footer page opts)
`((hr)
(div (@ (class "footer") (style "text-align:right"))
"Last modified : " ,(wiliki:format-time (ref page 'mtime))
(br)
(a (@ (href "http://www.shiro.dreamhost.com/scheme/wiliki/wiliki.cgi"))
"WiLiKi " ,(wiliki:version))
" running on "
(a (@ (href "http://www.shiro.dreamhost.com/scheme/gauche/"))
"Gauche ",(gauche-version)))))
(define (csw-time time)
(if time
(if (zero? time)
($$ "Epoch")
(sys-strftime "%Y-%m-%d %T" (sys-gmtime time)))
"-"))
(let ((formatter (wiliki:formatter)))
(set! (ref formatter 'head-elements) csw-page-head-elements)
(set! (ref formatter 'header) csw-page-header)
(set! (ref formatter 'footer) csw-page-footer)
(set! (ref formatter 'time) csw-time))
(define (settings)
`(a (@ (href ,(wiliki:self-url "c=settings")))
"[Settings]"))
(define (howto)
`(a (@ (href ,(wiliki:self-url "wiki-howto")))
"[Wiki Howto]"))
(define (category-link)
`(a (@ (href ,(wiliki:self-url "category-category")))
"[Categories]"))
(define (user-page-link)
(and-let* ((user-name (wiliki:settings-user-name #f)))
`(a (@ (href ,(wiliki:self-url user-name)))
"[" ,user-name "]")))
(define (main args)
(wiliki-main
(make <wiliki>
:db-type <gdbm-ci>
:db-path "/home/csw/data/community.dbm"
:log-file "/home/csw/data/community.log"
:top-page "Community-Scheme-Wiki"
:title "Community Scheme Wiki"
:cookie-name "csw-settings"
:description "A wiki by the Scheme community for the Scheme community"
:style-sheet "/css/default.css"
:language 'en
:charsets '((en . utf-8) (jp . euc-jp))
:image-urls '((#/.*/ allow))
:scheme-keyword-page "scheme-keywords"
:interwikiname "inter-wiki-map"
:max-rc-size #f
:max-rc-age (* 10 24 60 60) :debug-level 0
)))
category-this-wiki