aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"
}
}