From 63b135f3ff3113aaeba84f35ae15fcecc1d3f450 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Sun, 23 Jan 2011 15:14:48 -0500 Subject: script name now accepts database file name Ignore-this: 79609934c090100999bab87af2e37b33 darcs-hash:20110123201448-067c0-237c5ec368d492e27ba9243b5a6913202cb490ea.gz --- GradeBook.tcl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'GradeBook.tcl') diff --git a/GradeBook.tcl b/GradeBook.tcl index fb3bcd5..a94bd5c 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -26,8 +26,20 @@ set password [::ncgi::cookie password] set action [::ncgi::value action defaultview] # end of read cookies +# script uri if { [catch {set script_name $env(SCRIPT_NAME)} errStat] } { set script_name unknown} +# figure out course db filename +if { [catch {set request_uri $env(REQUEST_URI)} errStat] } { set request_uri unknown} +regsub -all $script_name $request_uri "" coursedbfname +regsub -all {\?.*$} $coursedbfname "" coursedbfname +regsub -all {^/} $coursedbfname "" coursedbfname +set script_name "$script_name/$coursedbfname" +set dbfile "courses/$coursedbfname" + +#set url_base + +sqlite3 db $dbfile # ########################## procs begin ################################# proc dbg {msg {level 1}} { @@ -38,12 +50,6 @@ proc dbg {msg {level 1}} { } } -set dbfile "./testdb" - -#set url_base - -sqlite3 db $dbfile - proc ColName2SqlSafeForm {colname} { set bad_symbols [list {\}} {\{} {\\} {\'} {\"} {\]} {\[} ] foreach bs $bad_symbols { -- cgit v1.2.3