diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2012-01-21 10:16:13 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2012-01-21 10:16:13 -0500 |
commit | 5d2b13c7329383fe10366e1b68a24fb8e5d49df3 (patch) | |
tree | 4392f7487e4b02fb2548d73b0e9f341decca6d68 /GradeBook.tcl | |
parent | f388207e381fa801caf2753eb04882627607e668 (diff) | |
download | GradeBook-5d2b13c7329383fe10366e1b68a24fb8e5d49df3.tar.gz GradeBook-5d2b13c7329383fe10366e1b68a24fb8e5d49df3.zip |
db list capability added
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-x | GradeBook.tcl | 24 |
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 |