diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-29 15:23:44 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-29 15:23:44 -0400 |
commit | c9a62dafd318dd9cd16a059565ae10e771dc9eca (patch) | |
tree | 6b4cb67bcee23272bda86fea9d74f8cc31f5901c /GradeBook_lib.tcl | |
parent | 35d8bebde9a3e37dfc22352bd63394e56651ba27 (diff) | |
download | GradeBook-c9a62dafd318dd9cd16a059565ae10e771dc9eca.tar.gz GradeBook-c9a62dafd318dd9cd16a059565ae10e771dc9eca.zip |
html formatting proc return string instead of using puts
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 19 |
1 files changed, 15 insertions, 4 deletions
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 "</tr>" } -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 "</$font_style>" + } 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 {<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>" + set html_str [join [list ${html_str} "<td class=\"$category\">$col_value $action_html_code</td>"] {}] + } + default { + set html_str [join [list ${html_str} "<td class=\"$category\">$col_value</td>"] {}] } - default {puts -nonewline "<td class=\"$category\">$col_value</td>"} } + 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 "</tr>" |