{% /* * Part of AREDN® -- Used for creating Amateur Radio Emergency Data Networks * Copyright (C) 2024 Tim Wilkinson * See Contributors file for additional contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Additional Terms: * * Additional use restrictions exist on the AREDN® trademark and logo. * See AREDNLicense.txt for more info. * * Attributions to the AREDN® Project must be retained in the source code. * If importing this code into a new or existing project attribution * to the AREDN® project must be added to the source code. * * You must not misrepresent the origin of the material contained within. * * Modified versions must be modified to attribute to the original source * and be marked in reasonable ways as differentiate it from the original * version */ %} {% if (request.env.REQUEST_METHOD === "PUT") { configuration.prepareChanges(); if ("gridsquare" in request.args) { if (match(request.args.gridsquare, /^[A-X][A-X]\d\d[a-x][a-x]$/)) { uciMesh.set("aredn", "@location[0]", "gridsquare", request.args.gridsquare); } else if (request.args.gridsquare === "") { uciMesh.set("aredn", "@location[0]", "gridsquare", ""); } } if ("lat" in request.args) { if (request.args.lat > -90 && request.args.lat < 90) { uciMesh.set("aredn", "@location[0]", "lat", request.args.lat); } else if (request.args.lat === "") { uciMesh.set("aredn", "@location[0]", "lat", ""); } uciMesh.set("aredn", "@location[0]", "source", ""); } if ("lon" in request.args) { if (request.args.lon > -180 && request.args.lon < 180) { uciMesh.set("aredn", "@location[0]", "lon", request.args.lon); } else if (request.args.lon === "") { uciMesh.set("aredn", "@location[0]", "lon", ""); } uciMesh.set("aredn", "@location[0]", "source", ""); } if (request.args.gps_enable) { uciMesh.set("aredn", "@location[0]", "gps_enable", request.args.gps_enable === "on" ? "1" : "0"); } if ("mapurl" in request.args) { if (match(request.args.mapurl, constants.reUrl)) { uciMesh.set("aredn", "@location[0]", "map", request.args.mapurl); } } uciMesh.commit("aredn"); print(_R("changes")); return; } if (request.env.REQUEST_METHOD === "DELETE") { configuration.revertModalChanges(); print(_R("changes")); return; } const map = uciMesh.get("aredn", "@location[0]", "map"); const lat = uciMesh.get("aredn", "@location[0]", "lat") ?? 37; const lon = uciMesh.get("aredn", "@location[0]", "lon") ?? -122; const gridsquare = uciMesh.get("aredn", "@location[0]", "gridsquare"); const mapurl = map ? replace(replace(map, "(lat)", lat), "(lon)", lon) : null; %}
{{_R("dialog-header", "Location")}}
{% if (mapurl) { %}
{% } %}
Latitude
Node's latitude
{{_H("The latitude of this node. This information is used to determine the distance between this node and others and is required to optimize connection latency and bandwidth.")}}
Longitude
Node's longitude
{{_H("The longitude of this node. This information is used to determine the distance between this node and others and is required to optimize connection latency and bandwidth.")}}
Gridsquare
Maidenhead gridsquare
{{_H("A gridsquare is a 6 character (2 uppercase letters, 2 digits, 2 lowercase letters) designation of the node's location. A gridsquare is approximately 3x4 miles in size.")}} {{_R("dialog-advanced")}}
{% if (includeAdvanced) { %}
GPS Location
Use local or network GPS to set location
{{_R("switch", { name: "gps_enable", value: uciMesh.get("aredn", "@location[0]", "gps_enable") === "1" })}}
{{_H("Use either a local GPS devices to set the location, or search for a GPS device on another local node, and use its GPS to set our location.")}}
Map URL
URL for embedded map
{{_H("The map URL is used to embed maps in this page (see above) and in other node pages. The (lat) and (lon) parameters in the URL are expanded before the URL is used.")}} {% } %}
{{_R("dialog-footer")}}