aboutsummaryrefslogtreecommitdiff
path: root/CreateCourseGradeBook.tcl
blob: 273b44fbe5e46767751b5857b9568265c3222e13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
# (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com>
# vim:set ft=tcl: \
exec tclsh "$0" "$@"

package require sqlite3
package require md5
package require json::write
source ./GradeBook_lib.tcl

if { $argc < 5 } {	
	puts {Usage:}
	puts "  $argv0 database_name instructor_login Year  Semester Class_Title \[instructor_first_name\] \[instructor_last_name\]"
	puts {}
	puts {Example:}
	puts [concat "  $argv0" { 2013_Spring_Phys742 eemikh@wm.edu  2013 Spring "Physics 742 - Solid State Physics" Eugeniy Mikhailov}]
	exit
}

set dbfile [lindex $argv 0] 
set instructor_login [lindex $argv 1] 

if { $argc >= 3 } {
	set course_year  [lindex $argv 2] 
} else {
	set course_year {Year Unset}
}

if { $argc >= 4 } {
	set course_semester  [lindex $argv 3] 
} else {
	set course_semester {Semester Unset}
}

if { $argc >= 5 } {
	set course_title  [lindex $argv 4] 
} else {
	set course_title {Title Unset}
}

if { $argc >= 6 } {
	set instructor_fname  [lindex $argv 5] 
} else {
	set instructor_fname {}
}

if { $argc >= 7 } {
	set instructor_lname  [lindex $argv 6] 
} else {
	set instructor_lname {}
}

sqlite3 db $dbfile


CreateCourseInfoTable db
CreateGradesTable db
CreateAccessRightsTable db
CreateGradesCategoryTable db

#AddUserNonWeb  first_name last_name user_name group_name id_number section_num i
AddUserNonWeb  $instructor_fname  $instructor_lname $instructor_login  instructor 

# reasonable defaults for hidden columns
set instructor_hidden_columns [list UserHiddenColums UserHiddenGroups IdNum UserHiddenGradeCategories]
UpdateColValue4GroupNameNonWeb UserHiddenColums instructor $instructor_hidden_columns

# change default course information
UpdateCourseInfoTableItem course_title    $course_title
UpdateCourseInfoTableItem course_year     $course_year
UpdateCourseInfoTableItem course_semester $course_semester

UpdateColValue4UserNameNonWeb UserHiddenGroups $instructor_login 	inforow

# vim: ts=2 sw=2 foldmethod=indent: