diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2012-01-25 23:02:31 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2012-01-25 23:02:31 -0500 |
commit | a1ee27f71282fa19b16d1b611bf52464ebbbb09b (patch) | |
tree | c79f1eb5389b80434488d1463470b61ce69961f5 | |
parent | 508a9c236c5354e07e7c97f04d95a09a108ce9d6 (diff) | |
download | GradeBook-a1ee27f71282fa19b16d1b611bf52464ebbbb09b.tar.gz GradeBook-a1ee27f71282fa19b16d1b611bf52464ebbbb09b.zip |
Added file with config and its generation from template. Main programs use it now.
-rwxr-xr-x | GradeBook.tcl | 5 | ||||
-rwxr-xr-x | GradeBook_lib.tcl | 4 | ||||
-rw-r--r-- | gb_config.template | 15 |
3 files changed, 22 insertions, 2 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index 9193cdf..fdc3dd0 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -24,6 +24,11 @@ set execution_start_time [clock microseconds] source ./GradeBook_lib.tcl +set config_file "./gb_config.tcl" +if { [file exists $config_file] && ("$config_file" ne "") } { + source $config_file +} + ::ncgi::parse # defaults diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 9a622d6..a20c890 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -12,7 +12,7 @@ source ./libBasicTableOperations.tcl set VERSION 2.0.0 # ######################################################################## -# this should be in config file +# this should be in config file but these are reasonable defaults array set GradebookServerConfig [list \ icon_dir "/~evmik/icons" \ use_icons true \ @@ -965,7 +965,7 @@ proc htmlFooter {permission_list} { set execution_time [ format "%.3g" [expr { ($execution_end_time - $execution_start_time)/1e6}] ] puts "<div class=\"footer\">" puts "Execution time $execution_time seconds. <br>" - puts "GradeBook $VERSION code is written by Eugeniy E. Mikhailov" + puts "GradeBook $VERSION by Eugeniy E. Mikhailov" puts "</div>" } diff --git a/gb_config.template b/gb_config.template new file mode 100644 index 0000000..58b899b --- /dev/null +++ b/gb_config.template @@ -0,0 +1,15 @@ +#!/bin/sh +# (C) 2012 by Eugeniy Mikhailov, <evgmik@gmail.com> +# vim:set ft=tcl: \ +exec tclsh "$0" "$@" + +set VERSION __VERSION__ + +array set GradebookServerConfig [list \ + icon_dir "/~evmik/icons" \ + use_icons true \ + grades_db_dir "./courses" \ + passwords_db_file "./passwd.db" \ + ] + +# vim: ts=2 sw=2 foldmethod=indent: |