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>
|
<button type="submit" class="button button-primary">Speichern</button>
|
||||||
<a href="?module=devices&action=list" class="button">Abbrechen</a>
|
<a href="?module=devices&action=list" class="button">Abbrechen</a>
|
||||||
<?php if ($isEdit): ?>
|
<?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; ?>
|
<?php endif; ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
@@ -267,11 +267,7 @@ $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []);
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
function confirmDelete(link, id, connectionCount, portCount, moduleCount) {
|
||||||
if (event && typeof event.preventDefault === 'function') {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (confirm('Dieses Gerät wirklich löschen?')) {
|
if (confirm('Dieses Gerät wirklich löschen?')) {
|
||||||
const hasDependencies = (connectionCount > 0) || (portCount > 0) || (moduleCount > 0);
|
const hasDependencies = (connectionCount > 0) || (portCount > 0) || (moduleCount > 0);
|
||||||
if (hasDependencies) {
|
if (hasDependencies) {
|
||||||
@@ -289,15 +285,16 @@ function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
|||||||
if (!confirm(dependencyMessage)) {
|
if (!confirm(dependencyMessage)) {
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = '?module=devices&action=delete&id=' + encodeURIComponent(id);
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []);
|
|||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a href="?module=devices&action=edit&id=<?php echo $d['id']; ?>" class="button button-small">Bearbeiten</a>
|
<a href="?module=devices&action=edit&id=<?php echo $d['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||||
<a href="?module=devices&action=delete&id=<?php echo (int)$d['id']; ?>" class="button button-small button-danger" onclick="return confirmDelete(event, <?php echo (int)$d['id']; ?>, <?php echo (int)$d['connection_count']; ?>, <?php echo (int)$d['port_count']; ?>, <?php echo (int)$d['module_count']; ?>)">Löschen</a>
|
<a href="?module=devices&action=delete&id=<?php echo (int)$d['id']; ?>" class="button button-small button-danger" onclick="return confirmDelete(this, <?php echo (int)$d['id']; ?>, <?php echo (int)$d['connection_count']; ?>, <?php echo (int)$d['port_count']; ?>, <?php echo (int)$d['module_count']; ?>)">Löschen</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -350,11 +350,7 @@ $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []);
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
function confirmDelete(link, id, connectionCount, portCount, moduleCount) {
|
||||||
if (event && typeof event.preventDefault === 'function') {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (confirm('Dieses Gerät wirklich löschen?')) {
|
if (confirm('Dieses Gerät wirklich löschen?')) {
|
||||||
const hasDependencies = (connectionCount > 0) || (portCount > 0) || (moduleCount > 0);
|
const hasDependencies = (connectionCount > 0) || (portCount > 0) || (moduleCount > 0);
|
||||||
if (hasDependencies) {
|
if (hasDependencies) {
|
||||||
@@ -372,15 +368,16 @@ function confirmDelete(event, id, connectionCount, portCount, moduleCount) {
|
|||||||
if (!confirm(dependencyMessage)) {
|
if (!confirm(dependencyMessage)) {
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = '?module=devices&action=delete&id=' + encodeURIComponent(id);
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user