From 032d52333ca6c3c3df432718d5dcc5fbc346793c Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 21 Apr 2011 00:31:49 -0400 Subject: added icons for column actions Ignore-this: 78438121114ad2ac50080e3ef76edb25 darcs-hash:20110421043149-067c0-5fde0d2c92faf5b0244171bc07509cc6b0a0a94f.gz --- GradeBook_lib.tcl | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'GradeBook_lib.tcl') diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index b0dd7db..a30b7d3 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -21,7 +21,7 @@ set grades_category [list \ FinalExam\ ] - +set icon_dir "/~evmik/icons" # ########################## procs begin ################################# proc default_grades_category {} { @@ -372,6 +372,7 @@ proc ModifyWeightForGradesCategory {db category weight} { } UpdateColumnWithValueInTableWhere GradesCategoryTable CategoryWeight $weight CategoryName $category } +\ proc AddGradesCategory {db category} { if {[existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { @@ -599,6 +600,27 @@ proc htmlReplaceEmptyString { string } { set string } +proc action2atributes { action_name } { + # return list of action_name, text description, and icon name + # for each action + global icon_dir + case $action_name { + userhidecolumn { set attrib [list $action_name "hide" $icon_dir/hide.png ]} + changefirstname { set attrib [list $action_name "change first name" $icon_dir/tbd.png ]} + changelastname { set attrib [list $action_name "change last name" $icon_dir/tbd.png ]} + changeusername { set attrib [list $action_name "change user name" $icon_dir/tbd.png ]} + hidecolfromstudents { set attrib [list $action_name "hide from students" $icon_dir/students_hide.png ]} + unhidecolfromstudents { set attrib [list $action_name "show to students" $icon_dir/students_unhide.png ]} + changegrades { set attrib [list $action_name "change grades" $icon_dir/tbd.png ]} + deletecolumn { set attrib [list $action_name "delete" $icon_dir/delete_column.png ]} + changecolumn { set attrib [list $action_name "change column" $icon_dir/tbd.png ]} + hidecolfromstudents { set attrib [list $action_name "hide from students" $icon_dir/tbd.png ]} + unhidecolfromstudents { set attrib [list $action_name "show to students" $icon_dir/tbd.png ]} + default { set attrib [list $action_name "unknown" $icon_dir/tbd.png ]} + } + return $attrib +} + proc htmlDBout {db permission_list user {sort_col {}}} { array set permission $permission_list global script_name @@ -697,11 +719,11 @@ proc htmlDBout {db permission_list user {sort_col {}}} { set category [SelectColValue4User $col _Col_Category_] puts -nonewline "$col" # below list has action and action_label pairs - set action_list {userhidecolumn hide} + set action_list {userhidecolumn} 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" } + FirstName { lappend action_list changefirstname } + LastName { lappend action_list changelastname } + UserName { lappend action_list changeusername } PasswordHash { } UserHiddenColums { } UserHiddenGroups { } @@ -715,27 +737,32 @@ proc htmlDBout {db permission_list user {sort_col {}}} { # modify actions for weighted_column if { $permission(GroupName) eq "instructor" } { if { [SelectColValue4User $col _Visible_To_Students_] eq "true" } { - lappend action_list hidecolfromstudents "hide from students" + lappend action_list hidecolfromstudents } else { - lappend action_list unhidecolfromstudents "show to students" + lappend action_list unhidecolfromstudents } } } default { - lappend action_list changegrades "change grades" deletecolumn delete changecolumn "change column" + lappend action_list changegrades deletecolumn changecolumn if { [SelectColValue4User $col _Visible_To_Students_] eq "true" } { - lappend action_list hidecolfromstudents "hide from students" + lappend action_list hidecolfromstudents } else { - lappend action_list unhidecolfromstudents "show to students" + lappend action_list unhidecolfromstudents } } } } } set separator {
} - foreach {act act_label} $action_list { + foreach act $action_list { + set attributes [action2atributes $act] + set act_label [lindex $attributes 1] + set act_icon [lindex $attributes 2] if { [isActionGranted $act $permission_list $user] } { - puts -nonewline "$separator$act_label" + puts -nonewline "$separator" + puts -nonewline "\"$act_label\"" + puts -nonewline "" } } puts -nonewline "" -- cgit v1.2.3