aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl24
1 files changed, 18 insertions, 6 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index d8180f3..bff9175 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -34,7 +34,7 @@ set action defaultview
# defaults end
# read cookies
-set user [::ncgi::cookie user]
+set user_requested [::ncgi::cookie user]
set sortCol [::ncgi::cookie sortCol]
set password [::ncgi::cookie password]
set action [::ncgi::value action defaultview]
@@ -44,6 +44,7 @@ set action [::ncgi::value action defaultview]
if { [catch {set host_name $env(SERVER_NAME)} errStat] } { set request_uri unknown}
# script uri
if { [catch {set script_name $env(SCRIPT_NAME)} errStat] } { set script_name unknown}
+set script_root_name $script_name
# 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
@@ -66,18 +67,29 @@ if { $action == "logoff" } { LogMeOff; set action defaultview }
dbg "===== Connection at $timestamp for user $user ====="
::ncgi::header
-htmlHeader
-puts "<body>"
+
+set user [ Authenticate_User $user_requested $password ]
+
set dbfile "$GradebookServerConfig(grades_db_dir)/$coursedbfname"
dbg "DB filename: $dbfile"
-if { ($coursedbfname ne "") && [file exists $dbfile] } {
+if { [file exists $dbfile] && ("$coursedbfname" ne "") } {
+ htmlHeader
+ puts "<body>"
sqlite3 db $dbfile
set permission_list [AccessGroupRights db $user $password]
htmlTop $permission_list
ChoseAction $action $permission_list $user
+ db close
} else {
- htmlErrorMsg "No requested database {$coursedbfname}. Please, check your url"
- dbg "Attemt to access non existing database: {$dbfile}"
+ htmlHeaderDBSelector
+ set permission_list [list GroupName guest]
+ puts "<body>"
+ if { "$coursedbfname" ne "" } {
+ htmlErrorMsg "No requested database {$coursedbfname}. Please, check your url"
+ dbg "Attemt to access non existing database: {$dbfile}"
+ }
+
+ html_Show_Classes_List $permission_list $user
}
htmlFooter $permission_list