diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-05-02 23:05:05 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-05-02 23:05:05 -0400 |
commit | 1d9b9ddaf7e76a625105d791c4d88a246f4407de (patch) | |
tree | b398feb7019bae0e54797d3afcd1277044e46df4 /GradeBook_lib.tcl | |
parent | b0ba0af9eb99a93fc778e93f42d001b522fa642f (diff) | |
download | GradeBook-1d9b9ddaf7e76a625105d791c4d88a246f4407de.tar.gz GradeBook-1d9b9ddaf7e76a625105d791c4d88a246f4407de.zip |
adeed proc to pull grades categories from the DB and use along the lib
Ignore-this: 966901270828decd00b5cb38184ea4eb
darcs-hash:20110503030505-067c0-61d278fe9ca574f5c90b9d0b0bfe29edc26341a5.gz
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 92df017..373159e 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -11,22 +11,40 @@ source ./libBasicTableOperations.tcl # internal version of this code set VERSION 1.5.1 -# Grades category and their html names -set grades_category [list \ - "unset"\ - Quiz\ - HomeWork\ - LabReport\ - MidTerm\ - FinalExam\ - ] - +# ######################################################################## +# this should be in config file array set GradebookServerConfig [list \ icon_dir "/~evmik/icons" \ use_icons true \ ] +# ######################################################################## # ########################## procs begin ################################# +# Grades category and their html names +proc get_grades_category {} { + set eval_str "SELECT CategoryName FROM GradesCategoryTable" + set grades_category {} + set err [catch { + db eval $eval_str v { + lappend grades_category $v(CategoryName) + } + } errStat ] + if { $err } { + htmlErrorMsg $errStat + dbg "the following error happen: $errStat" 3 + } + #set grades_category [list \ + #"unset"\ + #Quiz\ + #HomeWork\ + #LabReport\ + #MidTerm\ + #FinalExam\ + #] + return $grades_category +} + + proc default_grades_category {} { set grades_category [list \ "unset"\ @@ -156,7 +174,8 @@ proc calculteSumOfPointsForStudentInCategory { student category } { } proc calculteWeightedTotals { } { - global grades_category + set grades_category [ get_grades_category ] + #global grades_category set all_column_names [getColListFromTable GradesTable] set students_list [ allUserNamesInGroup student ] @@ -627,7 +646,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { array set permission $permission_list global GradebookServerConfig global script_name - global grades_category + #global grades_category + set grades_category [ get_grades_category ] set defSortCol LastName if { $sort_col == {} } { @@ -1304,7 +1324,8 @@ proc ChangeColumn { permission_list user } { set category "unset" set category [SelectColValue4User $columnname _Col_Category_] set maxpoints [SelectColValue4User $columnname _Max_Points_] - global grades_category + #global grades_category + set grades_category [ get_grades_category ] puts {<div class="add_new_column">} puts "<form name=\"input\" method=\"post\" />" @@ -1545,7 +1566,8 @@ proc AddColumn { permission_list user } { proc AddColumnRequest { permission_list user } { global script_name - global grades_category + #global grades_category + set grades_category [ get_grades_category ] puts {<div class="add_new_column">} puts "<form name=\"input\" method=\"post\" />" puts {Column Name: <input type="text" name="columnname2add"><br>} @@ -1568,7 +1590,8 @@ proc AddColumnRequest { permission_list user } { proc ShowControls { permission_list user } { array set permission $permission_list global script_name - global grades_category + #global grades_category + set grades_category [ get_grades_category ] dbg "outputing contol list" puts "<div class=\"controls\">" set action_list [ list \ |