Differences From Artifact [0750806c42]:

To Artifact [7c09cb436b]:


50
51
52
53
54
55
56

57
58
59
60
61
62
63
   formdat
   request-method
   session-cookie
   curr-err
   log-port
   logfile
   seen-pages

   debugmode))

;; SPLIT INTO STRAIGHT FORWARD INIT AND COMPLEX INIT
(define-method (initialize (self <session>) initargs)
  (call-next-method)
  (slot-set! self 'dbtype      'pg)
  (slot-set! self 'page        "home")        ;; these are defaults







>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
   formdat
   request-method
   session-cookie
   curr-err
   log-port
   logfile
   seen-pages
   page-dir-style
   debugmode))

;; SPLIT INTO STRAIGHT FORWARD INIT AND COMPLEX INIT
(define-method (initialize (self <session>) initargs)
  (call-next-method)
  (slot-set! self 'dbtype      'pg)
  (slot-set! self 'page        "home")        ;; these are defaults
71
72
73
74
75
76
77


78
79
80
81
82
83
84
  (slot-set! self 'pagedat     '())
  (slot-set! self 'alt-page-dat #f)
  (slot-set! self 'sroot       "./")
  (slot-set! self 'session-cookie #f)
  (slot-set! self 'curr-err #f)
  (slot-set! self 'log-port (current-error-port))
  (slot-set! self 'seen-pages '())


  (slot-set! self 'debugmode #f)
  (for-each (lambda (slot-name)
              (slot-set! self slot-name (make-hash-table)))
            (list 'pagevars 'sessionvars 'globalvars 'pagevars-before 
		  'sessionvars-before 'globalvars-before))
  (slot-set! self 'domain "locahost")   ;; end of defaults
  (initialize-slots self (session:read-config self))







>
>







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  (slot-set! self 'pagedat     '())
  (slot-set! self 'alt-page-dat #f)
  (slot-set! self 'sroot       "./")
  (slot-set! self 'session-cookie #f)
  (slot-set! self 'curr-err #f)
  (slot-set! self 'log-port (current-error-port))
  (slot-set! self 'seen-pages '())
  (slot-set! self 'page-dir-style 'oldstyle) ;; onedir:        pages/<pagename>_(view|control).scm
                                             ;; anything else: pages/<pagename>/(view|control).scm 
  (slot-set! self 'debugmode #f)
  (for-each (lambda (slot-name)
              (slot-set! self slot-name (make-hash-table)))
            (list 'pagevars 'sessionvars 'globalvars 'pagevars-before 
		  'sessionvars-before 'globalvars-before))
  (slot-set! self 'domain "locahost")   ;; end of defaults
  (initialize-slots self (session:read-config self))
488
489
490
491
492
493
494



495
496

497



498


499


500
501
502
503
504
505
506
507
508
509
510
511
512
  (let ((p (open-input-file f)))
    (let loop ((hed (read-line p))
	       (res '()))
      (if (eof-object? hed)
	  res
	  (loop (read-line p)(append res (list hed)))))))




(define-method (session:call-parts (self <session>) page parts)
  (slot-set! self 'curr-page page)

  (let* ((dir     (string-append (slot-ref self 'sroot) "/pages/" page))



	 (control (string-append dir "/control.scm"))


	 (view    (string-append dir "/view.scm"))


	 (load-view    (and (file-exists? view)
			    (or (eq? parts 'both)(eq? parts 'view))))
	 (load-control (and (file-exists? control)
			    (or (eq? parts 'both)(eq? parts 'control))))
	 (view-dat   '())
	 (sugar "/home/matt/kiatoa/stml/sugar.scm" ))
    ;; (print "dir=" dir " control=" control " view=" view " load-view=" load-view " load=control=" load-control)
    (if load-control
	(begin
	  (load control)
	  (session:set-called! self page)))
    ;; move this to where it gets exectuted only once
    ;;







>
>
>


>
|
>
>
>
|
>
>
|
>
>




|
|







491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
  (let ((p (open-input-file f)))
    (let loop ((hed (read-line p))
	       (res '()))
      (if (eof-object? hed)
	  res
	  (loop (read-line p)(append res (list hed)))))))

;; May 2011, putting all pages into one directory for the following reasons:
;;   1. want filename to reflect page name (emacs limitation)
;;   2. that's it! no other reason. could make it configurable ...
(define-method (session:call-parts (self <session>) page parts)
  (slot-set! self 'curr-page page)
  (let* ((dir-style (eq? (slot-ref self 'page-dir-style) 'onedir)) ;; flag #t for onedir, #f for old style
	 (dir     (string-append (slot-ref self 'sroot) 
				 (if dir-style 
				     (conc "/pages/")
				     (conc "/pages/" page))))
	 (control (string-append dir (if dir-style 
					 (conc page "_ctrl.scm")
					 "/control.scm")))
	 (view    (string-append dir (if dir-style 
					 (conc page "_view.scm")
					 "/view.scm")))
	 (load-view    (and (file-exists? view)
			    (or (eq? parts 'both)(eq? parts 'view))))
	 (load-control (and (file-exists? control)
			    (or (eq? parts 'both)(eq? parts 'control))))
	 (view-dat   '()))
    ;;   (sugar "/home/matt/kiatoa/stml/sugar.scm" ))
    ;; (print "dir=" dir " control=" control " view=" view " load-view=" load-view " load=control=" load-control)
    (if load-control
	(begin
	  (load control)
	  (session:set-called! self page)))
    ;; move this to where it gets exectuted only once
    ;;