Compare commits
36 Commits
0145f5849f
...
Issue-2
| Author | SHA1 | Date | |
|---|---|---|---|
| c17c4d4608 | |||
| 5d3296c3bc | |||
| 09464aace5 | |||
| e3de786766 | |||
| b0aaf70e4d | |||
| b70996b4d9 | |||
| 8647c9b4d8 | |||
| b201ac6d24 | |||
| 1480feecf0 | |||
| f84395f79a | |||
| f3db1c1523 | |||
| 962bd7b504 | |||
| ec8efec61e | |||
| d23a19a3eb | |||
| 152bb30029 | |||
| 11c876886a | |||
| 9cce143cf9 | |||
| eb29a3799c | |||
| ba7db9279d | |||
| ce8e5d9ca7 | |||
| 0600ba18cd | |||
| ef0599342b | |||
| 5129d30992 | |||
| ed7a25cea3 | |||
| 968964e3fe | |||
| d41519ba91 | |||
| 513017d3cb | |||
| 3385954624 | |||
| 5a50400a56 | |||
| b138f462d9 | |||
| dd86d2e519 | |||
| 41c5b4560b | |||
| 01fd47814b | |||
| 9122040863 | |||
| 86f1512cc0 | |||
| f20b4cd8b6 |
3
BUGS
3
BUGS
@@ -1,4 +1,5 @@
|
||||
BUGS
|
||||
|
||||
1. Adding a reference to a note using the magnifying glass icon is possible even if not logged in. This results in a blank tech and shift.
|
||||
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There needs to be a specific view only state.)
|
||||
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There
|
||||
needs to be a specific view only state.)
|
||||
|
||||
48
CHANGELOG
48
CHANGELOG
@@ -240,3 +240,51 @@
|
||||
treating the $today variable as global.
|
||||
- In install.php, if a previous installation was found, make upgrade
|
||||
the default choice.
|
||||
|
||||
5.2.5 - 2026-02-10
|
||||
This is just a version number bump to get on a major-minor-patch
|
||||
scheme. There are no code changes for this release.
|
||||
|
||||
5.3.0 - 2026-02-20
|
||||
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
|
||||
its own page to make it less confusing and to fix some strange
|
||||
behavior.
|
||||
- Added global templates which can be used by anyone but can only be
|
||||
created, modified, or deleted by administrators. This makes it
|
||||
easier to employ standardized templates.
|
||||
- Changed the character encoding of the database to utf8mb4 to enable
|
||||
using emojis in text fields.
|
||||
- Changed the insert link functionality. There are now two fields, link
|
||||
text, and URL. The full URL string will now not be displayed in the
|
||||
note, since it frequently was too long and deformed the table,
|
||||
causing the user to have to scroll right to see the entire note. If
|
||||
a URL is entered in the URL field and no link text is entered in the
|
||||
link text field, the link will show up as just the last part of the
|
||||
URL. For example, "http://somewhere.com/myfile.pdf" will show as
|
||||
"myfile.pdf" in the note text. If text is entered in the link text
|
||||
field, that is what will show as the clickable link in the note text.
|
||||
NOTE: URLs in previously entered notes will not automatically be
|
||||
converted.
|
||||
- Changed the flag handling code to no longer dynamically create flag_
|
||||
tables in the database to track assignments. This is now done using
|
||||
a flagmap table.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- References will no longer be stored in the lognotes table with the note.
|
||||
There is now a reflinks table that stores the link information.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- Various code cleanups to prevent php warnings in the logs if logging
|
||||
is enabled.
|
||||
- Validate all date and time fields to prevent user entered invalid date
|
||||
formats from crashing php.
|
||||
- Fixed profile page to automatically refresh page to show the results
|
||||
when a user changes their color preferences.
|
||||
|
||||
5.3.1 - 2026-02-25
|
||||
- Fixed bug reported as Issue 1 where failure to select an action for a
|
||||
part entered in a lognote crashed php in logentry.php.
|
||||
- Fixed bug where the prompt to set flags on reference chain appeared
|
||||
even when no flags were available to select in logentry.php.
|
||||
|
||||
4
INSTALL
4
INSTALL
@@ -4,7 +4,6 @@
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
|
||||
Installation of OpenLog is straightforward.
|
||||
|
||||
1. Gather the required information.
|
||||
@@ -31,5 +30,4 @@ settings. You will need to log in as OpenLogAdmin. The initial default password
|
||||
is "OpenLog-1". From the Administration page, you can click on the links at the
|
||||
top to add techs, subjects, shifts, etc.
|
||||
|
||||
7. Start using OpenLog.
|
||||
|
||||
6. Start using OpenLog.
|
||||
|
||||
8
TODO.txt
8
TODO.txt
@@ -1,15 +1,15 @@
|
||||
TODO.txt
|
||||
|
||||
1. Create a weblink hot button on the add logbook entry page to insert a weblink. DONE
|
||||
2. Allow admins to create global templates.
|
||||
2. Allow admins to create global templates. DONE
|
||||
3. Create a way to restore the global page colors. (db change reqd)
|
||||
4. Pick a logbook subject to associate with a scheduled task to populate for the logbook entry. (db change reqd)
|
||||
5. Add info messages to scheduled task page edits.
|
||||
6. Allow scheduled tasks to be completed as a group instead of having to complete each member.
|
||||
7. Implement popup calendars for date entry fields. DONE
|
||||
8. Improve template management interface. It can be confusing. It needs its own page.
|
||||
9. Remove refs from templates. (db change reqd)
|
||||
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd)
|
||||
8. Improve template management interface. It can be confusing. It needs its own page. DONE
|
||||
9. Remove refs from templates. (db change reqd) DONE
|
||||
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd) DONE
|
||||
11. allow partids to be autogenerated if user doesn't supply one (db change reqd)
|
||||
12. If there are no flags, don't offer to set them on reference chain
|
||||
13. make some flags immutable so they won't be synced on reference chain.
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.3.0
|
||||
5.3.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,19 @@
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
function spinner() {
|
||||
local pid="$1"
|
||||
local delay="0.1"
|
||||
local spinstr='|/-\\'
|
||||
local i=0
|
||||
|
||||
while ps -p "$pid" > /dev/null; do
|
||||
i=$(( (i+1) % 4 ))
|
||||
printf "\r[%c]" "${spinstr:$i:1}"
|
||||
sleep "$delay"
|
||||
done
|
||||
printf "\r \r" # Clear the spinner line
|
||||
}
|
||||
|
||||
if [[ $1 == "" ]]
|
||||
then
|
||||
@@ -45,7 +58,9 @@ echo "Started database updates for OpenLog version 5.3.0..."
|
||||
# Import old flag data from old scheme to new flagmap table
|
||||
if [[ $(mysql $margs -e "select count(*) from flagmap") == 0 ]]
|
||||
then
|
||||
echo "Importing flag data from old scheme to new flagmap table..."
|
||||
echo "Importing flag data from old scheme to new flagmap table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for flagnumber in $(mysql $margs -e "select flagid from flags")
|
||||
do
|
||||
flag_x=$(mysql $margs -s -e "show tables like 'flag_$flagnumber'")
|
||||
@@ -69,13 +84,18 @@ then
|
||||
mysql $margs -e "drop table flag_$flagnumber"
|
||||
fi
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
fi
|
||||
|
||||
# Import reference chain data into new reflinks table
|
||||
if [[ $(mysql $margs -e "select count(*) from reflinks") == 0 ]]
|
||||
then
|
||||
echo "Importing lognote reference chain data into new reflinks table..."
|
||||
echo "Importing lognote reference chain data into new reflinks table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for note in $(mysql $margs -e "select lognoteid from lognotes where refs!=''")
|
||||
do
|
||||
refstring=$(mysql $margs -e "select refs from lognotes where lognoteid=$note")
|
||||
@@ -88,8 +108,13 @@ then
|
||||
done
|
||||
IFS=$oldifs
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
echo "Importing template reference chain data into new reflinks table..."
|
||||
echo "Importing template reference chain data into new reflinks table."
|
||||
echo "This may take some time..."
|
||||
(
|
||||
for template in $(mysql $margs -e "select templateid from notetemplates where refs!=''")
|
||||
do
|
||||
refstring=$(mysql $margs -e "select refs from notetemplates where templateid=$template")
|
||||
@@ -102,6 +127,9 @@ then
|
||||
done
|
||||
IFS=$oldifs
|
||||
done
|
||||
) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
echo "...done."
|
||||
mysql $margs -e "alter table lognotes drop column refs" >/dev/null 2>&1
|
||||
mysql $margs -e "alter table notetemplates drop column refs" >/dev/null 2>&1
|
||||
@@ -116,3 +144,7 @@ do
|
||||
done
|
||||
echo "...done."
|
||||
# -------------------------------------
|
||||
|
||||
# ---------- version 5.3.1 ------------
|
||||
# Nothing to do
|
||||
# -------------------------------------
|
||||
@@ -6,11 +6,15 @@ ALTER TABLE configs ADD UNIQUE(confname);
|
||||
|
||||
-- Delete db name, user, and password configs
|
||||
DELETE FROM configs where confname = "ol_dbname";
|
||||
|
||||
DELETE FROM configs where confname = "ol_dbuser";
|
||||
|
||||
DELETE FROM configs where confname = "ol_dbpass";
|
||||
|
||||
-- Add config option for server side error logging
|
||||
INSERT IGNORE INTO configs(confname,confvalue) values('log_errors','0')
|
||||
INSERT IGNORE INTO
|
||||
configs (confname, confvalue)
|
||||
values ('log_errors', '0')
|
||||
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue = "5.2.1" WHERE confname = "ol_version";
|
||||
@@ -80,3 +84,8 @@ CREATE TABLE IF NOT EXISTS `reflinks` (
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 5.3.1 -------------
|
||||
-- Update version number
|
||||
UPDATE configs SET confvalue = "5.3.1" WHERE confname = "ol_version";
|
||||
-- --------------------------------------
|
||||
13
default-apache.conf
Normal file
13
default-apache.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# _APPNAME_ default Apache configuration
|
||||
|
||||
Alias /_BASEURL_ _DOCROOTIN_/_BASEURL_
|
||||
|
||||
<Directory _DOCROOTIN_/_BASEURL_>
|
||||
AllowOverride Options
|
||||
Options FollowSymLinks
|
||||
DirectoryIndex index.php
|
||||
|
||||
#RewriteEngine On
|
||||
#RewriteBase /_BASEURL_/
|
||||
#RewriteRule . maintenancemode.php [L]
|
||||
</Directory>
|
||||
@@ -240,3 +240,52 @@
|
||||
treating the $today variable as global.
|
||||
- In install.php, if a previous installation was found, make upgrade
|
||||
the default choice.
|
||||
|
||||
5.2.5 - 2026-02-10
|
||||
This is just a version number bump to get on a major-minor-patch
|
||||
scheme. There are no code changes for this release.
|
||||
|
||||
5.3.0 - 2026-02-20
|
||||
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
|
||||
its own page to make it less confusing and to fix some strange
|
||||
behavior.
|
||||
- Added global templates which can be used by anyone but can only be
|
||||
created, modified, or deleted by administrators. This makes it
|
||||
easier to employ standardized templates.
|
||||
- Changed the character encoding of the database to utf8mb4 to enable
|
||||
using emojis in text fields.
|
||||
- Changed the insert link functionality. There are now two fields, link
|
||||
text, and URL. The full URL string will now not be displayed in the
|
||||
note, since it frequently was too long and deformed the table,
|
||||
causing the user to have to scroll right to see the entire note. If
|
||||
a URL is entered in the URL field and no link text is entered in the
|
||||
link text field, the link will show up as just the last part of the
|
||||
URL. For example, "http://somewhere.com/myfile.pdf" will show as
|
||||
"myfile.pdf" in the note text. If text is entered in the link text
|
||||
field, that is what will show as the clickable link in the note text.
|
||||
NOTE: URLs in previously entered notes will not automatically be
|
||||
converted.
|
||||
- Changed the flag handling code to no longer dynamically create flag_
|
||||
tables in the database to track assignments. This is now done using
|
||||
a flagmap table.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- References will no longer be stored in the lognotes table with the note.
|
||||
There is now a reflinks table that stores the link information.
|
||||
NOTE: The database will be modified to support this and the
|
||||
importation of the previous data will take some time during
|
||||
installation.
|
||||
- Various code cleanups to prevent php warnings in the logs if logging
|
||||
is enabled.
|
||||
- Validate all date and time fields to prevent user entered invalid date
|
||||
formats from crashing php.
|
||||
- Fixed profile page to automatically refresh page to show the results
|
||||
when a user changes their color preferences.
|
||||
|
||||
5.3.1 - 2026-02-25
|
||||
- Fixed bug reported as Issue 1 where failure to select an action for a
|
||||
part entered in a lognote crashed php in logentry.php.
|
||||
- Fixed bug where the prompt to set flags on reference chain appeared
|
||||
even when no flags were available to select in logentry.php.
|
||||
|
||||
|
||||
@@ -92,5 +92,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -76,29 +76,31 @@ if(!$print){
|
||||
if ($add) {
|
||||
switch ($table) {
|
||||
case "techs":
|
||||
if ($admin) $admin=1; else $admin=0;
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($admin) $admin = 1;
|
||||
else $admin = 0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for matching passwords
|
||||
if ($pass == $passconf) {
|
||||
$passmatch=1;
|
||||
$passmatch = TRUE;
|
||||
$passhash = password_hash($pass, PASSWORD_DEFAULT);
|
||||
} else {
|
||||
$passmatch=0;
|
||||
$passmatch = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
||||
}
|
||||
if ($namesuppld && $nameunique && $passmatch) {
|
||||
@@ -108,21 +110,22 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "shifts":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -131,21 +134,22 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "subjects":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -154,27 +158,28 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "links":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for urltxt supplied
|
||||
if (strlen(trim($url))) {
|
||||
$urlsuppld=1;
|
||||
$urlsuppld = TRUE;
|
||||
} else {
|
||||
$urlsuppld=0;
|
||||
$urlsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL text cannot be blank.<br>";
|
||||
}
|
||||
if ($namesuppld && $nameunique && $urlsuppld) {
|
||||
@@ -188,60 +193,59 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "flags":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for symbol supplied
|
||||
if (strlen(trim($flagsym))) {
|
||||
$symsuppld=1;
|
||||
$symsuppld = TRUE;
|
||||
} else {
|
||||
$symsuppld=0;
|
||||
$symsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol cannot be blank.<br>";
|
||||
}
|
||||
// test for symbol unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) {
|
||||
$symunique=0;
|
||||
$symunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol already exists.<br>";
|
||||
} else {
|
||||
$symunique=1;
|
||||
$symunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
|
||||
// insert record in links table
|
||||
// insert record in flags table
|
||||
mysqli_query($db, "insert into flags(flagname,flagsym,flagcolor,status) values(\"$name\",\"$flagsym\",\"$flagcolor\",\"$active\")");
|
||||
// create sub tables for this link
|
||||
$lastflagid=mysqli_insert_id($db);
|
||||
mysqli_query($db,"create table flag_$lastflagid(target tinytext,id int not null)");
|
||||
}
|
||||
break;
|
||||
case "logpartactions":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -253,17 +257,17 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -281,29 +285,31 @@ if(!$print){
|
||||
if ($edit) {
|
||||
switch ($table) {
|
||||
case "techs":
|
||||
if ($admin) $admin=1; else $admin=0;
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($admin) $admin = 1;
|
||||
else $admin = 0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
// check for log notes by this tech
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where tech=\"$id\""))) {
|
||||
$hasnotes=1;
|
||||
$hasnotes = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has notes in logbook and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasnotes=0;
|
||||
$hasnotes = FALSE;
|
||||
}
|
||||
// check for maintenance forms by this tech
|
||||
if (mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$id\""))) {
|
||||
$hasmfs=1;
|
||||
$hasmfs = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has maintenance forms and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasmfs=0;
|
||||
$hasmfs = FALSE;
|
||||
}
|
||||
// check for maintenance actions by this tech
|
||||
if (mysqli_num_rows(mysqli_query($db, "select maintactionid from maintactions where actiontech=\"$id\""))) {
|
||||
$hasmas=1;
|
||||
$hasmas = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has maintenance actions and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasmas=0;
|
||||
$hasmas = FALSE;
|
||||
}
|
||||
if (!$hasnotes && !$hasmfs && !$hasmas) {
|
||||
// delete entity
|
||||
@@ -314,34 +320,34 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for matching passwords
|
||||
if ($pass != "password_is_unchanged") {
|
||||
if ($pass == $passconf) {
|
||||
$passmatch=1;
|
||||
$passmatch = TRUE;
|
||||
$passhash = password_hash($pass, PASSWORD_DEFAULT);
|
||||
$updqry = ("update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",techpass=\"$passhash\",status=\"$active\" where techid=\"$id\"");
|
||||
} else {
|
||||
$passmatch=0;
|
||||
$passmatch = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
||||
}
|
||||
} else {
|
||||
$passmatch=1;
|
||||
$passmatch = TRUE;
|
||||
$updqry = "update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",status=\"$active\" where techid=\"$id\"";
|
||||
}
|
||||
if ($namesuppld && $nameunique && $passmatch) {
|
||||
@@ -351,14 +357,15 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "shifts":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
// check for log notes with this shift
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where shift=\"$id\""))) {
|
||||
$hasnotes=1;
|
||||
$hasnotes = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift has notes in logbook and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasnotes=0;
|
||||
$hasnotes = FALSE;
|
||||
}
|
||||
if (!$hasnotes) {
|
||||
// delete entity
|
||||
@@ -369,21 +376,21 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\" and shiftid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -392,14 +399,15 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "subjects":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
// check for log notes with this subject
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where subject=\"$id\""))) {
|
||||
$hasnotes=1;
|
||||
$hasnotes = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject has notes in logbook and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasnotes=0;
|
||||
$hasnotes = FALSE;
|
||||
}
|
||||
if (!$hasnotes) {
|
||||
// delete entity
|
||||
@@ -410,21 +418,21 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\" and subjectid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -433,7 +441,8 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "links":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
mysqli_query($db, "delete from links where linkid=\"$id\"");
|
||||
}
|
||||
@@ -441,27 +450,27 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\" and linkid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for urltxt supplied
|
||||
if (strlen(trim($url))) {
|
||||
$urlsuppld=1;
|
||||
$urlsuppld = TRUE;
|
||||
} else {
|
||||
$urlsuppld=0;
|
||||
$urlsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL text cannot be blank.<br>";
|
||||
}
|
||||
if ($namesuppld && $nameunique && $urlsuppld) {
|
||||
@@ -476,58 +485,58 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "flags":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
// check for things using this flag
|
||||
if (mysqli_num_rows(mysqli_query($db,"select * from flag_$id"))) {
|
||||
$used=1;
|
||||
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$id\""))) {
|
||||
$used = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag is used by other tables and cannot be deleted.<br>";
|
||||
} else {
|
||||
$used=0;
|
||||
$used = FALSE;
|
||||
}
|
||||
if (!$used) {
|
||||
// delete entity
|
||||
mysqli_query($db, "delete from flags where flagid=\"$id\"");
|
||||
mysqli_query($db,"drop table flag_$id");
|
||||
}
|
||||
}
|
||||
if ($update) {
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\" and flagid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for symbol supplied
|
||||
if (strlen(trim($flagsym))) {
|
||||
$symsuppld=1;
|
||||
$symsuppld = TRUE;
|
||||
} else {
|
||||
$symsuppld=0;
|
||||
$symsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol cannot be blank.<br>";
|
||||
}
|
||||
// test for symbol unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\" and flagid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) {
|
||||
$symunique=0;
|
||||
$symunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol already exists.<br>";
|
||||
} else {
|
||||
$symunique=1;
|
||||
$symunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$symunique=1;
|
||||
$symunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
|
||||
// modify the table
|
||||
@@ -536,14 +545,15 @@ if(!$print){
|
||||
}
|
||||
break;
|
||||
case "logpartactions":
|
||||
if ($active) $active=1; else $active=0;
|
||||
if ($active) $active = 1;
|
||||
else $active = 0;
|
||||
if ($delete) {
|
||||
// check for logparts with this part action
|
||||
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where action=\"$id\""))) {
|
||||
$hasparts=1;
|
||||
$hasparts = TRUE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Action is assigned to parts in logbook notes and cannot be deleted.<br>";
|
||||
} else {
|
||||
$hasparts=0;
|
||||
$hasparts = FALSE;
|
||||
}
|
||||
if (!$hasparts) {
|
||||
// delete entity
|
||||
@@ -554,21 +564,21 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\" and lpactionid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -585,21 +595,21 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\" and bannerid!=\"$id\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
if ($namesuppld && $nameunique) {
|
||||
// modify the table
|
||||
@@ -610,21 +620,24 @@ if(!$print){
|
||||
case "configs":
|
||||
switch ($type) {
|
||||
case "display":
|
||||
if ($display_showts) $display_showts=1; else $display_showts=0;
|
||||
if ($display_techalpha=="a") $display_techalpha=1; else $display_techalpha=0;
|
||||
if ($display_subjalpha=="a") $display_subjalpha=1; else $display_subjalpha=0;
|
||||
if ($display_showts) $display_showts = 1;
|
||||
else $display_showts = 0;
|
||||
if ($display_techalpha == "a") $display_techalpha = 1;
|
||||
else $display_techalpha = 0;
|
||||
if ($display_subjalpha == "a") $display_subjalpha = 1;
|
||||
else $display_subjalpha = 0;
|
||||
// test for logname supplied
|
||||
if (strlen(trim($display_logname))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Log name cannot be blank.<br>";
|
||||
}
|
||||
// test for urlchunk supplied
|
||||
if (strlen(trim($display_urlchunk))) {
|
||||
$chunksuppld=1;
|
||||
$chunksuppld = TRUE;
|
||||
} else {
|
||||
$chunksuppld=0;
|
||||
$chunksuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL chunk size cannot be blank.<br>";
|
||||
}
|
||||
if ($namesuppld && $chunksuppld) {
|
||||
@@ -666,16 +679,16 @@ if(!$print){
|
||||
}
|
||||
// test for sessttl supplied
|
||||
if (strlen(trim($misc_sessttl))) {
|
||||
$ttlsuppld=1;
|
||||
$ttlsuppld = TRUE;
|
||||
} else {
|
||||
$ttlsuppld=0;
|
||||
$ttlsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Session expiration time cannot be blank.<br>";
|
||||
}
|
||||
// test for sessdir supplied
|
||||
if (strlen(trim($misc_sessdir))) {
|
||||
$dirsuppld=1;
|
||||
$dirsuppld = TRUE;
|
||||
} else {
|
||||
$dirsuppld=0;
|
||||
$dirsuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Server session file directory cannot be blank.<br>";
|
||||
}
|
||||
if ($ttlsuppld && $dirsuppld) {
|
||||
@@ -751,6 +764,7 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from techs where techid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["techname"];
|
||||
$pass = $passconf = "password_is_unchanged";
|
||||
$shift = $currentvalues["shift"];
|
||||
@@ -764,6 +778,13 @@ switch($table) {
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = NULL;
|
||||
$pass = NULL;
|
||||
$shift = NULL;
|
||||
$admintag = "<input type=\"checkbox\" name=\"admin\">";
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
// set form options for add
|
||||
$sectiontitle = "<b>Add New Tech</b><br><br>";
|
||||
@@ -831,7 +852,8 @@ switch($table) {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
@@ -839,11 +861,13 @@ switch($table) {
|
||||
<td align=\"center\">%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["techid"],$tablerow["techid"],
|
||||
$tablerow["techid"],
|
||||
$tablerow["techid"],
|
||||
$tablerow["techname"],
|
||||
$shiftname,
|
||||
$admdef,
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -862,12 +886,17 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from shifts where shiftid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["shiftname"];
|
||||
if ($currentvalues["status"] == 1) {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = NULL;
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
// set form options for add
|
||||
$sectiontitle = "<b>Add New Shift</b><br><br>";
|
||||
@@ -906,15 +935,18 @@ switch($table) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["shiftid"],$tablerow["shiftid"],
|
||||
$tablerow["shiftid"],
|
||||
$tablerow["shiftid"],
|
||||
$tablerow["shiftname"],
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -933,12 +965,17 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from subjects where subjectid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["subjectname"];
|
||||
if ($currentvalues["status"] == 1) {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = "";
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
// set form options for add
|
||||
$sectiontitle = "<b>Add New Subject</b><br><br>";
|
||||
@@ -977,15 +1014,18 @@ switch($table) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["subjectid"],$tablerow["subjectid"],
|
||||
$tablerow["subjectid"],
|
||||
$tablerow["subjectid"],
|
||||
$tablerow["subjectname"],
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -1004,6 +1044,7 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from links where linkid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["displaytxt"];
|
||||
$priority = $currentvalues["linkpriority"];
|
||||
$url = $currentvalues["urltxt"];
|
||||
@@ -1012,6 +1053,12 @@ switch($table) {
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = NULL;
|
||||
$priority = NULL;
|
||||
$url = NULL;
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
// determine where we are in the priority stack
|
||||
$prow = mysqli_fetch_assoc(mysqli_query($db, "select min(linkpriority) as highest from links"));
|
||||
if ($prow["highest"] == $priority) {
|
||||
@@ -1090,17 +1137,21 @@ switch($table) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td><a href=\"%s\">%s</a></td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["linkid"],$tablerow["linkid"],
|
||||
$tablerow["linkid"],
|
||||
$tablerow["linkid"],
|
||||
$tablerow["displaytxt"],
|
||||
$tablerow["urltxt"],$tablerow["urltxt"],
|
||||
$statdef);
|
||||
$tablerow["urltxt"],
|
||||
$tablerow["urltxt"],
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -1119,10 +1170,22 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["flagname"];
|
||||
$flagsym = $currentvalues["flagsym"];
|
||||
$flagcolor = $currentvalues["flagcolor"];
|
||||
$flagcoloropts = "";
|
||||
if ($currentvalues["status"] == 1) {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = NULL;
|
||||
$flagsym = NULL;
|
||||
$flagcolor = NULL;
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
foreach ($basic_colors as $cname => $chex) {
|
||||
if ($chex == $flagcolor) {
|
||||
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
||||
@@ -1130,11 +1193,6 @@ switch($table) {
|
||||
$flagcoloropts = $flagcoloropts . "<option value=\"$chex\">$cname</option>";
|
||||
}
|
||||
}
|
||||
if ($currentvalues["status"]==1) {
|
||||
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
||||
} else {
|
||||
$activetag="<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
// set form options for add
|
||||
$sectiontitle = "<b>Add New Flag</b><br><br>";
|
||||
@@ -1187,17 +1245,21 @@ switch($table) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td align=\"center\"><font color=\"%s\">%s</font></td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["flagid"],$tablerow["flagid"],
|
||||
$tablerow["flagid"],
|
||||
$tablerow["flagid"],
|
||||
$tablerow["flagname"],
|
||||
$tablerow["flagcolor"],$tablerow["flagsym"],
|
||||
$statdef);
|
||||
$tablerow["flagcolor"],
|
||||
$tablerow["flagsym"],
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -1216,12 +1278,17 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from logpartactions where lpactionid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["lpactionname"];
|
||||
if ($currentvalues["status"] == 1) {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\" checked>";
|
||||
} else {
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
$name = NULL;
|
||||
$activetag = "<input type=\"checkbox\" name=\"active\">";
|
||||
}
|
||||
} else {
|
||||
// set form options for add
|
||||
$sectiontitle = "<b>Add New Part Action</b><br><br>";
|
||||
@@ -1260,15 +1327,18 @@ switch($table) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$tablerow["lpactionid"],$tablerow["lpactionid"],
|
||||
$tablerow["lpactionid"],
|
||||
$tablerow["lpactionid"],
|
||||
$tablerow["lpactionname"],
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -1287,9 +1357,15 @@ switch($table) {
|
||||
";
|
||||
// pull current values from database
|
||||
$currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=$id"));
|
||||
if (!empty($currentvalues)) {
|
||||
$name = $currentvalues["bannername"];
|
||||
$bnrcolor = $currentvalues["bannercolor"];
|
||||
$bnrtextcolor = $currentvalues["textcolor"];
|
||||
} else {
|
||||
$name = NULL;
|
||||
$bnrcolor = NULL;
|
||||
$bnrtextcolor = NULL;
|
||||
}
|
||||
$bnrcoloropts = "";
|
||||
foreach ($basic_colors as $cname => $chex) {
|
||||
if ($chex == $bnrcolor) {
|
||||
@@ -1363,13 +1439,18 @@ switch($table) {
|
||||
<tr><th>Banner ID</th><th>Banner</th></tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
||||
<td align=\"center\" bgcolor=\"%s\"><font color=\"%s\">%s</font></td>
|
||||
</tr>",
|
||||
$tablerow["bannerid"],$tablerow["bannerid"],
|
||||
$tablerow["bannercolor"],$tablerow["textcolor"],$tablerow["bannername"]);
|
||||
$tablerow["bannerid"],
|
||||
$tablerow["bannerid"],
|
||||
$tablerow["bannercolor"],
|
||||
$tablerow["textcolor"],
|
||||
$tablerow["bannername"]
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
break;
|
||||
@@ -1586,5 +1667,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -45,11 +45,13 @@ $basic_colors=array(
|
||||
"Blue" => "#0000FF",
|
||||
"Navy" => "#000080",
|
||||
"Fuchsia" => "#FF00FF",
|
||||
"Purple" => "#800080");
|
||||
"Purple" => "#800080"
|
||||
);
|
||||
|
||||
// Generic functions
|
||||
|
||||
function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
function framework($option, $htmltitle, $pagetitle, $print)
|
||||
{
|
||||
// generates html code for the beginning and end of all pages
|
||||
if ($option == "begin") {
|
||||
// generates everything down to the first horiz rule inclusive
|
||||
@@ -221,7 +223,8 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
}
|
||||
}
|
||||
|
||||
function pagetable($option) {
|
||||
function pagetable($option)
|
||||
{
|
||||
if ($option == "begin") {
|
||||
echo "
|
||||
<br>
|
||||
@@ -240,7 +243,8 @@ function pagetable($option) {
|
||||
}
|
||||
}
|
||||
|
||||
function pageblock($block,$option) {
|
||||
function pageblock($block, $option)
|
||||
{
|
||||
global $sbcolor;
|
||||
if ($block == "left") {
|
||||
if ($option == "begin") {
|
||||
@@ -280,7 +284,8 @@ function pageblock($block,$option) {
|
||||
}
|
||||
}
|
||||
|
||||
function sidemenu($noprint=false) {
|
||||
function sidemenu($noprint = false)
|
||||
{
|
||||
// Displays sidebar menu
|
||||
global $db, $mbgcolor, $noprint;
|
||||
$doparts = PARTS_FUNCTIONS;
|
||||
@@ -359,7 +364,8 @@ function sidemenu($noprint=false) {
|
||||
";
|
||||
}
|
||||
|
||||
function banner($print) {
|
||||
function banner($print)
|
||||
{
|
||||
// displays a banner
|
||||
global $db;
|
||||
$bannerid = BANNER;
|
||||
@@ -385,7 +391,8 @@ function banner($print) {
|
||||
}
|
||||
}
|
||||
|
||||
function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
|
||||
function dblookup($dbhandle, $table, $in_field, $out_field, $in_data)
|
||||
{
|
||||
// look up a single field in a database given a value for a single field
|
||||
$dbqry = mysqli_query($dbhandle, "select $out_field from $table where $in_field=\"$in_data\"");
|
||||
if (mysqli_num_rows($dbqry)) {
|
||||
@@ -396,7 +403,8 @@ function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
|
||||
return ($out_data);
|
||||
}
|
||||
|
||||
function calendar($year,$month,$day,$link_url) {
|
||||
function calendar($year, $month, $day, $link_url)
|
||||
{
|
||||
// takes a numeric year, month, day, and the basic url for the day links as arguments
|
||||
// Shows a calendar with clickable dates.
|
||||
// Based on an embeddable calendar by Yves Glodt.
|
||||
@@ -512,7 +520,8 @@ EOT;
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
function colorpicker($baseurl) {
|
||||
function colorpicker($baseurl)
|
||||
{
|
||||
// takes a standard url and tacks the color number on to the end of it
|
||||
// giving a palette of links
|
||||
echo "
|
||||
@@ -595,7 +604,8 @@ function colorpicker($baseurl) {
|
||||
// Project functions
|
||||
|
||||
|
||||
function getsetting($setting_name,$tech_id) {
|
||||
function getsetting($setting_name, $tech_id)
|
||||
{
|
||||
// get the value of a setting for a tech
|
||||
global $db;
|
||||
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
|
||||
@@ -617,7 +627,8 @@ function getsetting($setting_name,$tech_id) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function putsetting($setting_name,$setting_value,$tech_id) {
|
||||
function putsetting($setting_name, $setting_value, $tech_id)
|
||||
{
|
||||
// set the value of a setting for a tech
|
||||
global $db;
|
||||
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
|
||||
@@ -637,7 +648,8 @@ function putsetting($setting_name,$setting_value,$tech_id) {
|
||||
}
|
||||
}
|
||||
|
||||
function islink($il_note) {
|
||||
function islink($il_note)
|
||||
{
|
||||
// takes a noteid number as an argument
|
||||
// determines if the argument is a link in a reference chain
|
||||
// returns 1 if note is a link, 0 if not
|
||||
@@ -651,7 +663,8 @@ function islink($il_note) {
|
||||
}
|
||||
|
||||
|
||||
function generate_chain($chainlink) {
|
||||
function generate_chain($chainlink)
|
||||
{
|
||||
// generate a reference chain
|
||||
// takes a single parameter, a noteid
|
||||
// finds all notes that are members of a chain containing the supplied noteid
|
||||
@@ -693,7 +706,8 @@ function generate_chain($chainlink) {
|
||||
return ($chainarray);
|
||||
}
|
||||
|
||||
function convertweblinks($rawstring) {
|
||||
function convertweblinks($rawstring)
|
||||
{
|
||||
// takes a string, finds urls, and returns the string with urls converted to clickable links
|
||||
$urlchunksize = URL_CHUNK_SIZE;
|
||||
// define regex pattern for urls
|
||||
@@ -712,7 +726,8 @@ function convertweblinks($rawstring) {
|
||||
return $rawstring;
|
||||
}
|
||||
|
||||
function showlinklist($print) {
|
||||
function showlinklist($print)
|
||||
{
|
||||
global $db;
|
||||
$linkresult = mysqli_query($db, "select linkid from links where status=\"1\"");
|
||||
if (mysqli_num_rows($linkresult) && !$print) {
|
||||
@@ -726,7 +741,8 @@ function showlinklist($print) {
|
||||
}
|
||||
}
|
||||
|
||||
function nag($tech_id) {
|
||||
function nag($tech_id)
|
||||
{
|
||||
// nags the user if something is pending
|
||||
global $db, $today;
|
||||
// maintenance forms
|
||||
@@ -751,7 +767,8 @@ function nag($tech_id) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_part_data($partinputdata) {
|
||||
function get_part_data($partinputdata)
|
||||
{
|
||||
// given an associative array of partid, uid, partnum, sernum,
|
||||
// return an associative array of
|
||||
// partid, uid, partnum, sernum, partname, result
|
||||
@@ -821,7 +838,8 @@ function get_part_data($partinputdata) {
|
||||
return $partdata;
|
||||
}
|
||||
|
||||
function get_upcoming_events() {
|
||||
function get_upcoming_events()
|
||||
{
|
||||
// build array of upcoming events
|
||||
// takes no arguments
|
||||
// returns an array containing arrays of upcoming event data
|
||||
@@ -910,7 +928,8 @@ function get_upcoming_events() {
|
||||
return $ucevents;
|
||||
}
|
||||
|
||||
function format_message($msgtype,$msgtxt) {
|
||||
function format_message($msgtype, $msgtxt)
|
||||
{
|
||||
// displays a formatted message
|
||||
// $msgtype is 0 for success or anything else for failure
|
||||
// $msgtxt is the string to display
|
||||
@@ -930,13 +949,15 @@ function format_message($msgtype,$msgtxt) {
|
||||
";
|
||||
}
|
||||
|
||||
function templateselect($techid,$operation) {
|
||||
function templateselect($techid, $operation)
|
||||
{
|
||||
// Displays a line enabling selection of a user or global template
|
||||
// $techid is the id number of the current tech
|
||||
// $operation is one of "add" "edit" "delete"
|
||||
// $operation is one of "add" "edit" "delete" or NULL
|
||||
global $db;
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||
echo "
|
||||
<form method=\"post\" action=\"templates.php\">
|
||||
<form method=\"post\">
|
||||
";
|
||||
// generate template selection line
|
||||
echo "
|
||||
@@ -947,11 +968,20 @@ function templateselect($techid,$operation) {
|
||||
<td>
|
||||
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
||||
";
|
||||
if ($isadmin && $operation != NULL) {
|
||||
$templaterow = mysqli_query($db, "select * from notetemplates where tech!=\"0\" order by tech asc, templatename asc");
|
||||
} else {
|
||||
$templaterow = mysqli_query($db, "select * from notetemplates where tech=\"$techid\" order by templatename asc");
|
||||
}
|
||||
printf("<option value=\"%s\" selected>%s</option>", "0", "Select user template");
|
||||
while ($templateitem = mysqli_fetch_assoc($templaterow)) {
|
||||
if ($isadmin && $operation != NULL) {
|
||||
$techname = dblookup($db, "techs", "techid", "techname", $templateitem["tech"]);
|
||||
printf("<option value=\"%s\">%s(%s)</option>", $templateitem["templateid"], $templateitem["templatename"], $techname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>", $templateitem["templateid"], $templateitem["templatename"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select> or
|
||||
";
|
||||
@@ -980,4 +1010,31 @@ function templateselect($techid,$operation) {
|
||||
</form>
|
||||
";
|
||||
}
|
||||
?>
|
||||
|
||||
function fix_date($datestring)
|
||||
{
|
||||
// accepts a string as an argument
|
||||
// returns a valid date string in the format YYYY-MM-DD
|
||||
// if input string is not a valid date, return the current date
|
||||
global $db, $today;
|
||||
|
||||
if (!$datestring) $datestring = $today;
|
||||
$datepatt = '/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/';
|
||||
if (!preg_match($datepatt, $datestring)) $datestring = $today;
|
||||
$datestring = mysqli_real_escape_string($db, $datestring);
|
||||
return $datestring;
|
||||
}
|
||||
|
||||
function fix_time($timestring)
|
||||
{
|
||||
// accepts a string as an argument
|
||||
// returns a valid time string in the format HH:MM:SS
|
||||
// if input string is not a valid time, return the current time
|
||||
global $db, $now;
|
||||
|
||||
if (!$timestring) $timestring = $now;
|
||||
$timepatt = '/^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/';
|
||||
if (!preg_match($timepatt, $timestring)) $timestring = $now;
|
||||
$timestring = mysqli_real_escape_string($db, $timestring);
|
||||
return $timestring;
|
||||
}
|
||||
|
||||
@@ -380,5 +380,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (!$_SESSION['login'] && !$_REQUEST['partview']) {
|
||||
if (!array_key_exists("login", $_SESSION) && !array_key_exists("partview", $_REQUEST)) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ $uids=$_POST['uids'] ?? [];
|
||||
$partnums = $_POST['partnums'] ?? [];
|
||||
$sernums = $_POST['sernums'] ?? [];
|
||||
$actions = $_POST['actions'] ?? [];
|
||||
$mfreqs=$_POST['mfreqs'] ?? [];
|
||||
$mfreqs = $_POST['mfreqs'] ?? ["off"];
|
||||
$schedmaintcomplete = $_REQUEST['schedmaintcomplete'] ?? NULL;
|
||||
$partview = $_REQUEST['partview'] ?? NULL;
|
||||
|
||||
@@ -96,10 +96,9 @@ if ($add) {
|
||||
// add the entry if submit is pressed
|
||||
if ($note) {
|
||||
// sanitize and fix blank date and time
|
||||
$date=mysqli_real_escape_string($db,$date);
|
||||
$time=mysqli_real_escape_string($db,$time);
|
||||
if (!$date) $date=$today;
|
||||
if (!$time) $time=$now;
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
// determine whether supplied date is future or past
|
||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)"));
|
||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||
@@ -200,7 +199,7 @@ if ($add) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||
}
|
||||
|
||||
@@ -218,7 +217,7 @@ if ($add) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||
}
|
||||
|
||||
@@ -236,10 +235,9 @@ if ($add) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$newnoteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
|
||||
}
|
||||
|
||||
} else {
|
||||
// no part info was entered
|
||||
}
|
||||
@@ -264,6 +262,10 @@ if ($edit) {
|
||||
if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\"");
|
||||
if ($submit) {
|
||||
if ($note) {
|
||||
// sanitize and fix blank date and time
|
||||
$date = fix_date($date);
|
||||
$time = fix_time($time);
|
||||
|
||||
// remove cruft from note text
|
||||
$note = strip_tags($note, "<a>");
|
||||
$note = mysqli_real_escape_string($db, $note);
|
||||
@@ -362,7 +364,7 @@ if ($edit) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||
}
|
||||
|
||||
@@ -380,7 +382,7 @@ if ($edit) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||
}
|
||||
|
||||
@@ -398,10 +400,9 @@ if ($edit) {
|
||||
// add it to logparts table
|
||||
mysqli_query($db, "insert into logparts(lognoteid,partid,action) values(\"$noteid\",\"$lpid\",\"$actions[$plidx]\")");
|
||||
// create a maintenance form if required
|
||||
if ($mfreqs[$plidx]=="on") {
|
||||
if (array_key_exists($plidx,$mfreqs) && $mfreqs[$plidx] == "on") {
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
|
||||
}
|
||||
|
||||
} else {
|
||||
// no part info was entered
|
||||
;
|
||||
@@ -498,70 +499,15 @@ if ($submit) {
|
||||
if ($delete) {
|
||||
format_message(0, "<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
|
||||
}
|
||||
echo "
|
||||
<form method=\"post\" action=\"logentry.php\">
|
||||
";
|
||||
if ($_SESSION['login']) {
|
||||
// generate template line
|
||||
echo "
|
||||
<table border=\"0\" cellpadding=\"10\"><tr>
|
||||
";
|
||||
// list user templates
|
||||
echo "
|
||||
<td>
|
||||
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
||||
";
|
||||
if ($loadtemplate) $templatename=dblookup($db,"notetemplates","templateid","templatename",$usertemplateid);
|
||||
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"$techid\" order by templatename asc");
|
||||
if ($loadtemplate) {
|
||||
printf("<option value=\"%s\">%s</option>","0","Select user template");
|
||||
} else {
|
||||
printf("<option value=\"%s\" selected>%s</option>","0","Select user template");
|
||||
}
|
||||
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
|
||||
if ($loadtemplate && ($templateitem["templateid"] == $usertemplateid)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select> or
|
||||
";
|
||||
// list global templates
|
||||
echo "
|
||||
<select name=\"globaltemplateid\" title=\"Select the global template you'd like to load and click the Load Template button. User template selection takes precedence.\">
|
||||
";
|
||||
if ($loadtemplate) $templatename=dblookup($db,"notetemplates","templateid","templatename",$globaltemplateid);
|
||||
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"0\" order by templatename asc");
|
||||
if ($loadtemplate) {
|
||||
printf("<option value=\"%s\">%s</option>","0","Select global template");
|
||||
} else {
|
||||
printf("<option value=\"%s\" selected>%s</option>","0","Select global template");
|
||||
}
|
||||
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
|
||||
if ($loadtemplate && ($templateitem["templateid"] == $globaltemplateid)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
// show load button
|
||||
echo "
|
||||
<input type=\"submit\" name=\"loadtemplate\" value=\"Load Template\">
|
||||
</td>
|
||||
<td>
|
||||
<a href=\"templates.php\">Manage templates</a>
|
||||
</td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
";
|
||||
|
||||
if (array_key_exists('login', $_SESSION)) {
|
||||
// show the template selection line
|
||||
templateselect($techid, NULL);
|
||||
}
|
||||
|
||||
// start note entry section
|
||||
echo "
|
||||
<form method=\"post\" action=\"logentry.php\">
|
||||
<table border=\"0\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<td align=\"center\" colspan=\"2\"><b>Date: </b>
|
||||
@@ -575,7 +521,8 @@ if ($isadmin) {
|
||||
<td><b>Tech: </b>
|
||||
<select name=\"efftechid\">
|
||||
";
|
||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
||||
if ($techalpha) $torder = "techname";
|
||||
else $torder = "techid";
|
||||
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||
if ($techitem["status"] == 1) {
|
||||
@@ -618,7 +565,8 @@ echo "
|
||||
<td colspan=\"2\"><b>Subject: </b>
|
||||
<select name=\"subject\">
|
||||
";
|
||||
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
|
||||
if ($subjalpha) $sorder = "subjectname";
|
||||
else $sorder = "subjectid";
|
||||
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
|
||||
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
|
||||
if ($subjitem["status"] == 1) {
|
||||
@@ -671,15 +619,24 @@ $flagcount=1;
|
||||
|
||||
// display checkboxes for all the flags, selecting the ones that are set for this note/template
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
|
||||
if (in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
} else {
|
||||
$flagid = $flagcheckbox["flagid"];
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount < $flagsperline) {
|
||||
@@ -690,9 +647,15 @@ while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
if (mysqli_num_rows($flagslist)) {
|
||||
echo "
|
||||
<br><input type=\"checkbox\" name=\"syncflags\" value=\"1\"><font title=\"Set the selected flags on the other notes in the reference chain\">Set flags on reference chain</font>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<input type=\"hidden\" name=\"syncflags\" value=\"0\">
|
||||
";
|
||||
}
|
||||
|
||||
if ($add && $refto) $refstring = $refto;
|
||||
echo "
|
||||
@@ -720,18 +683,14 @@ if ($add) {
|
||||
<td align=\"center\"><input type=\"text\" name=\"partnums[$partline]\" size=\"20\"></td>
|
||||
<td align=\"center\"><input type=\"text\" name=\"sernums[$partline]\" size=\"20\"></td>
|
||||
<td align=\"center\"><select name=\"actions[$partline]\">
|
||||
<option value=\"select\">Select Action</option>
|
||||
<option value=\"$defaultaction\" selected>Select Action</option>
|
||||
";
|
||||
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||
if ($actitem["status"] == 1) {
|
||||
if ($actitem["lpactionid"]==$defaultaction) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
@@ -781,19 +740,28 @@ if ($edit) {
|
||||
<td align=\"center\">$epsn</td>
|
||||
<td align=\"center\">
|
||||
";
|
||||
$actrow=mysqli_query($db,"select * from logpartactions");
|
||||
while ($actitem=mysqli_fetch_assoc($actrow)) {
|
||||
if ($actitem["lpactionid"]==$defaultaction) {
|
||||
echo "$actitem[lpactionname]";
|
||||
}
|
||||
if ($defaultaction) {
|
||||
// an action was selected previously, so just display it
|
||||
$actname = dblookup($db, "logpartactions", "lpactionid", "lpactionname", $defaultaction);
|
||||
echo "$actname";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
";
|
||||
// find maint form for this line and show link
|
||||
$mflinknum=mysqli_fetch_assoc(mysqli_query($db,"select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\""))["maintformid"];
|
||||
echo "
|
||||
<td align=\"center\"><a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a></td>
|
||||
<td align=\"center\">
|
||||
";
|
||||
$mflinkqry = mysqli_query($db, "select maintformid from maintforms where lognoteid=\"$noteid\" and mfpart=\"$lpidvar\"");
|
||||
if (mysqli_num_rows($mflinkqry)) {
|
||||
$mflinkdata = mysqli_fetch_assoc($mflinkqry);
|
||||
$mflinknum = $mflinkdata["maintformid"];
|
||||
echo "
|
||||
<a href=\"maintformentry.php?mfedit=1&maintformid=$mflinknum\" title=\"Click to view/edit this maintenance form\">$mflinknum</a>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -806,18 +774,14 @@ if ($edit) {
|
||||
<td align=\"center\"><input type=\"text\" name=\"partnums[$partline]\" size=\"20\"></td>
|
||||
<td align=\"center\"><input type=\"text\" name=\"sernums[$partline]\" size=\"20\"></td>
|
||||
<td align=\"center\"><select name=\"actions[$partline]\">
|
||||
<option value=\"select\">Select Action</option>
|
||||
<option value=\"$defaultaction\" selected>Select Action</option>
|
||||
";
|
||||
$actrow = mysqli_query($db, "select * from logpartactions");
|
||||
while ($actitem = mysqli_fetch_assoc($actrow)) {
|
||||
if ($actitem["status"] == 1) {
|
||||
if ($actitem["lpactionid"]==$defaultaction) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$actitem["lpactionid"],$actitem["lpactionname"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>", $actitem["lpactionid"], $actitem["lpactionname"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
@@ -841,5 +805,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$tech=$_REQUEST['tech'];
|
||||
$pass=$_REQUEST['pass'];
|
||||
$login=$_REQUEST['login'];
|
||||
$cancel=$_REQUEST['cancel'];
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$tech = $_REQUEST['tech'] ?? NULL;
|
||||
$pass = $_REQUEST['pass'] ?? NULL;
|
||||
$login = $_REQUEST['login'] ?? NULL;
|
||||
$cancel = $_REQUEST['cancel'] ?? NULL;
|
||||
|
||||
if ($cancel) {
|
||||
session_destroy();
|
||||
@@ -58,7 +58,6 @@ if ($login) {
|
||||
while ($admintech = mysqli_fetch_row($adminqry)[0]) {
|
||||
echo "$admintech <br>";
|
||||
}
|
||||
|
||||
}
|
||||
} else if ($cancel) {
|
||||
echo "
|
||||
@@ -72,7 +71,8 @@ if ($login) {
|
||||
<b>Tech: </b>
|
||||
<select name=\"tech\">
|
||||
";
|
||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
||||
if ($techalpha) $torder = "techname";
|
||||
else $torder = "techid";
|
||||
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||
if ($techitem["status"] == 1) {
|
||||
@@ -98,5 +98,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -32,7 +32,8 @@ if ($print) {
|
||||
if ($tgt_date == "") $tgt_date = $today;
|
||||
|
||||
// define shifttable_classic function
|
||||
function shifttable_classic($shift, $tgt_date, $db) {
|
||||
function shifttable_classic($shift, $tgt_date, $db)
|
||||
{
|
||||
// convert the shift number to a name for display
|
||||
$doparts = PARTS_FUNCTIONS;
|
||||
$showtime = SHOW_TS;
|
||||
@@ -89,7 +90,9 @@ function shifttable_classic($shift, $tgt_date, $db) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],$tablerow["time"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["time"],
|
||||
$tname,
|
||||
$subjname,
|
||||
$fmtnote,
|
||||
@@ -104,7 +107,8 @@ function shifttable_classic($shift, $tgt_date, $db) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tname,
|
||||
$subjname,
|
||||
$fmtnote,
|
||||
@@ -121,7 +125,8 @@ function shifttable_classic($shift, $tgt_date, $db) {
|
||||
}
|
||||
|
||||
// define the shifttable_clean function
|
||||
function shifttable_clean($shift, $tgt_date, $db) {
|
||||
function shifttable_clean($shift, $tgt_date, $db)
|
||||
{
|
||||
// convert the shift number to a name for display
|
||||
$doparts = PARTS_FUNCTIONS;
|
||||
$showtime = SHOW_TS;
|
||||
@@ -177,7 +182,8 @@ function shifttable_clean($shift, $tgt_date, $db) {
|
||||
%s</b>
|
||||
<br>%s<br>
|
||||
<hr>\n",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["time"],
|
||||
$tname,
|
||||
$subjname,
|
||||
@@ -192,7 +198,8 @@ function shifttable_clean($shift, $tgt_date, $db) {
|
||||
%s</b>
|
||||
<br>%s<br>
|
||||
<hr>\n",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tname,
|
||||
$subjname,
|
||||
$refs,
|
||||
@@ -249,5 +256,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -29,7 +29,8 @@ if ($print) {
|
||||
}
|
||||
|
||||
// define pendtable function
|
||||
function pendtable($tech_id, $db) {
|
||||
function pendtable($tech_id, $db)
|
||||
{
|
||||
$uidtext = UID_TEXT;
|
||||
// print section header
|
||||
if ($tech_id) {
|
||||
@@ -89,14 +90,16 @@ function pendtable($tech_id, $db) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$pendrow["maintformid"],$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["mfdate"],
|
||||
$tname,
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,$noteidval
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
@@ -109,13 +112,15 @@ function pendtable($tech_id, $db) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$pendrow["maintformid"],$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["maintformid"],
|
||||
$pendrow["mfdate"],
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,$noteidval
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -125,7 +130,8 @@ function pendtable($tech_id, $db) {
|
||||
}
|
||||
|
||||
// define histtable function
|
||||
function histtable($hist_days,$db) {
|
||||
function histtable($hist_days, $db)
|
||||
{
|
||||
$uidtext = UID_TEXT;
|
||||
$dayopts = array(30, 90, 180, 365);
|
||||
// print section header
|
||||
@@ -187,14 +193,16 @@ function histtable($hist_days,$db) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$notetag</td>
|
||||
</tr>",
|
||||
$histrow["maintformid"],$histrow["maintformid"],
|
||||
$histrow["maintformid"],
|
||||
$histrow["maintformid"],
|
||||
$histrow["mfdate"],
|
||||
$tname,
|
||||
$uid,
|
||||
$partno,
|
||||
$serno,
|
||||
$partname,
|
||||
$noteidval,$noteidval
|
||||
$noteidval,
|
||||
$noteidval
|
||||
);
|
||||
}
|
||||
echo "
|
||||
@@ -227,5 +235,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,14 +17,16 @@ if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
|
||||
$loggedinas = $_SESSION['login'];
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||
|
||||
function getmfdata($maintformid) {
|
||||
function getmfdata($maintformid)
|
||||
{
|
||||
// pull maintenance form data from maintforms table
|
||||
global $db;
|
||||
$mfdata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintforms where maintformid=\"$maintformid\""));
|
||||
return $mfdata;
|
||||
}
|
||||
|
||||
function getactiondata($maintactionid) {
|
||||
function getactiondata($maintactionid)
|
||||
{
|
||||
// pull maintenance action data from maintactions table
|
||||
global $db;
|
||||
$actiondata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintactions where maintactionid=\"$maintactionid\""));
|
||||
@@ -133,6 +135,9 @@ if ($mfadd) {
|
||||
if ($mfsubmit) {
|
||||
// add the entry if submit is pressed
|
||||
if ($mfmalfunction && ($uid || ($partnum && $sernum))) {
|
||||
// sanitize and fix blank date and time
|
||||
$mfdate = fix_date($mfdate);
|
||||
$mftime = fix_time($mftime);
|
||||
// determine whether supplied date is future or past
|
||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$mfdate\",CURRENT_DATE)"));
|
||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||
@@ -173,6 +178,7 @@ if ($mfadd) {
|
||||
|
||||
// add the record to maintforms
|
||||
if (! $pdatamismatch) {
|
||||
$lognoteid = ($lognoteid == NULL) ? 0 : $lognoteid;
|
||||
mysqli_query($db, "insert into maintforms(mfdate,mftime,mftech,mfpart,mfpartloc,mfmalfunction,nha,repord,lognoteid,pending)
|
||||
values (\"$mfdate\", \"$mftime\",\"$loggedinas\",\"$mfpart\",\"$mfpartloc\",\"$mfmalfunction\",\"$nha\",\"$repord\",\"$lognoteid\",\"$pending\")");
|
||||
$newmaintformid = mysqli_insert_id($db);
|
||||
@@ -181,7 +187,7 @@ if ($mfadd) {
|
||||
// update the flagmap table
|
||||
foreach ($flags as $thisflag) {
|
||||
// set flag for this maintenance form
|
||||
mysqli_query($db,"insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$$newmaintformid\")");
|
||||
mysqli_query($db, "insert into flagmap(flagid,maintformid) values(\"$thisflag\",\"$newmaintformid\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,6 +240,9 @@ if ($mfdelete && $mfauthorized) {
|
||||
if ($actionadd) {
|
||||
if ($actionaddsubmit) {
|
||||
if ($action) {
|
||||
// sanitize and fix blank date and time
|
||||
$actiondate = fix_date($actiondate);
|
||||
$actiontime = fix_time($actiontime);
|
||||
// determine whether supplied date is future or past
|
||||
$datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$actiondate\",CURRENT_DATE)"));
|
||||
// if future, set time to 00:00:01, if past, set to 23:59:59
|
||||
@@ -258,6 +267,9 @@ if ($actionadd) {
|
||||
if ($actionedit) {
|
||||
if ($actioneditsubmit && $actionauthorized) {
|
||||
// update the action
|
||||
// sanitize and fix blank date and time
|
||||
$actiondate = fix_date($actiondate);
|
||||
$actiontime = fix_time($actiontime);
|
||||
// remove cruft from action text
|
||||
$action = htmlentities($action);
|
||||
$action = addslashes($action);
|
||||
@@ -314,7 +326,8 @@ if (($mfedit || $actionadd || $actionedit) && ! ($mfsubmit || $actionaddsubmit |
|
||||
$sernum = $partinfo['sernum'];
|
||||
$partname = $partinfo['partname'];
|
||||
$pluresult = $partinfo['result'];
|
||||
if ($pluresult==2) $pdatamismatch=TRUE; else $pdatamismatch=FALSE;
|
||||
if ($pluresult == 2) $pdatamismatch = TRUE;
|
||||
else $pdatamismatch = FALSE;
|
||||
}
|
||||
|
||||
$techname = dblookup($db, "techs", "techid", "techname", $mftech);
|
||||
@@ -481,13 +494,23 @@ if ($printfmt) {
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
//if ($theseflags[0]=="") $theseflags=[];
|
||||
if (in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
} else {
|
||||
$flagid = $flagcheckbox["flagid"];
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount < $flagsperline) {
|
||||
@@ -649,5 +672,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -172,5 +172,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin=1;
|
||||
$loggedin = TRUE;
|
||||
} else {
|
||||
unset($loggedin);
|
||||
$loggedin = FALSE;
|
||||
}
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
@@ -79,7 +79,8 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
|
||||
$pluidtxt = $partline['uid'];
|
||||
}
|
||||
if ($loggedin) {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>
|
||||
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
|
||||
@@ -87,13 +88,15 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>",
|
||||
$partline['partid'],$pluidtxt,
|
||||
$partline['partid'],
|
||||
$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
);
|
||||
} else {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
@@ -119,5 +122,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -54,34 +54,34 @@ if(!$print){
|
||||
// do error checking
|
||||
// test for name supplied
|
||||
if (strlen(trim($name))) {
|
||||
$namesuppld=1;
|
||||
$namesuppld = TRUE;
|
||||
} else {
|
||||
$namesuppld=0;
|
||||
$namesuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
||||
}
|
||||
// test for name unique
|
||||
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$techid\""))) {
|
||||
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
|
||||
$nameunique=0;
|
||||
$nameunique = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
} else {
|
||||
$nameunique=1;
|
||||
$nameunique = TRUE;
|
||||
}
|
||||
// test for matching passwords
|
||||
if ($pass != "password_is_unchanged") {
|
||||
if ($pass == $passconf) {
|
||||
$passmatch=1;
|
||||
$passmatch = TRUE;
|
||||
$passhash = password_hash($pass, PASSWORD_DEFAULT);
|
||||
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
|
||||
} else {
|
||||
$passmatch=0;
|
||||
$passmatch = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
||||
}
|
||||
} else {
|
||||
$passmatch=1;
|
||||
$passmatch = TRUE;
|
||||
$namepassupdqry = "update techs set techname=\"$name\" where techid=\"$techid\"";
|
||||
}
|
||||
if ($namesuppld && $nameunique && $passmatch) {
|
||||
@@ -91,14 +91,17 @@ if(!$print){
|
||||
}
|
||||
if ($updatedisplay) {
|
||||
// display settings
|
||||
if ($display_showts) $display_showts=1; else $display_showts=0;
|
||||
if ($display_techalpha=="a") $display_techalpha=1; else $display_techalpha=0;
|
||||
if ($display_subjalpha=="a") $display_subjalpha=1; else $display_subjalpha=0;
|
||||
if ($display_showts) $display_showts = 1;
|
||||
else $display_showts = 0;
|
||||
if ($display_techalpha == "a") $display_techalpha = 1;
|
||||
else $display_techalpha = 0;
|
||||
if ($display_subjalpha == "a") $display_subjalpha = 1;
|
||||
else $display_subjalpha = 0;
|
||||
// test for urlchunk supplied
|
||||
if (strlen(trim($display_urlchunk))) {
|
||||
$chunksuppld=1;
|
||||
$chunksuppld = TRUE;
|
||||
} else {
|
||||
$chunksuppld=0;
|
||||
$chunksuppld = FALSE;
|
||||
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL chunk size cannot be blank.<br>";
|
||||
}
|
||||
if ($chunksuppld) {
|
||||
@@ -113,6 +116,8 @@ if(!$print){
|
||||
// color settings
|
||||
$hexcolor = "#" . ltrim($hexcolor);
|
||||
putsetting($modcolor, $hexcolor, $techid);
|
||||
$currentpage = $_SERVER['PHP_SELF'];
|
||||
header("Refresh: .1; url=$currentpage");
|
||||
}
|
||||
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
|
||||
|
||||
@@ -294,5 +299,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
include("functions.php");
|
||||
|
||||
$print = $_REQUEST['print'] ?? "";
|
||||
$chainnote=$_REQUEST['chainnote'];
|
||||
$chainnote = $_REQUEST['chainnote'] ?? NULL;
|
||||
|
||||
$logname = LOG_NAME;
|
||||
|
||||
@@ -71,7 +71,8 @@ while($mptr<count($master)) {
|
||||
}
|
||||
|
||||
if ($flagstring) $fmtnote = $fmtnote . "<br>" . $flagstring;
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
||||
<td>%s / %s</td>
|
||||
@@ -81,13 +82,16 @@ while($mptr<count($master)) {
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
</tr>",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
||||
$tablerow["date"],$tablerow["time"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["lognoteid"],
|
||||
$tablerow["date"],
|
||||
$tablerow["time"],
|
||||
$shname,
|
||||
$tname,
|
||||
$subjname,
|
||||
$fmtnote,
|
||||
$refs);
|
||||
$refs
|
||||
);
|
||||
} else {
|
||||
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n", $master[$mptr]);
|
||||
}
|
||||
@@ -99,5 +103,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
blankpage.php
|
||||
schedmaint.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
@@ -73,9 +73,9 @@ $errorstack=array();
|
||||
if ($action) {
|
||||
if ($complete) {
|
||||
// sanitize user input
|
||||
$completedate=mysqli_real_escape_string($db,$completedate);
|
||||
$completedate = fix_date($completedate);
|
||||
// update events
|
||||
mysqli_query($db,"update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0000-00-00\" where eventid=\"$id\"");
|
||||
mysqli_query($db, "update events set last_date=\"$completedate\", deferred_flag=0, deferred_date=\"0001-01-01\" where eventid=\"$id\"");
|
||||
if ($addlognote) {
|
||||
$compltaskname = mysqli_fetch_row(mysqli_query($db, "select tasks.taskname from tasks,events where events.eventid=\"$id\" and tasks.taskid=events.task"))[0];
|
||||
$compldevicename = mysqli_fetch_row(mysqli_query($db, "select devices.devicename from devices,events where events.eventid=\"$id\" and devices.deviceid=events.device"))[0];
|
||||
@@ -88,6 +88,7 @@ if ($action) {
|
||||
}
|
||||
}
|
||||
if ($defer) {
|
||||
$deferuntil = fix_date($deferuntil);
|
||||
// update events
|
||||
mysqli_query($db, "update events set deferred_flag=1, deferred_date=\"$deferuntil\" where eventid=\"$id\"");
|
||||
}
|
||||
@@ -110,9 +111,12 @@ if ($add) {
|
||||
$errorstack[] = "<img src=\"icons/exclamation-red.png\" border=\"0\"> You didn't select a device.<br>";
|
||||
}
|
||||
// sanitize text data
|
||||
$start_date=mysqli_real_escape_string($db,$start_date);
|
||||
$last_date=mysqli_real_escape_string($db,$last_date);
|
||||
$deferred_date=mysqli_real_escape_string($db,$deferred_date);
|
||||
if ($start_date == NULL) $start_date = $today;
|
||||
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||
$start_date = fix_date($start_date);
|
||||
$last_date = fix_date($last_date);
|
||||
$deferred_date = fix_date($deferred_date);
|
||||
if ($taskselected && $deviceselected) {
|
||||
// determine if device represents a group and break out individual devices
|
||||
if (dblookup($db, "devices", "deviceid", "group_flag", $device)) {
|
||||
@@ -126,9 +130,6 @@ if ($add) {
|
||||
}
|
||||
// run through the memberlist and modify the table
|
||||
foreach ($memberlist as $memberdev) {
|
||||
if ($start_date==NULL) $start_date=$today;
|
||||
if ($last_date==NULL) $last_date="0000-00-00";
|
||||
if ($deferred_date==NULL) $deferred_date="0000-00-00";
|
||||
$addqry = ("insert into events(task,device,start_date,last_date,deferred_flag,deferred_date,active_flag)
|
||||
values(\"$task\",\"$memberdev\",\"$start_date\",\"$last_date\",\"$deferred_flag\",\"$deferred_date\",\"$active_flag\")");
|
||||
mysqli_query($db, $addqry);
|
||||
@@ -199,13 +200,13 @@ if ($edit) {
|
||||
if ($update) {
|
||||
// do error checking
|
||||
// sanitize text data
|
||||
$start_date=mysqli_real_escape_string($db,$start_date);
|
||||
$last_date=mysqli_real_escape_string($db,$last_date);
|
||||
$deferred_date=mysqli_real_escape_string($db,$deferred_date);
|
||||
// update the tasks table
|
||||
if ($start_date == NULL) $start_date = $today;
|
||||
if ($last_date==NULL) $last_date="0000-00-00";
|
||||
if ($deferred_date==NULL) $deferred_date="0000-00-00";
|
||||
if ($last_date == NULL) $last_date = "0001-01-01";
|
||||
if ($deferred_date == NULL) $deferred_date = "0001-01-01";
|
||||
$start_date = fix_date($start_date);
|
||||
$last_date = fix_date($last_date);
|
||||
$deferred_date = fix_date($deferred_date);
|
||||
// update the tasks table
|
||||
mysqli_query($db, "update events
|
||||
set task=\"$task\",device=\"$device\",start_date=\"$start_date\",last_date=\"$last_date\",deferred_flag=\"$deferred_flag\",
|
||||
deferred_date=\"$deferred_date\",active_flag=\"$active_flag\"
|
||||
@@ -404,9 +405,9 @@ if ($action) {
|
||||
} else {
|
||||
$deferredtag = "<input type=\"checkbox\" name=\"deferred_flag\" value=\"1\">";
|
||||
}
|
||||
if ($start_date=="0000-00-00") $start_date=$today;
|
||||
if ($last_date=="0000-00-00") $last_date="";
|
||||
if ($deferred_date=="0000-00-00") $deferred_date=$tomorrow;
|
||||
if ($start_date == "0001-01-01") $start_date = $today;
|
||||
//if ($last_date == "0001-01-01") $last_date = "";
|
||||
if ($deferred_date == "0001-01-01") $deferred_date = $tomorrow;
|
||||
$deferuntiltag = "<input type=\"text\" name=\"deferred_date\" id=\"deferdatepicker\" size=\"10\" maxlength=\"10\" value=\"$deferred_date\" title=\"Format: YYYY-MM-DD\">";
|
||||
$startdatetag = "<input type=\"text\" name=\"start_date\" id=\"startdatepicker\" size=\"10\" maxlength=\"10\" value=\"$start_date\" title=\"Format: YYYY-MM-DD\">";
|
||||
$lastdatetag = "<input type=\"text\" name=\"last_date\" id=\"completedatepicker\" size=\"10\" maxlength=\"10\" value=\"$last_date\" title=\"Format: YYYY-MM-DD\">";
|
||||
@@ -487,9 +488,9 @@ if ($action) {
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
|
||||
extract($tablerow);
|
||||
if ($start_date=="0000-00-00") $start_date=$today;
|
||||
if ($last_date=="0000-00-00") $last_date="";
|
||||
if ($deferred_date=="0000-00-00") $deferred_date="";
|
||||
if ($start_date == "0001-01-01") $start_date = $today;
|
||||
if ($last_date == "0001-01-01") $last_date = "";
|
||||
if ($deferred_date == "0001-01-01") $deferred_date = "";
|
||||
if ($active_flag) {
|
||||
$statdef = "<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
||||
} else {
|
||||
@@ -509,7 +510,8 @@ if ($action) {
|
||||
} else {
|
||||
$tasktitle = "Repeat every $taskdata_frequency $taskdata_period";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"schedmaint.php?schedule=1&edit=1&id=%s\">%s</a></td>
|
||||
<td title=\"%s\">%s</td>
|
||||
@@ -520,14 +522,17 @@ if ($action) {
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$eventid,$eventid,
|
||||
$tasktitle,$taskdata_taskname,
|
||||
$eventid,
|
||||
$eventid,
|
||||
$tasktitle,
|
||||
$taskdata_taskname,
|
||||
$devicedata_devicename,
|
||||
$start_date,
|
||||
$last_date,
|
||||
$deferredflag,
|
||||
$deferred_date,
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
} else if ($tasks) {
|
||||
@@ -650,7 +655,8 @@ if ($action) {
|
||||
} else {
|
||||
$wdoflag = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"schedmaint.php?tasks=1&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
@@ -660,16 +666,17 @@ if ($action) {
|
||||
<td>%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$taskid,$taskname,
|
||||
$taskid,
|
||||
$taskname,
|
||||
$taskdesc,
|
||||
$rptstrg,
|
||||
$duecalc,
|
||||
$wdoflag,
|
||||
$refstrg,
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
} else if ($devices) {
|
||||
// manage devices
|
||||
if ($edit) {
|
||||
@@ -735,7 +742,8 @@ if ($action) {
|
||||
} else {
|
||||
$memberdef = "<input type=\"checkbox\" name=\"members[]\" value=\"$gtbl_deviceid\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
@@ -743,7 +751,8 @@ if ($action) {
|
||||
</tr>",
|
||||
$gtbl_devicename,
|
||||
$gtbl_devicedesc,
|
||||
$memberdef);
|
||||
$memberdef
|
||||
);
|
||||
}
|
||||
echo "</table><br>";
|
||||
}
|
||||
@@ -774,7 +783,8 @@ if ($action) {
|
||||
} else {
|
||||
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
||||
}
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"schedmaint.php?devices=1&edit=1&id=%s\">%s</a></td>
|
||||
<td>%s</td>
|
||||
@@ -782,18 +792,23 @@ if ($action) {
|
||||
<td align=\"center\">%s</td>
|
||||
<td align=\"center\">%s</td>
|
||||
</tr>",
|
||||
$deviceid,$deviceid,
|
||||
$deviceid,
|
||||
$deviceid,
|
||||
$devicename,
|
||||
$devicedesc,
|
||||
$groupdef,
|
||||
$statdef);
|
||||
$statdef
|
||||
);
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
$ucevents = get_upcoming_events();
|
||||
|
||||
// sort the upcoming events
|
||||
function uc_cmp($a,$b) { return strcmp($a["duedate"], $b["duedate"]); }
|
||||
function uc_cmp($a, $b)
|
||||
{
|
||||
return strcmp($a["duedate"], $b["duedate"]);
|
||||
}
|
||||
uasort($ucevents, 'uc_cmp');
|
||||
|
||||
// show upcoming events table
|
||||
@@ -806,16 +821,20 @@ if ($action) {
|
||||
";
|
||||
foreach ($ucevents as $ucline) {
|
||||
extract($ucline);
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\">%s</a></td>
|
||||
<td><font title=\"%s\">%s</font></td>
|
||||
<td><font title=\"%s\">%s</font></td>
|
||||
<td>%s</td>
|
||||
</tr>",
|
||||
$eventdata_eventid,$duedatestrg,
|
||||
$devicedata_devicedesc,$devicedata_devicename,
|
||||
$taskdata_taskdesc,$taskdata_taskname,
|
||||
$eventdata_eventid,
|
||||
$duedatestrg,
|
||||
$devicedata_devicedesc,
|
||||
$devicedata_devicename,
|
||||
$taskdata_taskdesc,
|
||||
$taskdata_taskname,
|
||||
$lastdatestrg
|
||||
);
|
||||
}
|
||||
@@ -837,7 +856,7 @@ if ($action) {
|
||||
$taskdata = mysqli_fetch_assoc(mysqli_query($db, "select * from tasks where taskid=\"$def_task\""));
|
||||
extract($taskdata, EXTR_PREFIX_ALL, "taskdata");
|
||||
if (! ($taskdata_period == "once" && $def_last_date > $def_start_date)) {
|
||||
if ($def_last_date=="0000-00-00") {
|
||||
if ($def_last_date == "0001-01-01") {
|
||||
$lastdatestrg = "never";
|
||||
} else {
|
||||
$lastdatestrg = "$def_last_date";
|
||||
@@ -865,16 +884,20 @@ if ($action) {
|
||||
";
|
||||
foreach ($defevents as $defline) {
|
||||
extract($defline);
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\"><font color=\"#FFA500\">%s</font></a></td>
|
||||
<td><font title=\"%s\">%s</font></td>
|
||||
<td><font title=\"%s\">%s</font></td>
|
||||
<td>%s</td>
|
||||
</tr>",
|
||||
$def_eventid,$def_deferred_date,
|
||||
$devicedata_devicedesc,$devicedata_devicename,
|
||||
$taskdata_taskdesc,$taskdata_taskname,
|
||||
$def_eventid,
|
||||
$def_deferred_date,
|
||||
$devicedata_devicedesc,
|
||||
$devicedata_devicename,
|
||||
$taskdata_taskdesc,
|
||||
$taskdata_taskname,
|
||||
$lastdatestrg
|
||||
);
|
||||
}
|
||||
@@ -890,5 +913,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$noprint=1;
|
||||
$noprint = TRUE;
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin=1;
|
||||
$loggedin = TRUE;
|
||||
} else {
|
||||
unset($loggedin);
|
||||
$loggedin = FALSE;
|
||||
}
|
||||
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
@@ -34,8 +34,8 @@ $srchpname=$_REQUEST['srchpname'] ?? NULL;
|
||||
$srchploc = $_REQUEST['srchploc'] ?? NULL;
|
||||
$srchnha = $_REQUEST['srchnha'] ?? NULL;
|
||||
$srchrepord = $_REQUEST['srchrepord'] ?? NULL;
|
||||
$srchflags=$_POST['srchflags'] ?? [];
|
||||
$target=$_REQUEST['target'] ?? NULL;
|
||||
$srchflags = $_REQUEST['srchflags'] ?? [];
|
||||
$target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
|
||||
|
||||
$doparts = PARTS_FUNCTIONS;
|
||||
$logname = LOG_NAME;
|
||||
@@ -56,7 +56,7 @@ framework("begin","$logname Search","Search",$print);
|
||||
|
||||
// echo "REQUEST variables: <br>";
|
||||
// var_dump($_REQUEST);
|
||||
|
||||
// echo "<br>";
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
@@ -92,7 +92,6 @@ if ($search) {
|
||||
$srchpname = trim($srchpname);
|
||||
$srchploc = trim($srchploc);
|
||||
$srchnha = trim($srchnha);
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("log", $target)) {
|
||||
// define the query constraints
|
||||
// log note id
|
||||
@@ -131,23 +130,6 @@ if ($search) {
|
||||
$logfromtables[] = "lognotes";
|
||||
$logconstraints[] = "lognotes.lognote like \"%$srchtext%\"";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount=count($srchflags);
|
||||
$logfromtables[]="lognotes";
|
||||
$logfromtables[]="flagmap";
|
||||
$flagconstraints[]="flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $flagid) {
|
||||
$flagconstraints[]="\"$flagid\"";
|
||||
$flagconstraints[]=",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[]=") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$logconstraints[]=join('', $flagconstraints);
|
||||
}
|
||||
// uid
|
||||
if ($srchuid != "any" && $srchuid != "") {
|
||||
$logfromtables[] = "lognotes";
|
||||
@@ -200,12 +182,28 @@ if ($search) {
|
||||
$logfromtables[] = "maintforms";
|
||||
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount = count($srchflags);
|
||||
$logfromtables[] = "lognotes";
|
||||
$logfromtables[] = "flagmap";
|
||||
$flagconstraints[] = "flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $flagid) {
|
||||
$flagconstraints[] = "\"$flagid\"";
|
||||
$flagconstraints[] = ",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[] = ") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$logconstraints[] = join('', $flagconstraints);
|
||||
}
|
||||
// build the clauses and run the query
|
||||
$logfromclause = implode(",", array_unique($logfromtables));
|
||||
$logwhereclause = implode(" and ", $logconstraints);
|
||||
$logrowqry = mysqli_query($db, "select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
|
||||
}
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("maintform", $target)) {
|
||||
// maintforms search
|
||||
// define the query constraints
|
||||
@@ -248,23 +246,6 @@ if ($search) {
|
||||
$mffromtables[] = "maintactions";
|
||||
$mfconstraints[] = "maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount=count($srchflags);
|
||||
$mffromtables[]="maintforms";
|
||||
$mffromtables[]="flagmap";
|
||||
$flagconstraints[]="flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $thisflagid) {
|
||||
$flagconstraints[]="\"$thisflagid\"";
|
||||
$flagconstraints[]=",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[]=") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$mfconstraints[]=join('', $flagconstraints);
|
||||
}
|
||||
// uid
|
||||
if ($srchuid != "any" && $srchuid != "") {
|
||||
$mffromtables[] = "maintforms";
|
||||
@@ -307,12 +288,28 @@ if ($search) {
|
||||
$mffromtables[] = "maintforms";
|
||||
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||
}
|
||||
// flags
|
||||
if (!empty($srchflags)) {
|
||||
unset($flagconstraints);
|
||||
$flagcount = count($srchflags);
|
||||
$mffromtables[] = "maintforms";
|
||||
$mffromtables[] = "flagmap";
|
||||
$flagconstraints[] = "flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
|
||||
foreach ($srchflags as $thisflagid) {
|
||||
$flagconstraints[] = "\"$thisflagid\"";
|
||||
$flagconstraints[] = ",";
|
||||
}
|
||||
// remove final comma
|
||||
array_splice($flagconstraints, -1, 1);
|
||||
$flagconstraints[] = ") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
|
||||
// make flagconstraints a single string so that the final implode doesn't split it
|
||||
$mfconstraints[] = join('', $flagconstraints);
|
||||
}
|
||||
// build the clauses and run the query
|
||||
$mffromclause = implode(",", array_unique($mffromtables));
|
||||
$mfwhereclause = implode(" and ", $mfconstraints);
|
||||
$mfrowqry = mysqli_query($db, "select maintforms.* from $mffromclause where $mfwhereclause order by maintforms.mfdate asc, maintforms.mftime asc");
|
||||
}
|
||||
if ($target[0]=="") $target=[];
|
||||
if (in_array("part", $target)) {
|
||||
// parts search
|
||||
// define the query constraints
|
||||
@@ -334,7 +331,6 @@ if ($search) {
|
||||
// tech doesn't apply to parts
|
||||
// subject doesn't apply to parts
|
||||
// search text doesn't apply to parts
|
||||
// flags doesn't apply to parts
|
||||
// uid
|
||||
if ($srchuid != "any" && $srchuid != "") {
|
||||
$pfromtables[] = "parts";
|
||||
@@ -373,6 +369,7 @@ if ($search) {
|
||||
$pfromtables[] = "maintforms";
|
||||
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
|
||||
}
|
||||
// flags doesn't apply to parts
|
||||
// build the clauses and run the query
|
||||
$pfromclause = implode(",", array_unique($pfromtables));
|
||||
$pwhereclause = implode(" and ", $pconstraints);
|
||||
@@ -390,21 +387,36 @@ if(!$print){
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
// display the form
|
||||
if ($srchnoteid) $noteidval=$srchnoteid; else $noteidval="any";
|
||||
if ($srchmfid) $mfidval=$srchmfid; else $mfidval="any";
|
||||
if ($srchbdate) $bdateval=$srchbdate; else $bdateval=$mindate;
|
||||
if ($srchedate) $edateval=$srchedate; else $edateval=$maxdate;
|
||||
if ($srchshift) $shiftval=$srchshift; else $shiftval=0;
|
||||
if ($srchtech) $techval=$srchtech; else $techval=0;
|
||||
if ($srchsubj) $subjval=$srchsubj; else $subjval=0;
|
||||
if ($srchtext) $textval=$srchtext; else $textval="";
|
||||
if ($srchuid) $uidval=$srchuid; else $uidval="any";
|
||||
if ($srchpn) $pnval=$srchpn; else $pnval="any";
|
||||
if ($srchsn) $snval=$srchsn; else $snval="any";
|
||||
if ($srchpname) $pnameval=$srchpname; else $pnameval="any";
|
||||
if ($srchploc) $plocval=$srchploc; else $plocval="any";
|
||||
if ($srchnha) $nhaval=$srchnha; else $nhaval="any";
|
||||
if ($srchrepord) $repordval=$srchrepord; else $repordval="any";
|
||||
if ($srchnoteid) $noteidval = $srchnoteid;
|
||||
else $noteidval = "any";
|
||||
if ($srchmfid) $mfidval = $srchmfid;
|
||||
else $mfidval = "any";
|
||||
if ($srchbdate) $bdateval = $srchbdate;
|
||||
else $bdateval = $mindate;
|
||||
if ($srchedate) $edateval = $srchedate;
|
||||
else $edateval = $maxdate;
|
||||
if ($srchshift) $shiftval = $srchshift;
|
||||
else $shiftval = 0;
|
||||
if ($srchtech) $techval = $srchtech;
|
||||
else $techval = 0;
|
||||
if ($srchsubj) $subjval = $srchsubj;
|
||||
else $subjval = 0;
|
||||
if ($srchtext) $textval = $srchtext;
|
||||
else $textval = "";
|
||||
if ($srchuid) $uidval = $srchuid;
|
||||
else $uidval = "any";
|
||||
if ($srchpn) $pnval = $srchpn;
|
||||
else $pnval = "any";
|
||||
if ($srchsn) $snval = $srchsn;
|
||||
else $snval = "any";
|
||||
if ($srchpname) $pnameval = $srchpname;
|
||||
else $pnameval = "any";
|
||||
if ($srchploc) $plocval = $srchploc;
|
||||
else $plocval = "any";
|
||||
if ($srchnha) $nhaval = $srchnha;
|
||||
else $nhaval = "any";
|
||||
if ($srchrepord) $repordval = $srchrepord;
|
||||
else $repordval = "any";
|
||||
|
||||
if (!$print) {
|
||||
echo "
|
||||
@@ -439,7 +451,8 @@ if (!$print) {
|
||||
} else {
|
||||
echo "<option value=\"0\">any</option>";
|
||||
}
|
||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
||||
if ($techalpha) $torder = "techname";
|
||||
else $torder = "techid";
|
||||
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||
if ($techitem['techid'] == $techval) {
|
||||
@@ -457,7 +470,8 @@ if (!$print) {
|
||||
} else {
|
||||
echo "<option value=\"0\">any</option>";
|
||||
}
|
||||
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
|
||||
if ($subjalpha) $sorder = "subjectname";
|
||||
else $sorder = "subjectid";
|
||||
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
|
||||
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
|
||||
if ($subjitem['subjectid'] == $subjval) {
|
||||
@@ -632,8 +646,11 @@ if (!$print) {
|
||||
if ($srchflags) {
|
||||
if ($srchflags[0] == "") $srchflags = [];
|
||||
if (in_array($flagcheckbox["flagid"], $srchflags)) {
|
||||
printf("<font color=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagcolor"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<font color=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount < $flagsperline) {
|
||||
@@ -711,7 +728,8 @@ if ($search) {
|
||||
$logfmtnote = $logfmtnote . "<br>";
|
||||
}
|
||||
|
||||
printf("<tr>
|
||||
printf(
|
||||
"<tr>
|
||||
<td valign=\"top\"><a href=logentry.php?edit=1¬eid=%s>%s</a></td>
|
||||
<td valign=\"top\">%s / %s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
@@ -720,13 +738,16 @@ if ($search) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
</tr>",
|
||||
$logtablerow['lognoteid'],$logtablerow['lognoteid'],
|
||||
$logtablerow['date'],$logtablerow['time'],
|
||||
$logtablerow['lognoteid'],
|
||||
$logtablerow['lognoteid'],
|
||||
$logtablerow['date'],
|
||||
$logtablerow['time'],
|
||||
$logshname,
|
||||
$logtname,
|
||||
$logsubjname,
|
||||
$logfmtnote,
|
||||
$logrefs);
|
||||
$logrefs
|
||||
);
|
||||
}
|
||||
echo "</table><br><hr>";
|
||||
} else {
|
||||
@@ -782,14 +803,16 @@ if ($search) {
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">$mfnotetag</td>
|
||||
</tr>",
|
||||
$mfrow["maintformid"],$mfrow["maintformid"],
|
||||
$mfrow["maintformid"],
|
||||
$mfrow["maintformid"],
|
||||
$mfrow["mfdate"],
|
||||
$mftname,
|
||||
$mfuid,
|
||||
$mfpartno,
|
||||
$mfserno,
|
||||
$mfpartname,
|
||||
$mfnoteidval,$mfnoteidval
|
||||
$mfnoteidval,
|
||||
$mfnoteidval
|
||||
);
|
||||
}
|
||||
echo "</table><br><hr>";
|
||||
@@ -815,7 +838,8 @@ if ($search) {
|
||||
";
|
||||
while ($partrow = mysqli_fetch_assoc($prowqry)) {
|
||||
if ($loggedin) {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>
|
||||
<a href=\"partentry.php?edit=1&partid=%s\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this part\" alt=\"Edit this part\"></a>
|
||||
@@ -831,7 +855,8 @@ if ($search) {
|
||||
$partrow['partname']
|
||||
);
|
||||
} else {
|
||||
printf("
|
||||
printf(
|
||||
"
|
||||
<tr>
|
||||
<td>
|
||||
<img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"You must be logged in to edit a part\" alt=\"You must be logged in to edit a part\">
|
||||
@@ -864,5 +889,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -61,5 +61,3 @@ if ($logerrors==1) {
|
||||
} else {
|
||||
error_reporting(0);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -58,7 +58,8 @@ if ($isadmin) {
|
||||
|
||||
// var_dump($_REQUEST);
|
||||
|
||||
function templatetable($db,$techid,$user) {
|
||||
function templatetable($db, $techid, $user)
|
||||
{
|
||||
// Show template table
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
|
||||
$templatequery = mysqli_query($db, "select * from notetemplates where tech=\"$user\" order by templatename asc");
|
||||
@@ -161,6 +162,12 @@ if ($usertemplateid) {
|
||||
$loadtemplate = NULL;
|
||||
}
|
||||
|
||||
// determine original owner of template
|
||||
$orig_owner = dblookup($db, "notetemplates", "templateid", "tech", $templateid);
|
||||
if ($efftechid != NULL && $efftechid != $orig_owner) {
|
||||
$operation = "add";
|
||||
}
|
||||
|
||||
if ($operation == "add") {
|
||||
if ($submit) {
|
||||
if ($note) {
|
||||
@@ -393,7 +400,8 @@ if ($operation=="delete") {
|
||||
} else {
|
||||
echo "<option value=\"0\">--Global Template--</option>";
|
||||
}
|
||||
if ($techalpha) $torder="techname"; else $torder="techid";
|
||||
if ($techalpha) $torder = "techname";
|
||||
else $torder = "techid";
|
||||
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
|
||||
while ($techitem = mysqli_fetch_assoc($techrow)) {
|
||||
if ($techitem["techid"] == $filltech) {
|
||||
@@ -431,7 +439,8 @@ if ($operation=="delete") {
|
||||
<td><b>Subject: </b>
|
||||
<select name=\"subject\">
|
||||
";
|
||||
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
|
||||
if ($subjalpha) $sorder = "subjectname";
|
||||
else $sorder = "subjectid";
|
||||
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
|
||||
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
|
||||
if ($subjitem["status"] == 1) {
|
||||
@@ -474,13 +483,23 @@ if ($operation=="delete") {
|
||||
// display checkboxes for all the flags, selecting the ones that are set for this template
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
if ($operation == "edit" && in_array($flagcheckbox["flagid"], $theseflags)) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
} else {
|
||||
$flagid = $flagcheckbox["flagid"];
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount < $flagsperline) {
|
||||
@@ -550,5 +569,3 @@ pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end", "", "", $print);
|
||||
|
||||
?>
|
||||
|
||||
@@ -41,3 +41,15 @@ fi
|
||||
# ---------- version 5.2.4.4 -----------
|
||||
# No changes
|
||||
# --------------------------------------
|
||||
|
||||
# ---------- version 5.2.5 -------------
|
||||
# No changes
|
||||
# --------------------------------------
|
||||
|
||||
# ---------- version 5.3.0 -------------
|
||||
# No changes
|
||||
# --------------------------------------
|
||||
|
||||
# ---------- version 5.3.1 -------------
|
||||
# No changes
|
||||
# --------------------------------------
|
||||
144
install.sh
144
install.sh
@@ -2,13 +2,13 @@
|
||||
|
||||
# install.sh
|
||||
# OpenLog Online Logbook
|
||||
# Copyright (C) 2025 Rod Wright
|
||||
# Copyright (C) 2026 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
APP_NAME="OpenLog"
|
||||
DEFAULT_DB_NAME="openlog"
|
||||
APP_VERSION="5.3.0"
|
||||
APP_VERSION="5.3.1"
|
||||
DOC_ROOT="/var/www"
|
||||
INSTALL_LOC="openlog"
|
||||
APACHE_CONF_DIR="/etc/apache2/conf-available"
|
||||
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_COLUMN=""
|
||||
|
||||
function privilege_check() {
|
||||
# test for superuser rights
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
if [[ "$EUID" != 0 ]]; then
|
||||
echo "This script must be run with superuser privileges. Try sudo $0"
|
||||
exit 1
|
||||
fi
|
||||
@@ -36,11 +36,11 @@ function get_new_password() {
|
||||
echo ""
|
||||
read -p "Re-type new password: " -s -r rnewpw
|
||||
echo ""
|
||||
if [ "$newpassword" = "" -o "$rnewpw" = "" ]
|
||||
if [[ "$newpassword" == "" || "$rnewpw" == "" ]]
|
||||
then
|
||||
echo "Password cannot be blank. Please try again."
|
||||
echo ""
|
||||
elif [ "$newpassword" != "$rnewpw" ]
|
||||
elif [[ "$newpassword" != "$rnewpw" ]]
|
||||
then
|
||||
echo "Passwords do not match. Please try again."
|
||||
echo ""
|
||||
@@ -63,7 +63,7 @@ function install_required_packages() {
|
||||
gpattern=""
|
||||
for pkg_option in $(echo $prereq)
|
||||
do
|
||||
if [ "$pkg_option" != "or" ]
|
||||
if [[ "$pkg_option" != "or" ]]
|
||||
then
|
||||
gpattern+=" -e $pkg_option"
|
||||
preferred_pkg=$pkg_option
|
||||
@@ -76,7 +76,7 @@ function install_required_packages() {
|
||||
echo "$APP_NAME requires $prereq, but it doesn't seem to be installed. "
|
||||
echo -n "Install $preferred_pkg now? [Y/n]: "
|
||||
read reqinstall
|
||||
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
|
||||
if [[ "$reqinstall" == "N" || "$reqinstall" == "n" ]]
|
||||
then
|
||||
echo "$APP_NAME requires $prereq, but you have elected not to install it."
|
||||
echo "Installation cannot continue."
|
||||
@@ -172,20 +172,20 @@ echo ""
|
||||
echo -n "Enter name of $APP_NAME installation directory [$INSTALL_LOC] :"
|
||||
read install_loc_in
|
||||
echo ""
|
||||
if [ "$doc_root_in" = "" ]
|
||||
if [[ "$doc_root_in" == "" ]]
|
||||
then
|
||||
doc_root_in=$DOC_ROOT
|
||||
fi
|
||||
if [ "$install_loc_in" = "" ]
|
||||
if [[ "$install_loc_in" == "" ]]
|
||||
then
|
||||
install_loc_in=$INSTALL_LOC
|
||||
fi
|
||||
install_path="$doc_root_in/$install_loc_in"
|
||||
if [ -d "$install_path" ]
|
||||
if [[ -d "$install_path" ]]
|
||||
then
|
||||
echo "The installation path you chose already exists."
|
||||
# Install path exists.
|
||||
if [ -e "$install_path/db.php" ]
|
||||
if [[ -e "$install_path/db.php" ]]
|
||||
then
|
||||
# A db.php file was found in the install path
|
||||
if grep -q -e "$APP_NAME" $install_path/db.php
|
||||
@@ -195,12 +195,44 @@ then
|
||||
echo "and restart the install using a new installation location."
|
||||
echo -n "[U]pgrade or [C]ancel? [U] :"
|
||||
read upgrade_choice
|
||||
if [[ $upgrade_choice == "C" || $upgrade_choice == "c" ]] # Cancel chosen
|
||||
if [[ "$upgrade_choice" == "C" || "$upgrade_choice" == "c" ]] # Cancel chosen
|
||||
then
|
||||
echo "Cancelling installation"
|
||||
abort_exit
|
||||
else
|
||||
# proceed with upgrade
|
||||
# put app in maintenance mode
|
||||
echo "Putting the application in maintenance mode..."
|
||||
# make sure mod_rewrite is enabled
|
||||
if [[ ! -e "$APACHE_CONF_DIR/../mods-enabled/rewrite.load" ]]
|
||||
then
|
||||
a2enmod -q rewrite
|
||||
systemctl restart apache2
|
||||
fi
|
||||
# disable the app
|
||||
a2disconf -q $install_loc_in
|
||||
systemctl reload apache2
|
||||
# modify the apache conf file
|
||||
if ! grep -q "RewriteEngine" "$APACHE_CONF_DIR/$install_loc_in.conf"
|
||||
then
|
||||
# this is an old version of the conf file. Replace with new version
|
||||
cp -f default-apache.conf $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
sed -i "s|_APPNAME_|$APP_NAME|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
sed -i "s|_BASEURL_|$install_loc_in|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
sed -i "s|_DOCROOTIN_|$doc_root_in|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
fi
|
||||
sed -i "s|#Rewrite|Rewrite|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
# copy in the default maintenancemode.php if it's not already there
|
||||
if [[ ! -e "$install_path/maintenancemode.php" ]]
|
||||
then
|
||||
cp maintenancemode.php $install_path/
|
||||
# modify the maintenancemode.php file
|
||||
sed -i "s|_APPNAME_|$APP_NAME|g" $install_path/maintenancemode.php
|
||||
fi
|
||||
# re-enable the app in maintenance mode
|
||||
a2enconf -q $install_loc_in
|
||||
systemctl reload apache2
|
||||
|
||||
datestamp=$(date +%Y-%m-%d_%H:%M:%S)
|
||||
backupdir=backups/$datestamp
|
||||
mkdir -p $backupdir
|
||||
@@ -226,19 +258,15 @@ then
|
||||
echo "Backing up current installation to the package directory."
|
||||
cp -R $install_path $backupdir/$install_loc_in-$datestamp-backup
|
||||
|
||||
# delete all existing installation files except db.php
|
||||
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
|
||||
# delete all existing installation files except db.php and maintenancemode.php
|
||||
find $install_path/ -mindepth 1 ! \( -name 'db.php' -o -name 'maintenancemode.php' \) -delete
|
||||
|
||||
echo "Performing database updates. This may take a while..."
|
||||
echo "Performing database updates..."
|
||||
# apply database updates from sql file
|
||||
(mysql --defaults-extra-file=$mysql_opt_file --force < database-update.sql >/dev/null 2>&1) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
mysql --defaults-extra-file=$mysql_opt_file --force < database-update.sql >/dev/null 2>&1
|
||||
|
||||
# apply database updates via script
|
||||
(bash ./database-update.sh $mysql_opt_file) &
|
||||
task_pid=$!
|
||||
spinner $task_pid
|
||||
bash ./database-update.sh $mysql_opt_file
|
||||
|
||||
echo "... finished with database updates."
|
||||
rm -f $mysql_opt_file
|
||||
@@ -250,12 +278,12 @@ then
|
||||
echo "Installing distribution . . ."
|
||||
cp -R distfiles/* $install_path
|
||||
# set symlink for jquery-ui
|
||||
if [ ! -L "$install_path/jquery-ui" ]
|
||||
if [[ ! -L "$install_path/jquery-ui" ]]
|
||||
then
|
||||
ln -s $install_path/jquery-ui* $install_path/jquery-ui
|
||||
fi
|
||||
# set symlink for index.php
|
||||
if [ ! -L "$install_path/index.php" ]
|
||||
if [[ ! -L "$install_path/index.php" ]]
|
||||
then
|
||||
ln -s $install_path/$LANDING_PAGE $install_path/index.php
|
||||
fi
|
||||
@@ -270,6 +298,17 @@ then
|
||||
chown -R $httpd_user_group $install_path
|
||||
echo "Backups of the previous openlog files and the previous database were made"
|
||||
echo "and are located in the $backupdir directory."
|
||||
|
||||
# take app out of maintenance mode
|
||||
echo "Taking the app out of maintenance mode..."
|
||||
# disable the app
|
||||
a2disconf -q $install_loc_in
|
||||
systemctl reload apache2
|
||||
# modify the apache conf file
|
||||
sed -i "s|Rewrite|#Rewrite|g" $APACHE_CONF_DIR/$install_loc_in.conf
|
||||
# re-enable the app in production mode
|
||||
a2enconf -q $install_loc_in
|
||||
systemctl reload apache2
|
||||
fi
|
||||
else
|
||||
# This was a mistake. Exit now to avoid clobbering another app.
|
||||
@@ -287,11 +326,11 @@ then
|
||||
echo "Would you like to use this location for a fresh installation or quit and"
|
||||
echo "investigate further? It's probably safest to quit and investigate."
|
||||
proceed=""
|
||||
while [[ $proceed != "P" && $proceed != "p" && $proceed != "Q" && $proceed != "q" ]]
|
||||
while [[ "$proceed" != "P" && "$proceed" != "p" && "$proceed" != "Q" && "$proceed" != "q" ]]
|
||||
do
|
||||
read proceed -p "[P]roceed with new install or [Q]uit? : "
|
||||
done
|
||||
if [[ $proceed == "Q" || $proceed == "q" ]]
|
||||
if [[ "$proceed" == "Q" || "$proceed" == "q" ]]
|
||||
then
|
||||
abort_exit
|
||||
fi
|
||||
@@ -306,7 +345,7 @@ else
|
||||
echo "This can be changed later in the application itself."
|
||||
echo -n "Installation name [$APP_NAME]: "
|
||||
read new_inst_name
|
||||
if [ "$new_inst_name" = "" ]
|
||||
if [[ "$new_inst_name" == "" ]]
|
||||
then
|
||||
new_inst_name="$APP_NAME"
|
||||
fi
|
||||
@@ -323,7 +362,7 @@ else
|
||||
echo "distinctive name."
|
||||
echo -n "database name [$DEFAULT_DB_NAME]: "
|
||||
read new_db_name
|
||||
if [ "$new_db_name" = "" ]
|
||||
if [[ "$new_db_name" == "" ]]
|
||||
then
|
||||
new_db_name=$DEFAULT_DB_NAME
|
||||
fi
|
||||
@@ -336,7 +375,7 @@ else
|
||||
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" ]
|
||||
if [[ "$dbcreatetry" != "Y" || "$dbcreatetry" != "y" ]]
|
||||
then
|
||||
abort_exit
|
||||
fi
|
||||
@@ -356,7 +395,7 @@ else
|
||||
# Set the installation name
|
||||
export MYSQL_PWD="$db_pass"
|
||||
mysql -u"$db_user" $new_db_name -e "update $CONFIG_TABLE set $CONFIG_VALUE_COLUMN=\"$new_inst_name\" where $CONFIG_NAME_COLUMN=\"log_name\""
|
||||
if [ "$CONFIG_DEFAULT_COLUMN" != "" ]
|
||||
if [[ "$CONFIG_DEFAULT_COLUMN" != "" ]]
|
||||
then
|
||||
mysql -u"$db_user" $new_db_name -e "update $CONFIG_TABLE set $CONFIG_DEFAULT_COLUMN=\"$new_inst_name\" where $CONFIG_NAME_COLUMN=\"log_name\""
|
||||
fi
|
||||
@@ -365,23 +404,29 @@ else
|
||||
mkdir $install_path
|
||||
|
||||
# Create db.php if it doesn't exist
|
||||
if [ ! -f "$install_path/db.php" ]
|
||||
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/$db_user/g" $install_path/db.php
|
||||
sed -i "s/DBPASS/$db_pass/g" $install_path/db.php
|
||||
sed -i "s/APPNAME/$APP_NAME/g" $install_path/db.php
|
||||
sed -i "s|DBNAME|$new_db_name|g" $install_path/db.php
|
||||
sed -i "s|DBUSER|$db_user|g" $install_path/db.php
|
||||
sed -i "s|DBPASS|$db_pass|g" $install_path/db.php
|
||||
sed -i "s|APPNAME|$APP_NAME|g" $install_path/db.php
|
||||
fi
|
||||
# Create maintenancemode.php if it doesn't exist
|
||||
if [[ ! -f "$install_path/maintenancemode.php" ]]
|
||||
then
|
||||
cp maintenancemode.php $install_path/maintenancemode.php
|
||||
sed -i "s|_APPNAME_|$APP_NAME|g" $install_path/maintenancemode.php
|
||||
fi
|
||||
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -R distfiles/* $install_path
|
||||
if [ ! -L "$install_path/jquery-ui" ]
|
||||
if [[ ! -L "$install_path/jquery-ui" ]]
|
||||
then
|
||||
ln -s $install_path/jquery-ui* $install_path/jquery-ui
|
||||
fi
|
||||
if [ ! -L "$install_path/index.php" ]
|
||||
if [[ ! -L "$install_path/index.php" ]]
|
||||
then
|
||||
ln -s $install_path/$LANDING_PAGE $install_path/index.php
|
||||
fi
|
||||
@@ -404,23 +449,24 @@ echo ""
|
||||
echo ""
|
||||
echo "$APP_NAME has been $operation."
|
||||
base_url=$install_loc_in
|
||||
if [ "$operation" = "installed" ]
|
||||
if [[ "$operation" == "upgraded" ]]
|
||||
then
|
||||
echo "# $APP_NAME default Apache configuration" > $APACHE_CONF_DIR/$base_url.conf
|
||||
echo "" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo "Alias /$base_url $doc_root_in/$base_url" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo "" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo "<Directory $doc_root_in/$base_url>" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo " AllowOverride Options" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo " Options FollowSymLinks" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo " DirectoryIndex index.php" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
echo "</Directory>" >> $APACHE_CONF_DIR/$base_url.conf
|
||||
a2enconf -q $base_url
|
||||
systemctl reload apache2
|
||||
fi
|
||||
if [[ "$operation" == "installed" ]]
|
||||
then
|
||||
cp -f default-apache.conf $APACHE_CONF_DIR/$base_url.conf
|
||||
sed -i "s|_APPNAME_|$APP_NAME|g" $APACHE_CONF_DIR/$base_url.conf
|
||||
sed -i "s|_BASEURL_|$base_url|g" $APACHE_CONF_DIR/$base_url.conf
|
||||
sed -i "s|_DOCROOTIN_|$doc_root_in|g" $APACHE_CONF_DIR/$base_url.conf
|
||||
|
||||
echo -n "The apache2 $base_url configuration must be enabled. Would you like to do that now? [Y/n] :"
|
||||
read enconf
|
||||
if [ "$enconf" = "" -o "$enconf" = "Y" -o "$enconf" = "y" ]
|
||||
if [[ "$enconf" == "" || "$enconf" == "Y" || "$enconf" == "y" ]]
|
||||
then
|
||||
a2enconf $base_url.conf >/dev/null
|
||||
service apache2 reload
|
||||
a2enconf -q $base_url.conf >/dev/null
|
||||
systemctl reload apache2
|
||||
echo "You can now point a web browser to $base_url on your web server "
|
||||
echo "to set up and configure $APP_NAME."
|
||||
echo ""
|
||||
|
||||
26
maintenancemode.php
Normal file
26
maintenancemode.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
maintenancemode.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2026 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
echo "
|
||||
<html>
|
||||
<head>
|
||||
<title>_APPNAME_</title>
|
||||
<style type=\"text/css\">
|
||||
* {font-family: Arial, Helvetica, sans-serif;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<br><br><br><br>
|
||||
_APPNAME_ is currently down for maintenance. Please try again later.
|
||||
<br><br>
|
||||
</body>
|
||||
</html>
|
||||
";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user