Added closer view to managment web UI

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2022-05-03 00:33:31 +02:00
parent a81dfbb11e
commit 9e3d1fa878
3 changed files with 73 additions and 4 deletions

View file

@ -85,7 +85,7 @@ echo '<a href="progressinfo.php?tile=' . $name . '" target="progressinfo"><rect
</svg>
</li>
<li>
<iframe name="progressinfo" style="border: 0px; height: 450px; width: 100%;" src="progressinfo.php"></iframe>
<iframe name="progressinfo" style="border: 0px; height: 454px; width: 750px;" src="progressinfo.php"></iframe>
</li>
</ul>
</body>

View file

@ -1,5 +1,15 @@
<?php
include("config.php");
// Returns numbers in string format as needed for file names
function clipNumber($number, $length)
{
$number = abs($number) . "";
while (strlen($number) < $length)
{
$number = "0" . $number;
}
return $number;
}
if (isset($_GET['tile']))
{
$tile = $_GET['tile'];
@ -14,7 +24,7 @@
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body padding="0" margin="0">
<body id="infobody">
<?php
if ($tile == "None")
{
@ -22,18 +32,61 @@
}
else
{
preg_match_all('/([we])(\d{3})([sn])(\d{2})/m', $tile, $matches, PREG_SET_ORDER, 0);
$we = $matches[0][1];
$lon = (int)$matches[0][2];
$sn = $matches[0][3];
$lat = (int)$matches[0][4];
if ($we == "w")
{
$lon *= -1;
}
if ($sn == "s")
{
$lat *= -1;
}
echo '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="450" height="450" version="1.1" xmlns="http://www.w3.org/2000/svg">
<image width="450" height="450" href="https://ows.terrestris.de/osm/service?VERSION=1.3.0&SERVICE=WMS&REQUEST=GetMap&LAYERS=OSM-WMS&STYLES=&CRS=EPSG:4326&BBOX=' . (string)$lat . ',' . (string)$lon . ',' . (string)($lat + 10) . ',' . (string)($lon + 10) . '&WIDTH=450&HEIGHT=450&FORMAT=image/png"/>';
// Connect to DB
$con = new mysqli($SQL_SERVER, $SQL_USER, $SQL_PASSWORD, $SQL_DATABASE, $SQL_PORT);
if ($con->connect_error)
{
quit();
}
$stmt = $con->prepare("SELECT secondLevel.name AS name, status.color AS color FROM secondLevel JOIN status ON secondLevel.status_id = status.id WHERE secondLevel.parent_id = (SELECT id FROM topLevel WHERE name = ?)");
$stmt->bind_param("s", $tile);
$stmt->execute();
$result = $stmt->get_result();
$ret = $result->fetch_all(MYSQLI_ASSOC);
if ($ret != False)
{
$tiles = [];
foreach($ret as $row)
{
$tiles[$row["name"]] = $row["color"];
}
$y = 405;
for ($i = $lat; $i < $lat + 10; $i++)
{
$x = 0;
for ($j = $lon; $j < $lon + 10; $j++)
{
$name = $we . clipNumber($j, 3) . $sn . clipNumber($i, 2);
//echo '<a href="progressinfo.php?tile=' . $name . '" target="progressinfo"><rect x="' . $x . '" y="' . $y . '" width="45" height="45" style="fill: ' . $tiles[$name] . '; opacity: 0.5;"/></a>';
echo '<rect x="' . $x . '" y="' . $y . '" width="45" height="45" style="fill: ' . $tiles[$name] . '; opacity: 0.5;"/>';
$x += 45;
}
$y -= 45;
}
}
echo '</svg>';
$stmt = $con->prepare("SELECT status.name AS status, COUNT(*) AS sCount, status.color AS color FROM secondLevel JOIN status ON secondLevel.status_id = status.id WHERE secondLevel.parent_id = (SELECT id FROM topLevel WHERE name = ?) GROUP BY status.id ORDER BY priority");
$stmt->bind_param("s", $tile);
$stmt->execute();
$result = $stmt->get_result();
$ret = $result->fetch_all(MYSQLI_ASSOC);
echo '<table border="1"><tr><td>Tile Name</td><td>' . $tile . '</td></tr>';
echo '<table id="statustable" border="1"><tr><td>Tile Name</td><td>' . $tile . '</td></tr>';
foreach ($ret as $row)
{
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';

View file

@ -1,6 +1,22 @@
#container {
#container
{
display: flex;
flex-wrap: wrap;
list-style: none;
align-content: flex-start;
}
#infobody
{
margin: 0px;
padding: 0px;
}
#statustable
{
position: absolute;
top: 0px;
left: 457px;
}
svg
{
padding-right: 7px;
}