aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-10 01:41:09 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-10 01:41:09 -0500
commitd19c3354bbfd3550c2882a95d663362b47cc82ff (patch)
tree5d58998eaea834ace46d6644ff4b9db654caf749
parent4a53250d61e85350c0bf63dd8c69c3c24ce7dedd (diff)
downloadGradeBook-d19c3354bbfd3550c2882a95d663362b47cc82ff.tar.gz
GradeBook-d19c3354bbfd3550c2882a95d663362b47cc82ff.zip
replace empty or white space only strings for html out
Ignore-this: 4d7911149544aad071e937b8b7e5f422 darcs-hash:20110110064109-067c0-31108941b2ecfca64ca249b90e4f1cbfe262bb0a.gz
-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>"