From 63574045f42044601bfc460bf844ea82387f421f Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Tue, 12 Feb 2008 22:57:48 -0700 Subject: [PATCH] Changes required to implement config files that can be overridden locally. This enables an end user to make .local config files, and edit them as appropriate, preventing future code upgrades from blowing away their site specific settings. --- bin/import_ward_data | 12 ++---- bin/merge_eq_ppi_eq_interview_tables | 12 ++---- bin/parse_ward_data | 12 ++---- doc/install.txt | 21 +++++----- inc/class.eq.inc.php | 28 +++++-------- setup/db_config | 13 ++++++ setup/eq_config | 60 ++++++++++++++++++++++++++++ 7 files changed, 104 insertions(+), 54 deletions(-) create mode 100644 setup/db_config create mode 100644 setup/eq_config diff --git a/bin/import_ward_data b/bin/import_ward_data index 53a3c3d..0e04f05 100755 --- a/bin/import_ward_data +++ b/bin/import_ward_data @@ -3,14 +3,10 @@ use DBI; use Getopt::Std; -################################################### -# GLOBALS -$dbname = "phpgroupware"; -$dbhost = "192.168.0.2"; # This can be an IP address or name -$dbport = 3306; -$dbuser = "phpgroupware"; # This may require an additional '\@localhost' -$dbpass = "phpgroupware"; -################################################### +$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir); +unshift @INC,("$mydir/../setup"); +if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; } +else { require "db_config"; } %hometeaching_data = (); %membership_data = (); diff --git a/bin/merge_eq_ppi_eq_interview_tables b/bin/merge_eq_ppi_eq_interview_tables index c53ed4f..cd7484b 100755 --- a/bin/merge_eq_ppi_eq_interview_tables +++ b/bin/merge_eq_ppi_eq_interview_tables @@ -3,14 +3,10 @@ use DBI; use Getopt::Std; -################################################### -# GLOBALS -$dbname = "phpgroupware"; -$dbhost = "192.168.0.2"; # This can be an IP address or name -$dbport = 3306; -$dbuser = "phpgroupware"; # This may require an additional '\@localhost' -$dbpass = "phpgroupware"; -################################################### +$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir); +unshift @INC,("$mydir/../setup"); +if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; } +else { require "db_config"; } ################################################### # Connect to the database diff --git a/bin/parse_ward_data b/bin/parse_ward_data index 7a3c072..e6d94fb 100755 --- a/bin/parse_ward_data +++ b/bin/parse_ward_data @@ -3,14 +3,10 @@ use DBI; use Getopt::Std; -################################################### -# GLOBALS -$dbname = "phpgroupware"; -$dbhost = "192.168.0.2"; # This can be an IP address or a name -$dbport = 3306; -$dbuser = "phpgroupware"; # This may require an additional '\@localhost' -$dbpass = "phpgroupware"; -################################################### +$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir); +unshift @INC,("$mydir/../setup"); +if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; } +else { require "db_config"; } %hometeaching_data = (); %membership_data = (); diff --git a/doc/install.txt b/doc/install.txt index 4521caa..406126e 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -16,7 +16,7 @@ Downloading https://eq.pippins.net/eq.tar It can also be obtained via the GIT revision control system by pulling from here: - http://git.pippins.net/eq/ + http://git.pippins.net/eq/.git Installing @@ -29,23 +29,22 @@ Installing need to assign this app to the users you want to have be able to use it. Enable it for each user by going to Site Admin -> User Accounts -> -> edit Make sure the "eq" application has a checkmark next to it under "Permissions this user has" - 4) Edit the LOCAL CONFIGURATION section of eq/inc/class.eq.inc.php - Make sure you update the path locations for your specific: - upload_target_path & script_path - 5) Edit the GLOBALS section of the eq/bin/import_ward_data script and fix the permissions - 6) Edit the GLOBALS section of the eq/bin/parse_ward_data script and fix the permissions - 7) Try to run eq/bin/import_ward_data & parse_ward_data scripts from the commandline + 4) Copy the setup/db_config to setup/db_config.local and change the values in .local appropriately. + 5) Copy the setup/eq_config to setup/eq_config.local and change the values in .local appropriately. + Make sure you update the path locations for your specific installation locations: + upload_target_path & application_path + 6) Try to run eq/bin/import_ward_data & parse_ward_data scripts from the commandline to check for any missing perl library dependencies and mysql connection. Just run them without command line args. Install the right perl modules until the scripts run without any errors. - 8) A graphical representation of the mysql schema used by this application can + 7) A graphical representation of the mysql schema used by this application can be found here: eq/sql/eq.jpg - 9) Click on the Admin tool in the EQ app to import your initial set of ward data + 8) Click on the Admin tool in the EQ app to import your initial set of ward data obtained from MLS into the EQ application. - 10) Click on the Admin tool and update the EQ Presidency Table appropriately. + 9) Click on the Admin tool and update the EQ Presidency Table appropriately. The most important thing at this point is to get your district leaders added for each district you have in your quorum. - 11) I highly recommend installing phpmyadmin to view/edit/debug mysql tables related to this tool. + 10) I highly recommend installing phpmyadmin to view/edit/debug mysql tables related to this tool. Requirements diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index ed9b2c4..5ac7c0a 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -68,25 +68,15 @@ class eq function eq() { - // LOCAL CONFIGURATION. PLEASE UPDATE AS APPROPRIATE. - $this->upload_target_path = "/home/users/eqpres/eq_data"; - $this->script_path = "/usr/share/phpgroupware/eq/bin"; - $this->default_ht_num_months = 3; - $this->default_ppi_num_months = 3; - $this->default_ppi_num_years = 0; - $this->default_int_num_quarters = 1; - $this->default_int_num_years = 0; - $this->default_att_num_quarters = 1; - $this->default_vis_num_years = 1; - $this->max_num_districts = 4; - $this->time_drop_down_lists = 1; - $this->monthly_hometeaching_interviews = 0; - $this->time_drop_down_list_inc = 15; - $this->default_visit_appt_duration = 45; - $this->default_ppi_appt_duration = 30; + if(file_exists('setup/eq_config.local')) { + include('setup/eq_config.local'); + } else { + include('setup/eq_config'); + } + + $this->script_path = "$this->application_path"."/bin"; $this->max_presidency_members = 99; $this->max_appointments = 32768; - // END LOCAL CONFIGURATION $this->db = $GLOBALS['phpgw']->db; $this->db2 = $this->db; @@ -2719,7 +2709,7 @@ class eq $stat_data = "$num_companionships Companionships
Interview Quarterly Totals:
"; // Print the hometeaching interview stats - if($this->monthly_hometeaching_interviews == 0) { //Quarterly + if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly for($m=$num_months; $m >=0; $m--) { $month = $current_month - $m; if(($month % 3) == 1) { $quarter_total = $ints[$m]; } @@ -2745,7 +2735,7 @@ class eq } // Display the totals - if($this->monthly_hometeaching_interviews == 0) { //Quarterly + if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly $quarter_total = 0; $totals = "$total_companionships Total Comps
Interview Quarterly Totals:
"; for($m=$num_months; $m >=0; $m--) { diff --git a/setup/db_config b/setup/db_config new file mode 100644 index 0000000..b6d6cb3 --- /dev/null +++ b/setup/db_config @@ -0,0 +1,13 @@ +################################################################################ +# This is a perl module included by the perl scripts for this EQ application. +# You must modify these values to match your system configuration. +# Save the resulting file as "db_config.local" in this setup dir. +# This will prevent your settings from being overwritten by future code updates. +################################################################################ + +$dbname = "phpgroupware"; +$dbhost = "192.168.0.2"; # This can be an IP address or name +$dbport = 3306; +$dbuser = "phpgroupware"; # This may require an additional '\@localhost' +$dbpass = "phpgroupware"; + diff --git a/setup/eq_config b/setup/eq_config new file mode 100644 index 0000000..5baf6c6 --- /dev/null +++ b/setup/eq_config @@ -0,0 +1,60 @@ +upload_target_path = "/home/users/eqpres/eq_data"; + +// The full path to the installation location of this module +$this->application_path = "/usr/local/www/data-dist/phpgroupware/eq"; + +// Use drop down lists when specifying times in the scheduling tools. +// If set to 0, free form text fields for the hour and minutes will be used instead. +// If set to 1, drop down lists will be used for the hour and minute fields +$this->time_drop_down_lists = 1; + +// Compute hometeaching interview stats per month or per quarter +// If set to 0, stats will be computed per quarter. +// If set to 1, stats will be computed per month. +$this->monthly_hometeaching_interview_stats = 0; + +// Specify the minute interval increment to use in the time drop down lists +$this->time_drop_down_list_inc = 15; + +// The default visit appointment duration in minutes +$this->default_visit_appt_duration = 45; + +// The default ppi appointment duration in minutes +$this->default_ppi_appt_duration = 30; + +// The default number of months of hometeaching history to show +$this->default_ht_num_months = 3; + +// The default number of months of ppi history to show +$this->default_ppi_num_months = 3; + +// The default number of years of ppi history to show +$this->default_ppi_num_years = 0; + +// The default number of quarters of hometeaching interviews to show +$this->default_int_num_quarters = 1; + +// The default number of years of hometeaching interviews to show +$this->default_int_num_years = 0; + +// The default number of quarters of attendance to show +$this->default_att_num_quarters = 1; + +// The default nubmer of years of visits to show +$this->default_vis_num_years = 1; + +// The maximum number of districts you will ever need to create +$this->max_num_districts = 4; + +?> -- 2.34.1