From 100e75084060b6e23dc90f66210ec4c48c629931 Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Tue, 13 Oct 2020 18:24:24 +0200 Subject: [locationinfo] add forward link to location module + delete some unused code --- modules-available/locationinfo/clientscript.js | 62 ---------------------- .../locationinfo/lang/de/template-tags.json | 2 + .../locationinfo/lang/en/template-tags.json | 2 + .../templates/ajax-config-location.html | 13 ++++- .../locationinfo/templates/page-locations.html | 1 - .../locations/templates/locations.html | 10 +++- 6 files changed, 24 insertions(+), 66 deletions(-) (limited to 'modules-available') diff --git a/modules-available/locationinfo/clientscript.js b/modules-available/locationinfo/clientscript.js index 25c255fb..f8309a8a 100644 --- a/modules-available/locationinfo/clientscript.js +++ b/modules-available/locationinfo/clientscript.js @@ -89,65 +89,3 @@ function simpleToExpert() { } return retval; } - -/** - * Triggered when the form is submitted - */ -function submitLocationSettings(event) { - var schedule, s, e; - var badFormat = false; - $('#settings-outer').find('.red-bg').removeClass('red-bg'); - if ($('#week-open').length > 0) { - schedule = simpleToExpert(); - for (var i = 0; i < schedule.length; ++i) { - s = getTime(schedule[i].openingtime); - e = getTime(schedule[i].closingtime); - if (s === false) { - $(schedule[i].tag + '-open').addClass('red-bg'); - badFormat = true; - } - if (e === false || e <= s) { - $(schedule[i].tag + '-close').addClass('red-bg'); - badFormat = true; - } - } - } else { - // Serialize - schedule = []; - $('#expert-table').find('.expert-row').each(function () { - var $t = $(this); - if ($t.find('.i-delete').is(':checked')) return; // Skip marked as delete - var entry = { - 'days': [], - 'openingtime': $t.find('.i-openingtime').val(), - 'closingtime': $t.find('.i-closingtime').val() - }; - for (var i = 0; i < allDays.length; ++i) { - if ($t.find('.i-' + allDays[i]).is(':checked')) { - entry['days'].push(allDays[i]); - } - } - if (entry.openingtime.length === 0 && entry.closingtime.length === 0 && entry.days.length === 0) return; // Also ignore empty lines - s = getTime(entry.openingtime); - e = getTime(entry.closingtime); - if (s === false) { - $t.find('.i-openingtime').addClass('red-bg'); - badFormat = true; - } - if (e === false || e <= s) { - $t.find('.i-closingtime').addClass('red-bg'); - badFormat = true; - } - if (entry.days.length === 0) { - $t.find('.days-box').addClass('red-bg'); - badFormat = true; - } - if (badFormat) return; - schedule.push(entry); - }); - } - if (badFormat) { - event.preventDefault(); - } - $('#json-openingtimes').val(JSON.stringify(schedule)); -} \ No newline at end of file diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json index 90a38885..42d6c936 100644 --- a/modules-available/locationinfo/lang/de/template-tags.json +++ b/modules-available/locationinfo/lang/de/template-tags.json @@ -43,6 +43,8 @@ "lang_friday": "Freitag", "lang_general": "Allgemein", "lang_generalSettings": "Allgemeine Einstellungen", + "lang_goToLocation": "Gehe zu Raum", + "lang_goToLocationWarning": "Weiterleitung zum Raum-Modul", "lang_hostnameTooltip": "Zeige kurzen Hostnamen in Rechner-Piktogramm", "lang_ignoreSslTooltip": "Akzeptiere ung\u00fcltige, abgelaufene oder selbstsignierte SSL-Zertifikate", "lang_insecureSsl": "Unsicheres SSL", diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json index 64846ab6..c95208af 100644 --- a/modules-available/locationinfo/lang/en/template-tags.json +++ b/modules-available/locationinfo/lang/en/template-tags.json @@ -43,6 +43,8 @@ "lang_friday": "Friday", "lang_general": "General", "lang_generalSettings": "General Settings", + "lang_goToLocation": "GoTo Location", + "lang_goToLocationWarning": "Forward to Location-Module", "lang_hostnameTooltip": "Show simple hostname inside computer icon", "lang_ignoreSslTooltip": "Accept invalid, expired or self-signed ssl certificates", "lang_insecureSsl": "Insecure SSL", diff --git a/modules-available/locationinfo/templates/ajax-config-location.html b/modules-available/locationinfo/templates/ajax-config-location.html index f7e96b9d..2ae049d1 100644 --- a/modules-available/locationinfo/templates/ajax-config-location.html +++ b/modules-available/locationinfo/templates/ajax-config-location.html @@ -1,6 +1,7 @@

{{lang_openingTime}}

+ {{^expertMode}}
@@ -79,13 +80,21 @@
{{lang_openingTime}}
{{lang_closingTime}}
-
{{lang_delete}}
-
+
+ + + {{lang_goToLocation}} + + +
+
+ +

{{lang_remoteSchedule}}

diff --git a/modules-available/locationinfo/templates/page-locations.html b/modules-available/locationinfo/templates/page-locations.html index 9635268c..26f0b621 100644 --- a/modules-available/locationinfo/templates/page-locations.html +++ b/modules-available/locationinfo/templates/page-locations.html @@ -78,7 +78,6 @@ document.addEventListener("DOMContentLoaded", function () { $('#location-modal-header').text("[" + locationId + "] " + locationName); $('#location-modal').modal('show').find('.modal-body').load("?do=locationinfo&action=config-location&id=" + locationId); }); - $('#settings-form').submit(submitLocationSettings); }); //--> diff --git a/modules-available/locations/templates/locations.html b/modules-available/locations/templates/locations.html index 12d401c1..ed049d73 100644 --- a/modules-available/locations/templates/locations.html +++ b/modules-available/locations/templates/locations.html @@ -55,7 +55,7 @@ {{locationname}} {{/show-only}} {{^show-only}} - + {{locationname}} @@ -167,6 +167,14 @@ var slxLastLocation = false; var newRowCounter = 0; +document.addEventListener("DOMContentLoaded", function() { + var id = window.location.hash.substring(1); + if (id !== "") { + var loc_dom = document.getElementById(id); + slxOpenLocation(loc_dom, id); + } +}); + function slxAddLocationRow() { $("#saveLocationRows").show(); var tr = $('#lasttr'); -- cgit v1.2.3-55-g7522