2024-02-09 16:46:49 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>PiXelTube Web Interface</title>
|
|
|
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
|
|
|
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div class="container mt-5">
|
|
|
|
<h1 class="mb-4">PiXelTube Web Interface</h1>
|
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th scope="col">Tube ID</th>
|
|
|
|
<th scope="col">Universe</th>
|
|
|
|
<th scope="col">DMX Address</th>
|
|
|
|
<th scope="col">Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="tubeList">
|
2024-02-17 00:31:04 +00:00
|
|
|
<?php
|
|
|
|
$server = "localhost";
|
|
|
|
$username = "pxm";
|
|
|
|
$password = "pixel";
|
2024-02-17 00:39:21 +00:00
|
|
|
$db_name = "pixeltube_db";
|
2024-02-17 00:31:04 +00:00
|
|
|
|
2024-02-17 00:41:18 +00:00
|
|
|
$conn = new mysqli($server, $username, $password, $db_name);
|
2024-02-17 00:31:04 +00:00
|
|
|
|
|
|
|
if ($conn->connect_error) {
|
|
|
|
die("Connection failed: " . $conn->connect_error);
|
|
|
|
}
|
2024-02-17 00:32:10 +00:00
|
|
|
|
2024-02-17 00:36:10 +00:00
|
|
|
$sql_query = "SELECT id, mac_address, universe, dmx_address FROM tubes";
|
2024-02-17 00:41:46 +00:00
|
|
|
$result = $conn->query($sql_query);
|
2024-02-17 00:36:10 +00:00
|
|
|
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
// output data of each row
|
|
|
|
while($row = $result->fetch_assoc()) {
|
2024-02-17 00:51:23 +00:00
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<th>'.$row["id"].'</th>
|
|
|
|
<th>'.$row["universe"].'</th>
|
|
|
|
<th>'.$row["dmx_address"].'</th>
|
|
|
|
<th>
|
|
|
|
<form action="./settings.php?id='.$row["mac_address"].'">
|
|
|
|
<button type="submit" class="btn btn-secondary">Configure</button>
|
|
|
|
</form>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
';
|
2024-02-17 00:36:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo "0 results";
|
|
|
|
}
|
2024-02-17 00:31:04 +00:00
|
|
|
?>
|
2024-02-09 16:46:49 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2024-02-17 00:54:54 +00:00
|
|
|
<!-- Configure Modal -->
|
|
|
|
<div class="modal" id="configureModal" tabindex="-1" role="dialog" aria-labelledby="configureModalLabel" aria-hidden="true">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h5 class="modal-title" id="configureModalLabel">Configure DMX Address and Universe</h5>
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form id="configureForm">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="dmxAddress">DMX Address:</label>
|
|
|
|
<input type="text" class="form-control" id="dmxAddress" placeholder="Enter DMX Address">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="universe">Universe:</label>
|
|
|
|
<input type="text" class="form-control" id="universe" placeholder="Enter Universe">
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
// JavaScript to handle the modal and populate values when the button is clicked
|
|
|
|
$('#configureModal').on('show.bs.modal', function (event) {
|
|
|
|
var button = $(event.relatedTarget);
|
|
|
|
var macAddress = button.data('id');
|
|
|
|
var universe = button.data('universe');
|
|
|
|
var dmxAddress = button.data('dmx-address');
|
|
|
|
|
|
|
|
var modal = $(this);
|
|
|
|
modal.find('.modal-title').text('Configure DMX Address and Universe for Tube ID ' + macAddress);
|
|
|
|
modal.find('#dmxAddress').val(dmxAddress);
|
|
|
|
modal.find('#universe').val(universe);
|
|
|
|
});
|
|
|
|
|
|
|
|
// JavaScript to handle form submission
|
|
|
|
$('#configureForm').submit(function(event) {
|
|
|
|
// Add your logic here to handle form submission using AJAX or other methods
|
|
|
|
// You can access values with $('#dmxAddress').val() and $('#universe').val()
|
|
|
|
event.preventDefault();
|
|
|
|
$('#configureModal').modal('hide');
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2024-02-09 16:46:49 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|