diff options
-rwxr-xr-x | GradeBook_lib.tcl | 51 | ||||
-rw-r--r-- | Makefile | 5 |
2 files changed, 42 insertions, 14 deletions
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 "<th class=\"$category\"><a href=\"$script_name?action=sort&sortCol=$col\">$col</a>" # 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 {<br>} - 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<span class=\"column_control_$act\"><a href=\"$script_name?action=$act&columnname=[::ncgi::encode $col]\">$act_label</a></span>" + puts -nonewline "$separator<span class=\"column_control_$act\"><a href=\"$script_name?action=$act&columnname=[::ncgi::encode $col]\">" + puts -nonewline "<img src=\"$act_icon\" alt=\"$act_label\" title=\"$act_label\">" + puts -nonewline "</a></span>" } } puts -nonewline "</th>" @@ -1,6 +1,6 @@ # -*- make -*- -# FILE: "/home/evmik/src/my_src/GradeBook/Makefile" -# LAST MODIFICATION: "Fri, 15 Apr 2011 21:19:06 -0400 (evmik)" +# FILE: "/mnt/light_huge_archive/home/evmik/src/my_src/GradeBook/Makefile" +# LAST MODIFICATION: "Wed, 20 Apr 2011 23:26:32 -0400 (evmik)" # (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com> # $Id:$ # @@ -9,6 +9,7 @@ upscr = rsync -ave ssh upload_location_code = physics.wm.edu:public_html/cgi-bin/ upload_location_styles = physics.wm.edu:public_html/ +upload_location_icons = physics.wm.edu:public_html/icons files4upload_code = ./GradeBook.tcl ./GradeBook_lib.tcl ./libBasicTableOperations.tcl files4upload_styles = ./GradeBook.css |