debugging galore
[rrq/hourglass.git] / manager / controls.lsp
index 10153dfdf5eb65f4e25bdcedf3d0990180a94d13..555e49b076ff1387b75179c44fac304ef167780e 100644 (file)
@@ -4,6 +4,8 @@
 
 (constant
  'CONTROLFILE SITE:control.dat
+ 'GAP SITE:control.activity.gap
+ 'CLIP control.activity.clip
  )
 
 (setf UPDATE "")
   (load "controls-update.lsp")
   )
 
-(constant
- 'CONTROL (read-expr (read-file CONTROLFILE))
- 'GAP (or (lookup 'gap CONTROL) 5)
- 'CLIP (or (lookup 'clip CONTROL) 5)
- 'TIMES (map (fn (n) (or (assoc n CONTROL) '(1 timed (7 0) (3 0) (19 0))))
-             (sequence 1 7))
- )
+(define (time-row n)
+  (or (assoc n CONTROL) (cons n (copy '(timed (7 0) (3 0) (19 0))))))
 
 (setf
  DAYS '(0 "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
gap-options '(0 1 2 5 10 15 30)
clip-options '(0 200 500 800 1000 1200 1500 2000)
CONTROL (read-expr (read-file CONTROLFILE))
TIMES (map time-row (sequence 1 7))
  mode-options '("opened" "timed" "closed")
  start-options '()
  end-options '()
  limit-options '()
  )
-(dotimes (h 24) (dolist (m '(0 30))
-                  (push (format "%02d:%02d" h m) start-options -1)))
-(dotimes (h 24) (dolist (m '(0 30))
-                  (push (format "%02d:%02d" h m) end-options -1)))
-(for (h 1 8) (dolist (m '(0 30))
-               (push (format "%02d:%02d" h m) limit-options -1)))
+
+(dotimes (h 24)
+  (dolist (m '(0 30))
+    (push (format "%02d:%02d" h m) start-options -1)))
+(dotimes (h 24)
+  (dolist (m '(0 30))
+    (push (format "%02d:%02d" h m) end-options -1)))
+(for (h 1 8)
+  (dolist (m '(0 30))
+    (push (format "%02d:%02d" h m) limit-options -1)))
 
 (println "Status 200 OK\nContent-Type: text/html\n\n")
 (println (expand-file "tmpl/controls-form.html" ))