diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-20 22:01:26 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-20 22:01:26 -0500 |
commit | 41d3848b7123f915ece0d977a9675ef215cf8c34 (patch) | |
tree | b9090ded92d2c1fa214564f3e8f6e1ff9bc93b21 /GradeBook.tcl | |
parent | 08f76b64815fe894eea4f45a146a7a6e2bf3221d (diff) | |
download | GradeBook-41d3848b7123f915ece0d977a9675ef215cf8c34.tar.gz GradeBook-41d3848b7123f915ece0d977a9675ef215cf8c34.zip |
each column has different rights and actions
Ignore-this: cb4c9fd8c005677610938467db81dbd4
darcs-hash:20110121030126-067c0-89cefd967c9b3aacc44985c4d0bbe2cb44fc6349.gz
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-x | GradeBook.tcl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index 363617f..d62590c 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -127,7 +127,21 @@ proc htmlDBout {db permission_list user {sort_col {}}} { puts {<div class="gradestable">} set show_header 1 # show the table with grades - set eval_str [list SELECT * FROM GradesTable ORDER BY $sort_col] + set column_list [getColListFromTable GradesTable] + switch $permission(GroupName) { + instructor { set hidden_columns {} } + ta { set hidden_columns [list UserName] } + student { set hidden_columns [list FirstName LastName UserName] } + guest { set hidden_columns $column_list } + default { set hidden_columns $column_list } + } + # remove hidden columns from sql request + foreach col $hidden_columns { + set column_list [removeElementFromList $col $column_list] + } + set sql_column_str [colList2sqlColStr $column_list] + # get all allowed columns + set eval_str [concat SELECT $sql_column_str FROM GradesTable ORDER BY $sort_col] set err [catch { db eval $eval_str v { if { $show_header } { @@ -137,7 +151,15 @@ proc htmlDBout {db permission_list user {sort_col {}}} { foreach col $v(*) { puts -nonewline "<th><a href=\"$script_name?action=sort&sortCol=$col\">$col</a>" # below list has action and action_label pairs - set action_list [list changegrades "change grades" deletecolumn delete renamecolumn rename changecolumn "change column"] + set action_list {} + switch $col { + FirstName { lappend action_list changefirstname "change first name" } + LastName { lappend action_list changelastname "change last name" } + UserName { lappend action_list changeusername "change user name" } + default { + lappend action_list changegrades "change grades" deletecolumn delete changecolumn "change column" + } + } set separator {<br>} foreach {act act_label} $action_list { if { [isActionGranted $act $permission_list $user] } { |