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

Loading…
Cancel
Save