update
This commit is contained in:
parent
5733e855f7
commit
34fb393b55
|
|
@ -23,6 +23,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
if (isset($_POST['action'])) {
|
if (isset($_POST['action'])) {
|
||||||
$interface = $_POST['interface'] ?? '';
|
$interface = $_POST['interface'] ?? '';
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
|
$multicast = isset($_POST['multicast']) ? 'on' : 'off';
|
||||||
|
|
||||||
if ($action === 'save') {
|
if ($action === 'save') {
|
||||||
// Save configuration
|
// Save configuration
|
||||||
|
|
@ -33,7 +34,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
'netmask' => $_POST['netmask'] ?? '',
|
'netmask' => $_POST['netmask'] ?? '',
|
||||||
'gateway' => $_POST['gateway'] ?? '',
|
'gateway' => $_POST['gateway'] ?? '',
|
||||||
'dns' => $_POST['dns'] ?? '',
|
'dns' => $_POST['dns'] ?? '',
|
||||||
'multicast' => $_POST['multicast'] ?? 'off'
|
'multicast' => $multicast
|
||||||
];
|
];
|
||||||
|
|
||||||
$network_config[$interface] = $config;
|
$network_config[$interface] = $config;
|
||||||
|
|
@ -158,16 +159,23 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Multicast</label>
|
<label class="form-label">Multicast</label>
|
||||||
<div class="switch">
|
|
||||||
<input type="checkbox" id="multicast-<?php echo $selected_interface; ?>"
|
<div class="form-check form-switch">
|
||||||
name="multicast" value="on" <?php echo ($interface_data[$selected_interface]['config']['multicast'] ?? 'off') === 'on' ? 'checked' : ''; ?>>
|
<input
|
||||||
<span class="slider"></span>
|
class="form-check-input multicast-toggle"
|
||||||
</div>
|
type="checkbox"
|
||||||
<label for="multicast-<?php echo $selected_interface; ?>" class="switch-label" id="multicast-label-<?php echo $selected_interface; ?>">
|
id="multicast-<?php echo $selected_interface; ?>"
|
||||||
<?php echo ($interface_data[$selected_interface]['config']['multicast'] ?? 'off') === 'on' ? 'Enabled' : 'Disabled'; ?>
|
name="multicast"
|
||||||
</label>
|
value="on"
|
||||||
|
<?php echo (($interface_data[$selected_interface]['config']['multicast'] ?? 'off') === 'on') ? 'checked' : ''; ?>>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label
|
||||||
|
id="multicast-label-<?php echo $selected_interface; ?>"
|
||||||
|
for="multicast-<?php echo $selected_interface; ?>">
|
||||||
|
<?php echo (($interface_data[$selected_interface]['config']['multicast'] ?? 'off') === 'on') ? 'Enabled' : 'Disabled'; ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Configuration Method</label>
|
<label class="form-label">Configuration Method</label>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
|
@ -265,24 +273,32 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
|
||||||
|
|
||||||
// Multicast toggle switch functionality - simplified approach
|
// Multicast toggle switch functionality - simplified approach
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Add event listeners to all multicast checkboxes
|
|
||||||
const checkboxes = document.querySelectorAll('input[id^="multicast-"]');
|
|
||||||
|
|
||||||
checkboxes.forEach(checkbox => {
|
document.querySelectorAll('.multicast-toggle').forEach(function(checkbox) {
|
||||||
checkbox.addEventListener('change', function() {
|
|
||||||
// Extract interface name from ID (format: multicast-eth0)
|
checkbox.addEventListener('click', function() {
|
||||||
const idParts = this.id.split('-');
|
|
||||||
const interfaceName = idParts[1]; // Get the interface name part
|
const interfaceName = this.id.replace('multicast-', '');
|
||||||
|
|
||||||
|
const label = document.getElementById(
|
||||||
|
'multicast-label-' + interfaceName
|
||||||
|
);
|
||||||
|
|
||||||
if (interfaceName) {
|
|
||||||
const label = document.getElementById(`multicast-label-${interfaceName}`);
|
|
||||||
if (label) {
|
if (label) {
|
||||||
// Update label text based on checkbox state
|
label.textContent = this.checked ?
|
||||||
label.textContent = this.checked ? 'Enabled' : 'Disabled';
|
'Enabled' :
|
||||||
}
|
'Disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
'Multicast:',
|
||||||
|
interfaceName,
|
||||||
|
this.checked ? 'on' : 'off'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue