Incorporate changes for 1.2.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
common.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2020 Rod Wright
|
||||
Copyright (C) 2021 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -26,7 +26,19 @@ if (!file_exists("db.php")) {
|
||||
include("db.php");
|
||||
include("settings.php");
|
||||
|
||||
// define some constants
|
||||
// assign variables from constants
|
||||
$device_term=DEVICE_TERM;
|
||||
$discovered_term=DISCOVERED_TERM;
|
||||
$discovered_term_short=DISCOVERED_TERM_SHORT;
|
||||
$functional_term=FUNCTIONAL_TERM;
|
||||
$functional_term_short=FUNCTIONAL_TERM_SHORT;
|
||||
$disc_drop_data=DISC_DROP_DATA;
|
||||
$functional_yes=FUNCTIONAL_YES;
|
||||
$functional_no=FUNCTIONAL_NO;
|
||||
$functional_yes_short=FUNCTIONAL_YES_SHORT;
|
||||
$functional_no_short=FUNCTIONAL_NO_SHORT;
|
||||
|
||||
// define some other constants
|
||||
define("STAT_OPEN",1);
|
||||
define("STAT_CLOSED",2);
|
||||
define("STAT_DEFERRED",3);
|
||||
@@ -260,9 +272,9 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
$( \"#logoutall\" ).checkboxradio({
|
||||
icon: false
|
||||
});
|
||||
$( \"#device, #subsystem, #period, #period_effective, [id|='sel']\" ).selectmenu();
|
||||
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
|
||||
$( \"#status, #user, #reason\" ).selectmenu();
|
||||
$( \"#subsystem, #period, #searchstatus, #pass, #passconf\").tooltip();
|
||||
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
|
||||
$( \"[id|='ms']\").multiselect();
|
||||
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
|
||||
</script>
|
||||
@@ -276,7 +288,6 @@ function framework($option,$htmltitle,$pagetitle,$print) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
function pagetable($option) {
|
||||
if ($option=="begin") {
|
||||
echo "
|
||||
@@ -532,17 +543,24 @@ function validate_password($pass,$passconf) {
|
||||
}
|
||||
|
||||
function displaywriteup($id) {
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $drs_db;
|
||||
|
||||
$writeupdata=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from writeups where id=\"$id\""));
|
||||
// determine status indicator
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine effective icon
|
||||
if($writeupdata["period_effective"]==1) {
|
||||
$effind="<font color=\"#00FF00\" title=\"Period Effective\">EFF</font>";
|
||||
// determine functional indicator
|
||||
if($writeupdata["functional"]==1) {
|
||||
$funcind="<font color=\"#00FF00\" title=\"$functional_yes\">$functional_yes_short</font>";
|
||||
} else {
|
||||
$effind="<font color=\"#FF0000\" title=\"Period Non-effective\">NEF</font>";
|
||||
$funcind="<font color=\"#FF0000\" title=\"$functional_no\">$functional_no_short</font>";
|
||||
}
|
||||
// look up text data
|
||||
$devicename=dblookup($drs_db,"devices","id","name",$writeupdata["device"]);
|
||||
@@ -552,8 +570,8 @@ function displaywriteup($id) {
|
||||
$rdate=$writeupdata["report_date"];
|
||||
$rtime=$writeupdata["report_time"];
|
||||
$repby=$writeupdata["reported_by"];
|
||||
$period=$writeupdata["period"];
|
||||
$periodtimes=dblookup($drs_db,"periods","id","times",$period);
|
||||
$whendiscoveredname=dblookup($drs_db,"discovered","id","whendiscoveredname",$writeupdata["discovered"]);
|
||||
$whendiscovereddesc=dblookup($drs_db,"discovered","id","whendiscovereddesc",$writeupdata["discovered"]);
|
||||
$techfname=dblookup($drs_db,"users","id","firstname",$writeupdata["action_by"]);
|
||||
$techlname=dblookup($drs_db,"users","id","lastname",$writeupdata["action_by"]);
|
||||
$reasonname=dblookup($drs_db,"reasons","id","text",$writeupdata["action_reason"]);
|
||||
@@ -585,10 +603,10 @@ function displaywriteup($id) {
|
||||
<table border=\"0\">
|
||||
<tr><td><b>ID:</b> <a href=\"writeupdetail.php?id=$id\" title=\"View or change details of this writeup\">$id</a></td><td> </td>
|
||||
<td><b>$statusind</b></td><td> </td>
|
||||
<td><b>Device:</b> $devicename</td><td> </td>
|
||||
<td><b>$device_term:</b> $devicename</td><td> </td>
|
||||
<td><b>Subsystem:</b> <font title=\"$subsystemdesc\">$subsystemname</font></td><td> </td>
|
||||
<td><b>Period:</b> <font title=\"$periodtimes\">$period</font></td><td> </td>
|
||||
<td><b>$effind</b></td>
|
||||
<td><b>$discovered_term:</b> <font title=\"$whendiscovereddesc\">$whendiscoveredname</font></td><td> </td>
|
||||
<td><b>$funcind</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
@@ -676,7 +694,14 @@ function putsetting($setting_name,$setting_value,$user_id) {
|
||||
|
||||
function group_table($groupid,$role=false,$mode="view",$selection="none",$expanded=false) {
|
||||
// display a table for a single group
|
||||
// grab some important global variables
|
||||
global $device_term;
|
||||
global $discovered_term, $discovered_term_short, $disc_drop_data;
|
||||
global $functional_term, $functional_term_short;
|
||||
global $functional_yes, $functional_no;
|
||||
global $functional_yes_short, $functional_no_short;
|
||||
global $drs_db;
|
||||
|
||||
// print group id and name
|
||||
if ($selection == "all") {
|
||||
$sel_flag="checked";
|
||||
@@ -706,12 +731,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
} else {
|
||||
@@ -721,12 +746,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
<th style=\"width:1%;\">ID</th>
|
||||
<th style=\"width:1%;\">Status</th>
|
||||
<th style=\"width:100px;\">Date</th>
|
||||
<th style=\"width:1%;\">Period</th>
|
||||
<th style=\"width:1%;\">Device</th>
|
||||
<th style=\"width:1%;\">$discovered_term_short</th>
|
||||
<th style=\"width:1%;\">$device_term</th>
|
||||
<th style=\"width:1%;\">Subsystem</th>
|
||||
<th style=\"width:1%;\">Reported by</th>
|
||||
<th>Discrepancy</th>
|
||||
<th style=\"width:1%;\">Msn Eff</th>
|
||||
<th style=\"width:1%;\">$functional_term_short</th>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -744,13 +769,14 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
|
||||
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
|
||||
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
|
||||
// determine times for period
|
||||
$ptimes=mysqli_fetch_row(mysqli_query($drs_db,"select times from periods where id=\"{$writeupdata['period']}\""))[0];
|
||||
// determine effective icon
|
||||
if($writeupdata["period_effective"]==1) {
|
||||
$eff_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"Period Effective\" alt=\"Period Effective\">";
|
||||
// determine whendiscovered text for discovered id
|
||||
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$writeupdata['discovered']}\""))[0];
|
||||
// determine functional icon
|
||||
if($writeupdata["functional"]==1) {
|
||||
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
|
||||
} else {
|
||||
$eff_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"Period Non-effective\" alt=\"Period Non-effective\">";
|
||||
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
|
||||
}
|
||||
// print table row
|
||||
if ($role && $mode=="select") {
|
||||
@@ -771,12 +797,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$ptimes, $writeupdata["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
@@ -794,12 +820,12 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
$writeupdata["id"],$writeupdata["id"],
|
||||
$statusind,
|
||||
$writeupdata["report_date"],
|
||||
$ptimes, $writeupdata["period"],
|
||||
$whendiscdesc, $whendiscname,
|
||||
$tname,
|
||||
$ssname,
|
||||
$writeupdata["reported_by"],
|
||||
$writeupdata["discrepancy_text"],
|
||||
$eff_icon
|
||||
$func_icon
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -807,4 +833,5 @@ function group_table($groupid,$role=false,$mode="view",$selection="none",$expand
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user