summaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-25 12:19:40 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-25 12:19:40 -0500
commitc447b05000cd8ca3f0501712de11e79265ce3720 (patch)
tree71ef9a8d489edf5c1302f289452710e6904d483c /GradeBook_lib.tcl
parentee6ce3b9065e4f275c0a590db464d3938f04386a (diff)
downloadGradeBook-c447b05000cd8ca3f0501712de11e79265ce3720.tar.gz
GradeBook-c447b05000cd8ca3f0501712de11e79265ce3720.zip
checked validity conditions for new user to be added
Ignore-this: 7bd88c9d4475c3aacb602edfe0660d1f darcs-hash:20110125171940-067c0-f274692c58e223591c657dfbe72ddc635bd59904.gz
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl18
1 files changed, 17 insertions, 1 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index afb2d46..238bb17 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -466,7 +466,23 @@ proc AddNewUserInfo {db permission_list user } {
if { $subaction eq "Cancel" } {
return
}
+
+ if { $login eq "" } {
+ htmlErrorMsg "Empty login names are not permitted"
+ return
+ }
+
+ if { [SelectColValue4User UserName $login] ne "" } {
+ htmlErrorMsg "User with login $login already exists"
+ return
+ }
+
+ set permitted_groups [list instructor ta student guest]
if { $subaction eq "Submit" } {
+ if { $group_name ni $permitted_groups } {
+ htmlInfoMsg "Unknown group name {$group_name} replaced with {guest}."
+ set group_name guest
+ }
AddUserNonWeb $first_name $last_name $login {} $group_name $id_number $section_number
}
}
@@ -478,7 +494,7 @@ proc EditNewUserInfo {db permission_list user } {
puts "<form name=\"input\" action=\"$script_name\" method=\"post\" />"
puts "First Name: <input type=\"text\" name=\"first_name\" ><br>"
puts "Last Name: <input type=\"text\" name=\"last_name\" ><br>"
- puts "Login: <input type=\"text\" name=\"login\" ><br>"
+ puts "Login (email): <input type=\"text\" name=\"login\" ><br>"
puts "Id Number: <input type=\"text\" name=\"id_number\" ><br>"
puts "Section Number: <input type=\"text\" name=\"section_number\" ><br>"
puts "Group Name: <input type=\"text\" name=\"group_name\" ><br>"