software captore
[rrq/hourglass.git] / manager / controls.lsp
1 ; Load and present ../controls.dat
2
3 (load "expand-string.lsp")
4
5 (setf UPDATE "")
6
7 (when (= (env "REQUEST_METHOD") "POST")
8   (load "controls-update.lsp")
9   )
10
11 (constant
12  'CONTROLFILE "../control.dat"
13  'CONTROL (read-expr (read-file CONTROLFILE))
14  'GAP (or (lookup 'gap CONTROL) 5)
15  'CLIP (or (lookup 'clip CONTROL) 5)
16  'INCL (or (lookup control CONTROL) "ipset-control.lsp")
17  'TIMES (map (fn (n) (or (assoc n CONTROL) '(1 timed (7 0) (3 0) (19 0))))
18              (sequence 1 7))
19  )
20
21 (setf
22  DAYS '(0 "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
23  incl-options '("ipset-control.lsp")
24  gap-options '(0 1 2 5 10 15 30)
25  clip-options '(0 200 500 800 1000 1200 1500 2000)
26  mode-options '("opened" "timed" "closed")
27  start-options '()
28  end-options '()
29  limit-options '()
30  )
31 (dotimes (h 24) (dolist (m '(0 30))
32                   (push (format "%02d:%02d" h m) start-options -1)))
33 (dotimes (h 24) (dolist (m '(0 30))
34                   (push (format "%02d:%02d" h m) end-options -1)))
35 (for (h 1 8) (dolist (m '(0 30))
36                (push (format "%02d:%02d" h m) limit-options -1)))
37
38 (println (expand-file "tmpl/controls-form.html" ))
39 (exit 0)