diff options
-rwxr-xr-x | GradeBook_lib.tcl | 80 | ||||
-rwxr-xr-x | UpdateAccessRights.tcl | 2 | ||||
-rwxr-xr-x | csv2GradeBook.tcl | 2 | ||||
-rwxr-xr-x | libBasicTableOperations.tcl | 14 |
4 files changed, 49 insertions, 49 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index a92d1a2..10ee08c 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -9,7 +9,7 @@ package require Tcl 8.5 source ./libBasicTableOperations.tcl # internal version of this code -set VERSION 1.5.5 +set VERSION 2.0.0 # ######################################################################## # this should be in config file @@ -62,7 +62,7 @@ proc get_grades_category {} { } errStat ] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } #set grades_category [list \ #"unset"\ @@ -105,8 +105,8 @@ proc getGradingWeights { } { } } errStat ] if { $err } { - dbg "we should never be here if GradesCategoryTable exists" 1 - dbg $errStat 1 + dbg "we should never be here if GradesCategoryTable exists" msg_level_critical + dbg $errStat msg_level_critical htmlErrorMsg $errStat } return $category_name_weight_list @@ -114,7 +114,7 @@ proc getGradingWeights { } { proc isCalculateTotalForCategorySet { category } { if {![existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { - dbg "Category: $category does not exists in the GradesCategoryTable, setting CalculateTotal to false" 3 + dbg "Category: $category does not exists in the GradesCategoryTable, setting CalculateTotal to false" msg_level_warning return false } set flag [SelectColvalueFromTable GradesCategoryTable NeedsTotal CategoryName $category] @@ -134,8 +134,8 @@ proc allUserNamesInGroup { group } { } } errStat ] if { $err } { - dbg "we should never be here if UserName in GradesTable exists" 1 - dbg $errStat 1 + dbg "we should never be here if UserName in GradesTable exists" msg_level_critical + dbg $errStat msg_level_critical htmlErrorMsg $errStat } return $username_list @@ -227,7 +227,7 @@ proc calculteWeightedTotals { } { # no weighted total column created for categories which do no have at least 2 columns # check if Weighted Category Column exists if { $CategoryWeightedTolalName ni $all_column_names } { - dbg "Column $CategoryWeightedTolalName does not exist, will create it now" 1 + dbg "Column $CategoryWeightedTolalName does not exist, will create it now" msg_level_critical AddColumnNonWeb $CategoryWeightedTolalName weighted_column 0 } } else { @@ -260,7 +260,7 @@ proc calculteWeightedTotals { } { # now calculation of weighted grand total set grand_total_col_name "Grand Total" if { $grand_total_col_name ni $all_column_names } { - dbg "Column $grand_total_col_name does not exist, will create it now" 1 + dbg "Column $grand_total_col_name does not exist, will create it now" msg_level_critical AddColumnNonWeb $grand_total_col_name weighted_column 0 } foreach student $students_list { @@ -281,7 +281,7 @@ proc calculteWeightedTotals { } { } } if { $max_points($category,$student) == 0} { - dbg "Category: $category has 0 for total maximum points. Skipping it." 4 + dbg "Category: $category has 0 for total maximum points. Skipping it." msg_level_info continue } set grand_total($student) [ expr { $grand_total($student) + $weight*$points_sum($category,$student) } ] @@ -339,7 +339,7 @@ proc AddUserNonWeb { first_name last_name user_name {group_name {guest}} {id_num set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } @@ -348,7 +348,7 @@ proc AddCourseInfoTableItem { item value } { set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } @@ -359,7 +359,7 @@ proc UpdateCourseInfoTableItem { item value } { } errStat2 ] if { $err2 } { htmlErrorMsg $errStat2 - dbg "the following error happen: $errStat2" 3 + dbg "the following error happen: $errStat2" msg_level_critical } } @@ -367,7 +367,7 @@ proc CreateCourseInfoTable {db} { set err [catch {db eval {CREATE TABLE CourseInfoTable(Item text, Value text)} } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 1 + dbg "the following error happen: $errStat" msg_level_critical } AddCourseInfoTableItem course_title "Unset" AddCourseInfoTableItem course_year "Unset" @@ -384,7 +384,7 @@ proc SelectItemFromCourseInfoTable { item } { } errStat ] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } return $value } @@ -408,7 +408,7 @@ proc GetDefaultGradesTableColumn {} { proc ModifyNeedsTotalForGradesCategory {db category flag} { if {![existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { - dbg "Category: $category does not exists in the GradesCategoryTable, creating it" 3 + dbg "Category: $category does not exists in the GradesCategoryTable, creating it" msg_level_info AddGradesCategory db $category } UpdateColumnWithValueInTableWhere GradesCategoryTable NeedsTotal $flag CategoryName $category @@ -416,7 +416,7 @@ proc ModifyNeedsTotalForGradesCategory {db category flag} { proc ModifyWeightForGradesCategory {db category weight} { if {![existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { - dbg "Category: $category already does not exists in the GradesCategoryTable, creating it" 3 + dbg "Category: $category already does not exists in the GradesCategoryTable, creating it" msg_level_info AddGradesCategory db $category } UpdateColumnWithValueInTableWhere GradesCategoryTable CategoryWeight $weight CategoryName $category @@ -425,14 +425,14 @@ proc ModifyWeightForGradesCategory {db category weight} { proc AddGradesCategory {db category} { if {[existsColumnWithRowvalueInTable GradesCategoryTable CategoryName $category ]} { - dbg "Category: $category already exists in the GradesCategoryTable" 3 + dbg "Category: $category already exists in the GradesCategoryTable" msg_level_info return } set eval_str [concat INSERT INTO GradesCategoryTable (CategoryName) VALUES('$category')] set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } ModifyWeightForGradesCategory db $category 0 ModifyNeedsTotalForGradesCategory db $category false @@ -445,7 +445,7 @@ proc CreateGradesCategoryTable {db} { if { $err && ($errStat ne "table GradesCategoryTable already exists") } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 1 + dbg "the following error happen: $errStat" msg_level_critical } foreach category [default_grades_category] { @@ -478,7 +478,7 @@ proc UpdateGradesCategores { db permission_list user } { } errStat ] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } @@ -534,7 +534,7 @@ proc EditGradesCategories { db permission_list user } { puts "</table>" if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } puts {<input type="hidden" name="action" value="update_grades_categories"/>} puts {<input type="submit" name="subaction" value="Submit" />} @@ -565,7 +565,7 @@ proc CreateGradesTable {db} { set err [catch {db eval $sql_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 1 + dbg "the following error happen: $errStat" msg_level_critical } # add special users aka special info rows @@ -583,7 +583,7 @@ proc AddAccessRightNonWeb { action instructor_right ta_right student_right dropp set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } @@ -591,7 +591,7 @@ proc CreateAccessRightsTable {db} { set err [catch {db eval {CREATE TABLE AccessRightsTable(actionname text, instructor integer, ta integer, student integer, dropped integer, guest integer)} } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 1 + dbg "the following error happen: $errStat" msg_level_critical } # guest should have no rights make sure that 0 is evereywhere except logon # actionname instructor ta student dropped guest @@ -697,8 +697,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { set eval_str [concat SELECT * FROM GradesTable ORDER BY \"$sort_col\"] set err [catch {db eval $eval_str } errStat] if { $err } { - dbg $errStat 3 - dbg "changing to default sorting column $defSortCol" 3 + dbg $errStat msg_level_info + dbg "changing to default sorting column $defSortCol" msg_level_info set sort_col $defSortCol } @@ -761,8 +761,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { ta { set where_statement "WHERE GroupName=\"student\"" } student { set where_statement "WHERE UserName=\"$user\"" } dropped { set where_statement "WHERE UserName=\"$user\"" } - guest { dbg "Guest must not be allowed to set table view port. Aborting. This line is never executed" 0; exit } - default { dbg "Default must not be allowed to set table view port. Aborting. This line is never executed." 0; exit } + guest { dbg "Guest must not be allowed to set table view port. Aborting. This line is never executed" msg_level_critical; exit } + default { dbg "Default must not be allowed to set table view port. Aborting. This line is never executed." msg_level_critical; exit } } if { $sql_column_str ne "" } { # assign type cast for different sort_col @@ -859,8 +859,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { } } errStat_MP ] if { $errMaxPoints } { - dbg "we should never be here if UserName: _Max_Points_ exist in the table" 1 - dbg $errStat_MP 1 + dbg "we should never be here if UserName: _Max_Points_ exist in the table" msg_level_critical + dbg $errStat_MP msg_level_critical htmlErrorMsg $errStat_MP } puts "</tr>" @@ -914,8 +914,8 @@ proc htmlDBout {db permission_list user {sort_col {}}} { } } errStat ] if { $err } { - dbg "we should never be here if $sortCol exist in the table" 1 - dbg $errStat 1 + dbg "we should never be here if $sortCol exist in the table" msg_level_critical + dbg $errStat msg_level_critical htmlErrorMsg $errStat } puts "</table>" @@ -1075,7 +1075,7 @@ proc LogMeOn {} { global user_requested password set user_requested [::ncgi::value user guest] set password [::ncgi::value password guest] - dbg "Logging in and setting cookies" 4 + dbg "Logging in and setting cookies" msg_level_info ::ncgi::setCookie -name user -value $user_requested ::ncgi::setCookie -name password -value $password @@ -1087,7 +1087,7 @@ proc LogMeOn {} { } proc LogMeOff {} { - dbg "Logging off" 4 + dbg "Logging off" msg_level_info global user password #set user guest set password {} @@ -1545,7 +1545,7 @@ proc UpdateColValue4UserNameNonWeb { columnname username val } { } errStat2 ] if { $err2 } { htmlErrorMsg $errStat2 - dbg "the following error happen: $errStat2" 3 + dbg "the following error happen: $errStat2" msg_level_critical } } @@ -1556,7 +1556,7 @@ proc UpdateColValue4GroupNameNonWeb { columnname groupname val } { } errStat2 ] if { $err2 } { htmlErrorMsg $errStat2 - dbg "the following error happen: $errStat2" 3 + dbg "the following error happen: $errStat2" msg_level_critical } } @@ -1577,7 +1577,7 @@ proc UpdateGrades { permission_list user } { } errStat ] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } @@ -1631,7 +1631,7 @@ proc ChangeGrades { permission_list user } { puts "</table>" if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } puts {<input type="hidden" name="action" value="updategrades"/>} puts [concat <input type="hidden" name="columnname" value="$columnname"/>] @@ -1677,7 +1677,7 @@ proc AddColumnNonWeb { columnname2add column_category maxpointpossible {sql_type set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } UpdateColValue4UserNameNonWeb $columnname2add _Col_Category_ $column_category diff --git a/UpdateAccessRights.tcl b/UpdateAccessRights.tcl index 46da274..db28609 100755 --- a/UpdateAccessRights.tcl +++ b/UpdateAccessRights.tcl @@ -23,7 +23,7 @@ sqlite3 db $dbfile set eval_str [concat DROP TABLE AccessRightsTable] set err [catch {db eval $eval_str } errStat] if { $err } { - dbg $errStat 3 + dbg $errStat msg_level_critical } CreateAccessRightsTable db diff --git a/csv2GradeBook.tcl b/csv2GradeBook.tcl index 01e2d17..c880fad 100755 --- a/csv2GradeBook.tcl +++ b/csv2GradeBook.tcl @@ -35,7 +35,7 @@ proc AddUserNonWeb { first_name last_name user_name {group_name {guest}} {id_num set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } diff --git a/libBasicTableOperations.tcl b/libBasicTableOperations.tcl index 68781dc..c05a922 100755 --- a/libBasicTableOperations.tcl +++ b/libBasicTableOperations.tcl @@ -1,6 +1,6 @@ #!/bin/sh # FILE: "/home/evmik/src/my_src/GradeBook/libBasicTableOperations.tcl" -# LAST MODIFICATION: "Fri, 15 Apr 2011 20:38:36 -0400 (evmik)" +# LAST MODIFICATION: "Mon, 23 Jan 2012 00:19:39 -0500 (evmik)" # (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com> # $Id:$ # vim:set ft=tcl: \ @@ -19,8 +19,8 @@ proc getColListFromTable {table} { } } errStat ] if { $err } { - dbg "we should never be here if GradesTable exists" 1 - dbg $errStat 1 + dbg "we should never be here if GradesTable exists" msg_level_critical + dbg $errStat msg_level_critical htmlErrorMsg $errStat } return $all_column_names @@ -50,7 +50,7 @@ proc SelectColvalueFromTable { table column_of_interest col row_value } { if { $err } { set msg_text "the following error happen in proc SelectColvalueFromTable while selecting from table $table $errStat" htmlErrorMsg $msg_text - dbg $msg_text 3 + dbg $msg_text msg_level_critical set $value {} } return $value @@ -59,7 +59,7 @@ proc SelectColvalueFromTable { table column_of_interest col row_value } { proc existsColumnWithRowvalueInTable { table column row_value } { set sql_str [concat SELECT 1 FROM \'$table\' WHERE \"$column\"=\"$row_value\"] if {![db exists $sql_str]} { - dbg "Column \'$column\' does not have row with value \'$row_value\' in table \'$table\'" 3 + dbg "Column \'$column\' does not have row with value \'$row_value\' in table \'$table\'" msg_level_info return false } else { return true @@ -72,7 +72,7 @@ proc UpdateColumnWithValueInTableWhere { table column val where_column row_value if { $err } { set msg_str "Unable to update column $column in the table $table where $where_column=$row_value. The following error happen: $errStat" htmlErrorMsg $msg_str - dbg $msg_str 3 + dbg $msg_str msg_level_critical } } @@ -106,7 +106,7 @@ proc DeleteColumnFromTable { table columnname } { set err [catch {db eval $eval_str } errStat] if { $err } { htmlErrorMsg $errStat - dbg "the following error happen: $errStat" 3 + dbg "the following error happen: $errStat" msg_level_critical } } else { htmlErrorMsg "No column $columnname in the table $table" |