aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xGradeBook.tcl14
1 files changed, 12 insertions, 2 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index b1d7e82..fa09ef0 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -92,6 +92,14 @@ proc htmlErrorMsg { msg } {
puts "<div class=\"errormsg\">error: $msg</div>"
}
+proc htmlReplaceEmptyString { string } {
+ # empty string replaced with "---"
+ regsub {^$} $string "---" string
+ # white spaces only string replaced with "---"
+ regsub {^\s+$} $string "---" string
+ set string
+}
+
proc htmlDBout {db permission_list {sort_col {}}} {
array set permission $permission_list
global script_name
@@ -140,7 +148,8 @@ proc htmlDBout {db permission_list {sort_col {}}} {
}
foreach index $v(*) {
if { $index != "*" } {
- puts -nonewline "<td>$v($index)</td>"
+ set col_value [htmlReplaceEmptyString $v($index)]
+ puts -nonewline "<td>$col_value</td>"
}
}
puts "</tr>"
@@ -512,7 +521,8 @@ proc htmlStudentGrades { db user } {
}
foreach index $v(*) {
if { $index != "*" } {
- puts -nonewline "<td>$v($index)</td>"
+ set col_value [htmlReplaceEmptyString $v($index)]
+ puts -nonewline "<td>$col_value</td>"
}
}
puts "</tr>"