Commit ba78d85c authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

lots of things updated, way more than I want to type about right now.

please test and let me know.

I will update (and create) and changelog file quite soon.

Enjoy!
parent ce3fec84
......@@ -20,7 +20,7 @@ You are unfortunaly on your own there.
It is a time consuming and computationaly expensive process, but can be done on "normal" hardware.
It also takes 100's of GB of HD space if you want to map the entire world, and that *does not* include the tiles themselves, that is only for the data required to **make** the map tiles.
A good place to start for more info is: [https://switch2osm.org/serving-tiles/](https://switch2osm.org/serving-tiles/)
If you attempt it, be patient, you *will* get it wrong more than a few times but in the end you might be suprised. :)
If you attempt it, be patient, you *will* get it wrong more than a few times but in the end you might be surprised. :)
You might be able to convice KG6WXC to create local map tiles for you, if the area you want is in the USA...
......@@ -48,7 +48,8 @@ It is **very important** to make sure your SQL username and password are correct
Also important is, if the system that this is running on cannot resolve "localnode.local.mesh" you can
change that in the user-settings.ini file.
There are many other things you can change in the ini files. Default Map center position, the hearder messages, etc.
There are many other things you can change in the ini files. Default Map center position, the header messages, etc.
*Please read* the comments in the user-settings.ini file for more info about the different settings.
There is also a "custom.ini" file that can be used for more site specific overrides if needed.
If you have a need to "hide" passwords, or set the system to use offline maps only, etc... this is the file to do it in.
......@@ -89,6 +90,10 @@ UPDATING
------------
Simply run a "git pull" from the meshmap directory and the scripts will be updated from the git repo.
The user-settings.inc, meshmap-settings.ini, cronscript.sh, and custom.inc files will *not* be affected by updating.
The settings in the ini files *may* still change in future versions.
For now tho, if the ini files change, and you still have the old ones in use, things will probably break! Be Warned!
Hopefully in the future this process can be more automated.
If you make changes beyond the user editable files I encourage you to perhaps push the changes upstream, please contact kg6wxc@gmail.com if you wish to do so.
I am making changes all the time, it would be a good idea to run "git pull" from time to time to find any updates.
......
......@@ -724,7 +724,7 @@ function load_Topology($whereClause = null, $orderBy = null)
*
* This routine adds the MapLayers needed
* the (navigator.online) controls the display for online or offline browsers
* No it doesn't, it doesn't tell you crap really... being on a LAN makes navigator.onLine true!!!
* No it doesn't, it doesn't tell you crap really... being on a LAN makes navigator.online true!!! DO NOT USE IT.
* It has no bearing whatsoever if internet access is available or not
*
*
......@@ -735,9 +735,7 @@ function add_MapLayers()
if($GLOBALS['mesh']) {
$offline_map_tiles = $GLOBALS['USER_SETTINGS']['offlineMapTileDir'];
$Content = <<< EOD
// navigator.onLine *DOES NOT* work!!
var offlineMapTiles = "$offline_map_tiles/{z}/{x}/{y}.png";
var offlineMapTiles = "$offline_map_tiles";
var defaultMap = new L.tileLayer(offlineMapTiles);
var baseLayers = {"Offline Map": defaultMap};
......@@ -745,8 +743,24 @@ if($GLOBALS['mesh']) {
\n\n
EOD;
}else {
$Content = "\n";
$baseLayersString = "var baseLayers = {";
$map_num = 0;
foreach ($GLOBALS['USER_SETTINGS']['inetTileServer'] as $map_name => $map_url) {
if(@strpos($map_name, "-Default")) {
$map_name = preg_replace('/-Default/', '', $map_name);
$Content .= "var defaultMap = new L.tileLayer('" . $map_url . "');\n";
$baseLayersString .= "\"" . $map_name . "\": defaultMap,";
}else {
$map_num++;
$Content .= "var map" . $map_num . " = new L.tileLayer('" . $map_url . "');\n";
$baseLayersString .= "\"" . $map_name . "\": map" . $map_num . ",";
}
}
$baseLayersString .= "};\n";
$Content .= $baseLayersString;
/*
$Content = <<< EOD
//if (navigator.onLine) <-- *DOES NOT* work. REMOVED
var OSMMapURL = '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var terrainMapURL = '//stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg';
var topoMapURL = '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png';
......@@ -759,6 +773,7 @@ EOD;
\n\n
EOD;
*/
}
return $Content;
}
......@@ -1070,9 +1085,30 @@ function instantiate_Map()
* Scale Control
*/
L.control.scale().addTo(map);\n
/*
*The "help" button
*/
var contents = "";
EOD;
// $help_msg = file_get_contents('../webpage/help_msg.html');
// $Content .= "L.Control.slideMenu(\"" . $help_msg . "\").addTo(map);\n";
$help_msg_file = fopen("help_msg.html", "r");
if ($help_msg_file) {
while (($line = fgets($help_msg_file)) != false) {
$Content .= "contents += \"" . trim(preg_replace('/\s\s+/', ' ', $line)) . "\";\n";
}
fclose($help_msg_file);
}else {
$Content .= "alert('Could not open help_msg.html');\n";
}
$Content .= "\nL.control.slideMenu(contents, {width: '400px'}).addTo(map);\n";
/* Attribution */
//attributionCtrl({position: 'bottomleft'}).addTo(map);\n
EOD;
return $Content;
}
......
No preview for this file type
.leaflet-control-slidemenu{
cursor: pointer;
}
.leaflet-menu{
position: absolute;
background-color: rgba(255, 255, 255, 0.95);
overflow: auto;
cursor: default;
z-index: 9999;
}
.leaflet-menu::-webkit-scrollbar{
width: 7px;
height: 7px;
background: #f2f2f2;
}
.leaflet-menu::-webkit-scrollbar-thumb{
border-radius: 2px;
background: #777;
}
.leaflet-menu-close-button{
background-color: transparent;
border: none;
font-size: 14pt;
color: #777;
cursor: pointer;
}
.leaflet-menu-close-button:hover{
color: #4285F4;
}
\ No newline at end of file
<!--
DO NOT use any quotation marks in this file!
Use a single quote (') if you need to add more HTML or to quote something.
This file is read in by PHP and changed line by line into a javascript string variable.
New Comments should be in HTML comment format, just like this one.
Again, QUOTATION MARKS ARE NOT ALLOWED IN THIS FILE!!!
(fixes for this are welcomed!)
-->
<h2>Requirements for a Node to be displayed on this map</h2>
<ol>
<li>It must be a real Node. Reserved addresses and advertised services will not display.</li>
<li>It must be reachable over the Mesh Network by this server.</li>
<li>It must be running AREDN code 3.16.0.1 or later. Earlier AREDN code, all BBHN code, and HSMM-Pi will not display.</li>
<li>It must have its Latitude and Longitude recorded on the Basic Setup configuration page within the node.
<br>
(This does not mean that the node has to register with the AREDN map server.
<br>
It only means that the node must know where it is located.)</li>
<li>The node must have been seen within the last 30 days by this server.
<br>
Nodes not seen for 30 days are purged from the database.
</li>
</ol>
<br>
<p><b>Troubleshooting why a node does not show up.</b></p>
<p>In most cases of a node not showing up on the map it is because the latitude and longitude has not been entered into the node.
<br>To check this, run the following in a browser for the node in question:
<br />
<pre>http://nodename.local.mesh:8080/cgi-bin/sysinfo.json</pre>
<br>
In the file that is produced, look for <code>lat:</code> and <code> lon:</code>.
<br>
If one or both are empty, then the node does not know its latitude and longitude and can not tell the map where it is located.
<br>
Simply put, if the map can not determine a location for a node, it can not put it on the map.
<br>
(How can you place a marker on a map without knowing where it is?)
<br>
<p><b>If you have multiple nodes in one location:</b></p>
You will only see one node on the map if you have more than 1 with the same coordinates.
<br>
This issue is being worked on.
<br>
For now, either slightly change the nodes lat and lon in the settings page, or try to use the <a href='admin/admin.php'>'admin'</a> interface.
<br>
The admin interface will allow you to change a nodes location without having to login to the node itself.
<br>
Please read the text on the admin pages for tips on using it.
\ No newline at end of file
L.Control.SlideMenu = L.Control.extend({
options: {
position: 'topleft',
menuposition: 'topleft', // topleft,topright,bottomleft,bottomright
width: '300px',
height: '100%',
direction: 'horizontal', // vertical or horizontal
changeperc: '10',
delay: '10'
},
initialize: function(innerHTML, options){
L.Util.setOptions(this, options);
this._innerHTML = innerHTML;
this._isLeftPosition = this.options.menuposition == 'topleft' ||
this.options.menuposition == 'bottomleft' ? true : false;
this._isTopPosition = this.options.menuposition == 'topleft' ||
this.options.menuposition == 'topright' ? true : false;
this._isHorizontal = this.options.direction == 'horizontal' ? true : false;
},
onAdd: function(map){
this._container = L.DomUtil.create('div', 'leaflet-control-slidemenu leaflet-bar leaflet-control');
var link = L.DomUtil.create('a', 'leaflet-bar-part leaflet-bar-part-single', this._container);
link.title = 'Menu';
L.DomUtil.create('span', 'fa fa-question', link);
this._menu = L.DomUtil.create('div', 'leaflet-menu', map._container);
this._menu.style.width = this.options.width;
this._menu.style.height = this.options.height;
if(this._isHorizontal){
var frominit = -(parseInt(this.options.width, 10));
if(this._isLeftPosition){
this._menu.style.left = '-' + this.options.width;
}
else{
this._menu.style.right = '-' + this.options.width;
}
if(this._isTopPosition){
this._menu.style.top = '0px';
}
else{
this._menu.style.bottom = '0px';
}
}
else{
var frominit = -(parseInt(this.options.height, 10));
if(this._isLeftPosition){
this._menu.style.left = '0px';
}
else{
this._menu.style.right = '0px';
}
if(this._isTopPosition){
this._menu.style.top = '-' + this.options.height;
}
else{
this._menu.style.bottom = '-' + this.options.height;
}
}
var closeButton = L.DomUtil.create('button', 'leaflet-menu-close-button fa', this._menu);
if(this._isHorizontal){
if(this._isLeftPosition){
closeButton.style.float = 'right';
L.DomUtil.addClass(closeButton, 'fa-chevron-left');
}
else{
closeButton.style.float = 'left';
L.DomUtil.addClass(closeButton, 'fa-chevron-right');
}
}
else{
if(this._isTopPosition){
closeButton.style.float = 'right';
L.DomUtil.addClass(closeButton, 'fa-chevron-up');
}
else{
closeButton.style.float = 'right';
L.DomUtil.addClass(closeButton, 'fa-chevron-down');
}
}
this._contents = L.DomUtil.create('div', 'leaflet-menu-contents', this._menu);
this._contents.innerHTML = this._innerHTML;
this._contents.style.clear = 'both';
if(this._isHorizontal){
var ispx = this.options.width.slice(-1) == 'x' ? true : false;
var unit = parseInt(this.options.width, 10) * parseInt(this.options.changeperc, 10) / 100;
}
else{
var ispx = this.options.height.slice(-1) == 'x' ? true : false;
var unit = parseInt(this.options.height, 10) * parseInt(this.options.changeperc, 10) / 100;
}
L.DomEvent.disableClickPropagation(this._menu);
L.DomEvent
.on(link, 'click', L.DomEvent.stopPropagation)
.on(link, 'click', function(){
// Open
this._animate(this._menu, frominit, 0, true, ispx, unit);
}, this)
.on(closeButton, 'click', L.DomEvent.stopPropagation)
.on(closeButton, 'click', function(){
// Close
this._animate(this._menu, 0, frominit, false, ispx, unit);
}, this);
L.DomEvent.on(this._menu, 'mouseover', function(){
map.scrollWheelZoom.disable();
});
L.DomEvent.on(this._menu, 'mouseout', function(){
map.scrollWheelZoom.enable();
});
return this._container;
},
onRemove: function(map){
//Remove sliding menu from DOM
map._container.removeChild(this._menu);
delete this._menu;
},
setContents: function(innerHTML){
this._innerHTML = innerHTML;
this._contents.innerHTML = this._innerHTML;
},
_animate: function(menu, from, to, isOpen, ispx, unit){
if(this._isHorizontal){
if(this._isLeftPosition){
menu.style.left = from + (ispx ? 'px' : '%');
}
else{
menu.style.right = from + (ispx ? 'px' : '%');
}
}
else{
if(this._isTopPosition){
menu.style.top = from + (ispx ? 'px' : '%');
}
else{
menu.style.bottom = from + (ispx ? 'px' : '%');
}
}
if(from != to){
setTimeout(function(slideMenu){
var value = isOpen ? from + unit : from - unit;
slideMenu._animate(slideMenu._menu, value, to, isOpen, ispx, unit);
}, parseInt(this.options.delay), this);
}
else{
return;
}
}
});
L.control.slideMenu = function(innerHTML, options) {
return new L.Control.SlideMenu(innerHTML, options);
};
This diff is collapsed.
......@@ -139,8 +139,8 @@ date_default_timezone_set($USER_SETTINGS['localTimeZone']);
global $inetAccess;
global $mesh;
if (isset($_GET['inetAccess'])) {
$inetAccess = $_GET['inetAccess'];
if (isset($_GET['inetAccess']) || isset($_POST['inetAccess'])) {
$inetAccess = $_GET['inetAccess'] || $_POST['inetAccess'];
if ($inetAccess == "1") {
$mesh = "0";
}elseif ($inetAccess == "0") {
......@@ -152,6 +152,66 @@ if (isset($_GET['inetAccess'])) {
}
@include $INCLUDE_DIR . "/custom.inc";
if (!isset($GLOBALS['internet_only'])) {
function testForInet() {
$page = <<< EOD
<!DOCTYPE html>
<html>
<head>
<title>meshmap internet check page</title>
<script src='javascripts/ping.min.js'></script>
<script>
function postData(path, params, method) {
method = method || "post";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for (var key in params) {
if (params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
var p = new Ping();
var value = "0";
p.ping("//google.com", function(err, data) {
if (err) {
value = 0;
}else {
value = 1;
}
//window.location.replace("map_display.php?inetAccess="+value);
postData('map_display.php', {inetAccess: value});
});
</script>
</head>
<body>
Just a quick check for internet access so we can load the appropriate maps, etc...
<br>
Please be patient, this should only take a moment.
</body>
</html>
EOD;
echo $page;
//return;
exit("<br><br>reloading...");
}
}
if (!isset($GLOBALS['internet_only'])) {
if (!isset($_POST['inetAccess'])) {
testForInet();
}
}
/*
* SQL Connection
*/
......@@ -206,6 +266,7 @@ if (!$mesh) {
echo "<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css' rel='stylesheet'>\n";
echo "<script src='//ismyrnow.github.io/leaflet-groupedlayercontrol/src/leaflet.groupedlayercontrol.js'></script>\n";
echo "<link rel='stylesheet' href='//ismyrnow.github.io/leaflet-groupedlayercontrol/src/leaflet.groupedlayercontrol.css'>\n";
echo "<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.0.10/css/all.css' integrity='sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg' crossorigin='anonymous'>\n";
}else {
echo "<link href='css/leaflet.css' rel='stylesheet'>\n";
......@@ -215,9 +276,11 @@ if (!$mesh) {
echo "<link href='css/leaflet.fullscreen.css' rel='stylesheet'>\n";
echo "<script src='javascripts/leaflet.groupedlayercontrol.min.js'></script>\n";
echo "<link href='css/leaflet.groupedlayercontrol.min.css' rel='stylesheet'>\n";
echo "<link href='javascripts/fontawesome-all.css' rel='stylesheet'>\n";
}
echo "<script src='javascripts/leaflet-hash.js'></script>\n";
echo "<script src='javascripts/L.Control.SlideMenu.js'></script>\n";
echo "<link href='css/L.Control.SlideMenu.css' rel='stylesheet'>\n";
/*
echo "<link href='css/meshmap.css' rel='stylesheet'>\n";
echo "<link href='css/leaflet.css' rel='stylesheet'>\n";
......@@ -286,6 +349,25 @@ else
}
}
/*
if (isset($GLOBALS['no_req_msg'])) {
if ($GLOBALS['no_req_msg'] == "1") {
//output nothing!!
}
}else {
echo "<strong><a style=\"color: inherit;text-decoration: none;\" href=\"\" title=\"" .
$GLOBALS['USER_SETTINGS']['where_is_my_node'] . "\">Where the heck is my node??</a>\n";
}
*/
if (isset($GLOBALS['hide_admin'])) {
if ($GLOBALS['hide_admin'] == "1") {
//output nothing!!
}
}else {
echo "<strong><a style=\"float: right;\" href=\"admin/admin.php\">The \"Admin\" type page</a>\n";
}
echo "<div id='mapid' style='width: 100%; height: 95%;'>\n";
echo "</div>\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment