Overview
Comment: | 99.99% complete in porting to chicken 4.7 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | move-to-ck4.7.x |
Files: | files | file ages | folders |
SHA1: |
06b806d3c60226e5928cbd4b961c1274 |
User & Date: | matt on 2011-10-04 05:33:19 |
Other Links: | branch diff | manifest | tags |
Context
2011-10-05
| ||
03:35 | few more fixes from porting Leaf check-in: 562f01e7e5 user: matt tags: move-to-ck4.7.x | |
2011-10-04
| ||
14:42 | Merged changes for chicken4.7 to trunk check-in: fda7f57df0 user: mrwellan tags: trunk | |
05:33 | 99.99% complete in porting to chicken 4.7 check-in: 06b806d3c6 user: matt tags: move-to-ck4.7.x | |
03:39 | Moved to units based compilation check-in: 31955e0a02 user: matt tags: move-to-ck4.7.x | |
Changes
Modified formdat.scm from [3d0d733457] to [05ad5e414c].
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 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit formdat)) (use regex) (define formdat:*debug* #f) ;; Old data format was something like this. BUT! ;; Forms do not have names so the hierarcy is ;; unnecessary (I think) ;; ;; hashtable ;; |-formname --> <formdat> 'form-name=formname ;; | 'form-data=hashtable ;; | | name => value ;; ;; New data format is only the <formdat> portion from above ;; (define-class <formdat> () ;; (form-data ;; )) | > | | 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 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit formdat)) (use regex) (require-extension srfi-69) (define formdat:*debug* #f) ;; Old data format was something like this. BUT! ;; Forms do not have names so the hierarcy is ;; unnecessary (I think) ;; ;; hashtable ;; |-formname --> <formdat> 'form-name=formname ;; | 'form-data=hashtable ;; | | name => value ;; ;; New data format is only the <formdat> portion from above ;; (define-class <formdat> () ;; (form-data ;; )) (define (make-formdat:formdat)(vector (make-hash-table))) (define-inline (formdat:formdat-get-data vec) (vector-ref vec 0)) (define-inline (formdat:formdat-set-data! vec val)(vector-set! vec 0 val)) (define (formdat:initialize self) (formdat:formdat-set-data! self (make-hash-table))) (define (formdat:get self key) |
︙ | ︙ |
Modified html-filter.scm from [be2e4e1457] to [a71b1244d8].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit html-filter)) ;; (define (s:split-string strng delim) (if (eq? (string-length strng) 0) (list strng) (let loop ((head (make-string 1 (car (string->list strng)))) (tail (cdr (string->list strng))) (dest '()) | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit html-filter)) (require-extension regex) ;; (define (s:split-string strng delim) (if (eq? (string-length strng) 0) (list strng) (let loop ((head (make-string 1 (car (string->list strng)))) (tail (cdr (string->list strng))) (dest '()) |
︙ | ︙ |
Modified modules/twiki/twiki-mod.scm from [705f97d8d5] to [1e45e35279].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ;; Copyright 2007-2010, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;; twiki module (require-extension sqlite3 regex posix md5 base64) ;; TODO ;; ;; * Inline tiddlers [inline[TiddlerName]] ;; * Pics [pic X Y[picname.jpg]] ;; * Move twiki parsing/expanding to mattsutils as loadable module | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ;; Copyright 2007-2010, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;; twiki module (require-extension sqlite3 regex posix md5 base64) (import (prefix base64 base64:)) ;; TODO ;; ;; * Inline tiddlers [inline[TiddlerName]] ;; * Pics [pic X Y[picname.jpg]] ;; * Move twiki parsing/expanding to mattsutils as loadable module |
︙ | ︙ | |||
30 31 32 33 34 35 36 | ;; This is the currently supported mechanism. Postgres will be added later -mrw- 7/26/2009 ;; (define (twiki:open-db key . create-not-ok) ;; (s:log "Got to twiki:open-db with key: " key) (let* ((create-ok (if (null? create-not-ok) #t (car create-not-ok))) (fdat (twiki:key->fname key)) | | > > > | 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 59 60 61 62 | ;; This is the currently supported mechanism. Postgres will be added later -mrw- 7/26/2009 ;; (define (twiki:open-db key . create-not-ok) ;; (s:log "Got to twiki:open-db with key: " key) (let* ((create-ok (if (null? create-not-ok) #t (car create-not-ok))) (fdat (twiki:key->fname key)) (basepath (sdat-get-twikidir s:session)) (fpath (car fdat)) (fname (cadr fdat)) (fullname (conc basepath "/" fpath "/" fname)) (fexists (file-exists? fullname)) (db (if fexists (dbi:open 'sqlite3 (list (cons 'dbname fullname))) #f))) (if (and (not db) (not create-ok)) (exit 100) (begin (if (not fexists) (begin ;; (print "fullname: " fullname) (twiki:register-wiki key fullname) (system (conc "mkdir -p " fpath)) ;; create the path (if (file-exists? fpath) (s:log "OK: dir " fpath " has been made") (s:log "ERROR: Failed to make the path for the twiki")) (set! db (dbi:open 'sqlite3 (list (cons 'dbname fullname)))) (for-each (lambda (sqry) ;; (print sqry) (dbi:exec db sqry)) ;; types: 0 text, 1 jpg, 2 png, 3 svg, 4 spreadsheet, 5 audio, 6 video :: better specs to come... (list |
︙ | ︙ | |||
73 74 75 76 77 78 79 | "CREATE TABLE members (id INTEGER PRIMARY KEY,person_id INTEGER,group_id INTEGER);" ;; setup and configuration data "CREATE TABLE meta (id INTEGER PRIMARY KEY,key TEXT,val TEXT);" ;; need to create an entry for *this* twiki (conc "INSERT INTO wikis (id,name,created_on) VALUES (1,'main'," (current-seconds) ");"))) ;; (conc "INSERT INTO tiddlers (wiki_id,name,created_on) VALUES(1,'MainMenu'," (current-seconds) ");"))))) (twiki:save-tiddler db "MainMenu" "[[FirstTiddler]]" "" 1 1))) | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | "CREATE TABLE members (id INTEGER PRIMARY KEY,person_id INTEGER,group_id INTEGER);" ;; setup and configuration data "CREATE TABLE meta (id INTEGER PRIMARY KEY,key TEXT,val TEXT);" ;; need to create an entry for *this* twiki (conc "INSERT INTO wikis (id,name,created_on) VALUES (1,'main'," (current-seconds) ");"))) ;; (conc "INSERT INTO tiddlers (wiki_id,name,created_on) VALUES(1,'MainMenu'," (current-seconds) ");"))))) (twiki:save-tiddler db "MainMenu" "[[FirstTiddler]]" "" 1 1))) ;; (sqlite3:set-busy-timeout!(dbi:db-conn db) 1000000) db)))) ;;====================================================================== ;; twikis (db naming, sqlite vs postgresql, keys etc. ;;====================================================================== ;; A wiki is specified by a list of keys, here we convert that list to a single string |
︙ | ︙ | |||
97 98 99 100 101 102 103 | (p1 (substring keypath 0 delta)) ;; 0 8)) (p2 (substring keypath delta (* delta 2)));; 8 16)) (p3 (substring keypath (* delta 2) (* delta 3)))) ;; 16 24)) (list (string-intersperse (list "twikis" p1 p2 p3) "/") keypath))) ;; look up the wid based on the keys, this is used for sub wikis only. I.e. a wiki instantiated inside another wiki ;; giving a separate namespace to all the tiddlers | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | (p1 (substring keypath 0 delta)) ;; 0 8)) (p2 (substring keypath delta (* delta 2)));; 8 16)) (p3 (substring keypath (* delta 2) (* delta 3)))) ;; 16 24)) (list (string-intersperse (list "twikis" p1 p2 p3) "/") keypath))) ;; look up the wid based on the keys, this is used for sub wikis only. I.e. a wiki instantiated inside another wiki ;; giving a separate namespace to all the tiddlers (define (twiki:name->wid db name) (let ((wid (dbi:get-one db "SELECT id FROM wikis WHERE name=?;" name))) (if wid wid (begin (dbi:exec db "INSERT INTO wikis (name,created_on) VALUES(?,?);" name (current-seconds)) (twiki:name->wid db name))))) ;;====================================================================== |
︙ | ︙ | |||
171 172 173 174 175 176 177 | ;;====================================================================== ;; twiki registry ;;====================================================================== ;; these can be overridden by end user (just create a new routine by the same name) (define (twiki:open-registry) | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | ;;====================================================================== ;; twiki registry ;;====================================================================== ;; these can be overridden by end user (just create a new routine by the same name) (define (twiki:open-registry) (let* ((basepath (sdat-get-sroot s:session)) (regfile (conc basepath "/twikis/registry.db")) (regexists (file-exists? regfile)) (db (dbi:open 'sqlite3 (list (cons 'dbname regfile))))) (if regexists db (begin (for-each (lambda (stmt)(dbi:exec db stmt)) |
︙ | ︙ | |||
291 292 293 294 295 296 297 | (s:a "delete" 'href (s:link-to (twiki:get-link-back-to-current) 'delete_tiddler tnum))(s:br) (s:input-preserve 'type "text" 'name "twiki_title" 'size "58" 'maxlength "150") (s:textarea-preserve 'type "textarea" 'name "twiki_body" 'rows "10" 'cols "65") (s:p "Tags" (s:input-preserve 'type "text" 'name "twiki_tags" 'size "55" 'maxlength "150"))))) ;; save a tiddler to the db for the twiki twik, getting data from the INPUT (define (twiki:save-curr-tiddler tdb wid) | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | (s:a "delete" 'href (s:link-to (twiki:get-link-back-to-current) 'delete_tiddler tnum))(s:br) (s:input-preserve 'type "text" 'name "twiki_title" 'size "58" 'maxlength "150") (s:textarea-preserve 'type "textarea" 'name "twiki_body" 'rows "10" 'cols "65") (s:p "Tags" (s:input-preserve 'type "text" 'name "twiki_tags" 'size "55" 'maxlength "150"))))) ;; save a tiddler to the db for the twiki twik, getting data from the INPUT (define (twiki:save-curr-tiddler tdb wid) (formdat:printall (sdat-get-formdat s:session) s:log) (let* ((heading (s:get-input 'twiki_title)) (body (s:get-input 'twiki_body)) (tags (s:get-input 'twiki_tags)) (uid (twiki:get-id))) ;; (s:log "twiki:save-curr-tiddler heading: " heading " body: " body " tags: " tags) (s:set! 'twiki_title heading) (if body |
︙ | ︙ | |||
347 348 349 350 351 352 353 | "INSERT INTO tiddlers (wiki_id,name,dat_id,created_on,owner_id) VALUES(?,?,?,?,?);" wid heading dat-id (current-seconds) uid)) #t) ;; success #f)) ;; non-success ;; text=0, jpg=1, png=2 (define (twiki:save-dat db dat type) | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | "INSERT INTO tiddlers (wiki_id,name,dat_id,created_on,owner_id) VALUES(?,?,?,?,?);" wid heading dat-id (current-seconds) uid)) #t) ;; success #f)) ;; non-success ;; text=0, jpg=1, png=2 (define (twiki:save-dat db dat type) (let* ((md5sum (md5-digest dat)) (datid (twiki:dat-exists? db md5sum type)) (datblob (if (string? dat) (string->blob dat) dat))) (if datid datid (begin |
︙ | ︙ | |||
477 478 479 480 481 482 483 | (define (twiki:get-thumb-dat tdb wid pic-id) (dbi:get-one tdb "SELECT dat FROM pics INNER JOIN dats ON pics.thumb_dat_id=dats.id WHERE pics.id=? AND wiki_id=?;" pic-id wid)) ;; this one sets up the Content type, puts the data into page-dat and is done (define (twiki:return-image-dat tdb wid pic-id) (let ((dat (twiki:get-pic-dat tdb wid pic-id))) (s:log "twiki:return-image-dat dat is: " dat " of size: " (if (blob? dat)(blob-size dat) "[not a blob]")) | | | | | | | | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | (define (twiki:get-thumb-dat tdb wid pic-id) (dbi:get-one tdb "SELECT dat FROM pics INNER JOIN dats ON pics.thumb_dat_id=dats.id WHERE pics.id=? AND wiki_id=?;" pic-id wid)) ;; this one sets up the Content type, puts the data into page-dat and is done (define (twiki:return-image-dat tdb wid pic-id) (let ((dat (twiki:get-pic-dat tdb wid pic-id))) (s:log "twiki:return-image-dat dat is: " dat " of size: " (if (blob? dat)(blob-size dat) "[not a blob]")) (sdat-set-page-type! s:session 'image) (sdat-set-content-type! s:session "image/jpeg") (sdat-set-alt-page-dat! s:session dat))) ;; (session:alt-out s:session))) ;; this one sets up the Content type, puts the data into page-dat and is done (define (twiki:return-thumb-dat tdb wid pic-id) (let ((dat (twiki:get-thumb-dat tdb wid pic-id))) (s:log "twiki:return-image-dat dat is: " dat " of size: " (if (blob? dat)(blob-size dat) "[not a blob]")) (sdat-set-page-type! s:session 'image) (sdat-set-content-type! s:session "image/jpeg") (sdat-set-alt-page-dat! s:session dat))) ;; (session:alt-out s:session))) (define (twiki:make-thumbnail tdb pic-id wid) (let ((indat (twiki:get-pic-dat tdb wid pic-id))) ;; (outdat (open-output-string))) (let-values (((inp oup pid)(process "convert" (list "-size" "500x180" "-" "-thumbnail" "250x90" "-unsharp" "0x.5" "-")))) (write-string (blob->string indat) #f oup) |
︙ | ︙ | |||
695 696 697 698 699 700 701 | (dbi:close tdb) result)) ;; should do a single more efficient query but this is good enough (define (twiki:get-tiddlers db wid tnames) (apply twiki:get-tiddlers-by-name db wid tnames)) ;; (let* ((tdlrs '()) | | < < | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | (dbi:close tdb) result)) ;; should do a single more efficient query but this is good enough (define (twiki:get-tiddlers db wid tnames) (apply twiki:get-tiddlers-by-name db wid tnames)) ;; (let* ((tdlrs '()) ;; ;; (conn (sdat-get-conn s:session)) ;; (namelst (conc "('" (string-intersperse (map conc tnames) "','") "')")) ;; (qry (conc twiki:tiddler-selector " WHERE t.wiki_id=? AND t.id IN " namelst ";"))) ;; ;; (print qry) ;; (dbi:for-each-row ;; (lambda (row) ;; (set! tdlrs (cons row tdlrs))) ;; db qry wid) ;; (reverse tdlrs))) ;; !Twiki\ ;; tlst is a list of tiddler nums (define (twiki:get-tiddlers-by-num db wid tlst) ;; (s:log "Got to twiki:get-tiddlers with keys: " tlst " and wid: " wid) ;; select where created_on < somedate order by created_on desc limit 1 (let* ((tdlrs '()) (tlststr (string-intersperse (map number->string tlst) ",")) (already-got (make-hash-table)) (qry (conc twiki:tiddler-selector " WHERE t.wiki_id=? AND t.id IN (" tlststr ") ORDER BY created_on DESC;"))) (dbi:for-each-row (lambda (row) (let ((tname (twiki:tiddler-get-name row))) (if (not (hash-table-ref/default already-got tname #f)) (begin (set! tdlrs (cons row tdlrs)) (hash-table-set! already-got tname #t))))) |
︙ | ︙ | |||
773 774 775 776 777 778 779 | (define twiki:u s:u) (define twiki:td s:td) (define twiki:tr s:tr) (define twiki:table s:table) (define twiki:div s:div) (define (twiki:web64enc str) | | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | (define twiki:u s:u) (define twiki:td s:td) (define twiki:tr s:tr) (define twiki:table s:table) (define twiki:div s:div) (define (twiki:web64enc str) (string-substitute "=" "_" (base64:base64-encode str) #t)) (define (twiki:web64dec str) (base64:base64-decode (string-substitute "_" "=" str #t))) (define (twiki:make-tlink text tiddlername) (s:a text 'href (s:link-to (twiki:get-link-back-to-current) 'view_tiddler (twiki:web64enc tiddlername)))) (define (twiki:pic pic-name size wiki) (let* ((tdb (twiki:wiki-get-dbh wiki)) (tkey (twiki:wiki-get-key wiki)) |
︙ | ︙ |
Modified session.scm from [0524c59e8f] to [74a61ca45d].
1 2 3 4 5 6 7 8 9 10 11 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit session)) (require-library dbi) | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit session)) (require-library dbi) (require-extension regex) (declare (uses cookie)) ;; sessions table ;; id session_id session_key ;; create table sessions (id serial not null,session-key text); ;; session_vars table |
︙ | ︙ | |||
161 162 163 164 165 166 167 168 | (let* ((rawconfigdat (session:read-config self)) (configdat (if rawconfigdat (eval rawconfigdat) '())) (sroot (s:find-param 'sroot configdat)) (logfile (s:find-param 'logfile configdat)) (dbtype (s:find-param 'dbtype configdat)) (dbinit (s:find-param 'dbinit configdat)) (domain (s:find-param 'domain configdat)) (page-dir (s:find-param 'page-dir-style configdat))) | > | | | | | > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | (let* ((rawconfigdat (session:read-config self)) (configdat (if rawconfigdat (eval rawconfigdat) '())) (sroot (s:find-param 'sroot configdat)) (logfile (s:find-param 'logfile configdat)) (dbtype (s:find-param 'dbtype configdat)) (dbinit (s:find-param 'dbinit configdat)) (domain (s:find-param 'domain configdat)) (twikidir (s:find-param 'twikidir configdat)) (page-dir (s:find-param 'page-dir-style configdat))) (if sroot (sdat-set-sroot! self sroot)) (if logfile (sdat-set-logfile! self logfile)) (if dbtype (sdat-set-dbtype! self dbtype)) (if dbinit (sdat-set-dbinit! self dbinit)) (if domain (sdat-set-domain! self domain)) (if twikidir (sdat-set-twikidir! self twikidir)) (sdat-set-page-dir-style! self page-dir) ;; (print "configdat: ")(pp configdat) ;;(session:log self "sroot: " sroot " logfile: " logfile " dbtype: " dbtype ;; " dbinit: " dbinit " domain: " domain " page-dir-style: " page-dir) ) ) ;; (let ((dbtype (sdat-get-dbtype self))) |
︙ | ︙ | |||
377 378 379 380 381 382 383 | ;; session vars ;; 1. keys are always a string NOT a symbol ;; 2. values are always a string conversion is the responsibility of the ;; consuming function (at least for now, I'd like to change this) ;; set a session var for the current page ;; | | | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | ;; session vars ;; 1. keys are always a string NOT a symbol ;; 2. values are always a string conversion is the responsibility of the ;; consuming function (at least for now, I'd like to change this) ;; set a session var for the current page ;; (define (session:curr-page-set! self key value) (hash-table-set! (sdat-get-pagevars self) (s:any->string key) (s:any->string value))) ;; del a var for the current page ;; (define (session:page-var-del! self key) (hash-table-delete! (sdat-get-pagevars self) (s:any->string key))) ;; get the appropriate hash given a page "*sessionvars*, *globalvars* or page ;; (define (session:get-page-hash self page) (if (string=? page "*sessionvars*") (sdat-get-sessionvars self) (if (string=? page "*globalvars*") (sdat-get-globalvars self) (sdat-get-pagevars self)))) ;; set a session var for a given page ;; (define (session:set! self page key value) (let ((ht (session:get-page-hash self page))) (hash-table-set! ht (s:any->string key) (s:any->string value)))) ;; get session vars for the current page ;; (define (session:page-get self key) (hash-table-ref/default (sdat-get-pagevars self) key #f)) ;; get session vars for a specified page ;; (define (session:get self page key) (let ((ht (session:get-page-hash self page))) (hash-table-ref/default ht key #f))) |
︙ | ︙ | |||
704 705 706 707 708 709 710 | (session:get-param-from params key))) ;; This one will get the first value found regardless of form (define (session:get-input self key) (let* ((formdat (sdat-get-formdat self))) (if (not formdat) #f (if (or (string? key)(number? key)(symbol? key)) | | | 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | (session:get-param-from params key))) ;; This one will get the first value found regardless of form (define (session:get-input self key) (let* ((formdat (sdat-get-formdat self))) (if (not formdat) #f (if (or (string? key)(number? key)(symbol? key)) (if (and (vector? formdat)(eq? (vector-length formdat) 1)(hash-table? (vector-ref formdat 0))) (formdat:get formdat key) (begin (session:log self "ERROR: formdat: " formdat " is not of class <formdat>") #f)) (session:log self "ERROR: bad key " key))))) (define (session:run-actions self) |
︙ | ︙ |
Modified setup.scm from [b36f45d459] to [5a10d6d9bf].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit setup)) (declare (uses session)) ;; (define s:session (make-sdat)) (session:initialize s:session) ;; use this for getting data from page to page when scope and evals ;; get in the way | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ;; Copyright 2007-2011, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (declare (unit setup)) (declare (uses session)) (require-extension srfi-69) (require-extension regex) ;; (define s:session (make-sdat)) (session:initialize s:session) ;; use this for getting data from page to page when scope and evals ;; get in the way |
︙ | ︙ | |||
56 57 58 59 60 61 62 | (session:link-to s:session page params)) (define (s:get-param key) (session:get-param s:session key)) ;; these are page local (define (s:get key) | | | | | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | (session:link-to s:session page params)) (define (s:get-param key) (session:get-param s:session key)) ;; these are page local (define (s:get key) (session:page-get s:session key)) (define (s:set! key val) (session:curr-page-set! s:session key val)) (define (s:del! key) (session:page-var-del! s:session key)) (define (s:get-n-del! key) (let ((val (session:page-get s:session key))) (session:del! s:session key) val)) ;; these are session wide (define (s:session-var-get key) (session:get s:session "*sessionvars*" key)) (define (s:session-var-set! key val) (session:set! s:session "*sessionvars*" key val)) (define (s:session-var-get-n-del! key) (let ((val (session:page-get s:session key))) (session:del! s:session "*sessionvars*" key) val)) (define (s:session-var-del! key) (session:del! s:session "*sessionvars*" key)) ;; |
︙ | ︙ |
Modified stml.scm from [d231bbdbe7] to [73cbc6a3f2].
︙ | ︙ | |||
127 128 129 130 131 132 133 | (define (s:form . args) ;; create a link for calling back into the current page and calling a specified ;; function (let* ((action (let ((v (s:find-param 'action args))) (if v v "default"))) (id (let ((i (s:find-param 'id args))) (if i i #f))) | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | (define (s:form . args) ;; create a link for calling back into the current page and calling a specified ;; function (let* ((action (let ((v (s:find-param 'action args))) (if v v "default"))) (id (let ((i (s:find-param 'id args))) (if i i #f))) (page (let ((p (sdat-get-page s:session))) (if p p "home"))) ;; (link (session:link-to s:session page (if id ;; (list 'action action 'id id) ;; (list 'action action))))) (link (if (string=? (substring action 0 5) "http:") ;; if first part of string is http: action (session:link-to s:session |
︙ | ︙ |
Modified stmlrun.scm from [c4bf2d3a15] to [fd5e8e9132].
︙ | ︙ | |||
11 12 13 14 15 16 17 | ;; (require-extension syntax-case) ;; (declare (run-time-macros)) (require-library dbi) (include "requirements.scm") | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ;; (require-extension syntax-case) ;; (declare (run-time-macros)) (require-library dbi) (include "requirements.scm") (declare (uses cookie)) (declare (uses html-filter)) (declare (uses misc-stml)) (declare (uses formdat)) (declare (uses stml)) (declare (uses session)) (declare (uses setup)) ;; s:session gets created here (declare (uses sqltbl)) |
︙ | ︙ |