From 9952d1ff3e77582d8b58323d872736fad3b78307 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 9 Mar 2011 17:32:36 -0500 Subject: added code for student visibility column toggle Ignore-this: 762febad016243f530d8908b330b5d52 darcs-hash:20110309223236-067c0-bc2fc4dd5d841b809040a242f3056438b31897ee.gz --- GradeBook_lib.tcl | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'GradeBook_lib.tcl') diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 7ba525e..d1d9942 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -395,6 +395,9 @@ proc htmlDBout {db permission_list user {sort_col {}}} { if { [SelectColValue4User $col _Col_Category_] in $UserHiddenGradeCategories } { set column_list [removeElementFromList $col $column_list] } + if { ( ($permission(GroupName) eq "student") || ($permission(GroupName) eq "dropped") ) && ( [SelectColValue4User $col _Visible_To_Students_] ne "true") } { + set column_list [removeElementFromList $col $column_list] + } } # add UserName column since a lot depends on it knowledge @@ -462,7 +465,12 @@ proc htmlDBout {db permission_list user {sort_col {}}} { if { $category eq "weighted_column" } { # modify actions for weighted_column } else { - lappend action_list changegrades "change grades" deletecolumn delete changecolumn "change column" + lappend action_list changegrades "change grades" deletecolumn delete changecolumn "change column" + } + if { [SelectColValue4User $col _Visible_To_Students_] eq "true" } { + lappend action_list hidecolfromstudents "hide from students" + } else { + lappend action_list unhidecolfromstudents "show to students" } } } @@ -736,6 +744,10 @@ proc ChoseAction {action permission_list user} { htmlDefaultView $permission_list $user } showcontrols { ShowControls $permission_list $user } + hidecolfromstudents { HideColumnFromStudents $permission_list $user + htmlDefaultView $permission_list $user } + unhidecolfromstudents { UnHideColumnFromStudents $permission_list $user + htmlDefaultView $permission_list $user } userhidecolumn { UserHideColumn $permission_list $user htmlDefaultView $permission_list $user } userunhidecolumn { UserUnHideColumn $permission_list $user @@ -974,6 +986,16 @@ proc UserHideGroup { permission_list user } { UpdateColValue4UserNameNonWeb UserHiddenGroups $user $currently_hidden_groups } +proc HideColumnFromStudents { permission_list user } { + set columnname [::ncgi::value columnname {}] + UpdateColValue4UserNameNonWeb $columnname _Visible_To_Students_ false +} + +proc UnHideColumnFromStudents { permission_list user } { + set columnname [::ncgi::value columnname {}] + UpdateColValue4UserNameNonWeb $columnname _Visible_To_Students_ true +} + proc UserHideColumn { permission_list user } { set columnname [::ncgi::value columnname {}] set currently_hidden_columns [SelectColValue4User UserHiddenColums $user] -- cgit v1.2.3