Initial git commit for OpenLog beginning with v5.2.4.
This commit is contained in:
123
distfiles/parts.php
Normal file
123
distfiles/parts.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/*
|
||||
parts.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
$loggedin=1;
|
||||
} else {
|
||||
unset($loggedin);
|
||||
}
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$add=$_REQUEST['add'];
|
||||
$sort=$_REQUEST['sort'];
|
||||
$order=$_REQUEST['order'];
|
||||
|
||||
$logname=LOG_NAME;
|
||||
$uidtext=UID_TEXT;
|
||||
|
||||
if ($add) {
|
||||
header ("Location: partentry.php?add=1");
|
||||
}
|
||||
|
||||
if (! $sort) $sort="uid";
|
||||
if ($order == "asc") {
|
||||
$order="desc";
|
||||
} else if ($order == "desc") {
|
||||
$order="asc";
|
||||
} else {
|
||||
$order="asc";
|
||||
}
|
||||
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
}
|
||||
|
||||
framework("begin","$logname","Parts",$print);
|
||||
|
||||
pagetable("begin");
|
||||
if(!$print) {
|
||||
pageblock("left","begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
banner($print);
|
||||
if ($loggedin) {
|
||||
echo "
|
||||
<br><form method=\"post\" action=\"partentry.php\">
|
||||
<input type=\"submit\" name=\"add\" value=\"Add New Part\">
|
||||
</form><br>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
|
||||
<tr>
|
||||
<th><a href=\"parts.php?sort=uid&order=$order\" title=\"Sort by $uidtext\">$uidtext</a></th>
|
||||
<th><a href=\"parts.php?sort=partnum&order=$order\" title=\"Sort by Part Number\">Part Number</a></th>
|
||||
<th><a href=\"parts.php?sort=sernum&order=$order\" title=\"Sort by Serial Number\">Serial Number</a></th>
|
||||
<th><a href=\"parts.php?sort=partname&order=$order\" title=\"Sort by Part Name\">Part Name</a></th>
|
||||
</tr>
|
||||
";
|
||||
$partqry=mysqli_query($db,"select * from parts order by $sort $order");
|
||||
while ($partline=mysqli_fetch_assoc($partqry)) {
|
||||
if (!$partline['uid']) {
|
||||
$pluidtxt="none";
|
||||
} else {
|
||||
$pluidtxt=$partline['uid'];
|
||||
}
|
||||
if ($loggedin) {
|
||||
printf("
|
||||
<tr>
|
||||
<td>
|
||||
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
|
||||
</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>",
|
||||
$partline['partid'],$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
);
|
||||
} else {
|
||||
printf("
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>",
|
||||
$pluidtxt,
|
||||
$partline['partnum'],
|
||||
$partline['sernum'],
|
||||
$partline['partname']
|
||||
);
|
||||
}
|
||||
echo "
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
</table>
|
||||
";
|
||||
|
||||
echo "<br><br>";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user