From a1ee27f71282fa19b16d1b611bf52464ebbbb09b Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 25 Jan 2012 23:02:31 -0500 Subject: Added file with config and its generation from template. Main programs use it now. --- GradeBook.tcl | 5 +++++ GradeBook_lib.tcl | 4 ++-- gb_config.template | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gb_config.template 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 "
" puts "Execution time $execution_time seconds.
" - puts "GradeBook $VERSION code is written by Eugeniy E. Mikhailov" + puts "GradeBook $VERSION by Eugeniy E. Mikhailov" puts "
" } 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, +# 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: -- cgit v1.2.3