/
clockwork.lisp
58 lines (52 loc) · 1.76 KB
/
clockwork.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(defpackage #:clockwork
(:use :cl :weblocks :local-time
:f-underscore :anaphora)
(:import-from :hunchentoot
#:header-in
#:set-cookie
#:set-cookie*
#:cookie-in
#:user-agent
#:referer)
(:import-from :split-sequence
#:split-sequence)
(:import-from :trivial-timers
#:make-timer
#:schedule-timer)
(:import-from :ironclad
#:digest-sequence
#:byte-array-to-hex-string
#:ascii-string-to-byte-array)
(:export #:start-clockwork
#:stop-clockwork
#:recover-reminders
#:*clockwork-host*)
(:documentation
"A web application based on Weblocks."))
(in-package :clockwork)
;; A macro that generates a class or this webapp
(defwebapp clockwork
:prefix "/"
:description "Fire-and-Forget Event Reminders"
:init-user-session 'clockwork::init-user-session
:autostart nil ;; have to start the app manually
:ignore-default-dependencies nil ;; accept the defaults
:hostnames '("clockwork.*.com")
:dependencies '((:stylesheet "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/ui-darkness/jquery-ui.css")
(:stylesheet "clockwork")
(:script "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js")
(:script "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js")
(:script "http://cdn.jquerytools.org/1.2.5/tiny/jquery.tools.min.js")
(:javascript-code "var $jquery = jQuery.noConflict();"))
:debug t
)
;; Top level start & stop scripts
(defun start-clockwork (&rest args)
"Starts the application by calling 'start-weblocks' with appropriate
arguments."
(apply #'start-weblocks args)
(start-webapp 'clockwork))
(defun stop-clockwork ()
"Stops the application by calling 'stop-weblocks'."
(stop-webapp 'clockwork)
(stop-weblocks))