diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-25 10:25:02 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-25 10:25:02 -0500 |
commit | 07019ca4cf3aa7cb7cff6216f1955deb098bc5a9 (patch) | |
tree | a85a79faf1dd854bf4e861fe1819085430425e64 /GradeBook_lib.tcl | |
parent | 49dbab346e512f71f58a41be2d4c4f35c13168a4 (diff) | |
download | GradeBook-07019ca4cf3aa7cb7cff6216f1955deb098bc5a9.tar.gz GradeBook-07019ca4cf3aa7cb7cff6216f1955deb098bc5a9.zip |
added new user web code
Ignore-this: a2428f982396ff4ee385e8c1bb90e78f
darcs-hash:20110125152502-067c0-dedc208c17fb1501834a4a4e9ed0bd8f408ffd0d.gz
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 21b89ea..d65a33f 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -134,6 +134,8 @@ proc CreateAccessRightsTable {db} { AddAccessRightNonWeb userunhidegroup 1 0 0 0 AddAccessRightNonWeb editcourseinfo 1 0 0 0 AddAccessRightNonWeb updatecourseinfo 1 0 0 0 + AddAccessRightNonWeb editnewuserinfo 1 0 0 0 + AddAccessRightNonWeb addnewuserinfo 1 0 0 0 } proc htmlErrorMsg { msg } { @@ -434,6 +436,9 @@ proc ChoseAction {action permission_list user} { editcourseinfo { EditCourseInfo db $permission_list $user } updatecourseinfo { UpdateCourseInfo db $permission_list $user htmlDefaultView $permission_list $user } + editnewuserinfo { EditNewUserInfo db $permission_list $user } + addnewuserinfo { AddNewUserInfo db $permission_list $user + htmlDefaultView $permission_list $user } defaultview { htmlDefaultView $permission_list $user } default { htmlErrorMsg "requested action <b>$action</b> is granted but not implemented yet" } } @@ -443,6 +448,41 @@ proc ChoseAction {action permission_list user} { } } +proc AddNewUserInfo {db permission_list user } { + set subaction [::ncgi::value subaction {}] + set first_name [::ncgi::value first_name {}] + set last_name [::ncgi::value last_name {}] + set login [::ncgi::value login {}] + set id_number [::ncgi::value id_number {}] + set section_number [::ncgi::value section_number {}] + set group_name [::ncgi::value group_name {}] + + if { $subaction eq "Cancel" } { + return + } + if { $subaction eq "Submit" } { + AddUserNonWeb $first_name $last_name $login {} $group_name $id_number $section_number + } +} + +proc EditNewUserInfo {db permission_list user } { + global script_name + + puts "<div class=editnewuserinfo>" + 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 "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>" + puts {<input type="hidden" name="action" value="addnewuserinfo"/>} + puts {<input type="submit" name="subaction" value="Submit" />} + puts {<input type="submit" name="subaction" value="Cancel" />} + puts {</form>} + puts "</div>" +} + proc EditCourseInfo {db permission_list user } { global script_name set CourseTitle [SelectItemFromCourseInfoTable course_title] @@ -814,7 +854,7 @@ proc ShowControls { permission_list user } { global script_name dbg "outputing contol list" puts "<div class=\"controls\">" - set action_list [ list defaultview "Refresh" addcolumnrequest "Add Column" logoff "Logoff" editcourseinfo "Edit Course Info"] + set action_list [ list defaultview "Refresh" addcolumnrequest "Add Column" logoff "Logoff" editcourseinfo "Edit Course Info" editnewuserinfo "Add new user"] set separator { } foreach {act act_label} $action_list { if { [isActionGranted $act $permission_list $user] } { |