diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2010-12-14 17:23:26 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2010-12-14 17:23:26 -0500 |
commit | a8968f29b0bd07fff26086887e2e4c018d2d00c1 (patch) | |
tree | c4ced96a162cce523485386372fe81ecdd9cce34 /GradeBook.tcl | |
parent | b8ebbbbf8bd6766eb167811fa8451b98f2255d68 (diff) | |
download | GradeBook-a8968f29b0bd07fff26086887e2e4c018d2d00c1.tar.gz GradeBook-a8968f29b0bd07fff26086887e2e4c018d2d00c1.zip |
added cookie for sort column
darcs-hash:20101214222326-067c0-5f35a5f04d12a29c6d7a22f39cc74fe42f670dee.gz
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-x | GradeBook.tcl | 20 |
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 { } } } |