Index: doc/howto.txt ================================================================== --- doc/howto.txt +++ doc/howto.txt @@ -83,19 +83,22 @@ make a selection drop down ~~~~~~~~~~~~~~~~~~~~~~~~~~ In view.scm: -(s:select '(("World" 0)("Country" 1)("State" 2 #t)("Town/City" 3)) 'name 'scope) +;; Label Value visible-str selected +(s:select '(("World" 0)("Country" 1)("State" 2 "The state" #t )("Town/City" 3)) 'name 'scope) + +Visible str will be shown if provided. Selected will set that entry to pre-selected. In control.scm: (let ((scope (s:get-input 'scope)) (scope-num (s:get-input 'scope 'number))) ;; 'number, 'raw or 'escaped .... -The optional third entry sets that item as selected if true +The optional fourth entry sets that item as selected if true Simple error reporting ~~~~~~~~~~~~~~~~~~~~~~ In control.scm: Index: session.scm ================================================================== --- session.scm +++ session.scm @@ -734,10 +734,19 @@ ((raw) res) ((number) (if (string? res)(string->number res) #f)) ((escaped) (if (string? res) (s:html-filter->string res tags) res)) + ((escaped-nl) (if (string? res) ;; escape \n and \r + (string-intersperse + (string-split + (string-intersperse + (string-split (s:html-filter->string res tags) "\n") + "\\n") + "\r") + "\\r") + res)) (else (if (string? res) (s:html-filter->string res '()) res))))) (define (session:get-param self key type-params) Index: setup.scm ================================================================== --- setup.scm +++ setup.scm @@ -9,10 +9,14 @@ (declare (unit setup)) (declare (uses session)) (require-extension srfi-69) (require-extension regex) + +;; macros in sugar don't work, have to load in all files or use compiled mode? +;; +;; (include "sugar.scm") ;; use this for getting data from page to page when scope and evals ;; get in the way (define s:local-vars (make-hash-table)) Index: sugar.scm ================================================================== --- sugar.scm +++ sugar.scm @@ -87,12 +87,21 @@ ;; v ; => 16 ;; (+= v) ;; v ; => 16 ;; +(define-simple-syntax (s:if-param varname first ...) + (if (s:get varname) + first + ...)) + +(define-simple-syntax (s:if-sessionvar varname first ...) + (if (s:session-var-get varname) + first + ...)) -;; (define-macro (s:if-param varname . dat) +;; (define-macro (s:if-param varname ...) ;; (match dat ;; (() '()) ;; ((a) `(if (s:get ,varname) ,a '())) ;; ((a b) `(if (s:get ,varname) ,a ,b)))) ;; Index: tests/test.scm ================================================================== --- tests/test.scm +++ tests/test.scm @@ -12,11 +12,12 @@ (use test md5) (require-extension sqlite3) (import (prefix sqlite3 sqlite3:)) -(require-library dbi) +;; (require-library dbi) +(use (prefix dbi dbi:)) (load "./requirements.scm") (load "./cookie.scm") (load "./misc-stml.scm") (load "./formdat.scm")