aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2014-03-29 12:26:20 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2014-03-29 12:33:28 -0400
commit35d8bebde9a3e37dfc22352bd63394e56651ba27 (patch)
tree61405ec90e3a5cf9ccffd25e1981a7b2b8d8b2db /GradeBook_lib.tcl
parent4da4c10870e6da4a17112c88e434d6cbdaa1f835 (diff)
downloadGradeBook-35d8bebde9a3e37dfc22352bd63394e56651ba27.tar.gz
GradeBook-35d8bebde9a3e37dfc22352bd63394e56651ba27.zip
column value html format in separate proc
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl72
1 files changed, 38 insertions, 34 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 49bed90..05e156a 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -1023,6 +1023,39 @@ proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } {
puts "</tr>"
}
+proc htmlFormatColVal { col_value columnname user user_shown permission_list} {
+ global script_name
+ set category [SelectColValue4User $columnname _Col_Category_]
+ set max_points [SelectColValue4User $columnname _Max_Points_]
+ if { ([SelectColValue4User GroupName $user_shown] ne "inforow") && ($category eq "weighted_column") && ($max_points != 0) } {
+ if { $col_value eq "" } {
+ set col_value 0
+ }
+ # calculate letter grade to Grand Total
+ if { $columnname eq "Grand Total" } {
+ set col_value_letter_grade [number2letter_grade $col_value]
+ }
+ # promote to percent format
+ set col_value [format "%04.2f%%" [expr {100.* $col_value} ] ]
+ # add letter grade to Grand Total
+ if { $columnname eq "Grand Total" } {
+ set col_value [ concat $col_value "=" <b> $col_value_letter_grade </b>]
+ }
+ }
+ set col_value [htmlReplaceEmptyString $col_value]
+ switch $columnname {
+ GroupName {
+ set action_html_code {}
+ if { [isActionGranted changegroupname $permission_list $user] && ($user_shown ne "_UNSET_") && ($col_value ne "inforow") } {
+ set separator {<br>}
+ set action_html_code "$separator<span class=\"controls\"><a href=\"$script_name?action=changegroupname&user2modify=$user_shown\">Change</a></span>"
+ }
+ puts -nonewline "<td class=\"$category\">$col_value $action_html_code</td>"
+ }
+ default {puts -nonewline "<td class=\"$category\">$col_value</td>"}
+ }
+}
+
proc htmlDBout {db permission_list user {sort_col {}}} {
array set permission $permission_list
global GradebookServerConfig
@@ -1126,41 +1159,12 @@ proc htmlDBout {db permission_list user {sort_col {}}} {
} else {
set user_shown "_UNSET_"
}
- foreach index $v(*) {
- if { $index in $hidden_columns } continue
- if { $index != "*" } {
+ foreach columnname $v(*) {
+ if { $columnname in $hidden_columns } continue
+ if { $columnname != "*" } {
# detect what column category it is
- set category [SelectColValue4User $index _Col_Category_]
- set max_points [SelectColValue4User $index _Max_Points_]
- set col_value $v($index)
- if { ([SelectColValue4User GroupName $user_shown] ne "inforow") && ($category eq "weighted_column") && ($max_points != 0) } {
- if { $col_value eq "" } {
- set col_value 0
- }
- # calculate letter grade to Grand Total
- if { $index eq "Grand Total" } {
- set col_value_letter_grade [number2letter_grade $col_value]
- }
- # promote to percent format
- set col_value [format "%04.2f%%" [expr {100.* $col_value} ] ]
- # add letter grade to Grand Total
- if { $index eq "Grand Total" } {
- set col_value [ concat $col_value "=" <b> $col_value_letter_grade </b>]
- }
- }
- set col_value [htmlReplaceEmptyString $col_value]
- switch $index {
- GroupName {
- if { [isActionGranted changegroupname $permission_list $user] && ($user_shown ne "_UNSET_") } {
- set separator {<br>}
- set action_html_code "$separator<span class=\"controls\"><a href=\"$script_name?action=changegroupname&user2modify=$user_shown\">Change</a></span>"
- } else {
- set action_html_code {}
- }
- puts -nonewline "<td class=\"$category\">$col_value $action_html_code</td>"
- }
- default {puts -nonewline "<td class=\"$category\">$col_value</td>"}
- }
+ set col_value $v($columnname)
+ htmlFormatColVal $col_value $columnname $user $user_shown $permission_list
}
}
puts "</tr>"