WIP: #8
This commit is contained in:
@@ -167,7 +167,7 @@ $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []);
|
||||
<button type="submit" class="button button-primary">Speichern</button>
|
||||
<a href="?module=devices&action=list" class="button">Abbrechen</a>
|
||||
<?php if ($isEdit): ?>
|
||||
<a href="?module=devices&action=delete&id=<?php echo (int)$deviceId; ?>" class="button button-danger" onclick="return confirmDelete(event, <?php echo (int)$deviceId; ?>, <?php echo (int)$dependencyCounts['connection_count']; ?>, <?php echo (int)$dependencyCounts['port_count']; ?>, <?php echo (int)$dependencyCounts['module_count']; ?>)">Löschen</a>
|
||||
<a href="?module=devices&action=delete&id=<?php echo (int)$deviceId; ?>" class="button button-danger" onclick="return confirmDelete(this, <?php echo (int)$deviceId; ?>, <?php echo (int)$dependencyCounts['connection_count']; ?>, <?php echo (int)$dependencyCounts['port_count']; ?>, <?php echo (int)$dependencyCounts['module_count']; ?>)">Löschen</a>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
|
||||
@@ -267,11 +267,7 @@ $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []);
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
||||
if (event && typeof event.preventDefault === 'function') {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function confirmDelete(link, id, connectionCount, portCount, moduleCount) {
|
||||
if (confirm('Dieses Gerät wirklich löschen?')) {
|
||||
const hasDependencies = (connectionCount > 0) || (portCount > 0) || (moduleCount > 0);
|
||||
if (hasDependencies) {
|
||||
@@ -289,15 +285,16 @@ function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
||||
if (!confirm(dependencyMessage)) {
|
||||
return false;
|
||||
}
|
||||
window.location.href = '?module=devices&action=delete&id=' + encodeURIComponent(id) + '&force=1';
|
||||
window.location.href = (link && link.href ? link.href : ('?module=devices&action=delete&id=' + encodeURIComponent(id))) + '&force=1';
|
||||
return false;
|
||||
}
|
||||
|
||||
window.location.href = '?module=devices&action=delete&id=' + encodeURIComponent(id);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user