Compare commits
2 Commits
v1.2.0-dev
...
1.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
| f7b91f4ef0 | |||
| 6e5c6e03e3 |
22
CHANGELOG
22
CHANGELOG
@@ -1,5 +1,5 @@
|
||||
OpenDRS - Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
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
|
||||
@@ -75,3 +75,23 @@ Changelog
|
||||
- Added ability to customize the terminology used for Device,
|
||||
Period, and Effective/Non-effective to make OpenDRS usable in
|
||||
a wider range of applications.
|
||||
|
||||
1.3.0 - 2022-03-05
|
||||
- Made several improvements to group functionality. The Writeup Groups
|
||||
page now displays all groups in a table instead of individually
|
||||
expandable sections. On the View Writeups and View Open Writeups
|
||||
pages, if a writeup is a member of only one group, clicking the
|
||||
icon will take you to the page for that group. If a writeup is
|
||||
a member of multiple groups, clicking the icon will take you to
|
||||
the detail page for that writeup where you can view or modify which
|
||||
groups the writeup is a member of. On the Search page, you can
|
||||
now choose which group(s) the results should include.
|
||||
- Made some improvements to the installation process for Raspberry Pi
|
||||
setup to accomodate the latest version of Raspberry Pi OS.
|
||||
- If setting up as a Raspberry Pi terminal/server, included the option
|
||||
to make the terminal a wireless access point if it connects to an
|
||||
ethernet network.
|
||||
|
||||
1.3.1 - 2022-05-11
|
||||
- Updated installation scripts and instructions to reflect changes in
|
||||
Raspberry Pi OS Release 2022-04-04.
|
||||
|
||||
115
RPiSetup/ap-setup.sh
Normal file
115
RPiSetup/ap-setup.sh
Normal file
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ap-setup.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2022 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# Wireless Access Point Raspberry Pi Setup
|
||||
current_user=`whoami`
|
||||
if [ "$current_user" != "root" ]
|
||||
then
|
||||
echo "You must have root privileges to run this setup."
|
||||
echo "Try 'sudo ./ap-setup.sh'"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo "If this terminal connects to a network using ethernet, it can be configured"
|
||||
echo "as a wireless access point for other terminals. Would you like to configure"
|
||||
echo -n "this terminal as an access point? [y/N]: "
|
||||
read wapconf
|
||||
if [ "$wapconf" = "Y" -o "$wapconf" = "y" ]
|
||||
then
|
||||
echo "Configuring as wireless access point."
|
||||
echo ""
|
||||
echo "Copying files..."
|
||||
chmod +x apsetup/usr/local/bin/*
|
||||
cp apsetup/usr/local/bin/* /usr/local/bin
|
||||
cp -R apsetup/etc/* /etc
|
||||
echo ""
|
||||
wapssidok=0
|
||||
while [ "$wapssidok" -ne 1 ]
|
||||
do
|
||||
echo "This access point will need an SSID. This is what will appear"
|
||||
echo "as the name of this terminal when other devices connect."
|
||||
echo -n "Please enter the desired SSID for this access point: "
|
||||
read wapssid
|
||||
if [ "$wapssid" = "" ]
|
||||
then
|
||||
echo "SSID cannot be blank. Try again."
|
||||
else
|
||||
wapssidok=1
|
||||
fi
|
||||
done
|
||||
wappassok=0
|
||||
while [ "$wappassok" -ne 1 ]
|
||||
do
|
||||
echo "You will need to set a passphrase for this access point. It should"
|
||||
echo "be at least 8 characters in length and cannot be blank."
|
||||
echo -n "Please enter the desired passphrase for this access point: "
|
||||
read wappass
|
||||
wappasslen=`echo -n $wappass | wc -m`
|
||||
if [ "$wappass" = "" -o "$wappasslen" -lt 8 ]
|
||||
then
|
||||
echo "Passphrase doesn't satisfy requirements above. Try again."
|
||||
else
|
||||
wappassok=1
|
||||
fi
|
||||
done
|
||||
apt install hostapd
|
||||
systemctl unmask hostapd
|
||||
systemctl enable hostapd
|
||||
echo "[NetDev]" >/etc/systemd/network/bridge-br0.netdev
|
||||
echo "Name=br0" >>/etc/systemd/network/bridge-br0.netdev
|
||||
echo "Kind=bridge" >>/etc/systemd/network/bridge-br0.netdev
|
||||
echo "[Match]" >/etc/systemd/network/br0-member-eth0.network
|
||||
echo "Name=eth0" >>/etc/systemd/network/br0-member-eth0.network
|
||||
echo "" >>/etc/systemd/network/br0-member-eth0.network
|
||||
echo "[Network]" >>/etc/systemd/network/br0-member-eth0.network
|
||||
echo "Bridge=br0" >>/etc/systemd/network/br0-member-eth0.network
|
||||
systemctl enable systemd-networkd
|
||||
mv /etc/dhcpcd.conf /etc/dhcpcd.conf.old
|
||||
echo "denyinterfaces wlan0 eth0" >/etc/dhcpcd.conf
|
||||
cat /etc/dhcpcd.conf.old >>/etc/dhcpcd.conf
|
||||
echo "interface br0" >>/etc/dhcpcd.conf
|
||||
rfkill unblock wlan
|
||||
echo "country_code=US" >/etc/hostapd/hostapd.conf
|
||||
echo "interface=wlan0" >>/etc/hostapd/hostapd.conf
|
||||
echo "bridge=br0" >>/etc/hostapd/hostapd.conf
|
||||
echo "ssid=$wapssid" >>/etc/hostapd/hostapd.conf
|
||||
echo "hw_mode=g" >>/etc/hostapd/hostapd.conf
|
||||
echo "channel=7" >>/etc/hostapd/hostapd.conf
|
||||
echo "macaddr_acl=0" >>/etc/hostapd/hostapd.conf
|
||||
echo "auth_algs=1" >>/etc/hostapd/hostapd.conf
|
||||
echo "ignore_broadcast_ssid=0" >>/etc/hostapd/hostapd.conf
|
||||
echo "wpa=2" >>/etc/hostapd/hostapd.conf
|
||||
echo "wpa_passphrase=$wappass" >>/etc/hostapd/hostapd.conf
|
||||
echo "wpa_key_mgmt=WPA-PSK" >>/etc/hostapd/hostapd.conf
|
||||
echo "wpa_pairwise=TKIP" >>/etc/hostapd/hostapd.conf
|
||||
echo "rsn_pairwise=CCMP" >>/etc/hostapd/hostapd.conf
|
||||
wget -c http://github.com/pjz/webmin-modules/releases/download/v1.0/hostap.wbm.gz
|
||||
gzip -d hostap.wbm.gz
|
||||
/usr/share/webmin/install-module.pl hostap.wbm
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Wireless access point setup is complete. It will be"
|
||||
echo "automatically enabled after reboot. To change the SSID or"
|
||||
echo "passphrase in the future, edit the file /etc/hostapd/hostapd.conf"
|
||||
echo "or use the Host AP module in the Servers section of Webmin."
|
||||
echo ""
|
||||
echo "To disable the access point altogether in the future, run:"
|
||||
echo " sudo wap-disable"
|
||||
echo "at a command prompt and reboot the terminal. To re-enable it, run:"
|
||||
echo " sudo wap-enable"
|
||||
echo "at a command prompt and reboot the terminal."
|
||||
echo "It can also be enabled or disabled via Custom Commands in the Tools"
|
||||
echo "section of Webmin."
|
||||
echo ""
|
||||
echo -n "Press enter key to continue..."
|
||||
read cont
|
||||
else
|
||||
exit 2
|
||||
fi
|
||||
|
||||
3
RPiSetup/apsetup/etc/webmin/custom/1630026603.cmd
Normal file
3
RPiSetup/apsetup/etc/webmin/custom/1630026603.cmd
Normal file
@@ -0,0 +1,3 @@
|
||||
sudo wap-enable
|
||||
Enable Wireless Access Point
|
||||
pi 0 1 0 0 0 0 0 -
|
||||
1
RPiSetup/apsetup/etc/webmin/custom/1630026603.html
Normal file
1
RPiSetup/apsetup/etc/webmin/custom/1630026603.html
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
3
RPiSetup/apsetup/etc/webmin/custom/1630026756.cmd
Normal file
3
RPiSetup/apsetup/etc/webmin/custom/1630026756.cmd
Normal file
@@ -0,0 +1,3 @@
|
||||
sudo wap-disable
|
||||
Disable Wireless Access Point
|
||||
pi 0 1 0 0 0 0 0 -
|
||||
1
RPiSetup/apsetup/etc/webmin/custom/1630026756.html
Normal file
1
RPiSetup/apsetup/etc/webmin/custom/1630026756.html
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
11
RPiSetup/apsetup/etc/webmin/custom/1630027149.edit
Normal file
11
RPiSetup/apsetup/etc/webmin/custom/1630027149.edit
Normal file
@@ -0,0 +1,11 @@
|
||||
/etc/hostapd/hostapd.conf
|
||||
Edit Wireless Access Point Parameters
|
||||
|
||||
|
||||
|
||||
|
||||
systemctl restart hostapd
|
||||
0
|
||||
0
|
||||
|
||||
|
||||
1
RPiSetup/apsetup/etc/webmin/custom/1630027149.html
Normal file
1
RPiSetup/apsetup/etc/webmin/custom/1630027149.html
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
8
RPiSetup/apsetup/etc/webmin/custom/config
Normal file
8
RPiSetup/apsetup/etc/webmin/custom/config
Normal file
@@ -0,0 +1,8 @@
|
||||
display_mode=1
|
||||
params_file=0
|
||||
params_cmd=0
|
||||
columns=1
|
||||
height=
|
||||
wrap=
|
||||
width=
|
||||
sort=
|
||||
4
RPiSetup/apsetup/usr/local/bin/wap-disable
Normal file
4
RPiSetup/apsetup/usr/local/bin/wap-disable
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
systemctl stop hostapd
|
||||
systemctl disable hostapd
|
||||
|
||||
4
RPiSetup/apsetup/usr/local/bin/wap-enable
Normal file
4
RPiSetup/apsetup/usr/local/bin/wap-enable
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
systemctl enable hostapd
|
||||
systemctl start hostapd
|
||||
|
||||
16
RPiSetup/apsetup/usr/local/bin/wap-setpassphrase
Normal file
16
RPiSetup/apsetup/usr/local/bin/wap-setpassphrase
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
newppok=0
|
||||
while [ "$newppok" -ne 1 ]
|
||||
do
|
||||
echo -n "New passphrase: "
|
||||
read newpp
|
||||
newpplen=`echo -n $newpp | wc -m`
|
||||
if [ "$newpp" = "" -o "$newpplen" -lt 8 ]
|
||||
then
|
||||
echo "Passphrase didn't satisfy requirements. Try again or hit <ctrl>-c to abort."
|
||||
else
|
||||
newppok=1
|
||||
fi
|
||||
done
|
||||
sed -i "/wpa_passphrase=.*/c wpa_passphrase=$newpp" /etc/hostapd/hostapd.conf
|
||||
systemctl restart hostapd
|
||||
15
RPiSetup/apsetup/usr/local/bin/wap-setssid
Normal file
15
RPiSetup/apsetup/usr/local/bin/wap-setssid
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
newssidok=0
|
||||
while [ "$newssidok" -ne 1 ]
|
||||
do
|
||||
echo -n "New SSID: "
|
||||
read newssid
|
||||
if [ "$newssid" = "" ]
|
||||
then
|
||||
echo "SSID cannot be blank. Try again or hit <ctrl>-c to abort."
|
||||
else
|
||||
newssidok=1
|
||||
fi
|
||||
done
|
||||
sed -i "/ssid=.*/c ssid=$newssid" /etc/hostapd/hostapd.conf
|
||||
systemctl restart hostapd
|
||||
@@ -1,2 +1,25 @@
|
||||
# drs.conf
|
||||
|
||||
# URL for OpenDRS
|
||||
DRS_SERVER="http://localhost"
|
||||
|
||||
# Set to "1" to prevent screen blanking on some monitors that go to sleep and won't wake up.
|
||||
INHIBIT_BLANK="0"
|
||||
|
||||
# For standard DRS functionality
|
||||
APP_CMD="chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER"
|
||||
ALIVE_STRING="chromium-browse"
|
||||
KILL_CMD="killall chromium-browser"
|
||||
CLEANUP_CMD="rm -rf ~/.{config,cache}/chromium/"
|
||||
|
||||
# Notes
|
||||
# --test-type will ignore any warnings and
|
||||
# --ignore-certificate-errors will allow you to kiosk any https-page without displaying certificate errors
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# For test use
|
||||
#APP_CMD="xterm"
|
||||
#ALIVE_STRING="xterm"
|
||||
#KILL_CMD="killall xterm"
|
||||
#CLEANUP_CMD="sleep 1"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# server-setup.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2021 Rod Wright
|
||||
# Copyright (C) 2022 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
@@ -11,6 +11,13 @@ docroot_path="/var/www"
|
||||
apache_user="www-data"
|
||||
apache_group="www-data"
|
||||
|
||||
current_user=`whoami`
|
||||
if [ "$current_user" != "root" ]
|
||||
then
|
||||
echo "You must have root privileges to run this setup."
|
||||
echo "Try 'sudo ./server-setup.sh'"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -20,7 +27,7 @@ echo ""
|
||||
echo ""
|
||||
echo "You should have already run the terminal-setup.sh script in this directory."
|
||||
echo ""
|
||||
if [ ! -e "/etc/drs.conf" ]
|
||||
if [ ! -e /etc/drs.conf ]
|
||||
then
|
||||
echo "It looks like the terminal-setup.sh script has not been run yet."
|
||||
echo "This is required before running the server-setup.sh script."
|
||||
@@ -50,23 +57,39 @@ echo ""
|
||||
echo "IMPORTANT!: Be sure to make note of usernames and passwords you provide below."
|
||||
echo "You will need them later."
|
||||
echo ""
|
||||
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 "Installing required server packages. You will be prompted about a couple of things:"
|
||||
echo ""
|
||||
echo "- Select apache2 as the web server to configure automatically."
|
||||
echo ""
|
||||
echo "- Choose Yes when prompted to install phpmyadmin database and allow it to"
|
||||
echo " generate a random password(leave the field blank)."
|
||||
echo ""
|
||||
echo -n "Press enter to continue."
|
||||
read continueok
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
apt install -y apache2 php php-mcrypt mariadb-server phpmyadmin uuid-runtime
|
||||
apt install -y apache2 php mariadb-server phpmyadmin uuid-runtime
|
||||
cp etc/apache2/mods-available/alias.conf /etc/apache2/mods-available
|
||||
service apache2 restart
|
||||
echo "...done."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Configuring the mysql installation. Accept the defaults at the following prompts."
|
||||
echo "Remember the password you set here. You'll need it during the OpenDRS install."
|
||||
echo "Configuring the MariaDB installation. There will be some more prompts:"
|
||||
echo ""
|
||||
echo "- You'll be prompted for the current password for the root user. You've"
|
||||
echo " just installed MariaDB and you haven't set one yet, so just press enter."
|
||||
echo ""
|
||||
echo "- You'll be prompted to switch to unix_socket authentication. Answer Y."
|
||||
echo ""
|
||||
echo "- You'll be prompted to change the root password. Answer Y and enter a password."
|
||||
echo " Note that this is just the password for the MariaDB root user, not the terminal."
|
||||
echo " DO NOT FORGET THIS PASSWORD. You'll need it later during OpenDRS install."
|
||||
echo ""
|
||||
echo "- Answer Y to remove anonymous users, disallow root login remotely, remove"
|
||||
echo " test database and access, and reload privilege tables."
|
||||
echo ""
|
||||
echo -n "Press enter to proceed."
|
||||
read continueok
|
||||
echo ""
|
||||
@@ -74,7 +97,6 @@ echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
mysql_secure_installation
|
||||
mysql mysql -e "update user set plugin='';flush privileges;"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
@@ -85,9 +107,13 @@ bad_mysql_adm=1
|
||||
while [ $bad_mysql_adm -eq 1 ]
|
||||
do
|
||||
admintestdb="drsadm`date +%Y%m%d`"
|
||||
echo "Starting OpenDRS installation."
|
||||
echo ""
|
||||
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 "to be able to create the database and user for OpenDRS. The username"
|
||||
echo "will be root and the password will be the one you were urged to remember"
|
||||
echo "a minute ago."
|
||||
echo ""
|
||||
echo -n "MySQL admin username: "
|
||||
read mysql_adm_user
|
||||
echo ""
|
||||
@@ -100,7 +126,7 @@ do
|
||||
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]: "
|
||||
echo -n "is not a MySQL administrator. Try again? [y/N]: "
|
||||
read admtry
|
||||
if [ "$admtry" != "Y" -o "$admtry" != "y" ]
|
||||
then
|
||||
@@ -208,6 +234,10 @@ fi
|
||||
echo "Installing distribution . . ."
|
||||
cp -Rv ../distfiles/* $install_path
|
||||
ln -s $install_path/writeups.php $install_path/index.php
|
||||
if [ ! -L "$install_path/jquery-ui" ]
|
||||
then
|
||||
ln -s $install_path/jquery-ui* $install_path/jquery-ui
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -222,9 +252,11 @@ 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_in
|
||||
if [ "$http_user_group_in" != "" ]
|
||||
if [ "$httpd_user_group_in" != "" ]
|
||||
then
|
||||
http_user_group=$http_user_group_in
|
||||
httpd_user_group="$httpd_user_group_in"
|
||||
else
|
||||
httpd_user_group="$apache_user:$apache_group"
|
||||
fi
|
||||
echo ""
|
||||
echo "Setting file ownership . . ."
|
||||
@@ -246,6 +278,26 @@ 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
|
||||
grep -q "<title>Apache2 Debian Default Page: It works</title>" /var/www/html/index.html
|
||||
if [ -$? -eq 0 ]
|
||||
then
|
||||
echo "This apache installation appears to be new or unconfigured. Replacing the default"
|
||||
echo "site index page with a more useful one."
|
||||
site_hostname=`hostname`
|
||||
mv /var/www/html/index.html /var/www/html/defaultindex.html
|
||||
echo "<!doctype html>
|
||||
<html lang=en>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<title>$site_hostname</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<a href=\"http://$site_hostname/$inst_name/\">$inst_name</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>" > /var/www/html/index.html
|
||||
fi
|
||||
|
||||
a2enconf $inst_name
|
||||
service apache2 reload
|
||||
@@ -265,4 +317,4 @@ 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
|
||||
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"http://localhost/$inst_name/\""',' /etc/drs.conf
|
||||
|
||||
@@ -2,10 +2,18 @@
|
||||
|
||||
# terminal-setup.sh
|
||||
# OpenDRS Online Maintenance Tracking System
|
||||
# Copyright (C) 2021 Rod Wright
|
||||
# Copyright (C) 2022 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
current_user=`whoami`
|
||||
current_login=`who am i | awk '{print $1}'`
|
||||
if [ "$current_user" != "root" ]
|
||||
then
|
||||
echo "You must have root privileges to run this setup."
|
||||
echo "Try 'sudo ./terminal-setup.sh'"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -16,20 +24,30 @@ echo ""
|
||||
echo "You should have already completed the following steps:"
|
||||
echo ""
|
||||
echo "1. Created a Raspberry Pi OS Lite SD card from the latest release."
|
||||
echo "2. Installed the card in a Raspberry Pi, booted it, and logged in as pi."
|
||||
echo ""
|
||||
echo "2. Installed the card in a Raspberry Pi, booted it, and completed"
|
||||
echo " initial configuration."
|
||||
echo ""
|
||||
echo "3. Ran sudo raspi-config and :"
|
||||
echo " a. Set a strong password for the pi user."
|
||||
echo " b. Set hostname and, if accessing a network through wifi, the SSID and"
|
||||
echo " passphrase under Network Options."
|
||||
echo " c. Set locale, timezone, keyboard layout, and wifi country under"
|
||||
echo " a. Set locale, timezone, and WLAN Country under"
|
||||
echo " Localisation Options. "
|
||||
echo " d. Enable SSH under Interfacing Options."
|
||||
echo " e. Set overscan as required to get rid of any black borders around the"
|
||||
echo " edge of the display."
|
||||
echo " f. Reboot when prompted and logged back in as pi."
|
||||
echo "4. Transferred the OpenDRS distribution package to /home/pi on the"
|
||||
echo ""
|
||||
echo " b. Set hostname and Boot / Auto Login to Console under System Options."
|
||||
echo ""
|
||||
echo " c. If accessing a network through wifi, the Wireless LAN SSID"
|
||||
echo " and passphrase under System Options."
|
||||
echo ""
|
||||
echo " d. Enable SSH under Interface Options."
|
||||
echo ""
|
||||
echo " e. Set underscan as required under Display Options to get rid of any"
|
||||
echo " black borders around the edge of the display."
|
||||
echo ""
|
||||
echo " f. Reboot when prompted and logged back in as $current_login."
|
||||
echo ""
|
||||
echo "4. Transferred the OpenDRS distribution package to /home/$current_login on the"
|
||||
echo " Raspberry Pi and extracted it."
|
||||
echo "5. Changed directory to RPiSetup in the the extracted distribution directory."
|
||||
echo "5. Changed directory to RPiSetup in the extracted distribution directory."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "If you have completed these steps, press enter to continue. If not,"
|
||||
echo -n "press ctrl-c to quit."
|
||||
@@ -56,6 +74,7 @@ echo ""
|
||||
echo "Copying files..."
|
||||
chmod +x usr/local/bin/*
|
||||
cp usr/local/bin/* /usr/local/bin
|
||||
cp etc/drs.conf /etc
|
||||
cp etc/apt/sources.list.d/* /etc/apt/sources.list.d
|
||||
cp lib/systemd/system/getty@tty1.service /lib/systemd/system
|
||||
echo ""
|
||||
@@ -72,14 +91,17 @@ echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
wget http://www.webmin.com/jcameron-key.asc
|
||||
apt-key add jcameron-key.asc
|
||||
echo "deb https://download.webmin.com/download/repository sarge contrib" >/etc/apt/sources.list.d/webmin.list
|
||||
wget https://download.webmin.com/jcameron-key.asc
|
||||
cat jcameron-key.asc | gpg --dearmor >/etc/apt/trusted.gpg.d/jcameron-key.gpg
|
||||
rm jcameron-key.asc
|
||||
apt install apt-transport-https
|
||||
apt update
|
||||
apt install -y --no-install-recommends xorg openbox chromium-browser
|
||||
apt install -y webmin cups libcups2-dev cmake
|
||||
apt install -y cups libcups2-dev cmake
|
||||
apt install -y webmin
|
||||
addgroup lpadmin
|
||||
usermod -a -G lpadmin pi
|
||||
usermod -a -G lpadmin $current_login
|
||||
systemctl enable getty@tty1.service
|
||||
service cups-browsed stop
|
||||
systemctl disable cups-browsed.service
|
||||
@@ -101,14 +123,13 @@ echo "of your choosing."
|
||||
echo -n "Press enter to continue."
|
||||
read continueok
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Creating customer user..."
|
||||
sleep 10
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
cloneuser `who am i | awk '{print $1}'` customer
|
||||
cloneuser $current_login customer
|
||||
mkdir -p /home/customer/.config/openbox
|
||||
cp home/customer/.profile /home/customer
|
||||
cp home/customer/.config/openbox/rc.xml /home/customer/.config/openbox
|
||||
@@ -127,24 +148,47 @@ read server_url
|
||||
if [[ $server_url == "" ]]
|
||||
then
|
||||
conftype="Server/Terminal"
|
||||
touch /etc/drs.conf
|
||||
./server-setup.sh
|
||||
else
|
||||
conftype="Terminal"
|
||||
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
|
||||
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"$server_url\""',' /etc/drs.conf
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
./ap-setup.sh
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "If you would like to configure this terminal as an access point at some"
|
||||
echo "time in the future, log in, change directory to the"
|
||||
echo "extracted distribution's RPiSetup directory, and run:"
|
||||
echo " sudo ./ap-setup.sh"
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo "$conftype configuration is now complete. "
|
||||
echo ""
|
||||
echo ""
|
||||
echo "It is highly recommended that after rebooting, you run ssh pi@$HOSTNAME"
|
||||
echo "It is highly recommended that after rebooting, you run ssh $current_login@$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 "any other administrators using the cloneuser command"
|
||||
echo "(cloneuser $current_login <new username>)."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Setup complete."
|
||||
echo -n "Press enter to reboot now."
|
||||
echo "Terminal setup complete."
|
||||
echo ""
|
||||
echo "If you would like to use this terminal as a DRS server, after rebooting"
|
||||
echo "and logging back in, change directory to the extracted distribution's"
|
||||
echo "RPiSetup directory, and run:"
|
||||
echo " sudo ./server-setup.sh"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "A reboot is required to start using this terminal."
|
||||
echo -n "Would you like to reboot now? [Y/n]: "
|
||||
read rebootok
|
||||
if [ "$rebootok" = "N" -o "$rebootok" = "n" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
reboot
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
#!/bin/bash
|
||||
# startdrs.sh
|
||||
|
||||
source /etc/drs.conf
|
||||
|
||||
openbox-session &
|
||||
|
||||
if [ "$INHIBIT_BLANK" -eq "1" ]
|
||||
then
|
||||
xset s off
|
||||
xset -dpms
|
||||
else
|
||||
xset s off
|
||||
xset +dpms
|
||||
xset dpms 0 600 1800
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
killall chromium-browser
|
||||
rm -rf ~/.{config,cache}/chromium/
|
||||
$KILL_CMD
|
||||
$CLEANUP_CMD
|
||||
|
||||
# start browser to DRS Server
|
||||
# --test-type will ignore any warnings and
|
||||
# --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 --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
|
||||
# start application
|
||||
$APP_CMD &
|
||||
|
||||
sleep 10
|
||||
|
||||
while true
|
||||
do
|
||||
pgrep chromium-browse
|
||||
pgrep $ALIVE_STRING
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
# relaunch browser if it terminates
|
||||
chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
|
||||
# relaunch application if it terminates
|
||||
$APP_CMD &
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -2,42 +2,37 @@ Raspberry Pi setup
|
||||
|
||||
1. Create Raspberry Pi OS Lite SD card from the most recent stable release.
|
||||
|
||||
2. Insert SD card in Raspberry Pi and boot.
|
||||
2. Insert SD card in Raspberry Pi, boot it, and complete initial config.
|
||||
|
||||
3. Login as pi.
|
||||
3. run sudo raspi-config and:
|
||||
|
||||
4. sudo raspi-config and:
|
||||
|
||||
a. Set a strong password for the default user (pi).
|
||||
|
||||
b. Set the desired hostname.
|
||||
|
||||
c. Set Wireless LAN SSID and passphrase if using WiFi for networking.
|
||||
|
||||
c. Use Localisation Options to:
|
||||
a. Use Localisation Options to:
|
||||
1. Set locale to en_US.UTF-8 UTF-8.
|
||||
2. Set timezone.
|
||||
3. Set keyboard layout (IMPORTANT! Raspberry Pi OS is made in
|
||||
England, so unless that's the kind of keyboard you have, the
|
||||
default layout will make your symbols come out wrong!).
|
||||
4. Set WLAN country.
|
||||
3. Set WLAN country.
|
||||
|
||||
d. Use Interfacing Options to enable SSH server.
|
||||
b. Use System Options to:
|
||||
1. Set the hostname.
|
||||
2. Set Boot / Auto Login to Console.
|
||||
3. If accessing the network through WiFi, set the Wireless LAN
|
||||
SSID and passphrase.
|
||||
|
||||
e. If you have black borders on the sides of the screen, use Display
|
||||
Underscan option to change Overscan compensation.
|
||||
c. Under Interface Options, enable SSH.
|
||||
|
||||
f. When you've finished, tab down to highlight Finish and hit enter.
|
||||
d. Under Display Options, set underscan as required to get rid of
|
||||
black screen borders.
|
||||
|
||||
g. Reboot when prompted.
|
||||
e. When you've finished, tab down to highlight Finish and hit enter.
|
||||
|
||||
h. Log back in as pi using the password you set in a. above.
|
||||
f. Reboot when prompted.
|
||||
|
||||
5. Copy OpenDRS distribution package to /home/pi on the Raspberry Pi and extract.
|
||||
g. Log back in as the user you created during initial configuration.
|
||||
|
||||
6. Change directory to the extracted distribution.
|
||||
4. Copy OpenDRS distribution package to the Raspberry Pi and extract.
|
||||
|
||||
7. Change directory to RPiSetup.
|
||||
5. Change directory to the extracted distribution.
|
||||
|
||||
8. run sudo ./terminal-setup.sh
|
||||
6. Change directory to RPiSetup.
|
||||
|
||||
7. run sudo ./terminal-setup.sh
|
||||
|
||||
|
||||
16
TODO.txt
16
TODO.txt
@@ -1,6 +1,18 @@
|
||||
TODO
|
||||
|
||||
- Provide ability to change terminology for "device", "period", and
|
||||
"effective" to broaden the use case for the application.
|
||||
- Fix search.php to validate action taken date and time entries
|
||||
|
||||
- Fix occurrences of $mts_db (should be $drs_db)in about.php and gpl.php
|
||||
|
||||
- Add ability to save/restore configuration.
|
||||
|
||||
- Add ability to backup/restore writeups.
|
||||
|
||||
- Get Chromium to remember printer selection across reboots.
|
||||
|
||||
- Fix default banner colors in opendrs-initial.sql to match the ones shown in common.php.
|
||||
|
||||
- Fix failure to preselect "action taken by" users on the search page for subsequent searches.
|
||||
|
||||
- $border_visible debug variable to the end of settings.php and use it wherever there's a
|
||||
"border=\"0\"" to be able to see and fix table layout issues.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
boilerplate.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
db.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
OpenDRS - Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
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
|
||||
@@ -75,3 +75,23 @@ Changelog
|
||||
- Added ability to customize the terminology used for Device,
|
||||
Period, and Effective/Non-effective to make OpenDRS usable in
|
||||
a wider range of applications.
|
||||
|
||||
1.3.0 - 2022-03-05
|
||||
- Made several improvements to group functionality. The Writeup Groups
|
||||
page now displays all groups in a table instead of individually
|
||||
expandable sections. On the View Writeups and View Open Writeups
|
||||
pages, if a writeup is a member of only one group, clicking the
|
||||
icon will take you to the page for that group. If a writeup is
|
||||
a member of multiple groups, clicking the icon will take you to
|
||||
the detail page for that writeup where you can view or modify which
|
||||
groups the writeup is a member of. On the Search page, you can
|
||||
now choose which group(s) the results should include.
|
||||
- Made some improvements to the installation process for Raspberry Pi
|
||||
setup to accomodate the latest version of Raspberry Pi OS.
|
||||
- If setting up as a Raspberry Pi terminal/server, included the option
|
||||
to make the terminal a wireless access point if it connects to an
|
||||
ethernet network.
|
||||
|
||||
1.3.1 - 2022-05-11
|
||||
- Updated installation scripts and instructions to reflect changes in
|
||||
Raspberry Pi OS Release 2022-04-04.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
about.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -78,7 +78,7 @@ echo "
|
||||
OpenDRS $drs_version Discrepancy Reporting System
|
||||
</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
|
||||
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) 2022 by Rod Wright.
|
||||
</p>
|
||||
<p>
|
||||
OpenDRS is a simple online maintenance tracking/discrepancy reporting application. It allows anyone with a web browser to create ,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
common.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -595,7 +595,7 @@ function displaywriteup($id) {
|
||||
if ($group_count == 1) {
|
||||
$group_ind="<a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$group_ind="<a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
$group_ind="<a href=\"writeupdetail.php?id={$writeupdata['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -692,8 +692,14 @@ function putsetting($setting_name,$setting_value,$user_id) {
|
||||
}
|
||||
}
|
||||
|
||||
function group_table($groupid,$role=false,$mode="view",$selection="none",$expanded=false) {
|
||||
function group_detail($groupid,$role=false,$mode="view",$selection="none") {
|
||||
// display a table for a single group
|
||||
|
||||
// groupid is the group for which detail is to be shown
|
||||
// role is true if user is logged in, false if not.
|
||||
// mode is "select" if selection boxes are to be displayed, "view" if not.
|
||||
// selection is "all" or "none"
|
||||
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
@@ -708,13 +714,6 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
} elseif ($selection == "none") {
|
||||
$sel_flag="";
|
||||
}
|
||||
if ($expanded) {
|
||||
echo "
|
||||
<a href=\"groups.php\" style=\"text-decoration:none\">
|
||||
<img src=\"icons/minus-white.png\" alt=\"Unexpand group\">
|
||||
</a>
|
||||
";
|
||||
}
|
||||
$groupname=dblookup($drs_db,"groups","id","name",$groupid);
|
||||
if ($groupname == "") {
|
||||
echo "<b>Group ID: $groupid";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
config.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
create.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
dbadmin.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
gpl.php
|
||||
OpenMTS Online Maintenance Tracking System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
groups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -38,7 +38,6 @@ $save=$incoming['save'];
|
||||
$targets=$incoming['targets'];
|
||||
$group=$incoming['group'];
|
||||
$name=$incoming['name'];
|
||||
$expandgrp=$incoming['expandgrp'];
|
||||
|
||||
$search=$incoming['search'];
|
||||
$s_status=$incoming['s_status'];
|
||||
@@ -317,7 +316,7 @@ if ($action=="add") {
|
||||
if ($save) {
|
||||
// show the group
|
||||
$mode="view";
|
||||
group_table($group,$role,$mode);
|
||||
group_detail($group,$role,$mode);
|
||||
if ($role) {
|
||||
// show buttons
|
||||
echo "
|
||||
@@ -621,7 +620,7 @@ if ($action=="add") {
|
||||
<input type=\"hidden\" name=\"group\" value=\"$group\">
|
||||
<input type=\"hidden\" name=\"action\" value=\"remove\">
|
||||
";
|
||||
group_table($group,$role,"select","all");
|
||||
group_detail($group,$role,"select","all");
|
||||
echo "
|
||||
Deselect the writeups you want to remove from this group. <br><br>
|
||||
<b>NOTE:</b> Deselecting them all will dissolve the group.
|
||||
@@ -653,7 +652,7 @@ if ($action=="add") {
|
||||
}
|
||||
// show the group
|
||||
$mode="view";
|
||||
group_table($group,$role,$mode);
|
||||
group_detail($group,$role,$mode);
|
||||
if ($role) {
|
||||
// show buttons
|
||||
echo "
|
||||
@@ -694,7 +693,7 @@ if ($action=="add") {
|
||||
}
|
||||
// show the group
|
||||
$mode="view";
|
||||
group_table($group,$role,$mode);
|
||||
group_detail($group,$role,$mode);
|
||||
if ($role) {
|
||||
// show buttons
|
||||
echo "
|
||||
@@ -720,7 +719,7 @@ if ($action=="add") {
|
||||
}
|
||||
// show the group
|
||||
$mode="view";
|
||||
group_table($group,$role,$mode);
|
||||
group_detail($group,$role,$mode);
|
||||
if ($role && ! $save) {
|
||||
// show action form
|
||||
echo "
|
||||
@@ -821,7 +820,7 @@ if ($action=="add") {
|
||||
if ($group) {
|
||||
// show only the requested group
|
||||
$mode="view";
|
||||
group_table($group,$role,$mode);
|
||||
group_detail($group,$role,$mode);
|
||||
if ($role) {
|
||||
// show buttons
|
||||
echo "
|
||||
@@ -841,45 +840,39 @@ if ($action=="add") {
|
||||
}
|
||||
echo "<hr><br>";
|
||||
} else {
|
||||
// show all groups
|
||||
$mode="view";
|
||||
$groups_qry=mysqli_query($drs_db,"select id from groups");
|
||||
// show group table
|
||||
$groups_qry=mysqli_query($drs_db,"select * from groups");
|
||||
if (mysqli_num_rows($groups_qry)) {
|
||||
echo "
|
||||
<br><br>
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th>Name</th>
|
||||
<th style=\"width:1%;\">Writeups assigned</th>
|
||||
</tr>
|
||||
";
|
||||
while ($grouprow=mysqli_fetch_assoc($groups_qry)) {
|
||||
if ($expandgrp == $grouprow['id']) {
|
||||
group_table($grouprow['id'],$role,$mode,"none",$expandgrp);
|
||||
if ($role) {
|
||||
// show buttons
|
||||
echo "
|
||||
<form method=post action=\"groups.php\">
|
||||
<input type=\"hidden\" name=\"group\" value=\"{$grouprow['id']}\">
|
||||
<button name=\"action\" value=\"add\" type=\"submit\">Add writeups to this group</button>
|
||||
|
||||
<button name=\"action\" value=\"remove\" type=\"submit\">Remove writeups from this group</button>
|
||||
|
||||
<button name=\"action\" value=\"dissolve\" type=\"submit\">Dissolve this group</button>
|
||||
|
||||
<button name=\"action\" value=\"setname\" type=\"submit\">Set name for this group</button>
|
||||
|
||||
<button name=\"action\" value=\"takeaction\" type=\"submit\">Take group action</button>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
$num_query=mysqli_query($drs_db,"select id from links where linkgroup={$grouprow['id']}");
|
||||
$num_writeups=mysqli_num_rows($num_query);
|
||||
if($grouprow['name']=="") {
|
||||
$name_text="Group {$grouprow['id']} has not been named";
|
||||
} else {
|
||||
echo "
|
||||
<a href=\"groups.php?expandgrp={$grouprow['id']}\" style=\"text-decoration:none\">
|
||||
<img src=\"icons/plus-white.png\" alt=\"Expand group\">
|
||||
</a>
|
||||
";
|
||||
$groupname=dblookup($drs_db,"groups","id","name",$grouprow['id']);
|
||||
if ($groupname == "") {
|
||||
echo "<b>Group ID:</b> {$grouprow['id']}";
|
||||
} else {
|
||||
echo "<b>Group Name:</b> $groupname";
|
||||
$name_text="{$grouprow['name']}";
|
||||
}
|
||||
// print table row
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"groups.php?group=%s\" title=\"View or change details of this group\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$grouprow["id"],$grouprow["id"],
|
||||
$name_text,
|
||||
$num_writeups
|
||||
);
|
||||
}
|
||||
echo "<br><br>";
|
||||
}
|
||||
echo "</table><br>";
|
||||
} else {
|
||||
echo "<br>No writeup groups were found.<br><br><br>";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
login.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
profile.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
search.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -305,12 +305,19 @@ if ($search) {
|
||||
// group membership
|
||||
if ($s_group) {
|
||||
$group_param="Group member: ";
|
||||
// create an array of writeups that are members of the groups specified
|
||||
$group_writeups=array();
|
||||
foreach ($s_group as $group_val) {
|
||||
if ($group_val=="0") $group_dsp="No";
|
||||
if ($group_val=="1") $group_dsp="Yes";
|
||||
$group_param="{$group_param} {$group_dsp}, ";
|
||||
$wulink_query=mysqli_query($drs_db,"select writeupid from links where linkgroup=$group_val");
|
||||
while($wulinkrow=mysqli_fetch_assoc($wulink_query)){
|
||||
$group_writeups[]=$wulinkrow['writeupid'];
|
||||
}
|
||||
$group_name=dblookup($drs_db,"groups","id","name",$group_val);
|
||||
$group_param="{$group_param} <font title=\"{$group_name}\">{$group_val}</font>, ";
|
||||
}
|
||||
$group_param=rtrim($group_param,", ");
|
||||
} else {
|
||||
$group_param="Group member: any";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,20 +502,30 @@ if (! $exportcsv) {
|
||||
";
|
||||
// Group status cell **************
|
||||
echo "
|
||||
Group Member?<br>
|
||||
Group Assignments:<br>
|
||||
<select style=\"max-width:40%;\" name=\"s_group[]\" id=\"ms-group\" multiple title=\"Select the groups the results should be a member of. If you uncheck them all, this field will not be included in the search.\">
|
||||
";
|
||||
if ($search) {
|
||||
$yesgroupstate=$nogroupstate="";
|
||||
if (in_array("1",$s_group,true)) $yesgroupstate="selected";
|
||||
if (in_array("0",$s_group,true)) $nogroupstate="selected";
|
||||
$grow=mysqli_query($drs_db,"select * from groups order by id asc");
|
||||
while ($gitem=mysqli_fetch_assoc($grow)) {
|
||||
if ($gitem["name"]=="") {
|
||||
$gname="Group ".$gitem["id"];
|
||||
} else {
|
||||
$yesgroupstate=$nogroupstate="selected";
|
||||
}echo "
|
||||
<select name=\"s_group[]\" id=\"ms-group\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"1\" $yesgroupstate title=\"Writeup is a member of a group\">Show group members</option>
|
||||
<option value=\"0\" $nogroupstate title=\"Writeup is not a member of a group\">Show non group members</option>
|
||||
$gname=$gitem["name"];
|
||||
}
|
||||
if($search) {
|
||||
if (in_array($gitem["id"],$s_group,true)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$gitem["id"],$gname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
|
||||
// ************************************
|
||||
echo "
|
||||
</td></tr>
|
||||
@@ -763,25 +780,10 @@ if ($search) {
|
||||
while ($eachid=mysqli_fetch_assoc($writeup)) {
|
||||
$result_ids[]=$eachid['id'];
|
||||
}
|
||||
mysqli_data_seek($writeup,0);
|
||||
// create an array of all ids in groups
|
||||
$groupmems=array();
|
||||
$groupmem_qry=mysqli_query($drs_db,"select writeupid from links");
|
||||
while ($groupmemrow=mysqli_fetch_row($groupmem_qry)) {
|
||||
$groupmems[]=$groupmemrow[0];
|
||||
}
|
||||
$groupmems=array_unique($groupmems);
|
||||
// determine how many group members are in results
|
||||
$member_count=0;
|
||||
foreach($result_ids as $result_id) {
|
||||
if (in_array($result_id,$groupmems)) $member_count += 1;
|
||||
}
|
||||
if (in_array("1",$s_group)) $show_groupmems=true;
|
||||
if (in_array("0",$s_group)) $show_nongroupmems=true;
|
||||
|
||||
if ($show_groupmems == $show_nongroupmems) $num_results=mysqli_num_rows($writeup); //show members and nonmembers
|
||||
if ($show_groupmems && !$show_nongroupmems) $num_results=$member_count; //only show members
|
||||
if (!$show_groupmems && $show_nongroupmems) $num_results=mysqli_num_rows($writeup)-$member_count; //only show nonmembers
|
||||
mysqli_data_seek($writeup,0);
|
||||
reset($group_writeups);
|
||||
$num_results=mysqli_num_rows($writeup);
|
||||
if ($num_results > 0) {
|
||||
if ($exportcsv) {
|
||||
// generate csv file
|
||||
@@ -886,7 +888,6 @@ if ($search) {
|
||||
rewind($csv_fp);
|
||||
// send file contents
|
||||
$csv_contents=stream_get_contents($csv_fp);
|
||||
//fpassthru($csv_fp);
|
||||
// Close our pointer and free up memory and /tmp space
|
||||
fclose($csv_fp);
|
||||
echo $csv_contents;
|
||||
@@ -946,11 +947,11 @@ if ($search) {
|
||||
}
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$group_num\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"writeupdetail.php?id={$tablerow['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
if (($show_groupmems == $show_nongroupmems) || ($is_member && $show_groupmems) || (!$is_member && $show_nongroupmems)) {
|
||||
if(in_array($tablerow['id'],$group_writeups) || count($s_group)==0) {
|
||||
// print table row
|
||||
printf(
|
||||
"<tr>
|
||||
@@ -985,7 +986,7 @@ if ($search) {
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
if (($show_groupmems == $show_nongroupmems) || ($is_member && $show_groupmems) || (!$is_member && $show_nongroupmems)) {
|
||||
if(in_array($tablerow['id'],$group_writeups) || count($s_group)==0) {
|
||||
displaywriteup($tablerow['id']);
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
settings.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeupdetail.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -52,6 +52,7 @@ $action_date=$incoming['action_date'];
|
||||
$action_time=$incoming['action_time'];
|
||||
$action_reason=$incoming['action_reason'];
|
||||
$action_text=$incoming['action_text'];
|
||||
$group=$incoming['group'];
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
@@ -93,6 +94,18 @@ if ($usersave) {
|
||||
|
||||
// update the record in writeups
|
||||
mysqli_query($drs_db,"update writeups set device=\"$device\",discovered=\"$discovered\",functional=\"$functional\",reported_by=\"$clean_reported_by\",report_date=\"$report_date\",report_time=\"$report_time\",subsystem=\"$subsystem\",discrepancy_text=\"$clean_discrepancy_text\" where id=\"$id\"");
|
||||
|
||||
// remove writeup from all groups and add to only selected groups
|
||||
mysqli_query($drs_db,"delete from links where writeupid=\"$id\"");
|
||||
foreach($group as &$link) {
|
||||
if($link==0) {
|
||||
// new group was requested
|
||||
mysqli_query($drs_db,"insert into groups(name) value(\"\")");
|
||||
$newgroup=mysqli_insert_id($drs_db);
|
||||
$link=$newgroup;
|
||||
}
|
||||
mysqli_query($drs_db,"insert into links(linkgroup, writeupid) values(\"$link\", \"$id\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($techsave) {
|
||||
@@ -371,13 +384,72 @@ if ($useredit) {
|
||||
<td align=\"right\" valign=\"bottom\"><input type=\"submit\" name=\"usersave\" value=\"Save Changes\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td><td></td><td align=\"right\" valign=\"bottom\">
|
||||
<td colspan=\"2\">Group Assignments:  
|
||||
";
|
||||
// Group multi-select ********************
|
||||
echo "
|
||||
<select style=\"max-width:60%;\" name=\"group[]\" id=\"ms-group\" multiple title=\"Select the groups this writeup should be a member of.\">
|
||||
";
|
||||
$linkquery=mysqli_query($drs_db,"select * from links where writeupid=\"$id\"");
|
||||
// create an array of ids returned by group query
|
||||
$wugroups=array();
|
||||
while ($eachlink=mysqli_fetch_assoc($linkquery)) {
|
||||
$wugroups[]=$eachlink['linkgroup'];
|
||||
}
|
||||
mysqli_data_seek($wugroups,0);
|
||||
$grow=mysqli_query($drs_db,"select * from groups order by id asc");
|
||||
printf("<option value=\"%s\">%s</option>",0,"New group");
|
||||
while ($gitem=mysqli_fetch_assoc($grow)) {
|
||||
if ($gitem["name"]=="") {
|
||||
$gname="Group ".$gitem["id"];
|
||||
} else {
|
||||
$gname=$gitem["name"];
|
||||
}
|
||||
if (in_array($gitem["id"],$wugroups,true)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$gitem["id"],$gname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
echo "
|
||||
</td>
|
||||
<td align=\"right\" valign=\"bottom\">
|
||||
<input type=\"submit\" name=\"cancel\" value=\"Cancel Changes\"></td>
|
||||
</tr>
|
||||
";
|
||||
} else {
|
||||
echo "<tr></tr><td colspan=\"2\">Group Assignments:  ";
|
||||
$wustat=dblookup($drs_db,"writeups","id","status",$id);
|
||||
if ($wustat==2 && !$role) $allowuseredit="disabled";
|
||||
// Group multi-select ********************
|
||||
echo "
|
||||
<select style=\"max-width:60%;\" name=\"groupshow\" id=\"ms-group\" multiple title=\"The groups this writeup is a member of.\">
|
||||
";
|
||||
$linkquery=mysqli_query($drs_db,"select * from links where writeupid=\"$id\"");
|
||||
// create an array of ids returned by group query
|
||||
$wugroups=array();
|
||||
while ($eachlink=mysqli_fetch_assoc($linkquery)) {
|
||||
$wugroups[]=$eachlink['linkgroup'];
|
||||
}
|
||||
mysqli_data_seek($wugroups,0);
|
||||
$grow=mysqli_query($drs_db,"select * from groups order by id asc");
|
||||
while ($gitem=mysqli_fetch_assoc($grow)) {
|
||||
if ($gitem["name"]=="") {
|
||||
$gname="Group ".$gitem["id"];
|
||||
} else {
|
||||
$gname=$gitem["name"];
|
||||
}
|
||||
if (in_array($gitem["id"],$wugroups,true)) {
|
||||
printf("<option value=\"%s\" selected disabled>%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
";
|
||||
echo "
|
||||
<td align=\"right\" valign=\"bottom\"><input $allowuseredit type=\"submit\" name=\"useredit\" value=\"Edit this Discrepancy\"></td>
|
||||
</tr>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2021 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
if ($group_count == 1) {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"writeupdetail.php?id={$tablerow['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
if ($group_count == 1) {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"writeupdetail.php?id={$tablerow['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,12 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
";
|
||||
$tgrow=mysqli_query($drs_db,"select id,name from groups order by id asc");
|
||||
while ($tgitem=mysqli_fetch_assoc($tgrow)) {
|
||||
printf("<option value=\"%s\">%s</option>",$tgitem["id"],$tgitem["name"]);
|
||||
if($tgitem["name"]=="") {
|
||||
$tgname="Group ".$tgitem["id"];
|
||||
} else {
|
||||
$tgname=$tgitem["name"];
|
||||
}
|
||||
printf("<option value=\"%s\">%s</option>",$tgitem["id"],$tgname);
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
|
||||
21
install.sh
21
install.sh
@@ -2,12 +2,12 @@
|
||||
|
||||
# install.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2021 Rod Wright
|
||||
# Copyright (C) 2022 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
|
||||
DRS_VERSION="1.1.2"
|
||||
DRS_VERSION="1.3.1"
|
||||
DOC_ROOT="/var/www"
|
||||
INSTALL_LOC="opendrs"
|
||||
APACHE_USER="www-data"
|
||||
@@ -91,6 +91,14 @@ then
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -R distfiles/* $install_path
|
||||
if [ ! -L "$install_path/jquery-ui" ]
|
||||
then
|
||||
ln -s $install_path/jquery-ui* $install_path/jquery-ui
|
||||
fi
|
||||
if [ ! -L "$install_path/index.php" ]
|
||||
then
|
||||
ln -s $install_path/writeups.php $install_path/index.php
|
||||
fi
|
||||
# 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"
|
||||
@@ -227,7 +235,14 @@ else
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -Rv distfiles/* $install_path
|
||||
|
||||
if [ ! -L "$install_path/jquery-ui" ]
|
||||
then
|
||||
ln -s $install_path/jquery-ui* $install_path/jquery-ui
|
||||
fi
|
||||
if [ ! -L "$install_path/index.php" ]
|
||||
then
|
||||
ln -s $install_path/writeups.php $install_path/index.php
|
||||
fi
|
||||
# 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"
|
||||
|
||||
@@ -69,7 +69,7 @@ CREATE TABLE `config` (
|
||||
LOCK TABLES `config` WRITE;
|
||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||
INSERT INTO `config` VALUES
|
||||
(1,'drs_version','1.2.0','1.2.0'),
|
||||
(1,'drs_version','1.3.1','1.3.1'),
|
||||
(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),
|
||||
(6,'banner','1','1'),
|
||||
(7,'background_color','0B3144','0B3144'),
|
||||
@@ -172,6 +172,7 @@ CREATE TABLE `discovered` (
|
||||
|
||||
LOCK TABLES `discovered` WRITE;
|
||||
/*!40000 ALTER TABLE `discovered` DISABLE KEYS */;
|
||||
INSERT INTO `discovered` VALUES (1,'Install','Initial installation',1);
|
||||
/*!40000 ALTER TABLE `discovered` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -272,6 +273,7 @@ CREATE TABLE `devices` (
|
||||
|
||||
LOCK TABLES `devices` WRITE;
|
||||
/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
|
||||
INSERT INTO `devices` VALUES (1,'OpenDRS Server',1);
|
||||
/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -337,6 +339,7 @@ CREATE TABLE `writeups` (
|
||||
|
||||
LOCK TABLES `writeups` WRITE;
|
||||
/*!40000 ALTER TABLE `writeups` DISABLE KEYS */;
|
||||
INSERT INTO `writeups` VALUES (1,1,1,1,'R. Wright',CURRENT_DATE(),CURRENT_TIME(),1,'This is a new installation of OpenDRS. There is one admin user (username: drsadmin password: OpenDRS-1). You should immediately log in and click on Manage Database under Admin Functions, go to the User Management tab, and add yourself as a new user, making sure to click the Admin checkbox to give yourself admin rights. You should then edit the DRS Admin user by clicking the User ID number in the table of existing users, and uncheck the Active checkbox. After you have done that, you can close this writeup.',1,0,NULL,NULL,0,NULL);
|
||||
/*!40000 ALTER TABLE `writeups` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
@@ -210,3 +210,14 @@ ALTER TABLE `writeups` CHANGE COLUMN `period` `discovered` int not null;
|
||||
|
||||
-- Rename period_effective column of writeups table to functional
|
||||
ALTER TABLE `writeups` CHANGE COLUMN `period_effective` `functional` tinyint(1) not null;
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.3.0 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.3.0",defaultvalue="1.3.0" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.3.1 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.3.1",defaultvalue="1.3.1" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user