summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-23 15:14:48 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-23 15:14:48 -0500
commit63b135f3ff3113aaeba84f35ae15fcecc1d3f450 (patch)
tree436974ff9dcbfb9796895cab47c660b9cc9b07fe
parent855fbfb9599c9a95c2c9a4b6f614cedc9f4de440 (diff)
downloadGradeBook-63b135f3ff3113aaeba84f35ae15fcecc1d3f450.tar.gz
GradeBook-63b135f3ff3113aaeba84f35ae15fcecc1d3f450.zip
script name now accepts database file name
Ignore-this: 79609934c090100999bab87af2e37b33 darcs-hash:20110123201448-067c0-237c5ec368d492e27ba9243b5a6913202cb490ea.gz
-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 {