summaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl53
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 \