aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-10 00:59:50 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-10 00:59:50 -0500
commitb63da517866b6b78fadd725cde93692630fb13a4 (patch)
tree570b1baee325cc11bcda3d6ce21ed2641009ce36
parentf9c478678638c64c18cf2aa703c3ead7ded33822 (diff)
downloadGradeBook-b63da517866b6b78fadd725cde93692630fb13a4.tar.gz
GradeBook-b63da517866b6b78fadd725cde93692630fb13a4.zip
special htmlErrorMsg use instead of raw puts
Ignore-this: 339d21aef6a174c70be6a5e37b455373 darcs-hash:20110110055950-067c0-a5383e3422f6ea573906e425955f244796a75b91.gz
-rwxr-xr-xGradeBook.tcl21
1 files changed, 13 insertions, 8 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 0ae2308..c78875b 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -88,6 +88,10 @@ proc CreateAccessRightsTable {db} {
db eval {INSERT INTO AccessRightsTable VALUES('updategrades', 1, 1, 0, 0)}
}
+proc htmlErrorMsg { msg } {
+ puts "<div class=\"errormsg\">error: $msg</div>"
+}
+
proc htmlDBout {db permission_list {sort_col {}}} {
array set permission $permission_list
global script_name
@@ -291,14 +295,14 @@ proc UpdateGrades { permission_list user } {
db eval $sql_str
} errStat2 ]
if { $err2 } {
- puts "<div class=\"errormsg\">the following error happen: $errStat2</div>"
+ htmlErrorMsg $errStat2
dbg "the following error happen: $errStat2" 3
}
}
} errStat ]
if { $err } {
- puts "<div class=\"errormsg\">the following error happen: $errStat</div>"
+ htmlErrorMsg $errStat
dbg "the following error happen: $errStat" 3
}
}
@@ -345,7 +349,7 @@ proc ChangeGrades { permission_list user } {
} errStat ]
puts "</table>"
if { $err } {
- puts "<div class=\"errormsg\">the following error happen: $errStat</div>"
+ htmlErrorMsg $errStat
dbg "the following error happen: $errStat" 3
}
puts {<input type="hidden" name="action" value="updategrades"/>}
@@ -356,7 +360,7 @@ proc ChangeGrades { permission_list user } {
#puts "<a href=\"$script_name\">Cancel changes</a>"
} else {
- puts "<div class=\"errormsg\">error: empty column names are not permitted</div>"
+ htmlErrorMsg "empty column names are not permitted"
}
}
@@ -385,11 +389,12 @@ proc DeleteColumn { permission_list user } {
COMMIT;"
set err [catch {db eval $eval_str } errStat]
if { $err } {
- puts "<div class=\"errormsg\">the following error happen: $errStat</div>"
+ htmlErrorMsg $errStat
dbg "the following error happen: $errStat" 3
}
} else {
- puts "<div class=\"errormsg\">error: empty column names are not permitted</div>"
+ htmlErrorMsg "empty column names are not permitted"
+
}
}
@@ -403,12 +408,12 @@ proc AddColumn { permission_list user } {
set eval_str [concat ALTER TABLE GradesTable ADD \"$columnname2add\" real]
set err [catch {db eval $eval_str } errStat]
if { $err } {
- puts "<div class=\"errormsg\">the following error happen: $errStat</div>"
+ htmlErrorMsg $errStat
dbg "the following error happen: $errStat" 3
}
} else {
- puts "<div class=\"errormsg\">error: empty column names are not permitted</div>"
+ htmlErrorMsg "empty column names are not permitted"
}
}