diff options
-rwxr-xr-x | GradeBook_lib.tcl | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 37db949..f548f44 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -1193,14 +1193,18 @@ proc htmlFormatColVal { col_value columnname user user_shown permission_list {fo set col_str_value ${font_style_strt}${col_str_value}${font_style_end} # embedded actions on values assignment - set embeded_actions_special_columns [ list \ + set embeded_actions_excluded_special_columns [ list \ PasswordHash GroupName UserHiddenColums \ + FirstName \ + LastName \ UserName \ + IdNum \ + SectionNum \ UserHiddenGroups \ UserHiddenGradeCategories \ ] - if { ([SelectColValue4User GroupName $user_shown] ne "inforow") && ($user ni $special_user_names) && ($category ne "weighted_column") && ($columnname ni $embeded_actions_special_columns) } { + if { ([SelectColValue4User GroupName $user_shown] ne "inforow") && ($user ni $special_user_names) && ($category ne "weighted_column") && ($columnname ni $embeded_actions_excluded_special_columns) } { if { [isActionGranted edit_user_grade $permission_list $user] && ($user_shown ne "_UNSET_") } { set col_str_value "<a href=\"$script_name?action=edit_user_grade_request&user2modify=$user_shown&column2modify=$columnname\">${col_str_value}</a>" } @@ -1628,6 +1632,9 @@ proc ChoseAction {action permission_list user} { htmlDefaultView $permission_list $user } update_grades_stats { UpdateGradesTableStatistic $permission_list $user htmlDefaultView $permission_list $user } + edit_user_grade_request { htmlEditUserGradeValue $permission_list $user } + edit_user_grade { EditUserGradeValue $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" } } @@ -1638,6 +1645,46 @@ proc ChoseAction {action permission_list user} { } } +proc EditUserGradeValue {permission_list user } { + global script_name + set subaction [::ncgi::value subaction {}] + set modified_user [::ncgi::value user2modify {}] + set modified_column [::ncgi::value column2modify {}] + set new_value [::ncgi::value newcolumnvalue {}] + + if { $subaction eq "Cancel" } { + return + } + + if { $subaction eq "Submit" } { + UpdateColValue4UserNameNonWeb $modified_column $modified_user $new_value + UpdateGradesTableStatistic $permission_list $user + } +} + +proc htmlEditUserGradeValue {permission_list user } { + global script_name + set modified_user [::ncgi::value user2modify {}] + set modified_column [::ncgi::value column2modify {}] + + set current_group_name [SelectColValue4User GroupName $modified_user] + set FirstName [SelectColValue4User FirstName $modified_user] + set LastName [SelectColValue4User LastName $modified_user] + set old_value [SelectColValue4User $modified_column $modified_user] + puts "<div class=edit_user_grade_request>" + puts "Change grade for student <b>$FirstName $LastName</b> with user name $modified_user" + puts "<form name=\"input\" action=\"$script_name\" method=\"post\" >" + puts "<b>$modified_column</b> old value: \{$old_value\}," + puts "new value: <input name=\"newcolumnvalue\" value=\"$old_value\" ><br>" + puts {<input type="hidden" name="action" value="edit_user_grade">} + puts [join [ list {<input type="hidden" name="user2modify" value="} $modified_user {">} ] ""] + puts [join [ list {<input type="hidden" name="column2modify" value="} $modified_column {">} ] "" ] + puts {<input type="submit" name="subaction" value="Submit" >} + puts {<input type="submit" name="subaction" value="Cancel" >} + puts {</form>} + puts "</div>" +} + proc ChangeGroupName {permission_list user } { global script_name set modified_user [::ncgi::value user2modify {}] |