From 7eb1d0db572671126d682f5323fc24d8b6be79af Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 16 Dec 2010 12:24:42 -0500 Subject: everything is done through action call darcs-hash:20101216172442-067c0-4fe4f7edc20b101452cf1cfb72f5efe9fa77b267.gz --- GradeBook.tcl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/GradeBook.tcl b/GradeBook.tcl index dac6250..9f9c098 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -1,6 +1,6 @@ #!/bin/sh -# FILE: "/home/evmik/src/my_src/GradeBook/GradeBook.tcl" -# LAST MODIFICATION: "Wed, 15 Dec 2010 20:19:00 -0500 (evmik)" +# FILE: "/mnt/light_huge_archive/home/evmik/src/my_src/GradeBook/GradeBook.tcl" +# LAST MODIFICATION: "Thu, 16 Dec 2010 12:23:15 -0500 (evmik)" # (C) 2010 by Eugeniy Mikhailov, # $Id:$ # vim:set ft=tcl: \ @@ -214,14 +214,15 @@ proc SetSortColumn {} { ::ncgi::setCookie -name sortCol -value $sortCol } -proc ChoseAction {action permission_list} { +proc ChoseAction {action permission_list user} { array set permission $permission_list dbg "requested action: $action" 3 switch $action { - sort { - if { $permission(sort) } { SetSortColumn } - } - default { } + sort { if { $permission(sort) } { SetSortColumn; ChoseAction {} $permission_list $user } } + addcolumn { if { $permission(addcolumn) } { } } + deletecolumn { if { $permission(deletecolumn) } { } } + renamecolumn { if { $permission(renamecolumn) } { } } + default { htmlGradesTable db $permission_list $user } } } @@ -284,8 +285,9 @@ proc htmlStudentGrades { db user } { } -proc htmlGradesTable {db permission_list sortCol user} { +proc htmlGradesTable {db permission_list user} { array set permission $permission_list + global sortCol switch $permission(GroupName) { guest { } student { htmlStudentGrades db $user} @@ -308,12 +310,12 @@ if { $action == "logon" } { LogMeOn } if { $action == "logoff" } { LogMeOff } dbg "===== Connection at $timestamp for user $user =====" -set permissions [AccessGroupRights db $user $password] +set permission_list [AccessGroupRights db $user $password] ::ncgi::header -ChoseAction $action $permissions -htmlTop $permissions -htmlGradesTable db $permissions $sortCol $user +htmlTop $permission_list +ChoseAction $action $permission_list $user +#htmlGradesTable db $permission_list $user #htmlDBout db $sortCol -- cgit v1.2.3