summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorUdo Walter2017-10-18 15:50:13 +0200
committerUdo Walter2017-10-18 15:50:13 +0200
commit663fd954b58e8b6376ecf67110876fa91f0008df (patch)
treec89d5dbf4adbc9b086e02e0ca706154330d2796b /modules-available/locations
parent[sysconfig] removed redundant horizontal lines (diff)
downloadslx-admin-663fd954b58e8b6376ecf67110876fa91f0008df.tar.gz
slx-admin-663fd954b58e8b6376ecf67110876fa91f0008df.tar.xz
slx-admin-663fd954b58e8b6376ecf67110876fa91f0008df.zip
[locations] added warning if subnets are marked for deletion; locations now scroll into view; subnet list now sorted by startip;
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/lang/de/template-tags.json1
-rw-r--r--modules-available/locations/lang/en/template-tags.json1
-rw-r--r--modules-available/locations/page.inc.php2
-rw-r--r--modules-available/locations/templates/location-subnets.html22
-rw-r--r--modules-available/locations/templates/locations.html24
5 files changed, 45 insertions, 5 deletions
diff --git a/modules-available/locations/lang/de/template-tags.json b/modules-available/locations/lang/de/template-tags.json
index 72f6c4f2..04d10d06 100644
--- a/modules-available/locations/lang/de/template-tags.json
+++ b/modules-available/locations/lang/de/template-tags.json
@@ -6,6 +6,7 @@
"lang_deleteChildLocations": "Untergeordnete Orte ebenfalls l\u00f6schen",
"lang_deleteLocation": "Ort l\u00f6schen",
"lang_deleteSubnet": "Bereich l\u00f6schen",
+ "lang_deleteSubnetWarning": "Alle zum L\u00f6schen markierten Subnetze werden gelöscht. Diese Aktion kann nicht r\u00fcckg\u00e4ngig gemacht werden.",
"lang_editConfigVariables": "Konfig.-Variablen",
"lang_editRoomplan": "Raumplan bearbeiten",
"lang_endAddress": "Endadresse",
diff --git a/modules-available/locations/lang/en/template-tags.json b/modules-available/locations/lang/en/template-tags.json
index 720e029f..e3c0b056 100644
--- a/modules-available/locations/lang/en/template-tags.json
+++ b/modules-available/locations/lang/en/template-tags.json
@@ -6,6 +6,7 @@
"lang_deleteChildLocations": "Delete child locations aswell",
"lang_deleteLocation": "Delete location",
"lang_deleteSubnet": "Delete range",
+ "lang_deleteSubnetWarning": "All subnets marked for deletion will be deleted. This cannot be undone!",
"lang_editConfigVariables": "Config vars",
"lang_editRoomplan": "Edit roomplan",
"lang_endAddress": "End address",
diff --git a/modules-available/locations/page.inc.php b/modules-available/locations/page.inc.php
index ed78a6c7..d9bc7130 100644
--- a/modules-available/locations/page.inc.php
+++ b/modules-available/locations/page.inc.php
@@ -316,7 +316,7 @@ class Page_Locations extends Page
}
if ($getAction === 'showsubnets') {
$res = Database::simpleQuery("SELECT subnetid, startaddr, endaddr, locationid FROM subnet
- WHERE locationid IN (:locations)",
+ WHERE locationid IN (:locations) ORDER BY startaddr ASC",
array("locations" => User::getAllowedLocations("location.view")));
$rows = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
diff --git a/modules-available/locations/templates/location-subnets.html b/modules-available/locations/templates/location-subnets.html
index 9505ceac..2cc8e98b 100644
--- a/modules-available/locations/templates/location-subnets.html
+++ b/modules-available/locations/templates/location-subnets.html
@@ -1,6 +1,6 @@
<div class="slx-well">
<div class="slx-bold">{{lang_locationSettings}}</div>
- <form method="post" action="?do=Locations">
+ <form id="locationForm{{locationid}}" method="post" action="?do=Locations">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="action" value="updatelocation">
<input type="hidden" name="locationid" value="{{locationid}}">
@@ -86,7 +86,7 @@
</div>
<div class="col-md-4 text-right">
<button style="margin-right: 10px" {{^deleteAllowed}}disabled{{/deleteAllowed}} type="button" class="btn btn-danger" data-toggle="modal" data-target="#deleteLocationModal{{locationid}}"><span class="glyphicon glyphicon-trash"></span> {{lang_deleteLocation}}</button>
- <button {{^saveButton}}disabled{{/saveButton}} type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
+ <button onclick="deleteSubnetWarning('{{locationid}}')" {{^saveButton}}disabled{{/saveButton}} type="button" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
</div>
</div>
@@ -102,11 +102,25 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
- <button type="submit" class="btn btn-sm btn-danger" name="deletelocation" value="{{locationid}}"><span class="glyphicon glyphicon-trash"></span> {{lang_deleteLocation}}</button>
+ <button type="submit" class="btn btn-danger" name="deletelocation" value="{{locationid}}"><span class="glyphicon glyphicon-trash"></span> {{lang_deleteLocation}}</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="modal fade" id="saveWarningModal{{locationid}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" style="width: 400px" role="document">
+ <div class="modal-content">
+ <div class="modal-body">
+ {{lang_deleteSubnetWarning}}
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
+ <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}</button>
</div>
</div>
</div>
</div>
</form>
-</div>
+</div> \ No newline at end of file
diff --git a/modules-available/locations/templates/locations.html b/modules-available/locations/templates/locations.html
index 238d6630..fb09a45e 100644
--- a/modules-available/locations/templates/locations.html
+++ b/modules-available/locations/templates/locations.html
@@ -157,6 +157,7 @@ function slxOpenLocation(e, lid) {
existing.show();
$(e).closest('tr').addClass('active slx-bold');
slxLastLocation = existing;
+ scollIntoView(existing);
}
return;
}
@@ -166,10 +167,24 @@ function slxOpenLocation(e, lid) {
$(e).closest('tr').addClass('active slx-bold').after(tr);
td.load('?do=Locations&action=showlocation&locationid=' + lid, function() {
slxAttachCidr();
+ scollIntoView(tr);
});
slxLastLocation = tr;
}
+function scollIntoView(el) {
+ var offset = $(el).offset();
+ var win = $(window);
+ var h = $(el).height();
+ if (offset.top + h > win.scrollTop() + win.height()) {
+ offset.top -= win.height();
+ offset.top += h;
+ $('html, body').animate({
+ scrollTop: offset.top
+ });
+ }
+}
+
function slxAddSubnetRow(e, lid) {
var tr = $('#loc-sub-' + lid);
tr.before('<tr id="row' + slxAddCounter + '" class="cidrmagic">\
@@ -189,5 +204,14 @@ function removeNewSubnetRow(r) {
function slxConfirm() {
return confirm('{{lang_areYouSureNoUndo}}');
}
+
+function deleteSubnetWarning(locid) {
+ var form = $("#locationForm"+locid);
+ if (form.find("input[type=checkbox]:checked").length > 0) {
+ $("#saveWarningModal"+locid).modal();
+ } else {
+ form.submit();
+ }
+}
// -->
</script>