From c9a62dafd318dd9cd16a059565ae10e771dc9eca Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Sat, 29 Mar 2014 15:23:44 -0400 Subject: html formatting proc return string instead of using puts --- GradeBook_lib.tcl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'GradeBook_lib.tcl') diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 05e156a..e26d16a 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -1023,8 +1023,15 @@ proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } { puts "" } -proc htmlFormatColVal { col_value columnname user user_shown permission_list} { +proc htmlFormatColVal { col_value columnname user user_shown permission_list {font_style {}} } { global script_name + set html_str {} + set font_style_strt {} + set font_style_end {} + if { $font_style ne "" } { + set font_style_strt "<$font_style>" + set font_style_end "" + } 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) } { @@ -1043,6 +1050,7 @@ proc htmlFormatColVal { col_value columnname user user_shown permission_list} { } } set col_value [htmlReplaceEmptyString $col_value] + set col_value ${font_style_strt}${col_value}${font_style_end} switch $columnname { GroupName { set action_html_code {} @@ -1050,10 +1058,13 @@ proc htmlFormatColVal { col_value columnname user user_shown permission_list} { set separator {
} set action_html_code "$separatorChange" } - puts -nonewline "$col_value $action_html_code" + set html_str [join [list ${html_str} "$col_value $action_html_code"] {}] + } + default { + set html_str [join [list ${html_str} "$col_value"] {}] } - default {puts -nonewline "$col_value"} } + return $html_str } proc htmlDBout {db permission_list user {sort_col {}}} { @@ -1164,7 +1175,7 @@ proc htmlDBout {db permission_list user {sort_col {}}} { if { $columnname != "*" } { # detect what column category it is set col_value $v($columnname) - htmlFormatColVal $col_value $columnname $user $user_shown $permission_list + puts [htmlFormatColVal $col_value $columnname $user $user_shown $permission_list] } } puts "" -- cgit v1.2.3