Incorporated changes for release 1.1.1

This commit is contained in:
2026-02-14 11:26:01 -05:00
parent a6331f7fed
commit 16d1ff9bb8
45 changed files with 459 additions and 155 deletions

View File

@@ -27,17 +27,38 @@ Changelog
back button in terminal mode. back button in terminal mode.
- Added configurable help text for period effective selection. - Added configurable help text for period effective selection.
- Changed Sim period effective from selection to yes/no radio buttons. - Changed Sim period effective from selection to yes/no radio buttons.
- Writeup groups page shows collapsed list of groups. Click the expand icon - Writeup groups page shows collapsed list of groups. Click the expand
to expand each group. icon to expand each group.
- Fixed bug where entries made on stale create page had inaccurate date/time. - Fixed bug where entries made on stale create page had inaccurate
- For logged in users, added the ability to select writeups directly on the date/time.
View All Writeups page and assign/create a group. - For logged in users, added the ability to select writeups directly on
- On the Create New Writeup page, removed the default selections for Device, the View All Writeups page and assign/create a group.
Subsystem, and Period dropdowns, forcing user to make a selection. - On the Create New Writeup page, removed the default selections for
Device, Subsystem, and Period dropdowns, forcing user to make a
selection.
- Added a Today button to the View All Writeups page - Added a Today button to the View All Writeups page
- Changed the Period dropdowns on the Create, Search, and Group pages to show - Changed the Period dropdowns on the Create, Search, and Group pages to
the times instead of the period numbers. Period numbers are still shown show the times instead of the period numbers. Period numbers are
in the results tables with mouse hover showing times. still shown in the results tables with mouse hover showing times.
- Moved all installation/upgrade functions to the install.sh script. - Moved all installation/upgrade functions to the install.sh script.
1.1.1 - 2020-04-09
- Fixed opendrs-update.sql to rename the trainers table.
- Fixed bug where the About page didn't show the version number.
- Fixed some grammar on the About page.
- Fixed hardcoded help text in groups.php to use constant from config.
- Added ID to searchable parameters in search.php.
- Added sort parameters to search results.
- Added a link for Admins to access the local Webmin to manage a terminal.
- For Raspberry Pi:
- In terminal setup, provided missing .profile and
.config/openbox/rc.xml files.
- In server setup, install mariadb-server since
mysql-server is obsolete.
- Changed startdrs.sh to re-enable ctrl keys for copy/paste, etc. Also
added chromium flags to prevent update popup.
- Added openbox keybindings to customer user's rc.xml to trap dangerous
chromium hotkey combinations and enable ctrl-alt-del reboot.
- Changed systemd ctrl-alt-del.target symlink to point to
reboot.target.

View File

@@ -14,7 +14,7 @@ follow the prompts.
4. Log in 4. Log in
Click on the Log In menu option on the main page. If this is a fresh Click on the Log In menu option on the main page. If this is a fresh
installation The initial user is drsadmin and the initial password installation The initial user is drsadmin and the initial password
is OpenDRS-1. It is highly recommended that you changethis password is OpenDRS-1. It is highly recommended that you change this password
to a strong one by going to the Manage Database page under the to a strong one by going to the Manage Database page under the
Admin Functions menu. If this an upgrade, your current usernames and Admin Functions menu. If this an upgrade, your current usernames and
passwords are unchanged. passwords are unchanged.

View File

@@ -2,10 +2,15 @@
# server-setup.sh # server-setup.sh
# OpenDRS Online Discrepancy Reporting System # OpenDRS Online Discrepancy Reporting System
# Copyright (C) 2018 Rod Wright # Copyright (C) 2020 Rod Wright
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
inst_name="OpenDRS"
docroot_path="/var/www"
apache_user="www-data"
apache_group="www-data"
echo "" echo ""
echo "" echo ""
echo "" echo ""
@@ -30,6 +35,8 @@ sleep 10
apt update && apt dist-upgrade -y apt update && apt dist-upgrade -y
echo "...done." echo "...done."
echo "" echo ""
echo "IMPORTANT!: Be sure to make note of usernames and passwords you provide below."
echo "You will need them later."
echo "" echo ""
echo "Installing required server packages. Select apache2 as the web server to configure" echo "Installing required server packages. Select apache2 as the web server to configure"
echo "automatically. Choose Yes when prompted to install phpmyadmin database and allow it to" echo "automatically. Choose Yes when prompted to install phpmyadmin database and allow it to"
@@ -37,7 +44,7 @@ echo "generate a random password(leave the field blank)."
echo -n "Press enter to continue." echo -n "Press enter to continue."
read continueok read continueok
sleep 10 sleep 10
apt install -y apache2 php php-mcrypt mysql-server phpmyadmin apt install -y apache2 php php-mcrypt mariadb-server phpmyadmin uuid-runtime
cp etc/apache2/mods-available/alias.conf /etc/apache2/mods-available cp etc/apache2/mods-available/alias.conf /etc/apache2/mods-available
service apache2 restart service apache2 restart
echo "...done." echo "...done."
@@ -51,34 +58,168 @@ mysql_secure_installation
mysql mysql -e "update user set plugin='';flush privileges;" mysql mysql -e "update user set plugin='';flush privileges;"
echo "" echo ""
echo "" echo ""
echo "Installing OpenDRS."
DRS_VERSION="1.1.0" # This is a fresh install
install_path="/var/www/opendrs-$DRS_VERSION" operation="installed"
httpd_user_group="www-data:www-data" # prompt for mysql information
new_link_name="/var/www/opendrs" bad_mysql_adm=1
while [ $bad_mysql_adm -eq 1 ]
do
admintestdb="drsadm`date +%Y%m%d`"
echo "We need to know the username and password of a MySQL administrator"
echo "to be able to create the database and user for OpenDRS. Note that this"
echo "is not necessarily the same as the login and password for the computer."
echo -n "MySQL admin username: "
read mysql_adm_user
echo ""
echo -n "MySQL admin password: "
read -s mysql_adm_pass
export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -e "create database $admintestdb;drop database $admintestdb"
if [ $? -eq 0 ]
then
bad_mysql_adm=0
else
echo "ERROR: Either the username/password you supplied were incorrect or the user"
echo -n "is not a MySQL administrator. Try again? [Y/N]: "
read admtry
if [ "$admtry" != "Y" -o "$admtry" != "y" ]
then
exit
fi
fi
done
echo ""
echo "What would you like to call this installation of OpenDRS? If you accept"
echo "the default, it will be called $inst_name. If you will be running multiple"
echo "instances of OpenDRS on this server, you should choose a distinctive name."
echo -n "Installation name [$inst_name]: "
read inst_name
echo ""
# Create initial database
db_create_fail=1
while [ $db_create_fail -eq 1 ]
do
name_valid=0
while [ $name_valid -eq 0 ]
do
echo "What would you like to call the database for this installation of OpenDRS?"
echo "If you accept the default or make it blank, it will be $inst_name."
echo "Spaces or special characters are not allowed in the name."
echo -n "database name [$inst_name]: "
read new_db_name
if [ "$new_db_name" = "" ]
then
new_db_name=$inst_name
fi
echo $new_db_name|egrep -q "\W"
if [ $? -eq 0 ]
then
echo "The name you entered seems to contain whitespace or special"
echo "characters. Try again or just accept the default."
else
name_valid=1
fi
done
echo ""
export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -e "create database $new_db_name"
if [ $? -eq 0 ]
then
db_create_fail=0
else
echo "An error was encountered when trying to create the database."
echo "This probably means the database already exists."
echo -n "Try again with a different database name? [Y/N]: "
read dbcreatetry
if [ "$dbcreatetry" != "Y" -o "$dbcreatetry" != "y" ]
then
exit
fi
fi
done
# Create user and give rights to database
drs_user="$new_db_name-user"
drs_pass=`uuidgen`
export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'"
mysql -u"$mysql_adm_user" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'"
mysql -u"$mysql_adm_user" -e "flush privileges"
# Populate initial database
mysql -u"$mysql_adm_user" $new_db_name < ../opendrs-initial.sql
# Set the installation name
export MYSQL_PWD="$drs_pass"
mysql -u"$drs_user" $new_db_name -e "update config set value=\"$inst_name\",defaultvalue=\"$inst_name\" where name=\"app_name\""
# Create install path
echo "Creating installation directory . . ." echo "Creating installation directory . . ."
install_path=$docroot_path/$inst_name
mkdir $install_path mkdir $install_path
# Create db.php if it doesn't exist
if [ ! -f "$install_path/db.php" ]
then
cp ../db.php.template $install_path/db.php
sed -i "s/DBNAME/$new_db_name/g" $install_path/db.php
sed -i "s/DBUSER/$drs_user/g" $install_path/db.php
sed -i "s/DBPASS/$drs_pass/g" $install_path/db.php
fi
# copy distribution to install location
echo "Installing distribution . . ." echo "Installing distribution . . ."
cp -Rv ../distfiles/* $install_path cp -Rv ../distfiles/* $install_path
ln -s $install_path/writeups.php $install_path/index.php
# set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the OpenDRS installation"
echo -n "directory [$apache_user:$apache_group] :"
read httpd_user_group
echo ""
echo "Setting file ownership . . ." echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path chown -R $httpd_user_group $install_path
ln -s $install_path $new_link_name
cp etc/apache2/conf-available/opendrs.conf /etc/apache2/conf-available
cp etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available
a2enconf opendrs
echo "DRS_SERVER=\"http://localhost\"" > /etc/drs.conf
service apache2 restart
echo "" echo ""
echo "Server configuration is now complete. "
echo "Once the reboot is complete you will need to do the final installation of OpenDRS through" # tell user to launch web browser to continue
echo "the browser. You will need the password you set during the mysql installation above."
echo "" echo ""
echo "" echo ""
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2," echo ""
echo "log in as pi, then create new users for yourself and any other" echo "OpenDRS has been installed."
echo "administrators using the cloneuser command (cloneuser pi newlogin)."
echo "# OpenDRS default Apache configuration" > /etc/apache2/conf-available/$inst_name.conf
echo "" >> /etc/apache2/conf-available/$inst_name.conf
echo "Alias /$inst_name $install_path" >> /etc/apache2/conf-available/$inst_name.conf
echo "" >> /etc/apache2/conf-available/$inst_name.conf
echo "<Directory $install_path>" >> /etc/apache2/conf-available/$inst_name.conf
echo " Options FollowSymLinks" >> /etc/apache2/conf-available/$inst_name.conf
echo " DirectoryIndex index.php" >> /etc/apache2/conf-available/$inst_name.conf
echo "</Directory>" >> /etc/apache2/conf-available/$inst_name.conf
a2enconf $inst_name
service apache2 reload
echo "OpenDRS server setup is complete."
echo ""
echo "Once the reboot is complete you will need to do the final installation of $inst_name through"
echo "the browser. You will need the mysql username and password you set during the mysql installation above."
echo "" echo ""
echo "" echo ""
echo -n "Press enter to reboot now." echo "Once the final install is done, you will need to log in to $inst_name to configure it."
read rebootok echo "IMPORTANT: The default login credentials for the initial admin user are:"
reboot echo ""
echo "login: drsadmin"
echo "password: OpenDRS-1"
echo ""
echo "REMEMBER THESE CREDENTIALS. Otherwise, you will not be able to log in and"
echo "configure your new installation."
echo "It is highly recommended that you change the initial password to something"
echo "secure after logging in for the first time."
echo "DRS_SERVER=\"http://localhost/$inst_name\"" > /etc/drs.conf

View File

@@ -2,7 +2,7 @@
# terminal-setup.sh # terminal-setup.sh
# OpenDRS Online Maintenance Tracking System # OpenDRS Online Maintenance Tracking System
# Copyright (C) 2018 Rod Wright # Copyright (C) 2020 Rod Wright
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
@@ -46,8 +46,6 @@ chmod +x usr/local/bin/*
cp usr/local/bin/* /usr/local/bin cp usr/local/bin/* /usr/local/bin
cp etc/apt/sources.list.d/* /etc/apt/sources.list.d cp etc/apt/sources.list.d/* /etc/apt/sources.list.d
cp lib/systemd/system/getty@tty1.service /lib/systemd/system cp lib/systemd/system/getty@tty1.service /lib/systemd/system
rm /lib/systemd/system/ctrl-alt-del.target
ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
echo "...done." echo "...done."
echo "" echo ""
echo "" echo ""
@@ -80,7 +78,7 @@ read continueok
echo "" echo ""
echo "" echo ""
echo "Creating customer user..." echo "Creating customer user..."
cloneuser pi customer cloneuser `who am i | awk '{print $1}'` customer
mkdir -p /home/customer/.config/openbox mkdir -p /home/customer/.config/openbox
cp home/customer/.profile /home/customer cp home/customer/.profile /home/customer
cp home/customer/.config/openbox/rc.xml /home/customer/.config/openbox cp home/customer/.config/openbox/rc.xml /home/customer/.config/openbox
@@ -89,32 +87,27 @@ echo "...done."
echo "" echo ""
echo "" echo ""
echo "This terminal will need to communicate with an OpenDRS server. If" echo "This terminal will need to communicate with an OpenDRS server. If"
echo "you intend to host the server directly on this terminal, accept the" echo "you intend to host the server directly on this terminal, leave this"
echo "default URL shown. Otherwise, enter the server URL." echo -n "blank. Otherwise, enter the server URL :"
echo -n "[http://localhost] :"
read server_url read server_url
if [[ $server_url == "" ]] if [[ $server_url == "" ]]
then then
server_url="http://localhost" conftype="Server/Terminal"
fi touch /etc/drs.conf
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
echo ""
echo ""
echo "Terminal configuration is now complete. "
echo ""
echo ""
echo "If this Raspberry Pi will also be used as the OpenDRS server, you will need"
echo "to run the server-setup.sh script in this same directory."
echo "Would you like to do that now? enter Y if so, or press enter to leave this"
echo -n "as a terminal only and reboot :"
read serverchoice
if [[ $serverchoice == "Y" || $serverchoice == "y" ]]
then
./server-setup.sh ./server-setup.sh
else
conftype="Terminal"
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
fi fi
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2," echo ""
echo "log in as pi, then create new users for yourself and any other" echo ""
echo "administrators using the cloneuser command (cloneuser pi newlogin)." echo "$conftype configuration is now complete. "
echo ""
echo ""
echo "It is highly recommended that after rebooting, you run ssh pi@$HOSTNAME"
echo "from another computer on the network, then create new users for"
echo "yourself and any other administrators using the cloneuser command"
echo "(cloneuser pi <new username>)."
echo "" echo ""
echo "" echo ""
echo "Setup complete." echo "Setup complete."

View File

@@ -2,17 +2,27 @@
SRC=$1 SRC=$1
DEST=$2 DEST=$2
if [ $# -ne 2 ]; then
echo "Usage: cloneuser source_user destination_user"
exit 1
fi
if ! grep -q $SRC /etc/passwd ;then echo "Source user doesn't exist!"; exit 1; fi
if grep -q $DEST /etc/passwd ;then echo "Destination user already exists!"; exit 1; fi
SRC_GROUPS=`id -Gn ${SRC}` SRC_GROUPS=`id -Gn ${SRC}`
SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd) SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd)
RAND_PW=`date +%s | sha256sum | base64 | head -c 32 ; echo`
echo "Creating user $DEST" echo "Creating user $DEST with a random password"
useradd --shell ${SRC_SHELL} --create-home ${DEST} useradd --shell ${SRC_SHELL} --password ${RAND_PW} --create-home ${DEST}
for grp in ${SRC_GROUPS};do for grp in ${SRC_GROUPS};do
if [ "$grp" != "$SRC" ]; then if [ "$grp" != "$SRC" ]; then
echo "Adding user $DEST to group $grp." echo "Adding user $DEST to group $grp."
usermod -a -G $grp ${DEST} usermod -a -G $grp ${DEST}
fi fi
done done
passwd ${DEST} echo "Finished. Please set an actual password for $DEST if you want them to be able to log in."

View File

@@ -7,18 +7,16 @@ openbox-session &
xset s off xset s off
xset +dpms xset +dpms
xset dpms 0 600 1800 xset dpms 0 600 1800
#xset dpms force off
while true while true
do do
killall chromium-browser killall chromium-browser
rm -rf ~/.{config,cache}/chromium/ rm -rf ~/.{config,cache}/chromium/
# start browser in your web site: here, just plain old localhost # start browser to DRS Server
# -test-type will ignore any warnings and # --test-type will ignore any warnings and
# --ignore-certificate-errors will allow you to kiosk any https-page without displaying certificate errors # --ignore-certificate-errors will allow you to kiosk any https-page without displaying certificate errors
chromium-browser -test-type --ignore-certificate-errors --kiosk --no-first-run --incognito $DRS_SERVER & chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
sleep 10 sleep 10
@@ -27,8 +25,8 @@ do
pgrep chromium-browse pgrep chromium-browse
if [ "$?" -eq "1" ] if [ "$?" -eq "1" ]
then then
# here you could execute something that is supposed to happen after the browser was accidentally quit # relaunch browser if it terminates
chromium-browser -test-type --ignore-certificate-errors --kiosk --no-first-run --incognito $DRS_SERVER & chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
fi fi
sleep 1 sleep 1
done done

View File

@@ -2,7 +2,7 @@
/* /*
boilerplate.php boilerplate.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -3,7 +3,7 @@
/* /*
db.php db.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -1,5 +1,5 @@
OpenDRS - Online Discrepancy Reporting System OpenDRS - Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -27,17 +27,37 @@ Changelog
back button in terminal mode. back button in terminal mode.
- Added configurable help text for period effective selection. - Added configurable help text for period effective selection.
- Changed Sim period effective from selection to yes/no radio buttons. - Changed Sim period effective from selection to yes/no radio buttons.
- Writeup groups page shows collapsed list of groups. Click the expand icon - Writeup groups page shows collapsed list of groups. Click the expand
to expand each group. icon to expand each group.
- Fixed bug where entries made on stale create page had inaccurate date/time. - Fixed bug where entries made on stale create page had inaccurate
- For logged in users, added the ability to select writeups directly on the date/time.
View All Writeups page and assign/create a group. - For logged in users, added the ability to select writeups directly on
- On the Create New Writeup page, removed the default selections for Device, the View All Writeups page and assign/create a group.
Subsystem, and Period dropdowns, forcing user to make a selection. - On the Create New Writeup page, removed the default selections for
Device, Subsystem, and Period dropdowns, forcing user to make a
selection.
- Added a Today button to the View All Writeups page - Added a Today button to the View All Writeups page
- Changed the Period dropdowns on the Create, Search, and Group pages to show - Changed the Period dropdowns on the Create, Search, and Group pages to
the times instead of the period numbers. Period numbers are still shown show the times instead of the period numbers. Period numbers are
in the results tables with mouse hover showing times. still shown in the results tables with mouse hover showing times.
- Moved all installation/upgrade functions to the install.sh script. - Moved all installation/upgrade functions to the install.sh script.
1.1.1 - 2020-04-09
- Fixed opendrs-update.sql to rename the trainers table.
- Fixed bug where the About page didn't show the version number.
- Fixed some grammar on the About page.
- Fixed hardcoded help text in groups.php to use constant from config.
- Added ID to searchable parameters in search.php.
- Added sort parameters to search results.
- Added a link for Admins to access the local Webmin to manage a terminal.
- For Raspberry Pi:
- In terminal setup, provided missing .profile and
.config/openbox/rc.xml files.
- In server setup, install mariadb-server since
mysql-server is obsolete.
- Changed startdrs.sh to re-enable ctrl keys for copy/paste, etc. Also
added chromium flags to prevent update popup.
- Added openbox keybindings to customer user's rc.xml to trap dangerous
chromium hotkey combinations and enable ctrl-alt-del reboot.
- Changed systemd ctrl-alt-del.target symlink to point to
reboot.target.

View File

@@ -14,7 +14,7 @@ follow the prompts.
4. Log in 4. Log in
Click on the Log In menu option on the main page. If this is a fresh Click on the Log In menu option on the main page. If this is a fresh
installation The initial user is drsadmin and the initial password installation The initial user is drsadmin and the initial password
is OpenDRS-1. It is highly recommended that you changethis password is OpenDRS-1. It is highly recommended that you change this password
to a strong one by going to the Manage Database page under the to a strong one by going to the Manage Database page under the
Admin Functions menu. If this an upgrade, your current usernames and Admin Functions menu. If this an upgrade, your current usernames and
passwords are unchanged. passwords are unchanged.

View File

@@ -2,7 +2,7 @@
/* /*
about.php about.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
@@ -39,6 +39,7 @@ if ($print) {
// assign variables from constants // assign variables from constants
$appname=APP_NAME; $appname=APP_NAME;
$drs_version=DRS_VERSION;
if ($print=="Printer Friendly") { if ($print=="Printer Friendly") {
$sbcolor=P_SIDEBAR_COLOR; $sbcolor=P_SIDEBAR_COLOR;
@@ -72,7 +73,7 @@ echo "<br>";
echo " echo "
<h3 align=\"center\"> <h3 align=\"center\">
OpenDRS $version Discrepancy Reporting System OpenDRS $drs_version Discrepancy Reporting System
</h3><br> </h3><br>
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link <p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2018 by Rod Wright. or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2018 by Rod Wright.
@@ -119,7 +120,7 @@ server.</td>
<tr> <tr>
<td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\" <td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\"
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenDRS are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenDRS are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and are licensed under a <a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and is licensed under the
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td> <a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
</tr> </tr>

View File

@@ -2,7 +2,7 @@
/* /*
common.php common.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
@@ -357,7 +357,7 @@ function sidemenu($printable=true) {
echo " echo "
<br> <br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\"> <table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\"><font size=\"+1\"><b>View Open Writeups</b></font></a></td></tr> <tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\">View Open Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr> <tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr> <tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr> <tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
@@ -374,6 +374,7 @@ function sidemenu($printable=true) {
<tr><td align=\"center\"><b>Admin Functions</b></td></tr> <tr><td align=\"center\"><b>Admin Functions</b></td></tr>
<tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr> <tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr>
<tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr> <tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr>
<tr><td align=\"center\"><a href=\"https://localhost:10000\" title=\"Webmin for managing a terminal. Webmin must be running on localhost.\">Manage Terminal</a></td></tr>
</table> </table>
<br> <br>
"; ";

View File

@@ -2,7 +2,7 @@
/* /*
config.php config.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
create.php create.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
dbadmin.php dbadmin.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
gpl.php gpl.php
OpenMTS Online Maintenance Tracking System OpenMTS Online Maintenance Tracking System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
groups.php groups.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
@@ -490,8 +490,7 @@ if ($action=="add") {
"; ";
// Period effective cell ************ // Period effective cell ************
echo " echo "
Sim period effective? &nbsp; <img src=\"icons/question.png\" title=\"If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Sim period effective? &nbsp; <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
Otherwise, answer Effective. \"><br>
"; ";
if ($search) { if ($search) {
$effstate=$nefstate=""; $effstate=$nefstate="";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 481 B

View File

@@ -2,7 +2,7 @@
/* /*
login.php login.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
profile.php profile.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
search.php search.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
@@ -42,9 +42,12 @@ $s_action_by=$incoming['s_action_by'];
$s_action_reason=$incoming['s_action_reason']; $s_action_reason=$incoming['s_action_reason'];
$s_action_text=$incoming['s_action_text']; $s_action_text=$incoming['s_action_text'];
$s_subsystem=$incoming['s_subsystem']; $s_subsystem=$incoming['s_subsystem'];
$s_id=$incoming['s_id'];
$s_discrepancy_text=$incoming['s_discrepancy_text']; $s_discrepancy_text=$incoming['s_discrepancy_text'];
$s_status=$incoming['s_status']; $s_status=$incoming['s_status'];
$s_group=$incoming['s_group']; $s_group=$incoming['s_group'];
$sort=$incoming['sort'];
$order=$incoming['order'];
// assign variables from constants // assign variables from constants
$appname=APP_NAME; $appname=APP_NAME;
@@ -79,6 +82,7 @@ if ($search) {
$s_reported_by=trim($s_reported_by); $s_reported_by=trim($s_reported_by);
$s_action_text=trim($s_action_text); $s_action_text=trim($s_action_text);
$s_discrepancy_text=trim($s_discrepancy_text); $s_discrepancy_text=trim($s_discrepancy_text);
$s_id=trim($s_id);
// build the query string // build the query string
$query_string=""; $query_string="";
@@ -114,6 +118,16 @@ if ($search) {
$query_string="{$query_string})"; $query_string="{$query_string})";
$query_string="{$query_string} and "; $query_string="{$query_string} and ";
} }
// id
if ($s_id) {
$query_string="{$query_string}(";
$query_string="{$query_string}id={$s_id}";
$query_string="{$query_string})";
$query_string="{$query_string} and ";
$id_param="ID: {$s_id}";
} else {
$id_param="ID: any";
}
// period // period
if ($s_period) { if ($s_period) {
$query_string="{$query_string}("; $query_string="{$query_string}(";
@@ -265,7 +279,7 @@ if ($search) {
} }
$query_string=rtrim($query_string," and "); $query_string=rtrim($query_string," and ");
$query_string="select * from writeups where {$query_string} order by report_date asc"; $query_string="select * from writeups where {$query_string} order by $sort $order";
// group membership // group membership
if ($s_group) { if ($s_group) {
@@ -301,6 +315,16 @@ if (!$print) {
<tr> <tr>
<td align=\"left\"> <td align=\"left\">
"; ";
// ID cell *****************
echo "
ID<br>
<input type=\"text\" name=\"s_id\" size=\"10\" value=\"$s_id\">
";
// **********************************
echo "
</td>
<td align=\"left\">
";
// Device cell ********************* // Device cell *********************
echo " echo "
Device<br> Device<br>
@@ -340,7 +364,7 @@ if (!$print) {
"; ";
// ********************************** // **********************************
echo " echo "
</td><td></td> </td>
"; ";
echo " echo "
</tr> </tr>
@@ -566,6 +590,44 @@ if (!$print) {
} else { } else {
$summarystat="checked"; $summarystat="checked";
} }
$idsort=$statussort=$datesort=$periodsort=$devicesort=$subsyssort=$repbysort=$discrepsort=$effsort="";
switch ($sort) {
case "id":
$idsort="checked";
break;
case "status":
$statussort="checked";
break;
case "report_date":
$datesort="checked";
break;
case "period":
$periodsort="checked";
break;
case "device":
$devicesort="checked";
break;
case "subsystem":
$subsyssort="checked";
break;
case "reported_by":
$repbysort="checked";
break;
case "discrepancy_text":
$discrepsort="checked";
break;
case "period_effective":
$effsort="checked";
break;
default:
$datesort="checked";
}
$ascsort=$descsort="";
if ($order=="desc") {
$descsort="checked";
} else {
$ascsort="checked";
}
echo "</td> echo "</td>
</tr> </tr>
</table> </table>
@@ -573,6 +635,20 @@ if (!$print) {
<input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>&nbsp;&nbsp;&nbsp; <input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label> <input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label>
<br><br> <br><br>
Sort Field:<br>
<input type=\"radio\" $idsort name=\"sort\" value=\"id\" id=\"idview\" ><label for=\"idview\" title=\"Sort by ID.\">ID</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $statussort name=\"sort\" value=\"status\" id=\"statusview\" ><label for=\"statusview\" title=\"Sort by Status.\">Status</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $datesort name=\"sort\" value=\"report_date\" id=\"dateview\" ><label for=\"dateview\" title=\"Sort by Report Date.\">Date</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $periodsort name=\"sort\" value=\"period\" id=\"periodview\" ><label for=\"periodview\" title=\"Sort by Period.\">Period</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $devicesort name=\"sort\" value=\"device\" id=\"deviceview\" ><label for=\"deviceview\" title=\"Sort by Device.\">Device</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $subsyssort name=\"sort\" value=\"subsystem\" id=\"subsysview\" ><label for=\"subsysview\" title=\"Sort by Subsystem.\">Subsystem</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $repbysort name=\"sort\" value=\"reported_by\" id=\"repbyview\" ><label for=\"repbyview\" title=\"Sort by Reported by.\">Reported by</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $discrepsort name=\"sort\" value=\"discrepancy_text\" id=\"discrepview\" ><label for=\"discrepview\" title=\"Sort by Discrepancy.\">Discrepancy</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $effsort name=\"sort\" value=\"period_effective\" id=\"effview\" ><label for=\"effview\" title=\"Sort by Mission Effective.\">Msn Eff</label>&nbsp;&nbsp;&nbsp;
<br>Sort Order:<br>
<input type=\"radio\" $ascsort name=\"order\" value=\"asc\" id=\"ascview\" ><label for=\"ascview\" title=\"Sort results in ascending order.\">Ascending</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $descsort name=\"order\" value=\"desc\" id=\"descview\" ><label for=\"descview\" title=\"Sort results in descending order.\">Descending</label>&nbsp;&nbsp;&nbsp;
<br><br>
<input type=\"submit\" name=\"search\" value=\"Search\"> <input type=\"submit\" name=\"search\" value=\"Search\">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"cancel\" value=\"Start New Search\"> <input type=\"submit\" name=\"cancel\" value=\"Start New Search\">
@@ -602,6 +678,7 @@ if ($search) {
<td><b>$status_param</b></td><td>&nbsp;&nbsp;&nbsp;</td> <td><b>$status_param</b></td><td>&nbsp;&nbsp;&nbsp;</td>
<td>$device_param</td><td>&nbsp;&nbsp;&nbsp;</td> <td>$device_param</td><td>&nbsp;&nbsp;&nbsp;</td>
<td>$subsystem_param</td><td>&nbsp;&nbsp;&nbsp;</td> <td>$subsystem_param</td><td>&nbsp;&nbsp;&nbsp;</td>
<td>$id_param</td><td>&nbsp;&nbsp;&nbsp;</td>
</tr> </tr>
</table> </table>
<table border=\"0\"> <table border=\"0\">

View File

@@ -2,7 +2,7 @@
/* /*
settings.php settings.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
writeupdetail.php writeupdetail.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */

View File

@@ -2,7 +2,7 @@
/* /*
writeups.php writeups.php
OpenDRS Online Discrepancy Reporting System OpenDRS Online Discrepancy Reporting System
Copyright (C) 2018 Rod Wright Copyright (C) 2020 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
@@ -58,7 +58,6 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
"; ";
if ($print) { if ($print) {
echo " echo "
<form method=post action=\"writeups.php\">
Open writeups between&nbsp;&nbsp; $start_date and $end_date Open writeups between&nbsp;&nbsp; $start_date and $end_date
"; ";
} else { } else {
@@ -175,20 +174,27 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
echo " echo "
<form method=post action=\"writeups.php\"> <form method=post action=\"writeups.php\">
<input type=\"hidden\" name=\"view\" value=\"1\"> <input type=\"hidden\" name=\"view\" value=\"1\">
Writeups between&nbsp;&nbsp;
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\">&nbsp;&nbsp; and &nbsp;&nbsp;
<input type=\"text\" name=\"end_date\" size=\"10\" value=\"$end_date\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"; ";
if(!$print) { if(!$print) {
echo " echo "
<input type=\"submit\" name=\"update\" value=\"Update\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"showtoday\" value=\"Today\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"submit\" name=\"showtoday\" value=\"Today\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\"><br><br> <input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
}
echo "
Writeups between&nbsp;&nbsp;
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\">&nbsp;&nbsp; and &nbsp;&nbsp;
<input type=\"text\" name=\"end_date\" size=\"10\" value=\"$end_date\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\"><br><br>
";
if(!$print) {
echo "
<input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>&nbsp;&nbsp;&nbsp; <input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>&nbsp;&nbsp;&nbsp;
<input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label> <input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label>
<br><br>"; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"update\" value=\"Update\">
<br><br>
";
} }
$writeup=mysqli_query($drs_db,"select * from writeups where report_date between \"$start_date\" and \"$end_date\" order by report_date desc,period desc,report_time desc"); $writeup=mysqli_query($drs_db,"select * from writeups where report_date between \"$start_date\" and \"$end_date\" order by report_date desc,period desc,report_time desc");
if (mysqli_num_rows($writeup)) { if (mysqli_num_rows($writeup)) {
@@ -306,7 +312,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
if ($role) { if ($role) {
echo " echo "
<br><br> <br><br>
<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Add selected to group:</button>&nbsp;&nbsp;&nbsp;<select name=\"togroup\" id=\"sel-togroup\"> Add selected to group:&nbsp;&nbsp;&nbsp;<select name=\"togroup\" id=\"sel-togroup\">
<option value=\"newgroup\">New group</option> <option value=\"newgroup\">New group</option>
"; ";
$tgrow=mysqli_query($drs_db,"select id,name from groups order by id asc"); $tgrow=mysqli_query($drs_db,"select id,name from groups order by id asc");
@@ -315,6 +321,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
} }
echo " echo "
</select> </select>
&nbsp;&nbsp;&nbsp;<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Submit</button>
"; ";
} }
} else { } else {

View File

@@ -2,12 +2,12 @@
# install.sh # install.sh
# OpenDRS Online Discrepancy Reporting System # OpenDRS Online Discrepancy Reporting System
# Copyright (C) 2018 Rod Wright # Copyright (C) 2020 Rod Wright
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
DRS_VERSION="1.1.0" DRS_VERSION="1.1.1"
DOC_ROOT="/var/www" DOC_ROOT="/var/www"
INSTALL_LOC="opendrs" INSTALL_LOC="opendrs"
APACHE_USER="www-data" APACHE_USER="www-data"
@@ -42,15 +42,6 @@ echo ""
echo -n "Enter name of OpenDRS installation directory [$INSTALL_LOC] :" echo -n "Enter name of OpenDRS installation directory [$INSTALL_LOC] :"
read install_loc_in read install_loc_in
echo "" echo ""
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the OpenDRS installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
echo ""
if [ "$doc_root_in" = "" ] if [ "$doc_root_in" = "" ]
then then
doc_root_in=$DOC_ROOT doc_root_in=$DOC_ROOT
@@ -59,10 +50,6 @@ if [ "$install_loc_in" = "" ]
then then
install_loc_in=$INSTALL_LOC install_loc_in=$INSTALL_LOC
fi fi
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
install_path="$doc_root_in/$install_loc_in" install_path="$doc_root_in/$install_loc_in"
if [ -d "$install_path" ] if [ -d "$install_path" ]
then then
@@ -90,22 +77,36 @@ then
curr_dbname=`grep dbname $install_path/db.php | head -1 | cut -d "\"" -f2` curr_dbname=`grep dbname $install_path/db.php | head -1 | cut -d "\"" -f2`
curr_username=`grep username $install_path/db.php | head -1 | cut -d "\"" -f2` curr_username=`grep username $install_path/db.php | head -1 | cut -d "\"" -f2`
curr_dbpass=`grep dbpass $install_path/db.php | head -1 | cut -d "\"" -f2` curr_dbpass=`grep dbpass $install_path/db.php | head -1 | cut -d "\"" -f2`
mysqldump -u"$curr_username" -p"$curr_dbpass" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql export MYSQL_PWD="$curr_dbpass"
mysqldump -u"$curr_username" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql
# back up existing installation # back up existing installation
echo "Backing up current installation to the package directory." echo "Backing up current installation to the package directory."
cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
# delete all existing installation files except db.php # delete all existing installation files except db.php
find $install_path/ -mindepth 1 -not -name 'db.php' -delete find $install_path/ -mindepth 1 -not -name 'db.php' -delete
# apply database updates # apply database updates
mysql -u"$curr_username" -p"$curr_dbpass" $curr_dbname < opendrs-update.sql mysql -u"$curr_username" $curr_dbname < opendrs-update.sql >/dev/null 2>&1
# apply updates to existing db.php # apply updates to existing db.php
./opendrs-update.sh $install_path ./opendrs-update.sh $install_path
# copy distribution to install location # copy distribution to install location
echo "Installing distribution . . ." echo "Installing distribution . . ."
cp -R distfiles/* $install_path cp -R distfiles/* $install_path
# set ownership # set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the OpenDRS installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo ""
echo "Setting file ownership . . ." echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path chown -R $httpd_user_group $install_path
else else
echo "Cancelling installation" echo "Cancelling installation"
exit exit
@@ -138,7 +139,8 @@ else
echo "" echo ""
echo -n "MySQL admin password: " echo -n "MySQL admin password: "
read -s mysql_adm_pass read -s mysql_adm_pass
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create database $admintestdb;drop database $admintestdb" 2>/dev/null export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -e "create database $admintestdb;drop database $admintestdb"
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
bad_mysql_adm=0 bad_mysql_adm=0
@@ -171,8 +173,13 @@ else
echo "distinctive name." echo "distinctive name."
echo -n "database name [opendrs]: " echo -n "database name [opendrs]: "
read new_db_name read new_db_name
if [ "$new_db_name" = "" ]
then
new_db_name=opendrs
fi
echo "" echo ""
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create database $new_db_name" 2>/dev/null export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -e "create database $new_db_name"
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
db_create_fail=0 db_create_fail=0
@@ -191,15 +198,17 @@ else
# Create user and give rights to database # Create user and give rights to database
drs_user="$new_db_name`date +%Y%m%d%H%M%S`" drs_user="$new_db_name`date +%Y%m%d%H%M%S`"
drs_pass=`uuidgen` drs_pass=`uuidgen`
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'" 2>/dev/null export MYSQL_PWD="$mysql_adm_pass"
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'" mysql -u"$mysql_adm_user" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'"
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "flush privileges" mysql -u"$mysql_adm_user" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'"
mysql -u"$mysql_adm_user" -e "flush privileges"
# Populate initial database # Populate initial database
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" $new_db_name < opendrs-initial.sql 2>/dev/null mysql -u"$mysql_adm_user" $new_db_name < opendrs-initial.sql
# Set the installation name # Set the installation name
mysql -u"$drs_user" -p"$drs_pass" $new_db_name -e "update config set value=\"$new_inst_name\",defaultvalue=\"$new_inst_name\" where name=\"app_name\"" export MYSQL_PWD="$drs_pass"
mysql -u"$drs_user" $new_db_name -e "update config set value=\"$new_inst_name\",defaultvalue=\"$new_inst_name\" where name=\"app_name\""
# Create install path # Create install path
echo "Creating installation directory . . ." echo "Creating installation directory . . ."
@@ -219,8 +228,21 @@ else
cp -Rv distfiles/* $install_path cp -Rv distfiles/* $install_path
# set ownership # set ownership
echo "In order to set the ownership correctly, we need to know the user and"
echo "group that the webserver expects its files to be owned by. This is"
echo "usually not the root account. Refer to the ownership of other files in"
echo "your webserver's document tree to see what this should be."
echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the OpenDRS installation"
echo -n "directory [$APACHE_USER:$APACHE_GROUP] :"
read httpd_user_group
if [ "$httpd_user_group" = "" ]
then
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
fi
echo ""
echo "Setting file ownership . . ." echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path chown -R $httpd_user_group $install_path
fi fi
echo "" echo ""

View File

@@ -63,7 +63,7 @@ CREATE TABLE `config` (
LOCK TABLES `config` WRITE; LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */; /*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'drs_version','1.1.0','1.1.0'),(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),(6,'banner','1','1'),(7,'background_color','0B3144','0B3144'),(8,'p_background_color','FFFFFF','FFFFFF'),(11,'menubg_color','000000','000000'),(12,'p_menubg_color','FFFFFF','FFFFFF'),(13,'text_color','FFFFFF','FFFFFF'),(14,'p_text_color','000000','000000'),(15,'link_color','79EFEA','79EFEA'),(16,'p_link_color','000000','000000'),(17,'vlink_color','79EFEA','79EFEA'),(18,'p_vlink_color','000000','000000'),(19,'heading_color','5AE2B3','5AE2B3'),(20,'p_heading_color','000000','000000'),(21,'footer_message','Please report bugs to Rod Wright (software@rodsplace.net)','Please report bugs to Rod Wright (software@rodsplace.net)'),(26,'unix_server_session_dir','/tmp/opendrs/opendrs/sessions','/tmp/opendrs/opendrs/sessions'),(27,'win_server_session_dir','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions'),(28,'session_ttl_days','30','30'),(29,'period_eff_help_txt','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.'); INSERT INTO `config` VALUES (1,'drs_version','1.1.1','1.1.1'),(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),(6,'banner','1','1'),(7,'background_color','0B3144','0B3144'),(8,'p_background_color','FFFFFF','FFFFFF'),(11,'menubg_color','000000','000000'),(12,'p_menubg_color','FFFFFF','FFFFFF'),(13,'text_color','FFFFFF','FFFFFF'),(14,'p_text_color','000000','000000'),(15,'link_color','79EFEA','79EFEA'),(16,'p_link_color','000000','000000'),(17,'vlink_color','79EFEA','79EFEA'),(18,'p_vlink_color','000000','000000'),(19,'heading_color','5AE2B3','5AE2B3'),(20,'p_heading_color','000000','000000'),(21,'footer_message','Please report bugs to Rod Wright (software@rodsplace.net)','Please report bugs to Rod Wright (software@rodsplace.net)'),(26,'unix_server_session_dir','/tmp/opendrs/opendrs/sessions','/tmp/opendrs/opendrs/sessions'),(27,'win_server_session_dir','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions'),(28,'session_ttl_days','30','30'),(29,'period_eff_help_txt','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.');
/*!40000 ALTER TABLE `config` ENABLE KEYS */; /*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;

View File

@@ -1,22 +1,36 @@
# opendrs-update.sql -- opendrs-update.sql
# ---------- version 1.1.0 ------------- -- ---------- version 1.1.0 -------------
# Update version number -- Update version number
update config set name="drs_version" where name="mts_version"; UPDATE config SET name="drs_version" WHERE name="mts_version";
update config set value="1.1.0",defaultvalue="1.1.0" where name="drs_version"; UPDATE config SET value="1.1.0",defaultvalue="1.1.0" WHERE name="drs_version";
# Add period_eff_help_txt to config table -- Add period_eff_help_txt to config table
insert into config(name,value,defaultvalue) INSERT INTO config(name,value,defaultvalue)
select * from SELECT * FROM
(select 'period_eff_help_txt', (SELECT 'period_eff_help_txt',
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' as wval, 'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS wval,
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' as dval 'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS dval
) )
as tmp AS tmp
where not exists WHERE NOT EXISTS
( (
select name from config where name = 'period_eff_help_txt' SELECT name FROM config WHERE name = 'period_eff_help_txt'
) limit 1 ) LIMIT 1
; ;
# --------------------------------------- -- --------------------------------------
-- ---------- version 1.1.1 -------------
-- Update version number
UPDATE config SET value="1.1.1",defaultvalue="1.1.1" WHERE name="drs_version";
-- Rename the trainers table to devices
RENAME TABLE trainers TO devices;
-- Update default app name
UPDATE config SET defaultvalue="OpenDRS Discrepancy Reporting System" WHERE name="app_name";
-- Update default session directories
UPDATE config SET defaultvalue="/tmp/opendrs/opendrs/sessions" WHERE name="unix_server_session_dir";
UPDATE config SET defaultvalue="c:\Windows\Temp\opendrs\opendrs\sessions" WHERE name="win_server_session_dir";
-- --------------------------------------