Compare commits
6 Commits
1.4.1
...
v1.5.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f84d3bcbc | |||
| 7b134c1010 | |||
| 0bc6d684c1 | |||
| 1d26b8bfed | |||
| 925332147a | |||
| 97249aa600 |
24
CHANGELOG
24
CHANGELOG
@@ -1,5 +1,5 @@
|
||||
OpenDRS - Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -146,8 +146,10 @@ Changelog
|
||||
in a trusted environment where anybody on the network can
|
||||
create/edit writeups and search the database, with a login required
|
||||
for everything else.
|
||||
- On the View Open Writeups and View All Writeups pages, replaced the
|
||||
"Last 30 days" button with a dropdown with more options.
|
||||
- On the View All Writeups pages, replaced the "Last 7 days" and
|
||||
"Last 30 days" buttons with a dropdown with more options, including
|
||||
future dates so that OpenDRS can be more useful for things like
|
||||
preventive maintenance.
|
||||
- Changed the global font to a sans-serif font.
|
||||
- For Raspberry Pi:
|
||||
- Removed the Raspberry Pi terminal setup from OpenDRS. Setting up
|
||||
@@ -162,3 +164,19 @@ Changelog
|
||||
package supplying uuidgen. If uuidgen is not present, the mysql
|
||||
user would be created with a blank password.
|
||||
|
||||
1.4.2 - 2024-06-27
|
||||
- Fixed bug introduced in version 1.4.1 in writeups.php where open
|
||||
writeups prior to the current day weren't displayed on the
|
||||
"View Open Writeups" page.
|
||||
- Removed open, closed, and deferred constant definitions from common.php
|
||||
since only one was ever used, and that in only one place.
|
||||
|
||||
1.4.3 - 2025-02-27
|
||||
- Poorly documented changes in the previous three versions resulted
|
||||
in confusion about when the date range selection dropdown should
|
||||
appear on the View Open Writeups and View All Writeups pages.
|
||||
Since the View Open Writeups page seemed redundant (all that info
|
||||
was available on the View All Writeups page) removed the View
|
||||
Open Writeups page entirely. The writeups page now shows all
|
||||
writeups for the selected date range, or today if no dates are
|
||||
specified.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
boilerplate.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
db.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
OpenDRS - Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -163,3 +163,20 @@ Changelog
|
||||
- Updated the installer script (install.sh) to check for and install the
|
||||
package supplying uuidgen. If uuidgen is not present, the mysql
|
||||
user would be created with a blank password.
|
||||
|
||||
1.4.2 - 2024-06-27
|
||||
- Fixed bug introduced in version 1.4.1 in writeups.php where open
|
||||
writeups prior to the current day weren't displayed on the
|
||||
"View Open Writeups" page.
|
||||
- Removed open, closed, and deferred constant definitions from common.php
|
||||
since only one was ever used, and that in only one place.
|
||||
|
||||
1.4.3 - 2025-02-27
|
||||
- Poorly documented changes in the previous three versions resulted
|
||||
in confusion about when the date range selection dropdown should
|
||||
appear on the View Open Writeups and View All Writeups pages.
|
||||
Since the View Open Writeups page seemed redundant (all that info
|
||||
was available on the View All Writeups page) removed the View
|
||||
Open Writeups page entirely. The writeups page now shows all
|
||||
writeups for the selected date range, or today if no dates are
|
||||
specified.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
about.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -79,7 +79,7 @@ echo "
|
||||
OpenDRS $drs_version Discrepancy Reporting System
|
||||
</h3><br>
|
||||
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
|
||||
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2024 by Rod Wright.
|
||||
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2025 by Rod Wright.
|
||||
</p>
|
||||
<p>
|
||||
OpenDRS is a simple online maintenance tracking/discrepancy reporting application. It allows anyone with a web browser to create,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
changelog.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
common.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -40,9 +40,6 @@ $functional_no_short=FUNCTIONAL_NO_SHORT;
|
||||
$access_mode=ACCESS_MODE;
|
||||
|
||||
// define some other constants
|
||||
define("STAT_OPEN",1);
|
||||
define("STAT_CLOSED",2);
|
||||
define("STAT_DEFERRED",3);
|
||||
define("ADMIN",2);
|
||||
define("USER",1);
|
||||
|
||||
@@ -386,8 +383,7 @@ function sidemenu($printable=true) {
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\">View Open Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View writeups\">View Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
|
||||
</table>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
config.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
create.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
dbadmin.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
gpl.php
|
||||
OpenMTS Online Maintenance Tracking System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
groups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -54,18 +54,28 @@ extract($incoming, EXTR_SKIP);
|
||||
* possible keys are:
|
||||
* action
|
||||
* save
|
||||
* targets
|
||||
* candidates
|
||||
* group
|
||||
* name
|
||||
* search
|
||||
* viewtype
|
||||
* s_status
|
||||
* s_group
|
||||
* s_device
|
||||
* s_subsystem
|
||||
* s_id
|
||||
* s_discovered
|
||||
* s_report_date_start
|
||||
* s_report_date_end
|
||||
* s_report_time_start
|
||||
* s_report_time_end
|
||||
* s_action_date_start
|
||||
* s_action_date_end
|
||||
* s_action_time_start
|
||||
* s_action_time_end
|
||||
* s_action_by
|
||||
* s_action_reason
|
||||
* s_action_text
|
||||
* s_discrepancy_text
|
||||
* s_reported_by
|
||||
* s_functional
|
||||
@@ -75,17 +85,28 @@ extract($incoming, EXTR_SKIP);
|
||||
* edit_action_date
|
||||
* edit_action_time
|
||||
* edit_action_text
|
||||
* sort
|
||||
* order
|
||||
*/
|
||||
|
||||
if (!isset($action)) $action=NULL;
|
||||
if (!isset($s_discrepancy_text)) $s_discrepancy_text=NULL;
|
||||
if (!isset($s_reported_by)) $s_reported_by=NULL;
|
||||
if (!isset($s_action_text)) $s_action_text=NULL;
|
||||
if (!isset($s_action_date_start)) $s_action_date_start=NULL;
|
||||
if (!isset($s_action_date_end)) $s_action_date_end=NULL;
|
||||
if (!isset($s_action_time_start)) $s_action_time_start=NULL;
|
||||
if (!isset($s_action_time_end)) $s_action_time_end=NULL;
|
||||
if (!isset($sort)) $sort=NULL;
|
||||
if (!isset($order)) $order=NULL;
|
||||
if (!isset($edit_status)) $edit_status=NULL;
|
||||
if (!isset($edit_action_by)) $edit_action_by=NULL;
|
||||
if (!isset($edit_action_reason)) $edit_action_reason=NULL;
|
||||
if (!isset($edit_action_text)) $edit_action_text=NULL;
|
||||
if (!isset($save)) $save=false;
|
||||
if (!isset($search)) $search=false;
|
||||
if (!isset($viewtype)) $viewtype="summary";
|
||||
if (!isset($s_id)) $s_id=NULL;
|
||||
if (!isset($group)) $group=NULL;
|
||||
if (!isset($name)) $name=NULL;
|
||||
|
||||
@@ -106,10 +127,10 @@ $role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
framework("begin","$appname","Writeup Groups",$print);
|
||||
|
||||
//echo "_REQUEST array <br>";
|
||||
//var_dump($_REQUEST);
|
||||
//echo "<br><hr> incoming array <br>";
|
||||
//var_dump($incoming);
|
||||
echo "_REQUEST array <br>";
|
||||
var_dump($_REQUEST);
|
||||
echo "<br><hr> incoming array <br>";
|
||||
var_dump($incoming);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
@@ -136,11 +157,11 @@ if ($action=="add" && $role && $save) {
|
||||
$fail=mysqli_error($drs_db);
|
||||
$group=mysqli_insert_id($drs_db);
|
||||
}
|
||||
foreach ($targets as $target) {
|
||||
foreach ($candidates as $candidate) {
|
||||
// add writeup to the group
|
||||
if (!mysqli_num_rows(mysqli_query($drs_db,"select id from links where writeupid=\"$target\" and linkgroup=\"$group\""))) {
|
||||
// target is not already a member of this group
|
||||
mysqli_query($drs_db,"insert into links (linkgroup,writeupid) values($group,$target)");
|
||||
if (!mysqli_num_rows(mysqli_query($drs_db,"select id from links where writeupid=\"$candidate\" and linkgroup=\"$group\""))) {
|
||||
// candidate is not already a member of this group
|
||||
mysqli_query($drs_db,"insert into links (linkgroup,writeupid) values($group,$candidate)");
|
||||
$fail=mysqli_error($drs_db);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +173,7 @@ if ($action=="add" && $role && $save) {
|
||||
$writeups[]=$writeuprow[0];
|
||||
}
|
||||
foreach ($writeups as $writeup) {
|
||||
if (!isset($targets) || !in_array($writeup,$targets)) {
|
||||
if (!isset($candidates) || !in_array($writeup,$candidates)) {
|
||||
// remove writeup from group
|
||||
mysqli_query($drs_db,"delete from links where writeupid=$writeup and linkgroup=$group");
|
||||
$fail=mysqli_error($drs_db);
|
||||
@@ -206,14 +227,16 @@ if ($action=="add" && $role && $save) {
|
||||
if ($search) {
|
||||
// strip whitespace from beginning and end of text fields
|
||||
$s_reported_by=trim($s_reported_by);
|
||||
$s_action_text=trim($s_action_text);
|
||||
$s_discrepancy_text=trim($s_discrepancy_text);
|
||||
$s_id=trim($s_id);
|
||||
|
||||
// build the query string
|
||||
$query_string="";
|
||||
// device
|
||||
if (isset($s_device)) {
|
||||
$query_string="{$query_string}(";
|
||||
$device_param="Devices:";
|
||||
$device_param="{$device_term}s:";
|
||||
foreach ($s_device as $dev_val) {
|
||||
$query_string="{$query_string}device=\"{$dev_val}\" or ";
|
||||
$device_dsp=dblookup($drs_db,"devices","id","name",$dev_val);
|
||||
@@ -221,7 +244,7 @@ if ($search) {
|
||||
}
|
||||
$device_param=rtrim($device_param,", ");
|
||||
$num_devices=mysqli_num_rows(mysqli_query($drs_db,"select id from devices"));
|
||||
if (count($s_device)==$num_devices) $device_param="Devices: any";
|
||||
if (count($s_device)==$num_devices) $device_param="{$device_term}s: any";
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
@@ -242,6 +265,16 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// id
|
||||
if ($s_id!=NULL) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}id={$s_id}";
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$id_param="ID: {$s_id}";
|
||||
} else {
|
||||
$id_param="ID: any";
|
||||
}
|
||||
// discovered
|
||||
if (isset($s_discovered)) {
|
||||
$query_string="{$query_string}(";
|
||||
@@ -289,6 +322,46 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// action by
|
||||
if ($s_action_by) {
|
||||
$query_string="{$query_string}(";
|
||||
$actionby_param="Status changed by:";
|
||||
foreach ($s_action_by as $actby_val) {
|
||||
$query_string="{$query_string}action_by=\"{$actby_val}\" or ";
|
||||
if ($actby_val==0) {
|
||||
$actionby_dsp=" (none set)";
|
||||
} else {
|
||||
$actionby_dsp=dblookup($drs_db,"users","id","firstname",$actby_val)." ".dblookup($drs_db,"users","id","lastname",$actby_val);
|
||||
}
|
||||
$actionby_param="{$actionby_param} {$actionby_dsp}, ";
|
||||
}
|
||||
$actionby_param=rtrim($actionby_param,", ");
|
||||
$num_users=mysqli_num_rows(mysqli_query($drs_db,"select id from users"));
|
||||
if (count($s_action_by)==$num_users+1) $actionby_param="Status changed by: any";
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// action reason
|
||||
if ($s_action_reason) {
|
||||
$query_string="{$query_string}(";
|
||||
$reason_param="Status change reason:";
|
||||
foreach ($s_action_reason as $actrn_val) {
|
||||
$query_string="{$query_string}action_reason=\"{$actrn_val}\" or ";
|
||||
if ($actrn_val==0) {
|
||||
$reason_dsp=" (none set)";
|
||||
} else {
|
||||
$reason_dsp=dblookup($drs_db,"reasons","id","text",$actrn_val);
|
||||
}
|
||||
$reason_param="{$reason_param} {$reason_dsp}, ";
|
||||
}
|
||||
$reason_param=rtrim($reason_param,", ");
|
||||
$num_reasons=mysqli_num_rows(mysqli_query($drs_db,"select id from reasons"));
|
||||
if (count($s_action_reason)==$num_reasons+1) $reason_param="Status change reason: any";
|
||||
$query_string=rtrim($query_string," or ");
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// report date
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}report_date between \"{$s_report_date_start}\" and \"{$s_report_date_end}\"";
|
||||
@@ -301,8 +374,28 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$reporttime_param="Report time between {$s_report_time_start} and {$s_report_time_end}";
|
||||
// action date
|
||||
if ($s_action_date_start && $s_action_date_end) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}action_date between \"{$s_action_date_start}\" and \"{$s_action_date_end}\"";
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$actiondate_param="Action taken date between {$s_action_date_start} and {$s_action_date_end}";
|
||||
} else {
|
||||
$actiondate_param="Action taken date: any";
|
||||
}
|
||||
// action time
|
||||
if ($s_action_time_start && $s_action_time_end) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}action_time between \"{$s_action_time_start}\" and \"{$s_action_time_end}\"";
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$actiontime_param="Action taken time between {$s_action_time_start} and {$s_action_time_end}";
|
||||
} else {
|
||||
$actiontime_param="Action taken time: any";
|
||||
}
|
||||
// discrepancy text
|
||||
if (isset($s_discrepancy_text)) {
|
||||
if ($s_discrepancy_text!=NULL) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}discrepancy_text like \"%{$s_discrepancy_text}%\"";
|
||||
$query_string="{$query_string})";
|
||||
@@ -311,8 +404,18 @@ if ($search) {
|
||||
} else {
|
||||
$discrepancytext_param="Text in discrepancy: any";
|
||||
}
|
||||
// action text
|
||||
if ($s_action_text) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}action_text like \"%{$s_action_text}%\"";
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$actiontext_param="Text in Action taken: {$s_action_text}";
|
||||
} else {
|
||||
$actiontext_param="Text in Action taken: any";
|
||||
}
|
||||
// reported by
|
||||
if (isset($s_reported_by)) {
|
||||
if ($s_reported_by!=NULL) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}reported_by like \"%{$s_reported_by}%\"";
|
||||
$query_string="{$query_string})";
|
||||
@@ -324,6 +427,24 @@ if ($search) {
|
||||
|
||||
$query_string=rtrim($query_string," and ");
|
||||
$query_string="select * from writeups where {$query_string} order by report_date asc";
|
||||
|
||||
// group membership
|
||||
if (isset($s_group)) {
|
||||
$group_param="Group member: ";
|
||||
// create an array of writeups that are members of the groups specified
|
||||
$group_writeups=[];
|
||||
foreach ($s_group as $group_val) {
|
||||
$wulink_query=mysqli_query($drs_db,"select writeupid from links where linkgroup=$group_val");
|
||||
while($wulinkrow=mysqli_fetch_assoc($wulink_query)){
|
||||
$group_writeups[]=$wulinkrow['writeupid'];
|
||||
}
|
||||
$group_name=dblookup($drs_db,"groups","id","name",$group_val);
|
||||
$group_param="{$group_param} <font title=\"{$group_name}\">{$group_val}</font>, ";
|
||||
}
|
||||
$group_param=rtrim($group_param,", ");
|
||||
} else {
|
||||
$group_param="Group member: any";
|
||||
}
|
||||
}
|
||||
|
||||
// ******** end database manipulation ********
|
||||
@@ -339,8 +460,8 @@ banner($print);
|
||||
echo "<br>";
|
||||
|
||||
if ($action=="add") {
|
||||
if (!isset($targets)) $targets=[];
|
||||
if (count($targets) > 1) {
|
||||
if (!isset($candidates)) $candidates=[];
|
||||
if (count($candidates) > 1) {
|
||||
$plural="s";
|
||||
} else {
|
||||
$plural="";
|
||||
@@ -374,7 +495,7 @@ if ($action=="add") {
|
||||
}
|
||||
} else {
|
||||
if ($role){
|
||||
// show mini search with discrepancy data only
|
||||
// show search form
|
||||
echo "
|
||||
<form method=post action=\"groups.php\">
|
||||
<input type=\"hidden\" name=\"group\" value=\"$group\">
|
||||
@@ -384,24 +505,11 @@ if ($action=="add") {
|
||||
<tr>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Status cell **********************
|
||||
|
||||
// ID cell *****************
|
||||
echo "
|
||||
Status<br>
|
||||
";
|
||||
if ($search) {
|
||||
$openstate=$clsdstate=$dfrdstate="";
|
||||
if (in_array("1",$s_status,true)) $openstate="selected";
|
||||
if (in_array("2",$s_status,true)) $clsdstate="selected";
|
||||
if (in_array("3",$s_status,true)) $dfrdstate="selected";
|
||||
} else {
|
||||
$openstate=$clsdstate=$dfrdstate="selected";
|
||||
}
|
||||
echo "
|
||||
<select name=\"s_status[]\" id=\"ms-status\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option title=\"Open\" value=\"1\" $openstate>OPEN</option>
|
||||
<option title=\"Closed\" value=\"2\" $clsdstate>CLSD</option>
|
||||
<option title=\"Deferred\" value=\"3\" $dfrdstate>DFRD</option>
|
||||
</select>
|
||||
ID<br>
|
||||
<input type=\"text\" name=\"s_id\" size=\"10\" value=\"$s_id\">
|
||||
";
|
||||
// **********************************
|
||||
echo "
|
||||
@@ -410,7 +518,7 @@ if ($action=="add") {
|
||||
";
|
||||
// Device cell *********************
|
||||
echo "
|
||||
Device<br>
|
||||
$device_term<br>
|
||||
<select name=\"s_device[]\" id=\"ms-device\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
";
|
||||
$drow=mysqli_query($drs_db,"select * from devices order by id asc");
|
||||
@@ -459,12 +567,19 @@ if ($action=="add") {
|
||||
$discovered_term<br>
|
||||
<select name=\"s_discovered[]\" id=\"ms-discovered\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
";
|
||||
if ($disc_drop_data=="Name") {
|
||||
$discddtitle="whendiscovereddesc";
|
||||
$discddtext="whendiscoveredname";
|
||||
} else if ($disc_drop_data=="Desc") {
|
||||
$discddtitle="whendiscoveredname";
|
||||
$discddtext="whendiscovereddesc";
|
||||
}
|
||||
$discrow=mysqli_query($drs_db,"select * from discovered order by whendiscoveredname asc");
|
||||
while ($discitem=mysqli_fetch_assoc($discrow)) {
|
||||
if (!$search || in_array($discitem["id"],$s_discovered,true)) {
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["$discddtitle"],$discitem["$discddtext"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
|
||||
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["$discddtitle"],$discitem["$discddtext"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -542,93 +657,509 @@ if ($action=="add") {
|
||||
<option value=\"1\" $funcyesstate>$functional_yes</option>
|
||||
<option value=\"0\" $funcnostate>$functional_no</option>
|
||||
</select>
|
||||
</td>
|
||||
";
|
||||
// **********************************"
|
||||
// **********************************
|
||||
echo "
|
||||
<td align=\"right\">
|
||||
<input type=\"submit\" name=\"search\" value=\"Find Writeups\">
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>";
|
||||
// display the results
|
||||
if ($search) {
|
||||
$writeup_qry=mysqli_query($drs_db,$query_string);
|
||||
if (mysqli_num_rows($writeup_qry)) {
|
||||
echo "
|
||||
<form method=post action=\"groups.php\">
|
||||
<input type=\"hidden\" name=\"group\" value=\"$group\">
|
||||
<input type=\"hidden\" name=\"action\" value=\"add\">
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">Select</th>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup_qry)) {
|
||||
// determine functional icon
|
||||
if($tablerow["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes\">";
|
||||
} else {
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no\">";
|
||||
}
|
||||
|
||||
// determine status indicator
|
||||
if ($tablerow['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($tablerow['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($tablerow['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
|
||||
// convert device number to name
|
||||
$dname=dblookup($drs_db,"devices","id","name",$tablerow["device"]);
|
||||
$disc_txt="{$tablerow["discrepancy_text"]}";
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
if ($is_member) {
|
||||
$group_count=$is_member;
|
||||
$member_group=mysqli_fetch_row($member_qry)[0];
|
||||
$member_group_name=dblookup($drs_db,"groups","id","name",$member_group);
|
||||
if ($member_group_name) {
|
||||
$imgtitle="Member of group: $member_group_name";
|
||||
} else {
|
||||
$imgtitle="Member of group ID: $member_group";
|
||||
}
|
||||
if ($group_count == 1) {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
}
|
||||
}
|
||||
// print table row
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"targets[]\" value=\"%s\"></td>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["id"],
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$statusind,
|
||||
$tablerow["report_date"],
|
||||
$dname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$func_icon
|
||||
);
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Group status cell **************
|
||||
echo "
|
||||
Group Assignments:<br>
|
||||
<select style=\"max-width:40%;\" name=\"s_group[]\" id=\"ms-group\" multiple title=\"Select the groups the results should be a member of. If you uncheck them all, this field will not be included in the search.\">
|
||||
";
|
||||
if (!isset($s_group)) $s_group=[];
|
||||
$grow=mysqli_query($drs_db,"select * from groups order by id asc");
|
||||
while ($gitem=mysqli_fetch_assoc($grow)) {
|
||||
if ($gitem["name"]=="") {
|
||||
$gname="Group ".$gitem["id"];
|
||||
} else {
|
||||
$gname=$gitem["name"];
|
||||
}
|
||||
if($search) {
|
||||
if (in_array($gitem["id"],$s_group,true)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$gitem["id"],$gname);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$gitem["id"],$gname);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
|
||||
// ************************************
|
||||
echo "
|
||||
</td></tr>
|
||||
<tr><td colspan=\"3\" bgcolor=\"black\"></td></tr>
|
||||
<tr><td colspan=\"3\" bgcolor=\"black\"></td></tr>
|
||||
<tr>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Status cell **********************
|
||||
echo "
|
||||
Status<br>
|
||||
";
|
||||
if ($search) {
|
||||
$openstate=$clsdstate=$dfrdstate="";
|
||||
if (in_array("1",$s_status,true)) $openstate="selected";
|
||||
if (in_array("2",$s_status,true)) $clsdstate="selected";
|
||||
if (in_array("3",$s_status,true)) $dfrdstate="selected";
|
||||
} else {
|
||||
$openstate=$clsdstate=$dfrdstate="selected";
|
||||
}
|
||||
echo "
|
||||
<select name=\"s_status[]\" id=\"ms-status\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option title=\"Open\" value=\"1\" $openstate>OPEN</option>
|
||||
<option title=\"Closed\" value=\"2\" $clsdstate>CLSD</option>
|
||||
<option title=\"Deferred\" value=\"3\" $dfrdstate>DFRD</option>
|
||||
</select>
|
||||
";
|
||||
// **********************************
|
||||
echo "
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// action by cell ************
|
||||
echo "
|
||||
Status changed by<br>
|
||||
<select name=\"s_action_by[]\" id=\"ms-user\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"0\" selected>(none set)</option>
|
||||
";
|
||||
$persrow=mysqli_query($drs_db,"select id,firstname,lastname from users order by lastname asc");
|
||||
while ($persitem=mysqli_fetch_assoc($persrow)) {
|
||||
if (!$search || in_array($persitem["id"],$s_action_by,true)) {
|
||||
printf("<option value=\"%s\" selected>%s %s</option>",$persitem["id"],$persitem["firstname"],$persitem["lastname"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s %s</option>",$persitem["id"],$persitem["firstname"],$persitem["lastname"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
// ***********************************
|
||||
echo "
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// action reason cell *********
|
||||
echo "
|
||||
Status change reason<br>
|
||||
<select name=\"s_action_reason[]\" id=\"ms-reason\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
|
||||
<option value=\"0\" selected>(none set)</option>
|
||||
";
|
||||
$reasrow=mysqli_query($drs_db,"select id,text from reasons order by id asc");
|
||||
while ($reasitem=mysqli_fetch_assoc($reasrow)) {
|
||||
if (!$search || in_array($reasitem["id"],$s_action_reason,true)) {
|
||||
printf("<option value=\"%s\" selected>%s</option>",$reasitem["id"],$reasitem["text"]);
|
||||
} else {
|
||||
printf("<option value=\"%s\">%s</option>",$reasitem["id"],$reasitem["text"]);
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
// ***********************************
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td></td><td></td><td></td></tr>
|
||||
<tr>
|
||||
<td colspan=\"3\">
|
||||
";
|
||||
// Action taken text cell ************
|
||||
echo "
|
||||
Words in Action Taken<br>
|
||||
<textarea rows=\"5\" cols=\"80\" name=\"s_action_text\" wrap=\"soft\">$s_action_text</textarea><br>
|
||||
";
|
||||
// ***********************************
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=\"left\" >
|
||||
";
|
||||
// Action date cell ******************
|
||||
echo "
|
||||
Action Taken Date Between<br>
|
||||
<input type=\"text\" name=\"s_action_date_start\" size=\"10\" maxlength=\"10\" value=\"$s_action_date_start\" id=\"sdp-action_date\" title=\"Format: YYYY-MM-DD\">
|
||||
and
|
||||
<input type=\"text\" name=\"s_action_date_end\" size=\"10\" maxlength=\"10\" value=\"$s_action_date_end\" id=\"edp-action_date\" title=\"Format: YYYY-MM-DD\">
|
||||
";
|
||||
// ***********************************
|
||||
echo "
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Action time cell ******************
|
||||
echo "
|
||||
Action Taken Time Between<br>
|
||||
<input type=\"text\" name=\"s_action_time_start\" size=\"8\" maxlength=\"8\" value=\"$s_action_time_start\" title=\"Format: HH:MM:SS\">
|
||||
and
|
||||
<input type=\"text\" name=\"s_action_time_end\" size=\"8\" maxlength=\"8\" value=\"$s_action_time_end\" title=\"Format: HH:MM:SS\">
|
||||
";
|
||||
// ***********************************
|
||||
$summarystat=$detailstat="";
|
||||
if ($viewtype=="detail") {
|
||||
$detailstat="checked";
|
||||
} else {
|
||||
$summarystat="checked";
|
||||
}
|
||||
$idsort=$statussort=$datesort=$discsort=$devicesort=$subsyssort=$repbysort=$discrepsort=$funcsort="";
|
||||
switch ($sort) {
|
||||
case "id":
|
||||
$idsort="checked";
|
||||
break;
|
||||
case "status":
|
||||
$statussort="checked";
|
||||
break;
|
||||
case "report_date":
|
||||
$datesort="checked";
|
||||
break;
|
||||
case "discovered":
|
||||
$discsort="checked";
|
||||
break;
|
||||
case "device":
|
||||
$devicesort="checked";
|
||||
break;
|
||||
case "subsystem":
|
||||
$subsyssort="checked";
|
||||
break;
|
||||
case "reported_by":
|
||||
$repbysort="checked";
|
||||
break;
|
||||
case "discrepancy_text":
|
||||
$discrepsort="checked";
|
||||
break;
|
||||
case "functional":
|
||||
$funcsort="checked";
|
||||
break;
|
||||
default:
|
||||
$datesort="checked";
|
||||
}
|
||||
$ascsort=$descsort="";
|
||||
if ($order=="desc") {
|
||||
$descsort="checked";
|
||||
} else {
|
||||
$ascsort="checked";
|
||||
}
|
||||
echo "</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>
|
||||
<input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label>
|
||||
<br><br>
|
||||
Sort Field:<br>
|
||||
<input type=\"radio\" $idsort name=\"sort\" value=\"id\" id=\"idview\" ><label for=\"idview\" title=\"Sort by ID.\">ID</label>
|
||||
<input type=\"radio\" $statussort name=\"sort\" value=\"status\" id=\"statusview\" ><label for=\"statusview\" title=\"Sort by Status.\">Status</label>
|
||||
<input type=\"radio\" $datesort name=\"sort\" value=\"report_date\" id=\"dateview\" ><label for=\"dateview\" title=\"Sort by Report Date.\">Date</label>
|
||||
<input type=\"radio\" $discsort name=\"sort\" value=\"discovered\" id=\"discoveredview\" ><label for=\"discoveredview\" title=\"Sort by $discovered_term.\">$discovered_term_short</label>
|
||||
<input type=\"radio\" $devicesort name=\"sort\" value=\"device\" id=\"deviceview\" ><label for=\"deviceview\" title=\"Sort by $device_term.\">$device_term</label>
|
||||
<input type=\"radio\" $subsyssort name=\"sort\" value=\"subsystem\" id=\"subsysview\" ><label for=\"subsysview\" title=\"Sort by Subsystem.\">Subsystem</label>
|
||||
<input type=\"radio\" $repbysort name=\"sort\" value=\"reported_by\" id=\"repbyview\" ><label for=\"repbyview\" title=\"Sort by Reported by.\">Reported by</label>
|
||||
<input type=\"radio\" $discrepsort name=\"sort\" value=\"discrepancy_text\" id=\"discrepview\" ><label for=\"discrepview\" title=\"Sort by Discrepancy.\">Discrepancy</label>
|
||||
<input type=\"radio\" $funcsort name=\"sort\" value=\"functional\" id=\"funcview\" ><label for=\"funcview\" title=\"Sort by $functional_term.\">$functional_term_short</label>
|
||||
<br>Sort Order:<br>
|
||||
<input type=\"radio\" $ascsort name=\"order\" value=\"asc\" id=\"ascview\" ><label for=\"ascview\" title=\"Sort results in ascending order.\">Ascending</label>
|
||||
<input type=\"radio\" $descsort name=\"order\" value=\"desc\" id=\"descview\" ><label for=\"descview\" title=\"Sort results in descending order.\">Descending</label>
|
||||
<br><br>
|
||||
<input type=\"submit\" name=\"search\" value=\"Search\">
|
||||
|
||||
<input type=\"submit\" name=\"cancel\" value=\"Start New Search\">
|
||||
</form>
|
||||
<br>
|
||||
";
|
||||
|
||||
// display the results ***********************************
|
||||
//display the search parameters used
|
||||
if ($search) {
|
||||
if (!$print) echo "<a id=\"results\"></a>";
|
||||
|
||||
// show the parameters used block
|
||||
echo "
|
||||
<table border=\"2\" width=\"100%\">
|
||||
<tr><td align=\"left\"><b>Parameters used in this search</b>
|
||||
";
|
||||
if (!$print) {
|
||||
echo " <font size=\"-1\">Scroll up to modify parameters</font></td>";
|
||||
} else {
|
||||
echo "</td>";
|
||||
}
|
||||
echo "
|
||||
</tr>
|
||||
<tr><td>
|
||||
<table border=\"0\">
|
||||
<td><b>$status_param</b></td><td> </td>
|
||||
<td>$device_param</td><td> </td>
|
||||
<td>$subsystem_param</td><td> </td>
|
||||
<td>$id_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$discovered_param</td><td> </td>
|
||||
<td>$reportdate_param</td><td> </td>
|
||||
<td>$reporttime_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$discrepancytext_param</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$repby_param</td><td> </td>
|
||||
<td>$func_param</td><td> </td>
|
||||
<td>$group_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$actionby_param</td><td> </td>
|
||||
<td>$reason_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$actiontext_param</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
<tr>
|
||||
<td>$actiondate_param</td><td> </td>
|
||||
<td>$actiontime_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
<br>
|
||||
";
|
||||
|
||||
// show the results
|
||||
$currentparams=arrayCopy($_REQUEST);
|
||||
echo "
|
||||
<form method=\"post\" target=\"_blank\">
|
||||
<input type=\"hidden\" name=\"all_parameters\" value=\"". htmlentities(serialize($currentparams))."\">
|
||||
";
|
||||
$writeup=mysqli_query($drs_db,$query_string);
|
||||
// create an array of ids returned by the query string
|
||||
$result_ids=[];
|
||||
while ($eachid=mysqli_fetch_assoc($writeup)) {
|
||||
$result_ids[]=$eachid['id'];
|
||||
}
|
||||
|
||||
mysqli_data_seek($writeup,0);
|
||||
if (!isset($group_writeups)) $group_writeups=[];
|
||||
reset($group_writeups);
|
||||
$num_results=mysqli_num_rows($writeup);
|
||||
if ($num_results > 0) {
|
||||
if ($viewtype=="summary") {
|
||||
echo "
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">Select</th>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup)) {
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
|
||||
// determine functional icon
|
||||
if($tablerow["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
|
||||
// determine status indicator
|
||||
if ($tablerow['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($tablerow['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($tablerow['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
|
||||
// convert device number to name
|
||||
$dname=dblookup($drs_db,"devices","id","name",$tablerow["device"]);
|
||||
// convert discovered number to description
|
||||
$discname=dblookup($drs_db,"discovered","id","whendiscoveredname",$tablerow["discovered"]);
|
||||
// convert discovered number to description
|
||||
$discdesc=dblookup($drs_db,"discovered","id","whendiscovereddesc",$tablerow["discovered"]);
|
||||
// convert subsystem number to name
|
||||
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
|
||||
$disc_txt="{$tablerow["discrepancy_text"]}";
|
||||
|
||||
// set group indicator
|
||||
if ($is_member) {
|
||||
$group_count=$is_member;
|
||||
if ($group_count == 1) {
|
||||
$group_num=mysqli_fetch_row(mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\""))[0];
|
||||
$member_group_name=dblookup($drs_db,"groups","id","name",$group_num);
|
||||
if ($member_group_name) {
|
||||
$imgtitle="Member of group: $member_group_name";
|
||||
} else {
|
||||
$imgtitle="Member of group ID: $group_num";
|
||||
}
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$group_num\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"writeupdetail.php?id={$tablerow['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($tablerow['id'],$group_writeups) || count($s_group)==0) {
|
||||
// print table row
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"candidates[]\" value=\"%s\"></td>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</font></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["id"],
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$statusind,
|
||||
$tablerow["report_date"],
|
||||
$discdesc,$discname,
|
||||
$dname,
|
||||
$ssname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
} elseif ($viewtype=="detail") {
|
||||
echo "
|
||||
<table border=\"0\"><tr><td>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup)) {
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
if(in_array($tablerow['id'],$group_writeups) || count($s_group)==0) {
|
||||
echo "<input type=\"checkbox\" name=\"candidates[]\" value={$tablerow['id']}> Select";
|
||||
displaywriteup($tablerow['id']);
|
||||
echo "<br>";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
</td></tr></table>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////begin original display
|
||||
//// display the results
|
||||
//if ($search) {
|
||||
//$writeup_qry=mysqli_query($drs_db,$query_string);
|
||||
//if (mysqli_num_rows($writeup_qry)) {
|
||||
//echo "
|
||||
//<form method=post action=\"groups.php\">
|
||||
//<input type=\"hidden\" name=\"group\" value=\"$group\">
|
||||
//<input type=\"hidden\" name=\"action\" value=\"add\">
|
||||
//<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
//<tr>
|
||||
//<th style=\"width:1%;\">Select</th>
|
||||
//<th style=\"width:1%;\">ID</th>
|
||||
//<th style=\"width:1%;\">Status</th>
|
||||
//<th style=\"width:100px;\">Date</th>
|
||||
//<th style=\"width:1%;\">Device</th>
|
||||
//<th style=\"width:1%;\">Reported by</th>
|
||||
//<th>Discrepancy</th>
|
||||
//<th style=\"width:1%;\">$functional_term_short</th>
|
||||
//</tr>
|
||||
//";
|
||||
//while ($tablerow = mysqli_fetch_assoc($writeup_qry)) {
|
||||
//// determine functional icon
|
||||
//if($tablerow["functional"]==1) {
|
||||
//$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes\">";
|
||||
//} else {
|
||||
//$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no\">";
|
||||
//}
|
||||
|
||||
//// determine status indicator
|
||||
//if ($tablerow['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
//if ($tablerow['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
//if ($tablerow['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
|
||||
//// convert device number to name
|
||||
//$dname=dblookup($drs_db,"devices","id","name",$tablerow["device"]);
|
||||
//$disc_txt="{$tablerow["discrepancy_text"]}";
|
||||
//// determine if this is a member of a group
|
||||
//$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
//$is_member=mysqli_num_rows($member_qry);
|
||||
//if ($is_member) {
|
||||
//$group_count=$is_member;
|
||||
//$member_group=mysqli_fetch_row($member_qry)[0];
|
||||
//$member_group_name=dblookup($drs_db,"groups","id","name",$member_group);
|
||||
//if ($member_group_name) {
|
||||
//$imgtitle="Member of group: $member_group_name";
|
||||
//} else {
|
||||
//$imgtitle="Member of group ID: $member_group";
|
||||
//}
|
||||
//if ($group_count == 1) {
|
||||
//$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
//} else {
|
||||
//$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
|
||||
//}
|
||||
//}
|
||||
//// print table row
|
||||
//printf(
|
||||
//"<tr>
|
||||
//<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"candidates[]\" value=\"%s\"></td>
|
||||
//<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
//<td valign=\"top\">%s</td>
|
||||
//<td valign=\"top\">%s</td>
|
||||
//<td valign=\"top\">%s</td>
|
||||
//<td valign=\"top\">%s</td>
|
||||
//<td valign=\"top\">%s</td>
|
||||
//<td align=\"center\" valign=\"top\">%s</td>
|
||||
//</tr>\n",
|
||||
//$tablerow["id"],
|
||||
//$tablerow["id"],$tablerow["id"],
|
||||
//$statusind,
|
||||
//$tablerow["report_date"],
|
||||
//$dname,
|
||||
//$tablerow["reported_by"],
|
||||
//$disc_txt,
|
||||
//$func_icon
|
||||
//);
|
||||
//}
|
||||
//echo "
|
||||
//</table>\n
|
||||
//"
|
||||
//// end original display
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo "
|
||||
</table>\n
|
||||
<br>
|
||||
Select the writeups above you'd like to add to the group and
|
||||
<button name=\"save\" value=\"save\" type=\"submit\">Save group</button>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
login.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
profile.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
search.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
settings.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeupdetail.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2024 Rod Wright
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -51,8 +51,6 @@ extract($incoming, EXTR_SKIP);
|
||||
* end_date
|
||||
* showtoday
|
||||
* showyesterday
|
||||
* show7day
|
||||
* show30day
|
||||
* showdays
|
||||
* viewtype
|
||||
* togroup
|
||||
@@ -73,128 +71,6 @@ if ($print) {
|
||||
$role=dblookup($drs_db,"users","id","role",$userid);
|
||||
|
||||
// define local functions
|
||||
function opentable($incoming,$start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
|
||||
// show date range selector
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
";
|
||||
if ($print) {
|
||||
echo "
|
||||
Open writeups between $start_date and $end_date
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<input type=\"submit\" name=\"showtoday\" value=\"Today\">
|
||||
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">
|
||||
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\"><br><br>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</form>
|
||||
";
|
||||
$writeup=mysqli_query($drs_db,"select * from writeups where status=".STAT_OPEN." and report_date between \"$start_date\" and \"$end_date\" order by report_date desc,report_time desc");
|
||||
if (mysqli_num_rows($writeup)) {
|
||||
$now=date("H:i l");
|
||||
echo "
|
||||
<font color=\"red\">As of $now</font> <font size=\"-1\">Newest at top</font><br>
|
||||
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
while ($tablerow = mysqli_fetch_assoc($writeup)) {
|
||||
// determine effective icon
|
||||
if($tablerow["functional"]==1) {
|
||||
$funcind="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$funcind="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
|
||||
// convert device number to name
|
||||
$dname=dblookup($drs_db,"devices","id","name",$tablerow["device"]);
|
||||
|
||||
// convert subsystem number to name
|
||||
$ssname=dblookup($drs_db,"subsystems","id","name",$tablerow["subsystem"]);
|
||||
|
||||
// convert subsystem number to description
|
||||
$ssdesc=dblookup($drs_db,"subsystems","id","description",$tablerow["subsystem"]);
|
||||
|
||||
// determine values for when discovered
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$tablerow['discovered']}\""))[0];
|
||||
|
||||
$disc_txt="{$tablerow['discrepancy_text']}";
|
||||
|
||||
// determine if this is a member of a group
|
||||
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
|
||||
$is_member=mysqli_num_rows($member_qry);
|
||||
if ($is_member) {
|
||||
$group_count=$is_member;
|
||||
$member_group=mysqli_fetch_row($member_qry)[0];
|
||||
$member_group_name=dblookup($drs_db,"groups","id","name",$member_group);
|
||||
if ($member_group_name) {
|
||||
$imgtitle="Member of group: $member_group_name";
|
||||
} else {
|
||||
$imgtitle="Member of group ID: $member_group";
|
||||
}
|
||||
if ($group_count == 1) {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
|
||||
} else {
|
||||
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"writeupdetail.php?id={$tablerow['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
// print table row
|
||||
printf(
|
||||
"<tr>
|
||||
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</font></td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\"><font title=\"%s\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td valign=\"top\">%s</td>
|
||||
<td align=\"center\" valign=\"top\">%s</td>
|
||||
</tr>\n",
|
||||
$tablerow["id"],$tablerow["id"],
|
||||
$tablerow["report_date"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$dname,
|
||||
$ssdesc, $ssname,
|
||||
$tablerow["reported_by"],
|
||||
$disc_txt,
|
||||
$funcind
|
||||
);
|
||||
}
|
||||
echo "</table>\n";
|
||||
} else {
|
||||
if (array_key_exists('showyesterday',$incoming)) {
|
||||
$datespec="yesterday";
|
||||
} elseif (array_key_exists('show7day',$incoming)) {
|
||||
$datespec="the last 7 days";
|
||||
} elseif (array_key_exists('show30day',$incoming)) {
|
||||
$datespec="the last 30 days";
|
||||
} else {
|
||||
$datespec="today";
|
||||
}
|
||||
echo "<b>No open writeups for $datespec.</b>";
|
||||
}
|
||||
}
|
||||
|
||||
function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$role) {
|
||||
// grab some important global variables
|
||||
@@ -431,11 +307,7 @@ if (isset($showdays) && $showdays != "") {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($view)) {
|
||||
$pgtitle="Recent Writeups";
|
||||
} else {
|
||||
$pgtitle="Open Writeups";
|
||||
}
|
||||
$pgtitle="Recent Writeups";
|
||||
|
||||
framework("begin","$appname",$pgtitle,$print);
|
||||
|
||||
@@ -492,13 +364,10 @@ if (isset($addtogroup)) {
|
||||
}
|
||||
if (!isset($viewtype)) $viewtype="summary";
|
||||
|
||||
if (isset($view)) {
|
||||
// show writeup table
|
||||
viewtable($start_date,$end_date,$print,$drs_db,$viewtype,$role);
|
||||
} else {
|
||||
// show open table
|
||||
opentable($incoming,$start_date,$end_date,$print,$drs_db,$viewtype);
|
||||
}
|
||||
|
||||
// show writeup table
|
||||
viewtable($start_date,$end_date,$print,$drs_db,$viewtype,$role);
|
||||
|
||||
|
||||
echo "<br>";
|
||||
banner($print);
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
# install.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2024 Rod Wright
|
||||
# Copyright (C) 2025 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
|
||||
DRS_VERSION="1.4.0"
|
||||
DRS_VERSION="1.4.3"
|
||||
DOC_ROOT="/var/www"
|
||||
INSTALL_LOC="opendrs"
|
||||
APACHE_USER="www-data"
|
||||
@@ -21,6 +21,7 @@ if [[ $EUID -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Preparing for OpenDRS installation or upgrade. Please stand by..."
|
||||
|
||||
# Prevent unattended-upgrades from interfering
|
||||
restart_uu=false
|
||||
@@ -426,7 +427,7 @@ then
|
||||
# apply database updates
|
||||
mysql -u"$curr_username" -f -D $curr_dbname < opendrs-update.sql >/dev/null 2>&1
|
||||
# apply updates to existing db.php
|
||||
./opendrs-update.sh $install_path
|
||||
bash ./opendrs-update.sh $install_path
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -R distfiles/* $install_path
|
||||
|
||||
@@ -69,7 +69,7 @@ CREATE TABLE `config` (
|
||||
LOCK TABLES `config` WRITE;
|
||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||
INSERT INTO `config` VALUES
|
||||
(1,'drs_version','1.4.0','1.4.0'),
|
||||
(1,'drs_version','1.4.3','1.4.3'),
|
||||
(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),
|
||||
(6,'banner','1','1'),
|
||||
(7,'background_color','0B3144','0B3144'),
|
||||
|
||||
@@ -249,5 +249,19 @@ WHERE NOT EXISTS
|
||||
SELECT `name` FROM `config` WHERE `name` = "access_mode"
|
||||
) LIMIT 1
|
||||
;
|
||||
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.4.1 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.4.1",defaultvalue="1.4.1" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.4.2 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.4.2",defaultvalue="1.4.2" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.4.3 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.4.3",defaultvalue="1.4.3" WHERE name="drs_version";
|
||||
-- --------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user