diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2010-12-16 17:34:30 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2010-12-16 17:34:30 -0500 |
commit | 89172be4283ddd9f249973ba26b8a7f88a0412a6 (patch) | |
tree | 8a3c5b615edb503d16f479c8f81f269d2b1e298b /GradeBook.tcl | |
parent | 79ce3d4d72def4127149efe9d164a6ff7eafe0cb (diff) | |
download | GradeBook-89172be4283ddd9f249973ba26b8a7f88a0412a6.tar.gz GradeBook-89172be4283ddd9f249973ba26b8a7f88a0412a6.zip |
added access rights
darcs-hash:20101216223430-067c0-edd40d6d1d6cf36bbeb213cba1ef3f5668e1de22.gz
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-x | GradeBook.tcl | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index f3f252e..f0fedf5 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -71,12 +71,12 @@ proc CreateGradesTable {db} { } proc CreateAccessRightsTable {db} { - db eval {CREATE TABLE AccessRightsTable(GroupName text, showgrades integer, sort integer, addcolumn integer, deletecolumn integer, renamecolumn integer, editcolumn integer, showcontrols integer)} - db eval {INSERT INTO AccessRightsTable VALUES('instructor', 1, 1, 1, 1, 1, 1, 1)} - db eval {INSERT INTO AccessRightsTable VALUES('ta', 1, 1, 1, 1, 1, 1, 1)} - db eval {INSERT INTO AccessRightsTable VALUES('student', 1, 0, 0, 0, 0, 0, 0)} + db eval {CREATE TABLE AccessRightsTable(GroupName text, showgrades integer, sort integer, addcolumnrequest integer, addcolumn integer, deletecolumn integer, renamecolumn integer, editcolumn integer, showcontrols integer)} + db eval {INSERT INTO AccessRightsTable VALUES('instructor', 1, 1, 1, 1, 1, 1, 1, 1)} + db eval {INSERT INTO AccessRightsTable VALUES('ta', 1, 1, 1, 1, 1, 1, 1, 1)} + db eval {INSERT INTO AccessRightsTable VALUES('student', 1, 0, 0, 0, 0, 0, 0, 0)} # guest should have no rights make sure that 0 is evereywhere - db eval {INSERT INTO AccessRightsTable VALUES('guest', 0, 0, 0, 0, 0, 0, 0)} + db eval {INSERT INTO AccessRightsTable VALUES('guest', 0, 0, 0, 0, 0, 0, 0, 0)} } proc htmlDBout {db permission_list {sort_col {}}} { @@ -242,19 +242,27 @@ proc ChoseAction {action permission_list user} { dbg "requested action: $action" 3 if { [isActionGranted $action $permission_list $user] } { switch $action { - sort { SetSortColumn; ChoseAction defaultview $permission_list $user } - addcolumn { AddColumn } - deletecolumn { } - renamecolumn { } - showcontrols { ShowControls $permission_list $user } - showgrades { htmlGradesTable db $permission_list $user } - defaultview { htmlDefaultView $permission_list $user } - default { } + sort { SetSortColumn; ChoseAction defaultview $permission_list $user } + addcolumn { AddColumn } + addcolumnrequest { AddColumnRequest } + deletecolumn { } + renamecolumn { } + showcontrols { ShowControls $permission_list $user } + showgrades { htmlGradesTable db $permission_list $user } + defaultview { htmlDefaultView $permission_list $user } + default { } } } } -proc AddColumn { permission_list user } { +proc AddColumnRequest { permission_list user } { + puts "<form name=\"input\" action=\"$script_name\" method=\"post\" />" + puts {Column Name: <input type="text" name="columnname"><br>} + puts {Max Point Possible:<input type="text" name="maxpointpossible"><br>} + puts {<input type="hidden" name="action" value="addcolumn"/>} + puts {<input type="submit" value="Submit" />} + puts {</form>} + } proc ShowControls { permission_list user } { @@ -262,8 +270,8 @@ proc ShowControls { permission_list user } { global script_name dbg "outputing contol list" puts "<div>" - set action_list [ list addcolumn "Add Column" ] - set separator {"_z_"} + set action_list [ list addcolumnrequest "Add Column" ] + set separator {} foreach {act act_label} $action_list { if { [info exist permission($act) ] } { if { $permission($act) } { |