diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-29 16:22:01 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2014-03-29 16:22:01 -0400 |
commit | 68ca873f050da98064f6ace4a1b3b8718e99710b (patch) | |
tree | 4da879e9d23b7ff8d0252f2c1d7db5a6f8ecf384 | |
parent | d49e39a116097ae98b1a6f55f5d139a4d1836af3 (diff) | |
download | GradeBook-68ca873f050da98064f6ace4a1b3b8718e99710b.tar.gz GradeBook-68ca873f050da98064f6ace4a1b3b8718e99710b.zip |
expect html string and then output it instead of relying on proc puts command
-rwxr-xr-x | GradeBook_lib.tcl | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index f2508c7..4f902e5 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -977,50 +977,50 @@ proc htmlFormatMaxPossibleRaw { sql_column_str hidden_columns } { proc htmlFormatTheHighestGradeRaw { sql_column_str hidden_columns } { # show max point values in html format - puts "<tr>" array set v [getColAndValForUserName _The_Highest_Grade_ $sql_column_str $hidden_columns] - foreach c $v(*) { - if { $c in $hidden_columns } continue - switch $c { - "FirstName" {set out_str "Class"} - "LastName" {set out_str "High"} - "GroupName" {set out_str ""} - "UserName" {set out_str "_Derived_"} + set html_str "<tr>\n" + foreach columnname $v(*) { + if { $columnname in $hidden_columns } continue + switch $columnname { + "FirstName" {set col_value "Class"} + "LastName" {set col_value "High"} + "UserName" {set col_value "_Derived_"} default { - if { ![info exists v($c)] } { - set out_str "N/A" + if { ![info exists v($columnname)] } { + set col_value "N/A" } else { - set out_str $v($c) + set col_value $v($columnname) } } } - puts "<td> <b>$out_str</b> </td>" + set html_str [join [list $html_str "\n" [htmlFormatColVal $col_value $columnname _The_Highest_Grade_ _The_Highest_Grade_ {} {b}] ] {}] } - puts "</tr>" + set html_str [join [list $html_str "\n" "</tr>"]] + return $html_str } proc htmlFormatTheLowestGradeRaw { sql_column_str hidden_columns } { # show max point values in html format - puts "<tr>" array set v [getColAndValForUserName _The_Lowest_Grade_ $sql_column_str $hidden_columns] - foreach c $v(*) { - if { $c in $hidden_columns } continue - switch $c { - "FirstName" {set out_str "Class"} - "LastName" {set out_str "Low"} - "GroupName" {set out_str ""} - "UserName" {set out_str "_Derived_"} + set html_str "<tr>\n" + foreach columnname $v(*) { + if { $columnname in $hidden_columns } continue + switch $columnname { + "FirstName" {set col_value "Class"} + "LastName" {set col_value "Low"} + "UserName" {set col_value "_Derived_"} default { - if { ![info exists v($c)] } { - set out_str "N/A" + if { ![info exists v($columnname)] } { + set col_value "N/A" } else { - set out_str $v($c) + set col_value $v($columnname) } } } - puts "<td> <b>$out_str</b> </td>" + set html_str [join [list $html_str "\n" [htmlFormatColVal $col_value $columnname _The_Lowest_Grade_ _The_Lowest_Grade_ {} {b}] ] {}] } - puts "</tr>" + set html_str [join [list $html_str "\n" "</tr>"]] + return $html_str } proc htmlFormatColVal { col_value columnname user user_shown permission_list {font_style {}} } { @@ -1166,8 +1166,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { set v_array_list [array get v] htmlGradesTableHeadersRaw $permission_list $user $sql_column_str $hidden_columns $v_array_list htmlFormatMaxPossibleRaw $sql_column_str $hidden_columns - htmlFormatTheHighestGradeRaw $sql_column_str $hidden_columns - htmlFormatTheLowestGradeRaw $sql_column_str $hidden_columns + puts [htmlFormatTheHighestGradeRaw $sql_column_str $hidden_columns] + puts [htmlFormatTheLowestGradeRaw $sql_column_str $hidden_columns] } puts "<tr>" |