aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl20
1 files changed, 17 insertions, 3 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 9b5722d..6c04ad4 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -1,6 +1,6 @@
#!/bin/sh
# FILE: "/home/evmik/src/my_src/GradeBook/GradeBook.tcl"
-# LAST MODIFICATION: "Tue, 14 Dec 2010 17:15:57 -0500 (evmik)"
+# LAST MODIFICATION: "Tue, 14 Dec 2010 17:23:25 -0500 (evmik)"
# (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
# $Id:$
# vim:set ft=tcl: \
@@ -11,15 +11,22 @@ package require sqlite3
package require ncgi
::ncgi::parse
+# defaults
+set sortCol LastName
+set user guest
+set password guest
+# defaults end
+# read cookies
set user [::ncgi::cookie user]
+set sortCol [::ncgi::cookie sortCol]
set password [::ncgi::cookie password]
set action [::ncgi::value action none]
+# end of read cookies
if { [catch {set script_name $env(SCRIPT_NAME)} errStat] } { set script_name unknown}
#set val [::ncgi::value fd]
-set sortCol [::ncgi::value sortCol LastName]
proc dbg {msg {level 1}} {
if { $level <=2 } {
@@ -73,7 +80,7 @@ proc htmlDBout {db {sort_col {}}} {
puts {<table border="1">}
puts "<tr>"
foreach col $v(*) {
- puts -nonewline "<th><a href=$script_name?sortCol=$col>$col</a></th>"
+ puts -nonewline "<th><a href=$script_name?action=sort&sortCol=$col>$col</a></th>"
}
puts "</tr>"
puts "<tr>"
@@ -162,11 +169,18 @@ proc LogMeOff {} {
}
+proc SetSortColumn {} {
+ global sortCol
+ set sortCol [::ncgi::value sortCol LastName]
+ ::ncgi::setCookie -name sortCol -value $sortCol
+}
+
proc ChoseAction {action} {
dbg "requeste action: $action" 3
switch $action {
logon { LogMeOn }
logoff { LogMeOff }
+ sort { SetSortColumn }
default { }
}
}