aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xGradeBook.tcl18
1 files changed, 12 insertions, 6 deletions
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 {