Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e5c6e03e3 | |||
| 3667c4358f | |||
| 39931c0ca5 | |||
| 16d1ff9bb8 |
70
CHANGELOG
@@ -27,17 +27,67 @@ Changelog
|
||||
back button in terminal mode.
|
||||
- Added configurable help text for period effective selection.
|
||||
- Changed Sim period effective from selection to yes/no radio buttons.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand icon
|
||||
to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate date/time.
|
||||
- For logged in users, added the ability to select writeups directly on the
|
||||
View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for Device,
|
||||
Subsystem, and Period dropdowns, forcing user to make a selection.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand
|
||||
icon to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate
|
||||
date/time.
|
||||
- For logged in users, added the ability to select writeups directly on
|
||||
the View All Writeups page and assign/create a group.
|
||||
- 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
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to show
|
||||
the times instead of the period numbers. Period numbers are still shown
|
||||
in the results tables with mouse hover showing times.
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to
|
||||
show the times instead of the period numbers. Period numbers are
|
||||
still shown in the results tables with mouse hover showing times.
|
||||
- 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.
|
||||
|
||||
1.1.2 - 2021-04-28
|
||||
- Added ability to export search results as a CSV file.
|
||||
- Fixed bug in server-setup.sh that resulted in an incorrect install
|
||||
location if the installation name was left at the default.
|
||||
- Fixed bug in server-setup.sh that resulted in failure to set the
|
||||
ownership of the installed server directory tree if the http
|
||||
user and group names were left at the default.
|
||||
- Updated and tested to support Raspberry Pi 4B hardware.
|
||||
|
||||
1.2.0 - 2021-05-05
|
||||
- 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.
|
||||
|
||||
2
INSTALL
@@ -14,7 +14,7 @@ follow the prompts.
|
||||
4. Log in
|
||||
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
|
||||
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
|
||||
Admin Functions menu. If this an upgrade, your current usernames and
|
||||
passwords are unchanged.
|
||||
|
||||
108
RPiSetup/ap-setup.sh
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
# 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
@@ -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
@@ -0,0 +1 @@
|
||||
|
||||
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
@@ -0,0 +1 @@
|
||||
|
||||
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
@@ -0,0 +1 @@
|
||||
|
||||
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
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
systemctl stop hostapd
|
||||
systemctl disable hostapd
|
||||
|
||||
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
@@ -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
@@ -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"
|
||||
|
||||
|
||||
695
RPiSetup/home/customer/.config/openbox/rc.xml
Normal file
@@ -0,0 +1,695 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<openbox_config xmlns="http://openbox.org/3.4/rc"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<resistance>
|
||||
<strength>10</strength>
|
||||
<screen_edge_strength>20</screen_edge_strength>
|
||||
</resistance>
|
||||
|
||||
<focus>
|
||||
<focusNew>yes</focusNew>
|
||||
<!-- always try to focus new windows when they appear. other rules do
|
||||
apply -->
|
||||
<followMouse>no</followMouse>
|
||||
<!-- move focus to a window when you move the mouse into it -->
|
||||
<focusLast>yes</focusLast>
|
||||
<!-- focus the last used window when changing desktops, instead of the one
|
||||
under the mouse pointer. when followMouse is enabled -->
|
||||
<underMouse>no</underMouse>
|
||||
<!-- move focus under the mouse, even when the mouse is not moving -->
|
||||
<focusDelay>200</focusDelay>
|
||||
<!-- when followMouse is enabled, the mouse must be inside the window for
|
||||
this many milliseconds (1000 = 1 sec) before moving focus to it -->
|
||||
<raiseOnFocus>no</raiseOnFocus>
|
||||
<!-- when followMouse is enabled, and a window is given focus by moving the
|
||||
mouse into it, also raise the window -->
|
||||
</focus>
|
||||
|
||||
<placement>
|
||||
<policy>Smart</policy>
|
||||
<!-- 'Smart' or 'UnderMouse' -->
|
||||
<center>yes</center>
|
||||
<!-- whether to place windows in the center of the free area found or
|
||||
the top left corner -->
|
||||
<monitor>Primary</monitor>
|
||||
<!-- with Smart placement on a multi-monitor system, try to place new windows
|
||||
on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
|
||||
the active window is, 'Primary' - only on the primary monitor -->
|
||||
<primaryMonitor>1</primaryMonitor>
|
||||
<!-- The monitor where Openbox should place popup dialogs such as the
|
||||
focus cycling popup, or the desktop switch popup. It can be an index
|
||||
from 1, specifying a particular monitor. Or it can be one of the
|
||||
following: 'Mouse' - where the mouse is, or
|
||||
'Active' - where the active window is -->
|
||||
</placement>
|
||||
|
||||
<theme>
|
||||
<name>Clearlooks</name>
|
||||
<titleLayout>NLIMC</titleLayout>
|
||||
<!--
|
||||
available characters are NDSLIMC, each can occur at most once.
|
||||
N: window icon
|
||||
L: window label (AKA title).
|
||||
I: iconify
|
||||
M: maximize
|
||||
C: close
|
||||
S: shade (roll up/down)
|
||||
D: omnipresent (on all desktops).
|
||||
-->
|
||||
<keepBorder>yes</keepBorder>
|
||||
<animateIconify>yes</animateIconify>
|
||||
<font place="ActiveWindow">
|
||||
<name>sans</name>
|
||||
<size>8</size>
|
||||
<!-- font size in points -->
|
||||
<weight>bold</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
<font place="InactiveWindow">
|
||||
<name>sans</name>
|
||||
<size>8</size>
|
||||
<!-- font size in points -->
|
||||
<weight>bold</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
<font place="MenuHeader">
|
||||
<name>sans</name>
|
||||
<size>9</size>
|
||||
<!-- font size in points -->
|
||||
<weight>normal</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
<font place="MenuItem">
|
||||
<name>sans</name>
|
||||
<size>9</size>
|
||||
<!-- font size in points -->
|
||||
<weight>normal</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
<font place="ActiveOnScreenDisplay">
|
||||
<name>sans</name>
|
||||
<size>9</size>
|
||||
<!-- font size in points -->
|
||||
<weight>bold</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
<font place="InactiveOnScreenDisplay">
|
||||
<name>sans</name>
|
||||
<size>9</size>
|
||||
<!-- font size in points -->
|
||||
<weight>bold</weight>
|
||||
<!-- 'bold' or 'normal' -->
|
||||
<slant>normal</slant>
|
||||
<!-- 'italic' or 'normal' -->
|
||||
</font>
|
||||
</theme>
|
||||
|
||||
<desktops>
|
||||
<!-- this stuff is only used at startup, pagers allow you to change them
|
||||
during a session
|
||||
|
||||
these are default values to use when other ones are not already set
|
||||
by other applications, or saved in your session
|
||||
|
||||
use obconf if you want to change these without having to log out
|
||||
and back in -->
|
||||
<number>1</number>
|
||||
<firstdesk>1</firstdesk>
|
||||
<names>
|
||||
<!-- set names up here if you want to, like this:
|
||||
<name>desktop 1</name>
|
||||
<name>desktop 2</name>
|
||||
-->
|
||||
</names>
|
||||
<popupTime>875</popupTime>
|
||||
<!-- The number of milliseconds to show the popup for when switching
|
||||
desktops. Set this to 0 to disable the popup. -->
|
||||
</desktops>
|
||||
|
||||
<resize>
|
||||
<drawContents>yes</drawContents>
|
||||
<popupShow>Nonpixel</popupShow>
|
||||
<!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -->
|
||||
<popupPosition>Center</popupPosition>
|
||||
<!-- 'Center', 'Top', or 'Fixed' -->
|
||||
<popupFixedPosition>
|
||||
<!-- these are used if popupPosition is set to 'Fixed' -->
|
||||
|
||||
<x>10</x>
|
||||
<!-- positive number for distance from left edge, negative number for
|
||||
distance from right edge, or 'Center' -->
|
||||
<y>10</y>
|
||||
<!-- positive number for distance from top edge, negative number for
|
||||
distance from bottom edge, or 'Center' -->
|
||||
</popupFixedPosition>
|
||||
</resize>
|
||||
|
||||
<!-- You can reserve a portion of your screen where windows will not cover when
|
||||
they are maximized, or when they are initially placed.
|
||||
Many programs reserve space automatically, but you can use this in other
|
||||
cases. -->
|
||||
<margins>
|
||||
<top>0</top>
|
||||
<bottom>0</bottom>
|
||||
<left>0</left>
|
||||
<right>0</right>
|
||||
</margins>
|
||||
|
||||
<dock>
|
||||
<position>TopLeft</position>
|
||||
<!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -->
|
||||
<floatingX>0</floatingX>
|
||||
<floatingY>0</floatingY>
|
||||
<noStrut>no</noStrut>
|
||||
<stacking>Above</stacking>
|
||||
<!-- 'Above', 'Normal', or 'Below' -->
|
||||
<direction>Vertical</direction>
|
||||
<!-- 'Vertical' or 'Horizontal' -->
|
||||
<autoHide>no</autoHide>
|
||||
<hideDelay>300</hideDelay>
|
||||
<!-- in milliseconds (1000 = 1 second) -->
|
||||
<showDelay>300</showDelay>
|
||||
<!-- in milliseconds (1000 = 1 second) -->
|
||||
<moveButton>Middle</moveButton>
|
||||
<!-- 'Left', 'Middle', 'Right' -->
|
||||
</dock>
|
||||
|
||||
<keyboard>
|
||||
<!-- Chromium disable opening new window -->
|
||||
<keybind key="C-n">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening new incognito window -->
|
||||
<keybind key="C-S-n">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening new tab -->
|
||||
<keybind key="C-t">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening home page -->
|
||||
<keybind key="A-Home">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable back -->
|
||||
<keybind key="A-Left">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable forward -->
|
||||
<keybind key="A-Right">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening bookmark manager -->
|
||||
<keybind key="C-S-o">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening history page -->
|
||||
<keybind key="C-h">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening downloads page -->
|
||||
<keybind key="C-j">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening task manager -->
|
||||
<keybind key="S-Escape">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening help center -->
|
||||
<keybind key="F1">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable saving current page -->
|
||||
<keybind key="C-s">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable opening local file -->
|
||||
<keybind key="C-o">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable display source -->
|
||||
<keybind key="C-u">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable saving bookmark-->
|
||||
<keybind key="C-d">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Chromium disable saving multi bookmarks -->
|
||||
<keybind key="C-S-d">
|
||||
<action name="Execute">
|
||||
<command>true</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<!-- Enable rebooting with ctrl-alt-shift-del -->
|
||||
<keybind key="C-A-S-Delete">
|
||||
<action name="Execute">
|
||||
<command>shutdown -P now</command>
|
||||
</action>
|
||||
</keybind>
|
||||
<chainQuitKey>C-g</chainQuitKey>
|
||||
</keyboard>
|
||||
|
||||
<mouse>
|
||||
<dragThreshold>1</dragThreshold>
|
||||
<!-- number of pixels the mouse must move before a drag begins -->
|
||||
<doubleClickTime>500</doubleClickTime>
|
||||
<!-- in milliseconds (1000 = 1 second) -->
|
||||
<screenEdgeWarpTime>400</screenEdgeWarpTime>
|
||||
<!-- Time before changing desktops when the pointer touches the edge of the
|
||||
screen while moving a window, in milliseconds (1000 = 1 second).
|
||||
Set this to 0 to disable warping -->
|
||||
<screenEdgeWarpMouse>false</screenEdgeWarpMouse>
|
||||
<!-- Set this to TRUE to move the mouse pointer across the desktop when
|
||||
switching due to hitting the edge of the screen -->
|
||||
|
||||
<context name="Frame">
|
||||
<mousebind button="A-Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="A-Left" action="Click">
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="A-Left" action="Drag">
|
||||
<action name="Move"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="A-Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="A-Right" action="Drag">
|
||||
<action name="Resize"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="A-Middle" action="Press">
|
||||
<action name="Lower"/>
|
||||
<action name="FocusToBottom"/>
|
||||
<action name="Unfocus"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="A-Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="C-A-Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="C-A-Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-S-Up" action="Click">
|
||||
<action name="SendToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-S-Down" action="Click">
|
||||
<action name="SendToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Titlebar">
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Move"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="DoubleClick">
|
||||
<action name="ToggleMaximize"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="Up" action="Click">
|
||||
<action name="if">
|
||||
<shaded>no</shaded>
|
||||
<then>
|
||||
<action name="Shade"/>
|
||||
<action name="FocusToBottom"/>
|
||||
<action name="Unfocus"/>
|
||||
<action name="Lower"/>
|
||||
</then>
|
||||
</action>
|
||||
</mousebind>
|
||||
<mousebind button="Down" action="Click">
|
||||
<action name="if">
|
||||
<shaded>yes</shaded>
|
||||
<then>
|
||||
<action name="Unshade"/>
|
||||
<action name="Raise"/>
|
||||
</then>
|
||||
</action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Titlebar Top Right Bottom Left TLCorner TRCorner BRCorner BLCorner">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="Middle" action="Press">
|
||||
<action name="Lower"/>
|
||||
<action name="FocusToBottom"/>
|
||||
<action name="Unfocus"/>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="ShowMenu"><menu>client-menu</menu></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Top">
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Resize"><edge>top</edge></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Left">
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Resize"><edge>left</edge></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Right">
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Resize"><edge>right</edge></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Bottom">
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Resize"><edge>bottom</edge></action>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="ShowMenu"><menu>client-menu</menu></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="TRCorner BRCorner TLCorner BLCorner">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Drag">
|
||||
<action name="Resize"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Client">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="Middle" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Icon">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
<action name="ShowMenu"><menu>client-menu</menu></action>
|
||||
</mousebind>
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="ShowMenu"><menu>client-menu</menu></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="AllDesktops">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Click">
|
||||
<action name="ToggleOmnipresent"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Shade">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Click">
|
||||
<action name="ToggleShade"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Iconify">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Click">
|
||||
<action name="Iconify"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Maximize">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Middle" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Click">
|
||||
<action name="ToggleMaximize"/>
|
||||
</mousebind>
|
||||
<mousebind button="Middle" action="Click">
|
||||
<action name="ToggleMaximize"><direction>vertical</direction></action>
|
||||
</mousebind>
|
||||
<mousebind button="Right" action="Click">
|
||||
<action name="ToggleMaximize"><direction>horizontal</direction></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Close">
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
<action name="Unshade"/>
|
||||
</mousebind>
|
||||
<mousebind button="Left" action="Click">
|
||||
<action name="Close"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Desktop">
|
||||
<mousebind button="Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="A-Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="C-A-Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="C-A-Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
|
||||
<mousebind button="Left" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
<mousebind button="Right" action="Press">
|
||||
<action name="Focus"/>
|
||||
<action name="Raise"/>
|
||||
</mousebind>
|
||||
</context>
|
||||
|
||||
<context name="Root">
|
||||
<!-- Menus -->
|
||||
</context>
|
||||
|
||||
<context name="MoveResize">
|
||||
<mousebind button="Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-Up" action="Click">
|
||||
<action name="GoToDesktop"><to>previous</to></action>
|
||||
</mousebind>
|
||||
<mousebind button="A-Down" action="Click">
|
||||
<action name="GoToDesktop"><to>next</to></action>
|
||||
</mousebind>
|
||||
</context>
|
||||
</mouse>
|
||||
|
||||
<menu>
|
||||
</menu>
|
||||
|
||||
<applications>
|
||||
<!--
|
||||
# this is an example with comments through out. use these to make your
|
||||
# own rules, but without the comments of course.
|
||||
# you may use one or more of the name/class/role/title/type rules to specify
|
||||
# windows to match
|
||||
|
||||
<application name="the window's _OB_APP_NAME property (see obxprop)"
|
||||
class="the window's _OB_APP_CLASS property (see obxprop)"
|
||||
groupname="the window's _OB_APP_GROUP_NAME property (see obxprop)"
|
||||
groupclass="the window's _OB_APP_GROUP_CLASS property (see obxprop)"
|
||||
role="the window's _OB_APP_ROLE property (see obxprop)"
|
||||
title="the window's _OB_APP_TITLE property (see obxprop)"
|
||||
type="the window's _OB_APP_TYPE property (see obxprob)..
|
||||
(if unspecified, then it is 'dialog' for child windows)">
|
||||
# you may set only one of name/class/role/title/type, or you may use more
|
||||
# than one together to restrict your matches.
|
||||
|
||||
# the name, class, role, and title use simple wildcard matching such as those
|
||||
# used by a shell. you can use * to match any characters and ? to match
|
||||
# any single character.
|
||||
|
||||
# the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
|
||||
# or desktop
|
||||
|
||||
# when multiple rules match a window, they will all be applied, in the
|
||||
# order that they appear in this list
|
||||
|
||||
|
||||
# each rule element can be left out or set to 'default' to specify to not
|
||||
# change that attribute of the window
|
||||
|
||||
<decor>yes</decor>
|
||||
# enable or disable window decorations
|
||||
|
||||
<shade>no</shade>
|
||||
# make the window shaded when it appears, or not
|
||||
|
||||
<position force="no">
|
||||
# the position is only used if both an x and y coordinate are provided
|
||||
# (and not set to 'default')
|
||||
# when force is "yes", then the window will be placed here even if it
|
||||
# says you want it placed elsewhere. this is to override buggy
|
||||
# applications who refuse to behave
|
||||
<x>center</x>
|
||||
# a number like 50, or 'center' to center on screen. use a negative number
|
||||
# to start from the right (or bottom for <y>), ie -50 is 50 pixels from
|
||||
# the right edge (or bottom). use 'default' to specify using value
|
||||
# provided by the application, or chosen by openbox, instead.
|
||||
<y>200</y>
|
||||
<monitor>1</monitor>
|
||||
# specifies the monitor in a xinerama setup.
|
||||
# 1 is the first head, or 'mouse' for wherever the mouse is
|
||||
</position>
|
||||
|
||||
<size>
|
||||
# the size to make the window.
|
||||
<width>20</width>
|
||||
# a number like 20, or 'default' to use the size given by the application.
|
||||
# you can use fractions such as 1/2 or percentages such as 75% in which
|
||||
# case the value is relative to the size of the monitor that the window
|
||||
# appears on.
|
||||
<height>30%</height>
|
||||
</size>
|
||||
|
||||
<focus>yes</focus>
|
||||
# if the window should try be given focus when it appears. if this is set
|
||||
# to yes it doesn't guarantee the window will be given focus. some
|
||||
# restrictions may apply, but Openbox will try to
|
||||
|
||||
<desktop>1</desktop>
|
||||
# 1 is the first desktop, 'all' for all desktops
|
||||
|
||||
<layer>normal</layer>
|
||||
# 'above', 'normal', or 'below'
|
||||
|
||||
<iconic>no</iconic>
|
||||
# make the window iconified when it appears, or not
|
||||
|
||||
<skip_pager>no</skip_pager>
|
||||
# asks to not be shown in pagers
|
||||
|
||||
<skip_taskbar>no</skip_taskbar>
|
||||
# asks to not be shown in taskbars. window cycling actions will also
|
||||
# skip past such windows
|
||||
|
||||
<fullscreen>yes</fullscreen>
|
||||
# make the window in fullscreen mode when it appears
|
||||
|
||||
<maximized>true</maximized>
|
||||
# 'Horizontal', 'Vertical' or boolean (yes/no)
|
||||
</application>
|
||||
|
||||
# end of the example
|
||||
-->
|
||||
</applications>
|
||||
|
||||
</openbox_config>
|
||||
23
RPiSetup/home/customer/.profile
Normal file
@@ -0,0 +1,23 @@
|
||||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
/usr/bin/startx /etc/X11/Xsession /usr/local/bin/startdrs.sh -- :0
|
||||
@@ -2,10 +2,22 @@
|
||||
|
||||
# server-setup.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2021 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
inst_name="OpenDRS"
|
||||
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 ""
|
||||
@@ -15,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."
|
||||
@@ -25,60 +37,284 @@ fi
|
||||
echo "It looks like you have. Continuing."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Updating Raspbian..."
|
||||
echo "Updating Raspberry Pi OS..."
|
||||
sleep 10
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
apt update && apt dist-upgrade -y
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "...done."
|
||||
sleep 10
|
||||
echo ""
|
||||
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 "generate a random password(leave the field blank)."
|
||||
echo ""
|
||||
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. 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
|
||||
sleep 10
|
||||
apt install -y apache2 php php-mcrypt mysql-server phpmyadmin
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
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 ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
mysql_secure_installation
|
||||
mysql mysql -e "update user set plugin='';flush privileges;"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Installing OpenDRS."
|
||||
DRS_VERSION="1.1.0"
|
||||
install_path="/var/www/opendrs-$DRS_VERSION"
|
||||
httpd_user_group="www-data:www-data"
|
||||
new_link_name="/var/www/opendrs"
|
||||
|
||||
# This is a fresh install
|
||||
operation="installed"
|
||||
# prompt for mysql information
|
||||
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. 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 ""
|
||||
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_in
|
||||
if [ "$inst_name_in" != "" ]
|
||||
then
|
||||
inst_name=$inst_name_in
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
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 ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Creating installation directory . . ."
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Installing to $docroot_path/$inst_name"
|
||||
sleep 10
|
||||
install_path=$docroot_path/$inst_name
|
||||
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 . . ."
|
||||
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 ""
|
||||
echo ""
|
||||
|
||||
# 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_in
|
||||
if [ "$httpd_user_group_in" != "" ]
|
||||
then
|
||||
httpd_user_group="$httpd_user_group_in"
|
||||
else
|
||||
httpd_user_group="$apache_user:$apache_group"
|
||||
fi
|
||||
echo ""
|
||||
echo "Setting file ownership . . ."
|
||||
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
|
||||
chown -R $httpd_user_group $install_path
|
||||
|
||||
echo ""
|
||||
echo "Server configuration is now complete. "
|
||||
echo "Once the reboot is complete you will need to do the final installation of OpenDRS through"
|
||||
echo "the browser. You will need the password you set during the mysql installation above."
|
||||
|
||||
# tell user to launch web browser to continue
|
||||
echo ""
|
||||
echo ""
|
||||
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2,"
|
||||
echo "log in as pi, then create new users for yourself and any other"
|
||||
echo "administrators using the cloneuser command (cloneuser pi newlogin)."
|
||||
echo ""
|
||||
echo "OpenDRS has been installed."
|
||||
|
||||
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
|
||||
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
|
||||
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 -n "Press enter to reboot now."
|
||||
read rebootok
|
||||
reboot
|
||||
echo "Once the final install is done, you will need to log in to $inst_name to configure it."
|
||||
echo "IMPORTANT: The default login credentials for the initial admin user are:"
|
||||
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."
|
||||
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"http://localhost/$inst_name/\""',' /etc/drs.conf
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
# terminal-setup.sh
|
||||
# OpenDRS Online Maintenance Tracking System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2021 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
current_user=`whoami`
|
||||
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 ""
|
||||
@@ -15,50 +22,76 @@ echo ""
|
||||
echo ""
|
||||
echo "You should have already completed the following steps:"
|
||||
echo ""
|
||||
echo "1. Created a Raspbian Lite SD card from the latest release."
|
||||
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 "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 " a. Set locale, timezone, keyboard layout, and wifi country under"
|
||||
echo " Localisation Options. IMPORTANT: Do this first before setting"
|
||||
echo " any passwords. Changing keyboard types usually changes character"
|
||||
echo " mappings, meaning your password after the change may not be what"
|
||||
echo " it was before the change."
|
||||
echo " b. Set a strong password for the pi user."
|
||||
echo " c. 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 " 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 " Raspberry Pi and extracted it."
|
||||
echo "5. Changed directory to RPiSetup in the the extracted distribution directory."
|
||||
echo "6. Ran sudo ./terminal-setup.sh (this file)."
|
||||
echo "5. Changed directory to RPiSetup in the extracted distribution directory."
|
||||
echo ""
|
||||
echo "If you have completed these steps, press enter to continue. If not,"
|
||||
echo -n "press ctrl-c to quit."
|
||||
read continueok
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Updating Raspbian..."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Updating Raspberry Pi OS..."
|
||||
sleep 10
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
apt update && apt dist-upgrade -y
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "...done."
|
||||
sleep 10
|
||||
echo ""
|
||||
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
|
||||
rm /lib/systemd/system/ctrl-alt-del.target
|
||||
ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "...done."
|
||||
sleep 10
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Installing required terminal packages..."
|
||||
sleep 10
|
||||
wget http://www.webmin.com/jcameron-key.asc
|
||||
apt-key add jcameron-key.asc
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
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
|
||||
systemctl enable getty@tty1.service
|
||||
@@ -70,6 +103,10 @@ cd brlaser-master
|
||||
cmake . && make && make install
|
||||
cd ..
|
||||
myhn=`hostname`
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Drivers have been installed for the Brother HL-L2300D printer that may come"
|
||||
echo "with the terminal."
|
||||
echo "After the terminal is set up and working, you can use another network"
|
||||
@@ -78,46 +115,72 @@ echo "of your choosing."
|
||||
echo -n "Press enter to continue."
|
||||
read continueok
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Creating customer user..."
|
||||
cloneuser pi customer
|
||||
sleep 10
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
cloneuser `who am i | awk '{print $1}'` customer
|
||||
mkdir -p /home/customer/.config/openbox
|
||||
cp home/customer/.profile /home/customer
|
||||
cp home/customer/.config/openbox/rc.xml /home/customer/.config/openbox
|
||||
chown -R customer:customer /home/customer/.config /home/customer/.profile
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "...done."
|
||||
echo ""
|
||||
echo ""
|
||||
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 "default URL shown. Otherwise, enter the server URL."
|
||||
echo -n "[http://localhost] :"
|
||||
echo "you intend to host the server directly on this terminal, leave this"
|
||||
echo -n "blank. Otherwise, enter the server URL :"
|
||||
read server_url
|
||||
if [[ $server_url == "" ]]
|
||||
then
|
||||
server_url="http://localhost"
|
||||
fi
|
||||
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
|
||||
conftype="Server/Terminal"
|
||||
./server-setup.sh
|
||||
else
|
||||
conftype="Terminal"
|
||||
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"$server_url\""',' /etc/drs.conf
|
||||
fi
|
||||
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2,"
|
||||
echo "log in as pi, then create new users for yourself and any other"
|
||||
echo "administrators using the cloneuser command (cloneuser pi newlogin)."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Setup complete."
|
||||
echo -n "Press enter to reboot now."
|
||||
./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 "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 "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
|
||||
reboot
|
||||
if [ "$rebootok" = "N" -o "$rebootok" = "n" ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
reboot
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,17 +2,27 @@
|
||||
SRC=$1
|
||||
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_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"
|
||||
useradd --shell ${SRC_SHELL} --create-home ${DEST}
|
||||
echo "Creating user $DEST with a random password"
|
||||
useradd --shell ${SRC_SHELL} --password ${RAND_PW} --create-home ${DEST}
|
||||
for grp in ${SRC_GROUPS};do
|
||||
if [ "$grp" != "$SRC" ]; then
|
||||
echo "Adding user $DEST to group $grp."
|
||||
usermod -a -G $grp ${DEST}
|
||||
fi
|
||||
done
|
||||
passwd ${DEST}
|
||||
echo "Finished. Please set an actual password for $DEST if you want them to be able to log in."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,37 @@
|
||||
#!/bin/bash
|
||||
# startdrs.sh
|
||||
|
||||
source /etc/drs.conf
|
||||
|
||||
openbox-session &
|
||||
|
||||
xset s off
|
||||
xset +dpms
|
||||
xset dpms 0 600 1800
|
||||
|
||||
#xset dpms force off
|
||||
|
||||
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/
|
||||
|
||||
# start browser in your web site: here, just plain old localhost
|
||||
# -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 --incognito $DRS_SERVER &
|
||||
$KILL_CMD
|
||||
$CLEANUP_CMD
|
||||
|
||||
# start application
|
||||
$APP_CMD &
|
||||
|
||||
sleep 10
|
||||
|
||||
while true
|
||||
do
|
||||
pgrep chromium-browse
|
||||
pgrep $ALIVE_STRING
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
# here you could execute something that is supposed to happen after the browser was accidentally quit
|
||||
chromium-browser -test-type --ignore-certificate-errors --kiosk --no-first-run --incognito $DRS_SERVER &
|
||||
# relaunch application if it terminates
|
||||
$APP_CMD &
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
Raspberry Pi setup
|
||||
|
||||
1. Create Raspbian Lite SD card from the most recent stable release.
|
||||
1. Create Raspberry Pi OS Lite SD card from the most recent stable release.
|
||||
|
||||
2. Insert SD card in Raspberry Pi and boot.
|
||||
|
||||
3. Login as pi.
|
||||
3. Login as pi. Default password is raspberry.
|
||||
|
||||
4. sudo raspi-config and:
|
||||
|
||||
a. Use option 1 to set a strong password for the default user (pi).
|
||||
|
||||
b. Use option 2 Network Options to:
|
||||
1. Set the desired hostname.
|
||||
2. Set WiFi SSID and passphrase if using WiFi for networking.
|
||||
|
||||
c. Use option 4 Localisation Options to:
|
||||
1. Set locale.
|
||||
a. Use Localisation Options to:
|
||||
1. Set locale to en_US.UTF-8 UTF-8.
|
||||
2. Set timezone.
|
||||
3. Set keyboard layout (IMPORTANT! Raspbian 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 WiFi country.
|
||||
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! Make
|
||||
sure you set this before setting any passwords or you may
|
||||
not be able to log back in!).
|
||||
4. Set WLAN country.
|
||||
|
||||
d. Use option 5 Interfacing Options to enable SSH server.
|
||||
b. Set a strong password for the default user (pi).
|
||||
|
||||
e. If you have black borders on the sides of the screen, use option 7
|
||||
Advanced Options to select No for Overscan compensation.
|
||||
c. Set the desired hostname.
|
||||
|
||||
f. When you've finished, tab down to highlight Finish and hit enter.
|
||||
d. Set Wireless LAN SSID and passphrase if using WiFi for networking.
|
||||
|
||||
g. Reboot when prompted.
|
||||
e. Use Interfacing Options to enable SSH server.
|
||||
|
||||
h. Log back in as pi using the password you set in a. above.
|
||||
f. If you have black borders on the sides of the screen, use Display
|
||||
Underscan option to change Overscan compensation.
|
||||
|
||||
g. When you've finished, tab down to highlight Finish and hit enter.
|
||||
|
||||
h. Reboot when prompted.
|
||||
|
||||
i. Log back in as pi using the password you set in b. above.
|
||||
|
||||
5. Copy OpenDRS distribution package to /home/pi on the Raspberry Pi and extract.
|
||||
|
||||
|
||||
18
TODO.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
TODO
|
||||
|
||||
- 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) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -48,11 +48,13 @@ if ($print=="Printer Friendly") {
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
}
|
||||
|
||||
$role=dblookup($mts_db,"users","id","role",$userid);
|
||||
$role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","Boilerplate Page",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
db.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
@@ -27,17 +27,67 @@ Changelog
|
||||
back button in terminal mode.
|
||||
- Added configurable help text for period effective selection.
|
||||
- Changed Sim period effective from selection to yes/no radio buttons.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand icon
|
||||
to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate date/time.
|
||||
- For logged in users, added the ability to select writeups directly on the
|
||||
View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for Device,
|
||||
Subsystem, and Period dropdowns, forcing user to make a selection.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand
|
||||
icon to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate
|
||||
date/time.
|
||||
- For logged in users, added the ability to select writeups directly on
|
||||
the View All Writeups page and assign/create a group.
|
||||
- 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
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to show
|
||||
the times instead of the period numbers. Period numbers are still shown
|
||||
in the results tables with mouse hover showing times.
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to
|
||||
show the times instead of the period numbers. Period numbers are
|
||||
still shown in the results tables with mouse hover showing times.
|
||||
- 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.
|
||||
|
||||
1.1.2 - 2021-04-28
|
||||
- Added ability to export search results as a CSV file.
|
||||
- Fixed bug in server-setup.sh that resulted in an incorrect install
|
||||
location if the installation name was left at the default.
|
||||
- Fixed bug in server-setup.sh that resulted in failure to set the
|
||||
ownership of the installed server directory tree if the http
|
||||
user and group names were left at the default.
|
||||
- Updated and tested to support Raspberry Pi 4B hardware.
|
||||
|
||||
1.2.0 - 2021-05-05
|
||||
- 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.
|
||||
|
||||
@@ -14,7 +14,7 @@ follow the prompts.
|
||||
4. Log in
|
||||
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
|
||||
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
|
||||
Admin Functions menu. If this an upgrade, your current usernames and
|
||||
passwords are unchanged.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
about.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -39,6 +39,7 @@ if ($print) {
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
$drs_version=DRS_VERSION;
|
||||
|
||||
if ($print=="Printer Friendly") {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
@@ -52,7 +53,9 @@ $role=dblookup($mts_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","About OpenDRS",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -72,7 +75,7 @@ echo "<br>";
|
||||
|
||||
echo "
|
||||
<h3 align=\"center\">
|
||||
OpenDRS $version Discrepancy Reporting System
|
||||
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.
|
||||
@@ -119,7 +122,7 @@ server.</td>
|
||||
<tr>
|
||||
<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
|
||||
<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>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
common.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -26,7 +26,19 @@ if (!file_exists("db.php")) {
|
||||
include("db.php");
|
||||
include("settings.php");
|
||||
|
||||
// define some constants
|
||||
// assign variables from constants
|
||||
$device_term=DEVICE_TERM;
|
||||
$discovered_term=DISCOVERED_TERM;
|
||||
$discovered_term_short=DISCOVERED_TERM_SHORT;
|
||||
$functional_term=FUNCTIONAL_TERM;
|
||||
$functional_term_short=FUNCTIONAL_TERM_SHORT;
|
||||
$disc_drop_data=DISC_DROP_DATA;
|
||||
$functional_yes=FUNCTIONAL_YES;
|
||||
$functional_no=FUNCTIONAL_NO;
|
||||
$functional_yes_short=FUNCTIONAL_YES_SHORT;
|
||||
$functional_no_short=FUNCTIONAL_NO_SHORT;
|
||||
|
||||
// define some other constants
|
||||
define("STAT_OPEN",1);
|
||||
define("STAT_CLOSED",2);
|
||||
define("STAT_DEFERRED",3);
|
||||
@@ -260,9 +272,9 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
$( \"#logoutall\" ).checkboxradio({
|
||||
icon: false
|
||||
});
|
||||
$( \"#device, #subsystem, #period, #period_effective, [id|='sel']\" ).selectmenu();
|
||||
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
|
||||
$( \"#status, #user, #reason\" ).selectmenu();
|
||||
$( \"#subsystem, #period, #searchstatus, #pass, #passconf\").tooltip();
|
||||
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
|
||||
$( \"[id|='ms']\").multiselect();
|
||||
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
|
||||
</script>
|
||||
@@ -276,7 +288,6 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
function pagetable($option) {
|
||||
if ($option=="begin") {
|
||||
echo "
|
||||
@@ -357,7 +368,7 @@ function sidemenu($printable=true) {
|
||||
echo "
|
||||
<br>
|
||||
<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=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
|
||||
@@ -374,6 +385,7 @@ function sidemenu($printable=true) {
|
||||
<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=\"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>
|
||||
<br>
|
||||
";
|
||||
@@ -531,17 +543,24 @@ function validate_password($pass,$passconf) {
|
||||
}
|
||||
|
||||
function displaywriteup($id) {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $drs_db;
|
||||
|
||||
$writeupdata=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from writeups where id=\"$id\""));
|
||||
// determine status indicator
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine effective icon
|
||||
if($writeupdata["period_effective"]==1) {
|
||||
$effind="<font color=\"#00FF00\" title=\"Period Effective\">EFF</font>";
|
||||
// determine functional indicator
|
||||
if($writeupdata["functional"]==1) {
|
||||
$funcind="<font color=\"#00FF00\" title=\"$functional_yes\">$functional_yes_short</font>";
|
||||
} else {
|
||||
$effind="<font color=\"#FF0000\" title=\"Period Non-effective\">NEF</font>";
|
||||
$funcind="<font color=\"#FF0000\" title=\"$functional_no\">$functional_no_short</font>";
|
||||
}
|
||||
// look up text data
|
||||
$devicename=dblookup($drs_db,"devices","id","name",$writeupdata["device"]);
|
||||
@@ -551,8 +570,8 @@ function displaywriteup($id) {
|
||||
$rdate=$writeupdata["report_date"];
|
||||
$rtime=$writeupdata["report_time"];
|
||||
$repby=$writeupdata["reported_by"];
|
||||
$period=$writeupdata["period"];
|
||||
$periodtimes=dblookup($drs_db,"periods","id","times",$period);
|
||||
$whendiscoveredname=dblookup($drs_db,"discovered","id","whendiscoveredname",$writeupdata["discovered"]);
|
||||
$whendiscovereddesc=dblookup($drs_db,"discovered","id","whendiscovereddesc",$writeupdata["discovered"]);
|
||||
$techfname=dblookup($drs_db,"users","id","firstname",$writeupdata["action_by"]);
|
||||
$techlname=dblookup($drs_db,"users","id","lastname",$writeupdata["action_by"]);
|
||||
$reasonname=dblookup($drs_db,"reasons","id","text",$writeupdata["action_reason"]);
|
||||
@@ -576,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 "
|
||||
@@ -584,10 +603,10 @@ function displaywriteup($id) {
|
||||
<table border=\"0\">
|
||||
<tr><td><b>ID:</b> <a href=\"writeupdetail.php?id=$id\" title=\"View or change details of this writeup\">$id</a></td><td> </td>
|
||||
<td><b>$statusind</b></td><td> </td>
|
||||
<td><b>Device:</b> $devicename</td><td> </td>
|
||||
<td><b>$device_term:</b> $devicename</td><td> </td>
|
||||
<td><b>Subsystem:</b> <font title=\"$subsystemdesc\">$subsystemname</font></td><td> </td>
|
||||
<td><b>Period:</b> <font title=\"$periodtimes\">$period</font></td><td> </td>
|
||||
<td><b>$effind</b></td>
|
||||
<td><b>$discovered_term:</b> <font title=\"$whendiscovereddesc\">$whendiscoveredname</font></td><td> </td>
|
||||
<td><b>$funcind</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
@@ -673,22 +692,28 @@ 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;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $drs_db;
|
||||
|
||||
// print group id and name
|
||||
if ($selection == "all") {
|
||||
$sel_flag="checked";
|
||||
} 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";
|
||||
@@ -705,12 +730,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
} else {
|
||||
@@ -720,12 +745,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -743,13 +768,14 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine times for period
|
||||
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$writeupdata['period']}\""))[0];
|
||||
// determine effective icon
|
||||
if($writeupdata["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
// determine whendiscovered text for discovered id
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
// determine functional icon
|
||||
if($writeupdata["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
// print table row
|
||||
if ($role && $mode=="select") {
|
||||
@@ -770,12 +796,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$ptimes, $writeupdata["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
@@ -793,12 +819,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$ptimes, $writeupdata["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
config.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -45,7 +45,17 @@ $update_display=$incoming['update_display'];
|
||||
$display_appname=$incoming['display_appname'];
|
||||
$display_banner=$incoming['display_banner'];
|
||||
$display_footer=$incoming['display_footer'];
|
||||
$display_pereffhlp=$incoming['display_pereffhlp'];
|
||||
$display_funchelp=$incoming['display_funchelp'];
|
||||
$display_device_term=$incoming['display_device_term'];
|
||||
$display_discovered_term=$incoming['display_discovered_term'];
|
||||
$display_discovered_term_short=$incoming['display_discovered_term_short'];
|
||||
$display_disc_drop_data=$incoming['display_disc_drop_data'];
|
||||
$display_functional_term=$incoming['display_functional_term'];
|
||||
$display_functional_term_short=$incoming['display_functional_term_short'];
|
||||
$display_functional_yes=$incoming['display_functional_yes'];
|
||||
$display_functional_no=$incoming['display_functional_no'];
|
||||
$display_functional_yes_short=$incoming['display_functional_yes_short'];
|
||||
$display_functional_no_short=$incoming['display_functional_no_short'];
|
||||
|
||||
$update_colors=$incoming['update_colors'];
|
||||
$reset_colors=$incoming['reset_colors'];
|
||||
@@ -81,7 +91,9 @@ if ($print=="Printer Friendly") {
|
||||
|
||||
framework("begin","$appname","Configuration",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -92,14 +104,52 @@ if ($update_display) {
|
||||
// remove html tags from app name and sanitize
|
||||
$display_appname=strip_tags($display_appname);
|
||||
$clean_display_appname=mysqli_real_escape_string($drs_db,$display_appname);
|
||||
// remove html tags from period effective help text and sanitize
|
||||
$display_pereffhlp=strip_tags($display_pereffhlp);
|
||||
$clean_display_pereffhlp=mysqli_real_escape_string($drs_db,$display_pereffhlp);
|
||||
// remove html tags from functional help text and sanitize
|
||||
$display_funchelp=strip_tags($display_funchelp);
|
||||
$clean_display_funchelp=mysqli_real_escape_string($drs_db,$display_funchelp);
|
||||
// remove html tags from device term and sanitize
|
||||
$display_device_term=strip_tags($display_device_term);
|
||||
$clean_display_device_term=mysqli_real_escape_string($drs_db,$display_device_term);
|
||||
// remove html tags from discovered term and sanitize
|
||||
$display_discovered_term=strip_tags($display_discovered_term);
|
||||
$clean_display_discovered_term=mysqli_real_escape_string($drs_db,$display_discovered_term);
|
||||
// remove html tags from short discovered term and sanitize
|
||||
$display_discovered_term_short=strip_tags($display_discovered_term_short);
|
||||
$clean_display_discovered_term_short=mysqli_real_escape_string($drs_db,$display_discovered_term_short);
|
||||
// remove html tags from functional term and sanitize
|
||||
$display_functional_term=strip_tags($display_functional_term);
|
||||
$clean_display_functional_term=mysqli_real_escape_string($drs_db,$display_functional_term);
|
||||
// remove html tags from short functional term and sanitize
|
||||
$display_functional_term_short=strip_tags($display_functional_term_short);
|
||||
$clean_display_functional_term_short=mysqli_real_escape_string($drs_db,$display_functional_term_short);
|
||||
// remove html tags from functional yes and sanitize
|
||||
$display_functional_yes=strip_tags($display_functional_yes);
|
||||
$clean_display_functional_yes=mysqli_real_escape_string($drs_db,$display_functional_yes);
|
||||
// remove html tags from functional no and sanitize
|
||||
$display_functional_no=strip_tags($display_functional_no);
|
||||
$clean_display_functional_no=mysqli_real_escape_string($drs_db,$display_functional_no);
|
||||
// remove html tags from short functional yes and sanitize
|
||||
$display_functional_yes_short=strip_tags($display_functional_yes_short);
|
||||
$clean_display_functional_yes_short=mysqli_real_escape_string($drs_db,$display_functional_yes_short);
|
||||
// remove html tags from short functional no and sanitize
|
||||
$display_functional_no_short=strip_tags($display_functional_no_short);
|
||||
$clean_display_functional_no_short=mysqli_real_escape_string($drs_db,$display_functional_no_short);
|
||||
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_appname\" where name=\"app_name\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$display_banner\" where name=\"banner\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_footer\" where name=\"footer_message\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_pereffhlp\" where name=\"period_eff_help_txt\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_funchelp\" where name=\"functional_help_txt\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_device_term\" where name=\"device_term\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_discovered_term\" where name=\"discovered_term\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_discovered_term_short\" where name=\"discovered_term_short\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$display_disc_drop_data\" where name=\"disc_drop_data\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_term\" where name=\"functional_term\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_term_short\" where name=\"functional_term_short\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_yes\" where name=\"functional_yes\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_no\" where name=\"functional_no\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_yes_short\" where name=\"functional_yes_short\"");
|
||||
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_no_short\" where name=\"functional_no_short\"");
|
||||
|
||||
echo "<meta http-equiv='refresh' content='0'>";
|
||||
}
|
||||
|
||||
@@ -239,7 +289,18 @@ echo "
|
||||
$curapn=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"app_name\""))[0];
|
||||
$curbnr=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"banner\""))[0];
|
||||
$curftr=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"footer_message\""))[0];
|
||||
$curpereffhlp=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"period_eff_help_txt\""))[0];
|
||||
$curfunchelp=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_help_txt\""))[0];
|
||||
$curdscterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"discovered_term\""))[0];
|
||||
$curdscterms=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"discovered_term_short\""))[0];
|
||||
$curdiscdropdata=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"disc_drop_data\""))[0];
|
||||
$curfuncterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_term\""))[0];
|
||||
$curfuncterms=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_term_short\""))[0];
|
||||
$curfuncyes=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_yes\""))[0];
|
||||
$curfuncno=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_no\""))[0];
|
||||
$curfuncyess=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_yes_short\""))[0];
|
||||
$curfuncnos=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_no_short\""))[0];
|
||||
$curdevterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"device_term\""))[0];
|
||||
|
||||
echo "
|
||||
<font size=\"+1\"><b>Display Configuration Parameters</b></font><br><br><br><br>
|
||||
";
|
||||
@@ -259,12 +320,37 @@ while ($bannerrow=mysqli_fetch_assoc($bannerqry)) {
|
||||
printf("<option value=\"%s\">%s</option>",$bannerrow["bannerid"],$bannerrow["bannername"]);
|
||||
}
|
||||
}
|
||||
|
||||
$dropnamestate=$dropdescstate="";
|
||||
if($curdiscdropdata=="Name") $dropnamestate="checked";
|
||||
if($curdiscdropdata=="Desc") $dropdescstate="checked";
|
||||
|
||||
echo "
|
||||
</select><br><br><br>
|
||||
Footer Message (will appear at the bottom of pages):<br>
|
||||
<input type=\"text\" name=\"display_footer\" size=\"80\" value=\"$curftr\"><br><br><br>
|
||||
Period Effective Help Text :<br>
|
||||
<textarea rows=\"4\" cols=\"80\" name=\"display_pereffhlp\" wrap=\"soft\">$curpereffhlp</textarea><br><br><br><br>
|
||||
Device Terminology :
|
||||
<input type=\"text\" name=\"display_device_term\" size=\"10\" value=\"$curdevterm\"><br><br><br>
|
||||
When Discovered Terminology :
|
||||
<input type=\"text\" name=\"display_discovered_term\" size=\"20\" value=\"$curdscterm\"><br><br><br>
|
||||
Short When Discovered Terminology (shown where space is limited, like table headers) :<br>
|
||||
<input type=\"text\" name=\"display_discovered_term_short\" size=\"9\" value=\"$curdscterms\"><br><br><br>
|
||||
When Discovered data to show in dropdowns: <input type=\"radio\" name=\"display_disc_drop_data\" value=\"Name\" $dropnamestate> Name
|
||||
<input type=\"radio\" name=\"display_disc_drop_data\" value=\"Desc\" $dropdescstate> Description<br><br><br>
|
||||
Functional Terminology :
|
||||
<input type=\"text\" name=\"display_functional_term\" size=\"20\" value=\"$curfuncterm\"><br><br><br>
|
||||
Short Functional Terminology (shown where space is limited, like table headers) :<br>
|
||||
<input type=\"text\" name=\"display_functional_term_short\" size=\"4\" value=\"$curfuncterms\"><br><br><br>
|
||||
Functional Yes Terminology :
|
||||
<input type=\"text\" name=\"display_functional_yes\" size=\"20\" value=\"$curfuncyes\"><br><br><br>
|
||||
Functional No Terminology :
|
||||
<input type=\"text\" name=\"display_functional_no\" size=\"20\" value=\"$curfuncno\"><br><br><br>
|
||||
Short Functional Yes Terminology (shown where space is limited, like table headers) :<br>
|
||||
<input type=\"text\" name=\"display_functional_yes_short\" size=\"4\" value=\"$curfuncyess\"><br><br><br>
|
||||
Short Functional No Terminology (shown where space is limited, like table headers) :<br>
|
||||
<input type=\"text\" name=\"display_functional_no_short\" size=\"4\" value=\"$curfuncnos\"><br><br><br>
|
||||
Functional Help Text :<br>
|
||||
<textarea rows=\"4\" cols=\"80\" name=\"display_funchelp\" wrap=\"soft\">$curfunchelp</textarea><br><br><br><br>
|
||||
<input type=\"submit\" name=\"update_display\" value=\"Update Options\">
|
||||
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br><br><br>
|
||||
</form>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
create.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -34,8 +34,8 @@ if ($print) {
|
||||
// load variables from incoming array
|
||||
$create=$incoming['create'];
|
||||
$device=$incoming['device'];
|
||||
$period=$incoming['period'];
|
||||
$period_effective=$incoming['period_effective'];
|
||||
$discovered=$incoming['discovered'];
|
||||
$functional=$incoming['functional'];
|
||||
$reported_by=$incoming['reported_by'];
|
||||
$report_date=$incoming['report_date'];
|
||||
$report_time=$incoming['report_time'];
|
||||
@@ -56,7 +56,9 @@ $role=dblookup($drs_db,"persons","id","role",$personid);
|
||||
|
||||
framework("begin","$appname","New Writeup",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -69,7 +71,7 @@ if (!$report_time || $report_time=="automatic") $report_time=$now;
|
||||
|
||||
if ($create) {
|
||||
// add the entry if create is pressed
|
||||
if ($discrepancy_text && $reported_by && $device && $subsystem && $period) {
|
||||
if ($discrepancy_text && $reported_by && $device && $subsystem && $discovered) {
|
||||
// sanitize and fix blank date and time
|
||||
$report_date=mysqli_real_escape_string($drs_db,$report_date);
|
||||
$report_time=mysqli_real_escape_string($drs_db,$report_time);
|
||||
@@ -82,8 +84,8 @@ if ($create) {
|
||||
$clean_reported_by=mysqli_real_escape_string($drs_db,$reported_by);
|
||||
|
||||
// add the record to writeups
|
||||
mysqli_query($drs_db,"insert into writeups(device,period,period_effective,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
|
||||
values (\"$device\",\"$period\",\"$period_effective\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
|
||||
mysqli_query($drs_db,"insert into writeups(device,discovered,functional,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
|
||||
values (\"$device\",\"$discovered\",\"$functional\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,15 +107,15 @@ if ($create) {
|
||||
$preserve=FALSE;
|
||||
}
|
||||
if (!$device) {
|
||||
format_message(1,"You didn't select a device. Please try again.");
|
||||
format_message(1,"You didn't select a $device_term. Please try again.");
|
||||
$preserve=TRUE;
|
||||
}
|
||||
if (!$subsystem) {
|
||||
format_message(1,"You didn't select a subsystem. Please try again.");
|
||||
$preserve=TRUE;
|
||||
}
|
||||
if (!$period) {
|
||||
format_message(1,"You didn't select a period. Please try again.");
|
||||
if (!$discovered) {
|
||||
format_message(1,"You didn't select a $discovered_term. Please try again.");
|
||||
$preserve=TRUE;
|
||||
}
|
||||
if (!$discrepancy_text) {
|
||||
@@ -140,7 +142,7 @@ if ($status==3) $statusind="<b><font color=\"#FFFF00\">DFRD</font></b>";
|
||||
echo "
|
||||
<table border=\"0\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<td align=\"left\">Device<br>
|
||||
<td align=\"left\">$device_term<br>
|
||||
<select name=\"device\" id=\"device\">
|
||||
<option value=\"\">Please select...</option>
|
||||
";
|
||||
@@ -170,16 +172,23 @@ echo "
|
||||
</select></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=\"left\">Period<br>
|
||||
<select name=\"period\" id=\"period\">
|
||||
<td align=\"left\">$discovered_term<br>
|
||||
<select name=\"discovered\" id=\"discoveredselect\">
|
||||
<option value=\"\">Please select...</option>
|
||||
";
|
||||
$prow=mysqli_query($drs_db,"select * from periods where active is true order by times asc");
|
||||
while ($pitem=mysqli_fetch_assoc($prow)) {
|
||||
if ($period==$pitem["id"] && $preserve) {
|
||||
printf("<option value=\"%s\" title=\"Period %s\" selected>%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
if ($disc_drop_data=="Name") {
|
||||
$discddtitle="whendiscovereddesc";
|
||||
$discddtext="whendiscoveredname";
|
||||
} else if ($disc_drop_data=="Desc") {
|
||||
$discddtitle="whendiscoveredname";
|
||||
$discddtext="whendiscovereddesc";
|
||||
}
|
||||
$drow=mysqli_query($drs_db,"select * from discovered where active is true order by whendiscoveredname asc");
|
||||
while ($ditem=mysqli_fetch_assoc($drow)) {
|
||||
if ($discoverd==$ditem["id"] && $preserve) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\" title=\"Period %s\">%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,12 +199,12 @@ if (!$preserve) {
|
||||
$reported_by="";
|
||||
}
|
||||
|
||||
$effstate=$nefstate="";
|
||||
$funcyesstate=$funcnostate="";
|
||||
if ($preserve) {
|
||||
if($period_effective==1) $effstate="checked";
|
||||
if($period_effective==0) $nefstate="checked";
|
||||
if($functional==1) $funcyesstate="checked";
|
||||
if($functional==0) $funcnostate="checked";
|
||||
} else {
|
||||
$effstate="checked";
|
||||
$funcyesstate="checked";
|
||||
}
|
||||
|
||||
echo "
|
||||
@@ -213,9 +222,9 @@ Discrepancy <font size=\"-2\">(required)</font><br>
|
||||
<tr>
|
||||
<td>Reported by <font size=\"-2\">(required)</font><br>
|
||||
<input type=\"text\" name=\"reported_by\" size=\"30\" value=\"$reported_by\" title=\"Who to contact with questions about this writeup\"></td>
|
||||
<td>Period effective? <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
|
||||
<input type=\"radio\" name=\"period_effective\" value=\"1\" $effstate> Yes
|
||||
<input type=\"radio\" name=\"period_effective\" value=\"0\" $nefstate> No
|
||||
<td>$functional_term? <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
|
||||
<input type=\"radio\" name=\"functional\" value=\"1\" $funcyesstate> Yes
|
||||
<input type=\"radio\" name=\"functional\" value=\"0\" $funcnostate> No
|
||||
</td>
|
||||
<td align=\"right\" valign=\"bottom\"><input type=\"submit\" name=\"create\" value=\"Submit Writeup\" id=\"createbutton\"></td>
|
||||
</tr>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
dbadmin.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -79,13 +79,14 @@ $reason_id=$incoming['reason_id'];
|
||||
$reason_text=$incoming['reason_text'];
|
||||
$reason_active=$incoming['reason_active'];
|
||||
|
||||
$edit_period=$incoming['edit_period'];
|
||||
$add_period=$incoming['add_period'];
|
||||
$update_period=$incoming['update_period'];
|
||||
$delete_period=$incoming['delete_period'];
|
||||
$period_id=$incoming['period_id'];
|
||||
$period_times=$incoming['period_times'];
|
||||
$period_active=$incoming['period_active'];
|
||||
$edit_discovered=$incoming['edit_discovered'];
|
||||
$add_discovered=$incoming['add_discovered'];
|
||||
$update_discovered=$incoming['update_discovered'];
|
||||
$delete_discovered=$incoming['delete_discovered'];
|
||||
$discovered_id=$incoming['discovered_id'];
|
||||
$discovered_name=$incoming['discovered_name'];
|
||||
$discovered_desc=$incoming['discovered_desc'];
|
||||
$discovered_active=$incoming['discovered_active'];
|
||||
|
||||
// define local functions
|
||||
|
||||
@@ -101,7 +102,9 @@ if ($print=="Printer Friendly") {
|
||||
|
||||
framework("begin","$appname","Database Administration",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -526,102 +529,118 @@ if ($edit_reason) {
|
||||
}
|
||||
}
|
||||
|
||||
// periods-----------------------------------
|
||||
if ($add_period) {
|
||||
// when discovered-----------------------------------
|
||||
if ($add_discovered) {
|
||||
// do error checking
|
||||
// remove html tags from id and times
|
||||
$period_id=strip_tags($period_id);
|
||||
$period_times=strip_tags($period_times);
|
||||
// test for id supplied
|
||||
if (strlen(trim($period_id))) {
|
||||
$peridsuppld=true;
|
||||
// remove html tags from name and description
|
||||
$discovered_name=strip_tags($discovered_name);
|
||||
$discovered_desc=strip_tags($discovered_desc);
|
||||
// test for name supplied
|
||||
if (strlen(trim($discovered_name))) {
|
||||
$discnamesuppld=true;
|
||||
} else {
|
||||
$peridsuppld=false;
|
||||
$peridsuppld_err=true;
|
||||
$discnamesuppld=false;
|
||||
$discnamesuppld_err=true;
|
||||
}
|
||||
// test for id is integer
|
||||
if (preg_match('/^[0-9]+$/',$period_id)) {
|
||||
$peridisint=true;
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from discovered where whendiscoveredname=\"$discovered_name\""))) {
|
||||
$discnameunique=false;
|
||||
$discnameunique_err=true;
|
||||
} else {
|
||||
$peridisint=false;
|
||||
$peridisint_err=true;
|
||||
$discnameunique=true;
|
||||
}
|
||||
// test for id unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from periods where id=\"$period_id\""))) {
|
||||
$peridunique=false;
|
||||
$peridunique_err=true;
|
||||
// test for description supplied
|
||||
if (strlen(trim($discovered_desc))) {
|
||||
$discdescsuppld=true;
|
||||
} else {
|
||||
$peridunique=true;
|
||||
$discdescsuppld=false;
|
||||
$discdescsuppld_err=true;
|
||||
}
|
||||
// test for times supplied
|
||||
if (strlen(trim($period_times))) {
|
||||
$pertimessuppld=true;
|
||||
// test for description unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from description where whendiscovereddesc =\"$discovered_desc\""))) {
|
||||
$discdescunique=false;
|
||||
$discdescunique_err=true;
|
||||
} else {
|
||||
$pertimessuppld=false;
|
||||
$pertimessuppld_err=true;
|
||||
}
|
||||
// test for times unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from periods where times=\"$period_times\""))) {
|
||||
$pertimesunique=false;
|
||||
$pertimesunique_err=true;
|
||||
} else {
|
||||
$pertimesunique=true;
|
||||
$discdescunique=true;
|
||||
}
|
||||
|
||||
// set active status
|
||||
if (!$period_active) $period_active=0;
|
||||
if (!$discovered_active) $discovered_active=0;
|
||||
|
||||
if ($pertimessuppld && $pertimesunique && $peridsuppld && $peridunique && $peridisint) {
|
||||
// sanitize times
|
||||
$clean_pertimes=mysqli_real_escape_string($drs_db,$period_times);
|
||||
if ($discnamesuppld && $discnameunique && $discdescsuppld) {
|
||||
// sanitize name
|
||||
$clean_discovered_name=mysqli_real_escape_string($drs_db,$discovered_name);
|
||||
// sanitize description
|
||||
$clean_discovered_desc=mysqli_real_escape_string($drs_db,$discovered_desc);
|
||||
// modify the table
|
||||
mysqli_query($drs_db,"insert into periods(id,times,active) values(\"$period_id\",\"$clean_pertimes\",\"$period_active\")");
|
||||
mysqli_query($drs_db,"insert into discovered(whendiscoveredname,whendiscovereddesc,active) values(\"$clean_discovered_name\",\"$clean_discovered_desc\",\"$discovered_active\")");
|
||||
} else {
|
||||
$period_add_fail=true;
|
||||
$discovered_add_fail=true;
|
||||
}
|
||||
}
|
||||
if ($edit_period) {
|
||||
if ($delete_period) {
|
||||
// check for writeups with this period
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from writeups where period=\"$period_id\""))) {
|
||||
$perhaswriteups=true;
|
||||
$perhaswriteups_err=true;
|
||||
if ($edit_discovered) {
|
||||
if ($delete_discovered) {
|
||||
// check for writeups with this when discovered
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from writeups where discovered=\"$discovered_id\""))) {
|
||||
$dischaswriteups=true;
|
||||
$dischaswriteups_err=true;
|
||||
} else {
|
||||
$perhaswriteups=false;
|
||||
$dischaswriteups=false;
|
||||
}
|
||||
// if none, then remove from db
|
||||
if (!$perhaswriteups) mysqli_query($drs_db,"delete from periods where id=\"$period_id\"");
|
||||
if (!$dischaswriteups) mysqli_query($drs_db,"delete from discovered where id=\"$discovered_id\"");
|
||||
}
|
||||
if ($update_period) {
|
||||
if ($update_discovered) {
|
||||
// do error checking
|
||||
// remove html tags from times
|
||||
$period_times=strip_tags($period_times);
|
||||
// test for times supplied
|
||||
if (strlen(trim($period_times))) {
|
||||
$pertimessuppld=true;
|
||||
} else {
|
||||
$pertimessuppld=false;
|
||||
$pertimessuppld_err=true;
|
||||
}
|
||||
// test for period times unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from periods where times=\"$period_times\" and id!=\"$period_id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from periods where times=\"$period_times\""))) {
|
||||
$pertimesunique=false;
|
||||
$pertimesunique_err=true;
|
||||
} else {
|
||||
$pertimesunique=true;
|
||||
}
|
||||
} else {
|
||||
$pertimesunique=true;
|
||||
}
|
||||
|
||||
// remove html tags from name and description
|
||||
$discovered_name=strip_tags($discovered_name);
|
||||
$discovered_desc=strip_tags($discovered_desc);
|
||||
// test for name supplied
|
||||
if (strlen(trim($discovered_name))) {
|
||||
$discnamesuppld=true;
|
||||
} else {
|
||||
$discnamesuppld=false;
|
||||
$discnamesuppld_err=true;
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from discovered where whendiscoveredname=\"$discovered_name\" and id!=\"$discovered_id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from discovered where whendiscoveredname=\"$discovered_name\""))) {
|
||||
$discnameunique=false;
|
||||
$discnameunique_err=true;
|
||||
} else {
|
||||
$discnameunique=true;
|
||||
}
|
||||
} else {
|
||||
$discnameunique=true;
|
||||
}
|
||||
// test for description supplied
|
||||
if (strlen(trim($discovered_desc))) {
|
||||
$discdescsuppld=true;
|
||||
} else {
|
||||
$discdescsuppld=false;
|
||||
$discdescsuppld_err=true;
|
||||
}
|
||||
// test for description unique
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from discovered where whendiscovereddesc=\"$discovered_text\" and id!=\"$discovered_id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($drs_db,"select id from discovered where whendiscovereddesc =\"$discovered_desc\""))) {
|
||||
$discdescunique=false;
|
||||
$discdescunique_err=true;
|
||||
} else {
|
||||
$discdescunique=true;
|
||||
}
|
||||
} else {
|
||||
$discdescunique=true;
|
||||
}
|
||||
// set active status
|
||||
if (!$period_active) $period_active=0;
|
||||
if (!$discovered_active) $discovered_active=0;
|
||||
|
||||
// sanitize times
|
||||
$clean_pertimes=mysqli_real_escape_string($drs_db,$period_times);
|
||||
$updqry="update periods set times=\"$clean_pertimes\",active=\"$period_active\" where id=\"$period_id\"";
|
||||
if ($pertimessuppld && $pertimesunique) {
|
||||
// sanitize name
|
||||
$clean_discovered_name=mysqli_real_escape_string($drs_db,$discovered_name);
|
||||
// sanitize description
|
||||
$clean_discovered_desc=mysqli_real_escape_string($drs_db,$discovered_desc);
|
||||
|
||||
$updqry="update discovered set whendiscoveredname=\"$clean_discovered_name\",whendiscovereddesc=\"$clean_discovered_desc\",active=\"$discovered_active\" where id=\"$discovered_id\"";
|
||||
if ($discnamesuppld && $discnameunique && $discdescsuppld && $discdescunique) {
|
||||
// modify the table
|
||||
mysqli_query($drs_db,$updqry);
|
||||
}
|
||||
@@ -646,7 +665,7 @@ echo "
|
||||
<li><a href=\"#devices\">Device Management</a></li>
|
||||
<li><a href=\"#subsystems\">Subsystem Management</a></li>
|
||||
<li><a href=\"#reasons\">Action Reasons Management</a></li>
|
||||
<li><a href=\"#periods\">Period Management</a></li>
|
||||
<li><a href=\"#discovered\">When Discovered Management</a></li>
|
||||
</ul>
|
||||
|
||||
<div id=\"users\">
|
||||
@@ -1001,53 +1020,49 @@ echo "</table>";
|
||||
echo "
|
||||
</div>
|
||||
|
||||
<div id=\"periods\">
|
||||
<div id=\"discovered\">
|
||||
";
|
||||
if ($peridisint_err) format_message(1,"Period number must be an integer.");
|
||||
if ($peridsuppld_err) format_message(1,"Period number cannot be blank.");
|
||||
if ($peridunique_err) format_message(1,"Period number already exists.");
|
||||
if ($pertimesunique_err) format_message(1,"Period already exists.");
|
||||
if ($pertimessuppld_err) format_message(1,"Period times cannot be blank.");
|
||||
if ($perhaswriteups_err) format_message(1,"Period has writeups in the database and cannot be deleted.");
|
||||
if ($discnamesuppld_err) format_message(1,"When Discovered name cannot be blank.");
|
||||
if ($discnameunique_err) format_message(1,"When Discovered name already exists.");
|
||||
if ($dischaswriteups_err) format_message(1,"When Discovered has writeups in the database and cannot be deleted.");
|
||||
|
||||
if ($edit_period && !$delete_period) {
|
||||
if ($edit_discovered && !$delete_discovered) {
|
||||
// set form options for editing
|
||||
$sectiontitle="<b><font size=\"+1\">Modify Period</font></b> <a href=\"dbadmin.php#periods\">Click here to add a new period</a><br><br>";
|
||||
$formtag="<form method=\"post\" action=\"dbadmin.php?edit_period=1#periods\">";
|
||||
$sectiontitle="<b><font size=\"+1\">Modify When Discovered</font></b> <a href=\"dbadmin.php#discovered\">Click here to add a new when discovered</a><br><br>";
|
||||
$formtag="<form method=\"post\" action=\"dbadmin.php?edit_discovered=1#discovered\">";
|
||||
$buttontags="
|
||||
<input type=\"hidden\" name=\"period_id\" value=\"$period_id\">
|
||||
<input type=\"submit\" name=\"update_period\" value=\"Update Period\">
|
||||
<input type=\"submit\" name=\"delete_period\" value=\"Delete Period\">
|
||||
<input type=\"hidden\" name=\"discovered_id\" value=\"$discovered_id\">
|
||||
<input type=\"submit\" name=\"update_discovered\" value=\"Update When Discovered\">
|
||||
<input type=\"submit\" name=\"delete_discovered\" value=\"Delete When Discovered\">
|
||||
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from periods where id=$period_id"));
|
||||
$period_times=$currentvalues["times"];
|
||||
$currentvalues=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from discovered where id=$discovered_id"));
|
||||
$discovered_name=$currentvalues["whendiscoveredname"];
|
||||
$discovered_desc=$currentvalues["whendiscovereddesc"];
|
||||
if ($currentvalues["active"]==1) {
|
||||
$activetag="<input type=\"checkbox\" name=\"period_active\" value=\"1\" checked>";
|
||||
$activetag="<input type=\"checkbox\" name=\"discovered_active\" value=\"1\" checked>";
|
||||
} else {
|
||||
$activetag="<input type=\"checkbox\" name=\"period_active\" value=\"1\">";
|
||||
$activetag="<input type=\"checkbox\" name=\"discovered_active\" value=\"1\">";
|
||||
}
|
||||
$idtag="$period_id";
|
||||
} else {
|
||||
// set form options for add
|
||||
if (!$period_add_fail) unset($period_id,$period_times,$period_active);
|
||||
$sectiontitle="<b><font size=\"+1\">Add New Period</font></b><br><br>";
|
||||
$formtag="<form method=\"post\" action=\"dbadmin.php#periods\">";
|
||||
if (!$discovered_add_fail) unset($discovered_id,$discovered_name,$discovered_desc,$discovered_active);
|
||||
$sectiontitle="<b><font size=\"+1\">Add New When Discovered</font></b><br><br>";
|
||||
$formtag="<form method=\"post\" action=\"dbadmin.php#discovered\">";
|
||||
$buttontags="
|
||||
<input type=\"submit\" name=\"add_period\" value=\"Add Period\">
|
||||
<input type=\"submit\" name=\"add_discovered\" value=\"Add When Discovered\">
|
||||
";
|
||||
$idtag="<input type=\"text\" name=\"period_id\" size=\"3\" value=\"$period_id\">";
|
||||
// set default values
|
||||
$activetag="<input type=\"checkbox\" name=\"period_active\" value=\"1\" checked>";
|
||||
$activetag="<input type=\"checkbox\" name=\"discovered_active\" value=\"1\" checked>";
|
||||
}
|
||||
echo "
|
||||
$sectiontitle
|
||||
$formtag
|
||||
<table border=\"0\">
|
||||
<tr><td>
|
||||
Period Number: $idtag<br><br>
|
||||
Period Times: <input type=\"text\" name=\"period_times\" size=\"40\" value=\"$period_times\"><br><br>
|
||||
When Discovered Name: <input type=\"text\" name=\"discovered_name\" size=\"8\" value=\"$discovered_name\"><br><br>
|
||||
When Discovered Description: <input type=\"text\" name=\"discovered_desc\" size=\"60\" value=\"$discovered_desc\"><br><br>
|
||||
Active: $activetag <br><br>
|
||||
</td></tr>
|
||||
</table>
|
||||
@@ -1057,11 +1072,11 @@ $buttontags
|
||||
";
|
||||
|
||||
// show the table of entities
|
||||
$existingdata=mysqli_query($drs_db,"select * from periods order by id asc");
|
||||
$existingdata=mysqli_query($drs_db,"select * from discovered order by id asc");
|
||||
echo "
|
||||
<b>Existing Periods</b> <font size=\"-1\">Click on the Period ID to edit.</font><br><br>
|
||||
<b>Existing When Discovereds</b> <font size=\"-1\">Click on the When Disc ID to edit.</font><br><br>
|
||||
<table border=\"1\">
|
||||
<tr><th>Period ID</th><th>Period Times</th><th>Active</th></tr>
|
||||
<tr><th>When Disc ID</th><th>Name</th><th>Description</th><th>Active</th></tr>
|
||||
";
|
||||
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
||||
if ($tablerow["active"]) {
|
||||
@@ -1071,12 +1086,14 @@ while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
||||
}
|
||||
printf("
|
||||
<tr>
|
||||
<td><a href=\"dbadmin.php?edit_period=1&period_id=%s#periods\">%s</a></td>
|
||||
<td><a href=\"dbadmin.php?edit_discovered=1&discovered_id=%s#discovered\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$tablerow["times"],
|
||||
$tablerow["whendiscoveredname"],
|
||||
$tablerow["whendiscovereddesc"],
|
||||
$activedef);
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
gpl.php
|
||||
OpenMTS Online Maintenance Tracking System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -52,7 +52,9 @@ $role=dblookup($mts_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","GNU General Public License",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
groups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -38,20 +38,19 @@ $save=$incoming['save'];
|
||||
$targets=$incoming['targets'];
|
||||
$group=$incoming['group'];
|
||||
$name=$incoming['name'];
|
||||
$expandgrp=$incoming['expandgrp'];
|
||||
|
||||
$search=$incoming['search'];
|
||||
$s_status=$incoming['s_status'];
|
||||
$s_device=$incoming['s_device'];
|
||||
$s_subsystem=$incoming['s_subsystem'];
|
||||
$s_period=$incoming['s_period'];
|
||||
$s_discovered=$incoming['s_discovered'];
|
||||
$s_report_date_start=$incoming['s_report_date_start'];
|
||||
$s_report_date_end=$incoming['s_report_date_end'];
|
||||
$s_report_time_start=$incoming['s_report_time_start'];
|
||||
$s_report_time_end=$incoming['s_report_time_end'];
|
||||
$s_discrepancy_text=$incoming['s_discrepancy_text'];
|
||||
$s_reported_by=$incoming['s_reported_by'];
|
||||
$s_period_effective=$incoming['s_period_effective'];
|
||||
$s_functional=$incoming['s_functional'];
|
||||
|
||||
$edit_status=$incoming['edit_status'];
|
||||
$edit_action_by=$incoming['edit_action_by'];
|
||||
@@ -78,7 +77,9 @@ $role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","Writeup Groups",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -205,33 +206,33 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// period
|
||||
if ($s_period) {
|
||||
// discovered
|
||||
if ($s_discovered) {
|
||||
$query_string="{$query_string}(";
|
||||
$period_param="Periods:";
|
||||
foreach ($s_period as $per_val) {
|
||||
$query_string="{$query_string}period=\"{$per_val}\" or ";
|
||||
$period_dsp=$per_val;
|
||||
$period_param="{$period_param} {$period_dsp}, ";
|
||||
$discovered_param="{$discovered_term_short}s:";
|
||||
foreach ($s_discovered as $disc_val) {
|
||||
$query_string="{$query_string}discovered=\"{$disc_val}\" or ";
|
||||
$disc_dsp=$disc_val;
|
||||
$discovered_param="{$discovered_param} {$disc_dsp}, ";
|
||||
}
|
||||
$period_param=rtrim($period_param,", ");
|
||||
$num_periods=mysqli_num_rows(mysqli_query($drs_db,"select id from periods"));
|
||||
if (count($s_period)==$num_periods) $period_param="Periods: any";
|
||||
$discovered_param=rtrim($discovered_param,", ");
|
||||
$num_discovereds=mysqli_num_rows(mysqli_query($drs_db,"select id from discovered"));
|
||||
if (count($s_discovered)==$num_discovereds) $discovered_param="{$discovered_term_short}s: any";
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// period_effective
|
||||
if ($s_period_effective) {
|
||||
// functional
|
||||
if ($s_functional) {
|
||||
$query_string="{$query_string}(";
|
||||
$eff_param="Period effective:";
|
||||
foreach ($s_period_effective as $eff_val) {
|
||||
$query_string="{$query_string}period_effective=\"{$eff_val}\" or ";
|
||||
if ($eff_val=="0") $eff_dsp="<font color=\"#FF0000\">NEF</font>";
|
||||
if ($eff_val=="1") $eff_dsp="<font color=\"#00FF00\">EFF</font>";
|
||||
$eff_param="{$eff_param} {$eff_dsp}, ";
|
||||
$func_param="$functional_term:";
|
||||
foreach ($s_functional as $func_val) {
|
||||
$query_string="{$query_string}functional=\"{$func_val}\" or ";
|
||||
if ($func_val=="0") $func_dsp="<font color=\"#FF0000\">$functional_no_short</font>";
|
||||
if ($func_val=="1") $func_dsp="<font color=\"#00FF00\">$functional_yes_short</font>";
|
||||
$func_param="{$func_param} {$func_dsp}, ";
|
||||
}
|
||||
$eff_param=rtrim($eff_param,", ");
|
||||
$func_param=rtrim($func_param,", ");
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
@@ -315,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 "
|
||||
@@ -416,17 +417,17 @@ if ($action=="add") {
|
||||
<tr>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Period cell **********************
|
||||
// Discovered cell **********************
|
||||
echo "
|
||||
Period<br>
|
||||
<select name=\"s_period[]\" id=\"ms-period\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
$discovered_term<br>
|
||||
<select name=\"s_discovered[]\" id=\"ms-discovered\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
";
|
||||
$prow=mysqli_query($drs_db,"select * from periods order by times asc");
|
||||
while ($pitem=mysqli_fetch_assoc($prow)) {
|
||||
if (!$search || in_array($pitem["id"],$s_period,true)) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
$discrow=mysqli_query($drs_db,"select * from discovered order by whendiscoveredname asc");
|
||||
while ($discitem=mysqli_fetch_assoc($discrow)) {
|
||||
if (!$search || in_array($discitem["id"],$s_discovered,true)) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$pitem["id"],$pitem["id"],$pitem["times"]);
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -488,22 +489,21 @@ if ($action=="add") {
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Period effective cell ************
|
||||
// functional cell ************
|
||||
echo "
|
||||
Sim period effective? <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.
|
||||
Otherwise, answer Effective. \"><br>
|
||||
$functional_term? <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
|
||||
";
|
||||
if ($search) {
|
||||
$effstate=$nefstate="";
|
||||
if (in_array("1",$s_period_effective,true)) $effstate="selected";
|
||||
if (in_array("0",$s_period_effective,true)) $nefstate="selected";
|
||||
$funcyesstate=$funcnostate="";
|
||||
if (in_array("1",$s_functional,true)) $funcyesstate="selected";
|
||||
if (in_array("0",$s_functional,true)) $funcnostate="selected";
|
||||
} else {
|
||||
$effstate=$nefstate="selected";
|
||||
$funcyesstate=$funcnostate="selected";
|
||||
}
|
||||
echo "
|
||||
<select name=\"s_period_effective[]\" id=\"ms-period_effective\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"1\" $effstate title=\"Training objectives were achieved\">Effective</option>
|
||||
<option value=\"0\" $nefstate title=\"Training objectives were not achieved\">Non-effective</option>
|
||||
<select name=\"s_functional[]\" id=\"ms-functional\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"1\" $funcyesstate>$functional_yes</option>
|
||||
<option value=\"0\" $funcnostate>$functional_no</option>
|
||||
</select>
|
||||
</td>
|
||||
";
|
||||
@@ -531,15 +531,15 @@ if ($action=="add") {
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup_qry)) {
|
||||
// determine effective icon
|
||||
if($tablerow["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
// determine functional icon
|
||||
if($tablerow["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no\">";
|
||||
}
|
||||
|
||||
// determine status indicator
|
||||
@@ -587,7 +587,7 @@ if ($action=="add") {
|
||||
$dname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
echo "
|
||||
@@ -620,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.
|
||||
@@ -652,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 "
|
||||
@@ -693,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 "
|
||||
@@ -719,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 "
|
||||
@@ -820,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 "
|
||||
@@ -840,48 +840,42 @@ 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>
|
||||
";
|
||||
}
|
||||
} 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";
|
||||
}
|
||||
}
|
||||
echo "<br><br>";
|
||||
}
|
||||
} else {
|
||||
echo "<br>No writeup groups were found.<br><br><br>";
|
||||
}
|
||||
$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 {
|
||||
$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 "</table><br>";
|
||||
} else {
|
||||
echo "<br>No writeup groups were found.<br><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 564 B |
|
Before Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 548 B |
|
Before Width: | Height: | Size: 757 B |
|
Before Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 592 B |
|
Before Width: | Height: | Size: 481 B |
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
login.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -31,7 +31,10 @@ if ($print) {
|
||||
|
||||
framework("begin","$appname","Login Page",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
pagetable("begin");
|
||||
if(!$print){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
profile.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -74,7 +74,9 @@ if ($print=="Printer Friendly") {
|
||||
|
||||
framework("begin","$appname","User Profile",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
1232
distfiles/search.php
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
settings.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 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) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -39,8 +39,8 @@ $useredit=$incoming['useredit'];
|
||||
$techedit=$incoming['techedit'];
|
||||
$id=$incoming['id'];
|
||||
$device=$incoming['device'];
|
||||
$period=$incoming['period'];
|
||||
$period_effective=$incoming['period_effective'];
|
||||
$discovered=$incoming['discovered'];
|
||||
$functional=$incoming['functional'];
|
||||
$reported_by=$incoming['reported_by'];
|
||||
$report_date=$incoming['report_date'];
|
||||
$report_time=$incoming['report_time'];
|
||||
@@ -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;
|
||||
@@ -66,6 +67,9 @@ $role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","Writeup Detail",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -89,7 +93,19 @@ if ($usersave) {
|
||||
$clean_reported_by=mysqli_real_escape_string($drs_db,$reported_by);
|
||||
|
||||
// update the record in writeups
|
||||
mysqli_query($drs_db,"update writeups set device=\"$device\",period=\"$period\",period_effective=\"$period_effective\",reported_by=\"$clean_reported_by\",report_date=\"$report_date\",report_time=\"$report_time\",subsystem=\"$subsystem\",discrepancy_text=\"$clean_discrepancy_text\" where id=\"$id\"");
|
||||
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) {
|
||||
@@ -115,8 +131,8 @@ elseif ($techsave) {
|
||||
// get current writeup data from database to populate fields
|
||||
$writeupdata=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from writeups where id=\"$id\""));
|
||||
$device=$writeupdata['device'];
|
||||
$period=$writeupdata['period'];
|
||||
$period_effective=$writeupdata['period_effective'];
|
||||
$discovered=$writeupdata['discovered'];
|
||||
$functional=$writeupdata['functional'];
|
||||
$reported_by=$writeupdata['reported_by'];
|
||||
$report_date=$writeupdata['report_date'];
|
||||
$report_time=$writeupdata['report_time'];
|
||||
@@ -195,7 +211,7 @@ echo "
|
||||
<td align=\"left\">Writeup ID<br>
|
||||
<table border=\"1\" width=\"100%\"><tr><td><center>$id</center></td></tr></table>
|
||||
</td>
|
||||
<td align=\"left\">Device<br>
|
||||
<td align=\"left\">$device_term<br>
|
||||
";
|
||||
if ($useredit) {
|
||||
echo "
|
||||
@@ -248,41 +264,49 @@ echo "
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=\"left\">Period<br>
|
||||
<td align=\"left\">$discovered_term<br>
|
||||
";
|
||||
if ($useredit) {
|
||||
echo "
|
||||
<select name=\"period\" id=\"period\">
|
||||
<select name=\"discovered\" id=\"discoveredselect\">
|
||||
";
|
||||
$prow=mysqli_query($drs_db,"select * from periods where active is true order by times asc");
|
||||
while ($pitem=mysqli_fetch_assoc($prow)) {
|
||||
if ($period==$pitem["id"]) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$pitem["id"],$pitem["times"],$pitem["id"]);
|
||||
if ($disc_drop_data=="Name") {
|
||||
$discddtitle="whendiscovereddesc";
|
||||
$discddtext="whendiscoveredname";
|
||||
} else if ($disc_drop_data=="Desc") {
|
||||
$discddtitle="whendiscoveredname";
|
||||
$discddtext="whendiscovereddesc";
|
||||
}
|
||||
$discrow=mysqli_query($drs_db,"select * from discovered where active is true order by whendiscoveredname asc");
|
||||
while ($discitem=mysqli_fetch_assoc($discrow)) {
|
||||
if ($discovered==$discitem["id"]) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["$discddtitle"],$discitem["$discddtext"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$pitem["id"],$pitem["times"],$pitem["id"]);
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["$discddtitle"],$discitem["$discddtext"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
} else {
|
||||
$pertimes=dblookup($drs_db,"periods","id","times",$period);
|
||||
$discname=dblookup($drs_db,"discovered","id","whendiscoveredname",$discovered);
|
||||
$discdesc=dblookup($drs_db,"discovered","id","whendiscovereddesc",$discovered);
|
||||
echo "
|
||||
<table border=\"1\" width=\"100%\"><tr><td><font title=\"$pertimes\">$period</font></td></tr></table>
|
||||
<table border=\"1\" width=\"100%\"><tr><td><font title=\"$discdesc\">$discname</font></td></tr></table>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
";
|
||||
|
||||
$effstate=$nefstate="";
|
||||
if($period_effective==1) {
|
||||
$effstate="checked";
|
||||
$eff_ind="Effective";
|
||||
$funcyesstate=$funcnostate="";
|
||||
if($functional==1) {
|
||||
$funcyesstate="checked";
|
||||
$func_ind="$functional_yes";
|
||||
}
|
||||
if($period_effective==0) {
|
||||
$nefstate="checked";
|
||||
$eff_ind="Non-Effective";
|
||||
if($functional==0) {
|
||||
$funcnostate="checked";
|
||||
$func_ind="$functional_no";
|
||||
}
|
||||
|
||||
$openstate=$closedstate=$deferredstate="";
|
||||
@@ -340,16 +364,16 @@ if ($useredit) {
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<td align=\"left\">Sim period effective? <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
|
||||
<td align=\"left\">$functional_term? <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
|
||||
";
|
||||
if ($useredit) {
|
||||
echo "
|
||||
<input type=\"radio\" name=\"period_effective\" value=\"1\" $effstate> Yes
|
||||
<input type=\"radio\" name=\"period_effective\" value=\"0\" $nefstate> No
|
||||
<input type=\"radio\" name=\"functional\" value=\"1\" $funcyesstate> Yes
|
||||
<input type=\"radio\" name=\"functional\" value=\"0\" $funcnostate> No
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<table border=\"1\" width=\"100%\"><tr><td><font title=\"$eff_title\">$eff_ind</font></td></tr></table>
|
||||
<table border=\"1\" width=\"100%\"><tr><td><font title=\"" . FUNCTIONAL_HELP_TXT . "\">$func_ind</font></td></tr></table>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
@@ -360,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) 2018 Rod Wright
|
||||
Copyright (C) 2022 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -52,13 +52,19 @@ $role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
// define local functions
|
||||
function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
|
||||
// show date range selector
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
";
|
||||
if ($print) {
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
Open writeups between $start_date and $end_date
|
||||
";
|
||||
} else {
|
||||
@@ -72,7 +78,7 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
echo "
|
||||
</form>
|
||||
";
|
||||
$writeup=mysqli_query($drs_db,"select * from writeups where status=".STAT_OPEN." and 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 status=".STAT_OPEN." and report_date between \"$start_date\" and \"$end_date\" order by report_date desc,report_time desc");
|
||||
if (mysqli_num_rows($writeup)) {
|
||||
$now=date("H:i l");
|
||||
echo "
|
||||
@@ -81,20 +87,20 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
<tr>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup)) {
|
||||
// determine effective icon
|
||||
if($tablerow["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
if($tablerow["functional"]==1) {
|
||||
$funcind="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$funcind="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
|
||||
// convert device number to name
|
||||
@@ -103,8 +109,12 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
// convert subsystem number to name
|
||||
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
|
||||
|
||||
// determine times for period
|
||||
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$tablerow['period']}\""))[0];
|
||||
// convert subsystem number to description
|
||||
$ssdesc=dblookup($drs_db,"subsystems","id","description",$tablerow["subsystem"]);
|
||||
|
||||
// determine values for when discovered
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
|
||||
$disc_txt="{$tablerow['discrepancy_text']}";
|
||||
|
||||
@@ -123,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>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,19 +144,19 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</font></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$tablerow["report_date"],
|
||||
$ptimes, $tablerow["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$dname,
|
||||
$ssname,
|
||||
$ssdesc, $ssname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$eff_icon
|
||||
$funcind
|
||||
);
|
||||
}
|
||||
echo "</table>\n";
|
||||
@@ -165,6 +175,13 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
}
|
||||
|
||||
function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$role) {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
|
||||
// show date range selector
|
||||
$summarystat=$detailstat="";
|
||||
if ($viewtype=="detail") {
|
||||
@@ -175,22 +192,29 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
<input type=\"hidden\" name=\"view\" value=\"1\">
|
||||
Writeups between
|
||||
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\"> and
|
||||
<input type=\"text\" name=\"end_date\" size=\"10\" value=\"$end_date\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">
|
||||
";
|
||||
if(!$print) {
|
||||
echo "
|
||||
<input type=\"submit\" name=\"update\" value=\"Update\">
|
||||
<input type=\"submit\" name=\"showtoday\" value=\"Today\">
|
||||
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">
|
||||
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\"><br><br>
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\">
|
||||
";
|
||||
}
|
||||
echo "
|
||||
Writeups between
|
||||
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\"> and
|
||||
<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>
|
||||
<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>";
|
||||
<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,report_time desc");
|
||||
if (mysqli_num_rows($writeup)) {
|
||||
$now=date("H:i l");
|
||||
if ($viewtype == "summary") {
|
||||
@@ -207,20 +231,20 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup)) {
|
||||
// determine effective icon
|
||||
if($tablerow["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
if($tablerow["functional"]==1) {
|
||||
$funcind="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$funcind="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
|
||||
// determine status indicator
|
||||
@@ -234,9 +258,11 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
// convert subsystem number to name
|
||||
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
|
||||
|
||||
// determine times for period
|
||||
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$tablerow['period']}\""))[0];
|
||||
$disc_txt="{$tablerow['discrepancy_text']}";
|
||||
// determine values for when discovered
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
|
||||
$disc_txt="{$tablerow['discrepancy_text']}";
|
||||
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
@@ -253,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>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,12 +306,12 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$statusind,
|
||||
$tablerow["report_date"],
|
||||
$ptimes, $tablerow["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$dname,
|
||||
$ssname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$eff_icon
|
||||
$funcind
|
||||
);
|
||||
}
|
||||
echo "</table>\n";
|
||||
@@ -306,15 +332,21 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
if ($role) {
|
||||
echo "
|
||||
<br><br>
|
||||
<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Add selected to group:</button> <select name=\"togroup\" id=\"sel-togroup\">
|
||||
Add selected to group: <select name=\"togroup\" id=\"sel-togroup\">
|
||||
<option value=\"newgroup\">New group</option>
|
||||
";
|
||||
$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>
|
||||
<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Submit</button>
|
||||
";
|
||||
}
|
||||
} else {
|
||||
@@ -353,7 +385,9 @@ if ($view) {
|
||||
}
|
||||
framework("begin","$appname",$pgtitle,$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
|
||||
|
||||
|
||||
92
install.sh
@@ -2,12 +2,12 @@
|
||||
|
||||
# install.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2022 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
|
||||
DRS_VERSION="1.1.0"
|
||||
DRS_VERSION="1.3.0"
|
||||
DOC_ROOT="/var/www"
|
||||
INSTALL_LOC="opendrs"
|
||||
APACHE_USER="www-data"
|
||||
@@ -42,15 +42,6 @@ echo ""
|
||||
echo -n "Enter name of OpenDRS installation directory [$INSTALL_LOC] :"
|
||||
read install_loc_in
|
||||
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" = "" ]
|
||||
then
|
||||
doc_root_in=$DOC_ROOT
|
||||
@@ -59,10 +50,6 @@ if [ "$install_loc_in" = "" ]
|
||||
then
|
||||
install_loc_in=$INSTALL_LOC
|
||||
fi
|
||||
if [ "$httpd_user_group" = "" ]
|
||||
then
|
||||
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
|
||||
fi
|
||||
install_path="$doc_root_in/$install_loc_in"
|
||||
if [ -d "$install_path" ]
|
||||
then
|
||||
@@ -90,22 +77,44 @@ then
|
||||
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_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
|
||||
echo "Backing up current installation to the package directory."
|
||||
cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
|
||||
# delete all existing installation files except db.php
|
||||
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
|
||||
# apply database updates
|
||||
mysql -u"$curr_username" -p"$curr_dbpass" $curr_dbname < opendrs-update.sql
|
||||
mysql -u"$curr_username" -f -D $curr_dbname < opendrs-update.sql >/dev/null 2>&1
|
||||
# apply updates to existing db.php
|
||||
./opendrs-update.sh $install_path
|
||||
# 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"
|
||||
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 . . ."
|
||||
chown -R $httpd_user_group $install_path
|
||||
chown -R $httpd_user_group $install_path
|
||||
else
|
||||
echo "Cancelling installation"
|
||||
exit
|
||||
@@ -138,7 +147,8 @@ else
|
||||
echo ""
|
||||
echo -n "MySQL admin password: "
|
||||
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 ]
|
||||
then
|
||||
bad_mysql_adm=0
|
||||
@@ -156,6 +166,7 @@ else
|
||||
echo "What would you like to call this installation of OpenDRS? If you accept"
|
||||
echo "the default, it will be called OpenDRS. If you will be running multiple"
|
||||
echo "instances of OpenDRS on this server, you should choose a distinctive name."
|
||||
echo "This can be changed later in the application itself."
|
||||
echo -n "Installation name [OpenDRS]: "
|
||||
read new_inst_name
|
||||
echo ""
|
||||
@@ -171,8 +182,13 @@ else
|
||||
echo "distinctive name."
|
||||
echo -n "database name [opendrs]: "
|
||||
read new_db_name
|
||||
if [ "$new_db_name" = "" ]
|
||||
then
|
||||
new_db_name=opendrs
|
||||
fi
|
||||
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 ]
|
||||
then
|
||||
db_create_fail=0
|
||||
@@ -191,15 +207,17 @@ else
|
||||
# Create user and give rights to database
|
||||
drs_user="$new_db_name`date +%Y%m%d%H%M%S`"
|
||||
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
|
||||
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" -p"$mysql_adm_pass" -e "flush privileges"
|
||||
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" -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
|
||||
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
|
||||
echo "Creating installation directory . . ."
|
||||
@@ -217,10 +235,30 @@ 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"
|
||||
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 . . ."
|
||||
chown -R $httpd_user_group $install_path
|
||||
chown -R $httpd_user_group $install_path
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -37,7 +37,12 @@ CREATE TABLE `banners` (
|
||||
|
||||
LOCK TABLES `banners` WRITE;
|
||||
/*!40000 ALTER TABLE `banners` DISABLE KEYS */;
|
||||
INSERT INTO `banners` VALUES (1,'no banner','#000000','#000000'),(2,'UNCLASSIFIED','#009900','#FFFFFF'),(3,'CONFIDENTIAL','#000099','#FFFFFF'),(4,'SECRET','#990000','#FFFFFF'),(5,'TOP SECRET','#FF6600','#FFFFFF');
|
||||
INSERT INTO `banners` VALUES
|
||||
(1,'no banner','#000000','#000000'),
|
||||
(2,'UNCLASSIFIED','#009900','#FFFFFF'),
|
||||
(3,'CONFIDENTIAL','#000099','#FFFFFF'),
|
||||
(4,'SECRET','#990000','#FFFFFF'),
|
||||
(5,'TOP SECRET','#FF6600','#FFFFFF');
|
||||
/*!40000 ALTER TABLE `banners` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -63,7 +68,38 @@ CREATE TABLE `config` (
|
||||
|
||||
LOCK TABLES `config` WRITE;
|
||||
/*!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.3.0','1.3.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,'functional_help_txt','If this discrepancy renders the device unusable, answer No. Otherwise, answer Yes.',
|
||||
'If this discrepancy renders the device unusable, answer No. Otherwise, answer Yes.'),
|
||||
(30,'device_term','Device','Device'),
|
||||
(31,'discovered_term','When Discovered','When Discovered'),
|
||||
(32,'discovered_term_short','When Disc','When Disc'),
|
||||
(33,'functional_term','Functional','Functional'),
|
||||
(34,'functional_term_short','Func','Func'),
|
||||
(35,'functional_yes','Functional','Functional'),
|
||||
(36,'functional_no','Non-functional','Non-functional'),
|
||||
(37,'functional_yes_short','OK','OK'),
|
||||
(38,'functional_no_short','INOP','INOP'),
|
||||
(39,'disc_drop_data','Name','Name');
|
||||
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -115,28 +151,29 @@ LOCK TABLES `links` WRITE;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `periods`
|
||||
-- Table structure for table `discovered`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `periods`;
|
||||
DROP TABLE IF EXISTS `discovered`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `periods` (
|
||||
`id` int(11) NOT NULL,
|
||||
`times` text NOT NULL,
|
||||
CREATE TABLE `discovered` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`whendiscoveredname` text NOT NULL,
|
||||
`whendiscovereddesc` text NOT NULL,
|
||||
`active` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `periods`
|
||||
-- Dumping data for table `discovered`
|
||||
--
|
||||
|
||||
LOCK TABLES `periods` WRITE;
|
||||
/*!40000 ALTER TABLE `periods` DISABLE KEYS */;
|
||||
INSERT INTO `periods` VALUES (1,'0600 brief, 0645 box, 0830 debrief, 0930 end',1),(2,'0745 brief, 0830 box, 1015 debrief, 1115 end',1),(3,'0930 brief, 1015 box, 1200 debrief, 1300 end',1),(4,'1115 brief, 1200 box, 1345 debrief, 1445 end',1),(5,'1300 brief, 1345 box, 1530 debrief, 1630 end',1),(6,'1445 brief, 1530 box, 1715 debrief, 1815 end',1),(7,'1630 brief, 1715 box, 1900 debrief, 2000 end',1),(8,'1815 brief, 1900 box, 2045 debrief, 2145 end',1);
|
||||
/*!40000 ALTER TABLE `periods` ENABLE KEYS */;
|
||||
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;
|
||||
|
||||
--
|
||||
@@ -236,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;
|
||||
|
||||
@@ -278,8 +316,8 @@ DROP TABLE IF EXISTS `writeups`;
|
||||
CREATE TABLE `writeups` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`device` int(11) NOT NULL,
|
||||
`period` int(11) NOT NULL,
|
||||
`period_effective` tinyint(1) NOT NULL,
|
||||
`discovered` int(11) NOT NULL,
|
||||
`functional` tinyint(1) NOT NULL,
|
||||
`reported_by` tinytext NOT NULL,
|
||||
`report_date` date NOT NULL,
|
||||
`report_time` time NOT NULL,
|
||||
@@ -301,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 */;
|
||||
|
||||
@@ -1,22 +1,218 @@
|
||||
# opendrs-update.sql
|
||||
-- opendrs-update.sql
|
||||
|
||||
# ---------- version 1.1.0 -------------
|
||||
# Update version number
|
||||
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";
|
||||
-- ---------- version 1.1.0 -------------
|
||||
-- Update version number
|
||||
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";
|
||||
|
||||
# Add period_eff_help_txt to config table
|
||||
insert into config(name,value,defaultvalue)
|
||||
select * from
|
||||
(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 dval
|
||||
-- Add period_eff_help_txt to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(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 dval
|
||||
)
|
||||
as tmp
|
||||
where not exists
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
select name from config where name = 'period_eff_help_txt'
|
||||
) limit 1
|
||||
SELECT name FROM config WHERE name = 'period_eff_help_txt'
|
||||
) 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";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.1.2 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.1.2",defaultvalue="1.1.2" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.2.0 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.2.0",defaultvalue="1.2.0" WHERE name="drs_version";
|
||||
|
||||
-- Add device_term to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'device_term',
|
||||
'Device' AS wval,
|
||||
'Device' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT name FROM config WHERE name = 'device_term'
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add discovered_term to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'discovered_term',
|
||||
'When Discovered' AS wval,
|
||||
'When Discovered' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT name FROM config WHERE name = 'discovered_term'
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add discovered_term_short to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'discovered_term_short',
|
||||
'When Disc' AS wval,
|
||||
'When Disc' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT name FROM config WHERE name = 'discovered_term_short'
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add disc_drop_data to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'disc_drop_data',
|
||||
'Name' AS wval,
|
||||
'Name' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT name FROM config WHERE name = 'disc_drop_data'
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_term to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_term',
|
||||
'Functional' AS wval,
|
||||
'Functional' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_term"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_term_short to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_term_short',
|
||||
'Func' AS wval,
|
||||
'Func' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_term_short"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_yes to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_yes',
|
||||
'Functional' AS wval,
|
||||
'Functional' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_yes"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_no to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_no',
|
||||
'Non-functional' AS wval,
|
||||
'Non-functional' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_no"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_yes_short to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_yes_short',
|
||||
'OK' AS wval,
|
||||
'OK' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_yes_short"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Add functional_no_short to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'functional_no_short',
|
||||
'INOP' AS wval,
|
||||
'INOP' AS dval
|
||||
)
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
SELECT `name` FROM `config` WHERE `name` = "functional_no_short"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- Rename period_eff_help_txt config to functional_help_txt
|
||||
UPDATE `config` SET name="functional_help_txt" WHERE name="period_eff_help_txt";
|
||||
|
||||
-- Change the default value of functional_help_text
|
||||
UPDATE `config` SET defaultvalue="If this discrepancy renders the device unusable, answer No. Otherwise, answer Yes." WHERE name="function_help_txt";
|
||||
|
||||
-- Rename periods table to discovered
|
||||
RENAME TABLE `periods` TO `discovered`;
|
||||
|
||||
-- Add whendiscoveredname column to discovered table
|
||||
ALTER TABLE `discovered` ADD COLUMN `whendiscoveredname` text NOT NULL AFTER id;
|
||||
|
||||
-- Copy the contents of the id column to the whendiscoveredname column where whendiscoveredname is empty
|
||||
UPDATE `discovered` SET `whendiscoveredname`=`id` WHERE `whendiscoveredname`="";
|
||||
|
||||
-- Rename times column of discovered table to whendiscovereddesc
|
||||
ALTER TABLE `discovered` CHANGE COLUMN `times` `whendiscovereddesc` text not null;
|
||||
|
||||
-- Add auto_increment flag to id column
|
||||
ALTER TABLE `discovered` CHANGE COLUMN `id` `id` text not null auto_increment;
|
||||
|
||||
-- Rename period column of writeups table to discovered
|
||||
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";
|
||||
-- --------------------------------------
|
||||
|
||||