aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xGradeBook.tcl22
1 files 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 "<body>"
-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 "</body>"