From 2bef0ff4885425e5b0f0d8fe20098bff39aa0f86 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Sun, 23 Jan 2011 20:58:30 -0500 Subject: added proper course database load, now this script can serve for different courses Ignore-this: 8902a82202769d781f105e89763f9b38 darcs-hash:20110124015830-067c0-17c971e8b4ddb538aebb4e3ec8442660ffe50bfe.gz --- GradeBook.tcl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/GradeBook.tcl b/GradeBook.tcl index a94bd5c..fc45e70 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -35,11 +35,7 @@ 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}} { @@ -851,17 +847,21 @@ dbg [::ncgi::names] 4 if { $action == "logon" } { LogMeOn; set action defaultview } if { $action == "logoff" } { LogMeOff; set action defaultview } -dbg "===== Connection at $timestamp for user $user =====" -set permission_list [AccessGroupRights db $user $password] ::ncgi::header htmlHeader puts "" -htmlTop $permission_list -ChoseAction $action $permission_list $user -#htmlDefaultView $permission_list $user -#htmlGradesTable db $permission_list $user -#htmlDBout db $sortCol +set dbfile "courses/$coursedbfname" +if { ($coursedbfname ne "") && [file exists $dbfile] } { + sqlite3 db $dbfile + dbg "===== Connection at $timestamp for user $user =====" + set permission_list [AccessGroupRights db $user $password] + htmlTop $permission_list + ChoseAction $action $permission_list $user +} else { + htmlErrorMsg "No requested database {$coursedbfname}. Please, check your url" + dbg "Attemt to access non existing database: {$dbfile}" +} htmlFooter $permission_list puts "" -- cgit v1.2.3