diff options
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) } { |