Don't make gutters and stuff when embedded

master
Skylar Ittner 4 years ago
parent 870d93ffe3
commit b7cb91d4ca

@ -32,229 +32,238 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
}
?>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<?php
if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) {
?>
<div class="card">
<h3 class="card-header d-flex">
<div>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
<?php if (!isset($_GET["embed"])) { ?>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<?php } else { ?>
<div class="row justify-content-center">
<div class="col-12">
<?php } ?>
<?php
if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]))) {
?>
<div class="card">
<h3 class="card-header d-flex">
<div>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
</div>
</h3>
<div class="card-body">
<?php
if (!empty($_GET["id"])) {
?>
<p class="text-danger">No machine with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
<?php
}
?>
<p>
Enter a Netsyms machine ID number or serial number.
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
</div>
</h3>
<div class="card-body">
<?php
if (!empty($_GET["id"])) {
?>
<p class="text-danger">No machine with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
<?php
} else {
if (Machine::exists($_GET["id"])) {
$machine = new Machine($_GET['id']);
} else {
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
}
?>
<p>
Enter a Netsyms machine ID number or serial number.
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
</div>
<?php
} else {
if (Machine::exists($_GET["id"])) {
$machine = new Machine($_GET['id']);
} else {
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
}
?>
<div class="card">
<h3 class="card-header d-flex">
<div>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
</div>
</h3>
<div class="card-body">
<div class="row">
<div class="col-12 mb-3">
<div class="list-group">
<div class="list-group-item">
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
</div>
<?php if (!empty($machine->getOS())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getSerial())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getManufacturer())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getModel())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
</div>
<?php } ?>
<?php
if ($machine->getCondition() > 0) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Condition"); ?></b>: <?php
$val = $machine->getCondition();
$filled = floor($val);
$empty = 10;
while ($filled > 0) {
$filled--;
$empty--;
echo "<i class=\"fas fa-star\"></i> ";
<div class="card">
<h3 class="card-header d-flex">
<div>
<i class="fas fa-desktop"></i> <?php $Strings->get("Machine Info"); ?>
</div>
</h3>
<div class="card-body">
<div class="row">
<div class="col-12 mb-3">
<div class="list-group">
<div class="list-group-item">
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
</div>
<?php if (!empty($machine->getOS())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getSerial())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getManufacturer())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
</div>
<?php } ?>
<?php if (!empty($machine->getModel())) { ?>
<div class="list-group-item">
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
</div>
<?php } ?>
<?php
if ($machine->getCondition() > 0) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Condition"); ?></b>: <?php
$val = $machine->getCondition();
$filled = floor($val);
$empty = 10;
while ($filled > 0) {
$filled--;
$empty--;
echo "<i class=\"fas fa-star\"></i> ";
}
if ($val - floor($val) > 0.75) {
$empty--;
echo "<i class=\"fas fa-star\"></i> ";
} else if ($val - floor($val) > 0.25) {
$empty--;
echo "<i class=\"fas fa-star-half-alt\"></i> ";
}
while ($empty > 0) {
$empty--;
echo "<i class=\"far fa-star\"></i> ";
}
echo " ($val/10)";
?>
</div>
<?php
}
if ($val - floor($val) > 0.75) {
$empty--;
echo "<i class=\"fas fa-star\"></i> ";
} else if ($val - floor($val) > 0.25) {
$empty--;
echo "<i class=\"fas fa-star-half-alt\"></i> ";
?>
<?php
if ($machine->getPrice() > 0) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
</div>
<?php
}
while ($empty > 0) {
$empty--;
echo "<i class=\"far fa-star\"></i> ";
?>
<?php
if (!empty($machine->getPublicNotes())) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Notes"); ?></b>: <?php echo htmlspecialchars($machine->getPublicNotes()); ?>
</div>
<?php
}
echo " ($val/10)";
?>
</div>
<?php
}
?>
<?php
if ($machine->getPrice() > 0) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
</div>
<?php
}
?>
<?php
if (!empty($machine->getPublicNotes())) {
?>
<div class="list-group-item">
<b><?php $Strings->get("Notes"); ?></b>: <?php echo htmlspecialchars($machine->getPublicNotes()); ?>
</div>
<?php
}
?>
</div>
</div>
<?php
$components = $machine->getComponents();
</div>
if (count($components) > 0) {
?>
<div class="col-sm-6 mb-3">
<h6>Components:</h6>
<div class="list-group">
<?php
foreach ($components as $c) {
?>
<div class = "list-group-item">
<?php
$components = $machine->getComponents();
<b><?php echo $c->getTypeName(); ?></b><br />
if (count($components) > 0) {
?>
<div class="col-sm-6 mb-3">
<h6>Components:</h6>
<div class="list-group">
<?php
if (!empty($c->getModel())) {
foreach ($components as $c) {
?>
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($c->getModel()); ?><br />
<?php
}
<div class = "list-group-item">
if (!empty($c->getCapacity())) {
?>
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
<?php
}
<b><?php echo $c->getTypeName(); ?></b><br />
<?php
if (!empty($c->getModel())) {
?>
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($c->getModel()); ?><br />
<?php
}
if (!empty($c->getSerial())) {
?>
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
<?php
}
if (!empty($c->getCapacity())) {
?>
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
<?php
}
if (!empty($c->getTestedDate())) {
?>
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br />
<?php
}
if (!empty($c->getSerial())) {
?>
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
<?php
}
if (!empty($c->getPrice())) {
?>
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?>
<?php
}
if (!empty($c->getTestedDate())) {
?>
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["datetime_format"], strtotime($c->getTestedDate())); ?><br />
<?php
}
if (!empty($c->getPublicNotes())) {
?>
<div>
<b>Notes:</b><br />
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
if (!empty($c->getPrice())) {
?>
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?>
<?php
}
if (!empty($c->getPublicNotes())) {
?>
<div>
<b>Notes:</b><br />
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
<?php
}
</div>
<?php
}
$history = $machine->getEvents();
$history = $machine->getEvents();
if (count($history) > 0) {
?>
<div class="col-sm-6 mb-3">
<h6>Events:</h6>
<div class="list-group">
<?php
foreach ($history as $h) {
echo "<div class=\"list-group-item\">\n";
echo "<b>$h[eventname]</b> on " . date($SETTINGS["datetime_format"], strtotime($h['date'])) . "<br />\n";
if (!empty($h['publicnotes'])) {
echo "<div><b>Notes:</b><br /><div class=\"ml-3\">" . htmlspecialchars($h['publicnotes']) . "</div></div>";
}
echo "\n</div>\n";
}
if (count($history) > 0) {
?>
</div>
<div class="col-sm-6 mb-3">
<h6>Events:</h6>
<div class="list-group">
<?php
foreach ($history as $h) {
echo "<div class=\"list-group-item\">\n";
echo "<b>$h[eventname]</b> on " . date($SETTINGS["datetime_format"], strtotime($h['date'])) . "<br />\n";
if (!empty($h['publicnotes'])) {
echo "<div><b>Notes:</b><br /><div class=\"ml-3\">" . htmlspecialchars($h['publicnotes']) . "</div></div>";
}
echo "\n</div>\n";
}
?>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?>
<div class="card-body">
<p>
Look up another machine:
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
<?php } ?>
</div>
<?php
}
?>
<?php if (!isset($_GET["embed"])) { ?>
</div>
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?>
<div class="card-body">
<p>
Look up another machine:
</p>
<form method="GET">
<input type="text" name="id" class="form-control" placeholder="Machine ID Number" required />
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
</form>
</div>
<?php } ?>
</div>
<?php
}
?>
</div>
</div>
<?php } else { ?></div>
</div>
</div>
<?php } ?>
<?php
// Send message to parent frame with our height so they can adjust the iframe

Loading…
Cancel
Save