Commit 6e0fb623 authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

BugFixs/Enhancements/Additions

Can change the non mesh markers info without having to recreate now.

The polling script can now find the info for some nodes that it could
not before, such as firmware 3.15.1.0b4, this was a pleasant side effect
of trying to remove some of the bunk entries i nthe database.

The polling script will now also try to check and "fix" the database,
this is due to changes in the newer AREDN firmwares (anything beyond
3.17RC1)
Some of those changes were made by me, just for the map. :)
These DB "fixes" also include removing some columns that were no longer
and were making the DB much larger than it needs to be, this will also
help cut down on the memory footprint when loading the webpage.

The numbers at the bottom of the map reflecting nodes and link, should
be more accurate now (I hope).

The Map legend has been change to use pure HTML5/CSS, the only images
are the small circle icons, this may cause issues with very old
browsers...

Removed some files that were no longer needed or forgetten about.
parent 7723b474
......@@ -4,3 +4,5 @@
**/meshmap-settings.ini
**/meshmap.css
**/admin.css
**/leaflet-custom-control-vertical-center.css
**/map-legend.css
......@@ -32,7 +32,8 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
<li><strong>openssl PHP extension</strong><br/>
(you may only need mysqlnd, it should be safe to enable both for now)<br/>
(One or more of these extensions may need to be enabled in php.ini)<br/>
(if you do not already have mysqlnd, you might need to install it, <code>apt-get install php[5 or 7]-mysqlnd</code>)</li>
(if you do not already have mysqlnd, you might need to install it, <code>apt-get install php[5 or 7]-mysqlnd</code>)<br/>
(<em>the requirement for the mysqlnd extension will be removed in the near future</em>)</li>
<li><strong>MySQL/MariaDB</strong><br/>
(Other database systems are up to you)</li>
<li><strong>An AREDN Mesh node available over the local network</strong><br/>
......@@ -40,7 +41,9 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
<li><strong>Map Tiles</strong><br/>
(Either in a static directory or available via some tile server&hellip;)</li>
<li><strong>RPi3 or better</strong><br/>
(The DB access can be pretty slow on an RPi1, you can move the DB to another system though&hellip;)</li>
(The DB access can be pretty slow on an RPi1, you can move the DB to another system though&hellip;)<br/>
(If your local mesh network grows to become very large, with tunnels opened to the entire planet,<br/>
you might find even an RPi3+ to become inadequate, it&rsquo;ll still work, it just might be slow)</li>
<li><strong>Patience</strong><br/>
(Perhaps a lot!)</li>
<li><strong>Familiarity with Linux/Apache/SQL</strong><br/>
......@@ -50,7 +53,7 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
<blockquote style="background: #d3d3d3; margin-right: 30%;">In theory, this <em>should</em> run on a Windows system as well.<br/>
It does not require anything specific to Linux (<em>Perhaps with the exception of the cron task</em>).<br/>
There is no reason that part could not be adapted to run from a Windows scheduled task though.<br/>
There is no reason that cronjob could not be adapted to run from a Windows scheduled task though.<br/>
PHP is PHP after all.</blockquote>
......@@ -109,6 +112,7 @@ Choose your own password!</p>
<li><p><strong>4: Copy scripts/user-settings.ini-default to scripts/user-settings.ini and edit the user-settings.ini file</strong></p>
<ul>
<li>You <strong>must</strong> do this or the <strong><em>entire system</em></strong> will refuse to run!</li>
<li>The file scripts/user-settings.ini is the most important to get right.<br/>
It is <strong>very important</strong> to make sure your SQL username and password are correct in scripts/user-settings.ini!!</li>
<li>Also important is, if the system that this is running on cannot resolve &ldquo;localnode.local.mesh&rdquo; you can change that in the user-settings.ini file.</li>
......@@ -210,22 +214,25 @@ You can add the &ldquo;Non Mesh&rdquo; Markers, fire stations, police stations,
The admin pages also allow for some maintenance of the database, more feedback is encouraged on this!</p>
<p>You can change the way the page looks by copying webpage/css/meshmap-default.css to webpage/css/meshmap.css.<br/>
The meshmap.css file will be used in place of the -default.css file.<br/>
(This also applies to other *-default.css files)</p>
The meshmap.css file will override the -default.css file.<br/>
(This also applies to other *-default.css files, there are a few, please look at them if you wish to customize the layout of the map)</p>
<h2>ToDo List</h2>
<hr />
<p>(In no particular order)<br/>
- [x] Finally finish my admin page idea.<br/>
- [x] Finally finish my admin page idea (mostly).<br/>
- [x] Add new MeshMap Logo.<br/>
- [x] Change the user editable files to be distributed with &ldquo;-default&rdquo; added to the extension, no more tar.gz file.<br/>
- [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).<br/>
- [ ] Make &ldquo;Parallel Threads&rdquo; work again in get-map-info script, with limits on how many can be run at once (this will greatly speed up network polling).<br/>
- [x] Changes so sbarc.org can have the new version too!<br/>
- [x] User css files will override the defaults.<br/>
- [x] Polling script checks the DB before it runs and makes changes if needed.<br/>
- [ ] Make &ldquo;Parallel Threads&rdquo; work again in get-map-info script, with limits on how many can be run at once.<br/>
(this will greatly speed up network polling)<br/>
- [x] Catch more nodes information now, like 3.15.1.0b04 and hopefully some other pesky ones!<br/>
(this will probably cause some warnings during node polling, but it is getting the info it needs)<br/>
(also helps clean up the database and was a nice side effect of that)<br/>
- [ ] Change css file for the &ldquo;?&rdquo; slide-out menu.<br/>
- [x] Fix a typo in the attribution bar so the pop-up for the links is only for the links number.<br/>
- [x] Make the numbers for stations and links in the attribution bar a bit more accurate I hope.<br/>
- [ ] Implement N2MH&rsquo;s &ldquo;Link aging&rdquo; idea(s).<br/>
- [ ] The &ldquo;Planning&rdquo; Tab.<br/>
- [ ] Make it so other networks can export their data for use on a &ldquo;Mega Map&rdquo; type page. :)</p>
......@@ -238,4 +245,4 @@ The meshmap.css file will be used in place of the -default.css file.<br/>
I can&rsquo;t think of <em>everything</em>!<br/>
If you find an improvement, typo, or whatever, please, send an email to kg6wxc@gmail.com and we can get you setup with write access if you&rsquo;d like!</p>
<p>This README file last updated: May 2018</p>
<p>This README file last updated: July 2018</p>
......@@ -26,14 +26,17 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
(you may only need mysqlnd, it should be safe to enable both for now)
(One or more of these extensions may need to be enabled in php.ini)
(if you do not already have mysqlnd, you might need to install it, `apt-get install php[5 or 7]-mysqlnd`)
(<em>the requirement for the mysqlnd extension will be removed in the near future</em>)
- **MySQL/MariaDB**
(Other database systems are up to you)
(Other database systems are up to you)
- **An AREDN Mesh node available over the local network**
(Preferably connected to an AREDN network...)
- **Map Tiles**
(Either in a static directory or available via some tile server...)
- **RPi3 or better**
(The DB access can be pretty slow on an RPi1, you can move the DB to another system though...)
(The DB access can be pretty slow on an RPi1, you can move the DB to another system though...)
(If your local mesh network grows to become very large, with tunnels opened to the entire planet,<br/>
you might find even an RPi3+ to become inadequate, it'll still work, it just might be slow)
- **Patience**
(Perhaps a lot!)
- **Familiarity with Linux/Apache/SQL**
......@@ -41,7 +44,7 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
<blockquote style="background: #d3d3d3; margin-right: 30%;">In theory, this <em>should</em> run on a Windows system as well.<br/>
It does not require anything specific to Linux (<em>Perhaps with the exception of the cron task</em>).<br/>
There is no reason that part could not be adapted to run from a Windows scheduled task though.<br/>
There is no reason that cronjob could not be adapted to run from a Windows scheduled task though.<br/>
PHP is PHP after all.</blockquote>
### Map Tile Server info
......@@ -88,8 +91,9 @@ Choose your own password!
> `FLUSH PRIVILEGES;`
- **4: Copy scripts/user-settings.ini-default to scripts/user-settings.ini and edit the user-settings.ini file**
* You **must** do this or the **<em>entire system</em>** will refuse to run!
* The file scripts/user-settings.ini is the most important to get right.
It is **very important** to make sure your SQL username and password are correct in scripts/user-settings.ini!!
It is **very important** to make sure your SQL username and password are correct in scripts/user-settings.ini!!
* 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.
* Once you save to the user-settings.ini file any changes you make will not be overwritten by future updates.
The "-default" files *will probably* change though and you will need to update your personal files when this happens.
......@@ -168,20 +172,23 @@ You can add the "Non Mesh" Markers, fire stations, police stations, EOC's , etc
The admin pages also allow for some maintenance of the database, more feedback is encouraged on this!
You can change the way the page looks by copying webpage/css/meshmap-default.css to webpage/css/meshmap.css.
The meshmap.css file will be used in place of the -default.css file.
(This also applies to other *-default.css files)
The meshmap.css file will override the -default.css file.
(This also applies to other *-default.css files, there are a few, please look at them if you wish to customize the layout of the map)
## ToDo List
----------
(In no particular order)
- [x] Finally finish my admin page idea.
- [x] Finally finish my admin page idea (mostly).
- [x] Add new MeshMap Logo.
- [x] Change the user editable files to be distributed with "-default" added to the extension, no more tar.gz file.
- [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).
- [ ] Make "Parallel Threads" work again in get-map-info script, with limits on how many can be run at once (this will greatly speed up network polling).
- [x] Changes so sbarc.org can have the new version too!
- [x] User css files will override the defaults.
- [x] Polling script checks the DB before it runs and makes changes if needed.
- [ ] Make "Parallel Threads" work again in get-map-info script, with limits on how many can be run at once.
(this will greatly speed up network polling)
- [x] Catch more nodes information now, like 3.15.1.0b04 and hopefully some other pesky ones!
(this will probably cause some warnings during node polling, but it is getting the info it needs)
(also helps clean up the database and was a nice side effect of that)
- [ ] Change css file for the "?" slide-out menu.
- [x] Fix a typo in the attribution bar so the pop-up for the links is only for the links number.
- [x] Make the numbers for stations and links in the attribution bar a bit more accurate I hope.
- [ ] Implement N2MH's "Link aging" idea(s).
- [ ] The "Planning" Tab.
- [ ] Make it so other networks can export their data for use on a "Mega Map" type page. :)
......@@ -192,4 +199,4 @@ The meshmap.css file will be used in place of the -default.css file.
I can't think of *everything*!
If you find an improvement, typo, or whatever, please, send an email to kg6wxc@gmail.com and we can get you setup with write access if you'd like!
This README file last updated: May 2018
This README file last updated: July 2018
-- --------------------------------------------------------
-- Host: 192.168.81.222
-- Server version: 10.2.14-MariaDB-log - MariaDB Server
-- Server version: 10.3.7-MariaDB-log - MariaDB Server
-- Server OS: Linux
-- HeidiSQL Version: 9.4.0.5125
-- --------------------------------------------------------
......@@ -19,7 +19,7 @@ USE `node_map`;
-- Dumping structure for table node_map.hosts_ignore
CREATE TABLE IF NOT EXISTS `hosts_ignore` (
`ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The name of the host, no domain',
`name` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
`reason` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`timestamp` datetime DEFAULT NULL,
UNIQUE KEY `name_2` (`name`),
......@@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `map_info` (
-- Dumping structure for table node_map.marker_info
CREATE TABLE IF NOT EXISTS `marker_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`lat` double NOT NULL,
......@@ -55,9 +55,11 @@ CREATE TABLE IF NOT EXISTS `marker_info` (
-- Data exporting was unselected.
-- Dumping structure for table node_map.node_info
CREATE TABLE IF NOT EXISTS `node_info` (
`node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
`wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_seen` datetime DEFAULT NULL,
`uptime` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`loadavg` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
......@@ -73,7 +75,7 @@ CREATE TABLE IF NOT EXISTS `node_info` (
`firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`grid_square` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`sysinfo_json` mediumblob DEFAULT NULL,
`services` varchar(2048) COLLATE utf8_unicode_ci DEFAULT NULL,
`location_fix` int(11) DEFAULT 0,
UNIQUE KEY `node` (`node`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Information about the nodes\r\ntaken from sysinfo.json that is on every node.';
......@@ -81,9 +83,11 @@ CREATE TABLE IF NOT EXISTS `node_info` (
-- Data exporting was unselected.
-- Dumping structure for table node_map.removed_nodes
CREATE TABLE IF NOT EXISTS `removed_nodes` (
`node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
`wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_seen` datetime DEFAULT NULL,
`uptime` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`loadavg` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
......@@ -99,7 +103,7 @@ CREATE TABLE IF NOT EXISTS `removed_nodes` (
`firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`grid_square` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`sysinfo_json` mediumblob DEFAULT NULL,
`services` varchar(2048) COLLATE utf8_unicode_ci DEFAULT NULL,
`time_removed` datetime DEFAULT NULL,
UNIQUE KEY `node` (`node`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='A place to put old nodes';
......@@ -107,10 +111,10 @@ CREATE TABLE IF NOT EXISTS `removed_nodes` (
-- Data exporting was unselected.
-- Dumping structure for table node_map.topology
CREATE TABLE IF NOT EXISTS `topology` (
`node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
`nodelat` double DEFAULT NULL,
`nodelon` double DEFAULT NULL,
`linkto` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`linkto` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL,
`linklat` double DEFAULT NULL,
`linklon` double DEFAULT NULL,
`cost` double DEFAULT NULL,
......@@ -128,7 +132,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`passwd` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_login` datetime DEFAULT NULL,
KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='a place to put users for the admin page(s)';
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='a place to put users for the admin page(s)';
-- Data exporting was unselected.
-- Dumping structure for trigger node_map.node_info_after_insert
......
This diff is collapsed.
......@@ -86,7 +86,8 @@ function build_NodesAndLinks($NodeList, $TopoList, $MarkerList = null)
* Find the Services for the node
********************************/
// $node_ServiceList = load_ServiceList($node_info['olsrinfo_json']);
$node_ServiceList = '';
// $node_ServiceList = '';
$node_ServiceList = load_ServiceList($node_info['services']);
/*
* Build the Nodes Marker
......@@ -151,14 +152,14 @@ function build_NodesAndLinks($NodeList, $TopoList, $MarkerList = null)
*
* @return string List of Services to Display
*/
function load_ServiceList($json_data)
function load_ServiceList($serviceList)
{
$json_array = wxc_findServices($json_data, 'services');
$localServiceArray = wxc_listServices($serviceList);
$serviceList = '';
if (is_array($json_array))
if (is_array($localServiceArray))
{
foreach ($json_array as $key => $value)
foreach ($localServiceArray as $key => $value)
{
//WXC 6-30-2017: removed links for services that have no link
if ($value == NULL) {
......@@ -259,7 +260,8 @@ function load_LinkList($NodeList, $TopoList)
{
$display_color = $MESH_SETTINGS['DTD_Link_Plus'];
$dtd = 1;
$display_opacity = 0.4;
$display_opacity = 0.3;
$display_weight = 0.3;
$map_LayerAssigned = 'dtdLinks';
}
//find the "infinite cost" links (they show as "INFINITE" in the olsr files the other script changes that to 99.99)
......@@ -387,24 +389,22 @@ function load_LinkedTO($node_info, $TopoList)
}
}
}
//now take all that info back out and put into a properly formatted string variable that we'll use later]
foreach ($linkInfoForStationPopups as $nodeNameLinkArray => $linktoArray)
{
if ($linktoArray > '')
{
foreach ($linktoArray as $linkedNodeName => $costArray)
{
if (($costArray['costTo'] == 0.1) && ($costArray['costFrom'] == 0.1))
{
$display_cost = ' <Link_DTD>(DTD)</Link_DTD> ';
}
else
{
$display_cost = ' (' . $costArray['costTo'] . '/' . $costArray['costFrom'] .
') ';
}
$linkedToList .= $linkedNodeName . $display_cost . $costArray['distance'] . ' mi ' .
$costArray['bearing'] . '&deg;<br>';
//now take all that info back out and put into a properly formatted string variable that we'll use later
//this part of the function reformatted by kg6wxc.
foreach ($linkInfoForStationPopups as $nodeNameLinkArray => $linktoArray) {
if (!empty($linktoArray)) {
foreach ($linktoArray as $linkedNodeName => $costArray) {
if (!empty($costArray)) {
if (!empty($costArray['costTo']) && !empty($costArray['costFrom'])) {
//if ((isset($costArray['costTo']) == 0.1) && (isset($costArray['costFrom']) == 0.1)) {
if ($costArray['costTo'] == "0.1" && $costArray['costFrom'] == "0.1") {
$display_cost = ' <Link_DTD>(DTD)</Link_DTD> ';
}else {
$display_cost = ' (' . $costArray['costTo'] . '/' . $costArray['costFrom'] . ') ';
}
$linkedToList .= $linkedNodeName . $display_cost . $costArray['distance'] . ' mi ' . $costArray['bearing'] . '&deg;<br>';
}
}
}
}
}
......@@ -510,8 +510,14 @@ function build_Marker($node_info, $node_ServiceList, $node_LinkedList, $node_Fir
"', icon: " . $icon . "}).bindPopup(\" " . $nodeUrl . " (" . $band . ")<br>" . $node_info['lat'] .
", " . $node_info['lon'] . "<br>SSID: " . $node_info['ssid'] . "<br>Channel: " . $node_info['channel'] .
", Bandwidth: " . $node_info['chanbw'] . "<br>" . $node_info['model'] . "<br>" . $firmware .
"<br>Last Polled: " . $node_info['last_seen'] .
$node_ServiceList . $node_LinkedList . "\").addTo(" . $AssignedLayer . ") ,\n"; // Close out this node
"<br>Last Polled: " . $node_info['last_seen'] . '<br>' . "Uptime: " . $node_info['uptime'] . '<br>';
//dot
if ($node_info['loadavg'] !== "NotAvailable") {
$loadavgs = unserialize($node_info['loadavg']);
//var_dump($loadavgs);
$markerList .= 'LoadAvg: 1 min ' . $loadavgs[0] . ', 5 min ' . $loadavgs[1] . ', 15 min ' . $loadavgs[2] . "<br>";
}
$markerList .= $node_ServiceList . $node_LinkedList . "\").addTo(" . $AssignedLayer . ") ,\n"; // Close out this node
/*
* If Upgrade Suggested add Node to that layer
*/
......@@ -983,12 +989,41 @@ function create_MapLegend()
{
//legend overlay
$Content = <<< EOD
var legendHidden = L.control({position: 'topright'});
legendHidden.onAdd = function(map) {
var div = L.DomUtil.create('div', 'info legendHidden', L.DomUtil.get('map'));
div.innerHTML += '<button id="legendLinkButtonHidden" onclick="hideLegend()">Map Legend</button>';
return div;
};
var legend = L.control({position: 'topright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend', L.DomUtil.get('map'));
div.innerHTML +=
'<img src="images/mapLegend/LinkCostLegend.jpg" alt="legend" width="175" height="25"><br>' +
'<img src="images/mapLegend/DTDLinkLegend.jpg" alt="legend" width="75" height="60" align="right">';
'<div id="legend">' +
'<div id="legendGradientRectangle">1.000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Link Cost&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10.000</div>' +
'<div id="legendDTDLink">DTD</div>' +
'<div id="legendOtherWireless">RF DTD</div>' +
'<div id="legendTunnelLink">Tunnel</div>' +
'<div id="legendInfinite">Infinite</div>' +
'<div id="legendUnknownOther">' +
'<img class="legendBandIcon" src="images/mapMarkers/greyRadioCircle-icon.png">Unknown' +
'</div>' +
'<div id="legend900MHz">' +
'<img class="legendBandIcon" src="images/mapMarkers/magentaRadioCircle-icon.png">900MHz' +
'</div>' +
'<div id="legend2GHz">' +
'<img class="legendBandIcon" src="images/mapMarkers/purpleRadioCircle-icon.png">2GHz' +
'</div>' +
'<div id="legend3GHz">' +
'<img class="legendBandIcon" src="images/mapMarkers/blueRadioCircle-icon.png">3GHz' +
'</div>' +
'<div id="legend5GHz">' +
'<img class="legendBandIcon" src="images/mapMarkers/goldRadioCircle-icon.png">5GHz' +
'</div>' +
'<div id="legendHide"><button id="legendLinkButton" onclick="hideLegend()">Hide</button></div>' +
'</div>';
// '<img src="images/mapLegend/LinkCostLegend.jpg" alt="legend" width="175" height="25"><br>' +
// '<img src="images/mapLegend/DTDLinkLegend.jpg" alt="legend" width="75" height="60" align="right">';
return div;
};\n\n
EOD;
......@@ -1006,17 +1041,39 @@ function create_MapImage()
//init the map with size, zoom level, center co-ords, etc...
//http://leafletjs.com/reference-1.0.3.html#control-zoom
$Content = "
var map = L.map('mapid', {
//attributionControl: false,
center: [" . $USER_SETTINGS['map_center_coordinates'] . "],
zoom: [" . $USER_SETTINGS['map_initial_zoom_level'] . "],
minZoom: 0,
maxZoom: 18,
zoomSnap: 0,
zoomDelta: 0.25,
layers: [defaultMap, twoGHzStations, threeGHzStations, fiveGHzStations, nineHundredMHzStations, otherStations, rfLinks, tunnelLinks, dtdLinks, infiniteLinks],
fullscreenControl: true
});\n\n
if (typeof rfLinks === 'undefined' || rfLinks === null) {
var map = L.map('mapid', {
//attributionControl: false,
center: [" . $USER_SETTINGS['map_center_coordinates'] . "],
zoom: [" . $USER_SETTINGS['map_initial_zoom_level'] . "],
minZoom: 0,
maxZoom: 18,
//zoomSnap: 0,
zoomSnap: 1,
//zoomDelta: 0.25,
zoomDelta: 1,
//layers: [defaultMap, twoGHzStations, threeGHzStations, fiveGHzStations, nineHundredMHzStations, otherStations, rfLinks, tunnelLinks, dtdLinks, infiniteLinks],
layers: [defaultMap, twoGHzStations, threeGHzStations, fiveGHzStations, nineHundredMHzStations, otherStations],
//layers: [defaultMap],
fullscreenControl: true
});\n\n
}else {
var map = L.map('mapid', {
//attributionControl: false,
center: [" . $USER_SETTINGS['map_center_coordinates'] . "],
zoom: [" . $USER_SETTINGS['map_initial_zoom_level'] . "],
minZoom: 0,
maxZoom: 18,
//zoomSnap: 0,
zoomSnap: 1,
//zoomDelta: 0.25,
zoomDelta: 1,
layers: [defaultMap, twoGHzStations, threeGHzStations, fiveGHzStations, nineHundredMHzStations, otherStations, rfLinks, tunnelLinks, dtdLinks, infiniteLinks],
//layers: [defaultMap, twoGHzStations, threeGHzStations, fiveGHzStations, nineHundredMHzStations, otherStations],
//layers: [defaultMap],
fullscreenControl: true
});\n\n
}
";
return $Content;
......@@ -1076,16 +1133,98 @@ function show_MapMarkerDetails($numNodes, $numLinks, $numMarkers, $numNodesTotal
function instantiate_Map()
{
$Content = <<< EOD
// Create additional Control placeholders
function addControlPlaceholders(map) {
var corners = map._controlCorners,
l = 'leaflet-',
container = map._controlContainer;
function createCorner(vSide, hSide) {
var className = l + vSide + ' ' + l + hSide;
corners[vSide + hSide] = L.DomUtil.create('div', className, container);
}
createCorner('verticalcenter', 'left');
createCorner('verticalcenter', 'right');
}
addControlPlaceholders(map);
map.zoomControl.setPosition('verticalcenterleft');
map.fullscreenControl.setPosition('verticalcenterleft');
//admin icon (the gears)
L.Control.Admin = L.Control.extend({
options: {
position: 'verticalcenterleft'
},
onAdd: function(map) {
var adminControl = L.DomUtil.create('div', 'leaflet-control-custom leaflet-bar');
adminControl.style.backgroundColor = 'white';
//adminControl.content = "\F013";
//adminControl.font-family = "FontAwesome";
//adminControl.style.background = "fa-cog";
adminControl.style.width = '30px';
adminControl.style.height = '30px';
adminControl.title = 'Admin';
var link = L.DomUtil.create('a', 'leaflet-bar-part leaflet-bar-part-single', adminControl);
var gear = L.DomUtil.create('span', 'fa fa-cogs', link);
gear.style.fontSize = '15px';
adminControl.onclick = function() {
//alert('you clicked it');
window.location = "admin/admin.php";
}
return adminControl;
}
});
L.control.admin = function(opts) {
return new L.Control.Admin(opts);
}
//the ruler
var rulerOptions = {position: 'verticalcenterleft',
lengthUnit: {
factor: 0.621371,
display: 'Miles',
decimal: 3}
};
L.control.ruler(rulerOptions).addTo(map);
document.getElementById('ruler').title = 'Ruler\\n(ESC 1x to stop, 2x to remove)';
//the watermark logo
L.Control.Watermark = L.Control.extend({
onAdd: function(map) {
var img = L.DomUtil.create('img');
img.src = 'images/MESHMAP_LOGO.svg';
img.style.width = '75px';
//img.className += 'watermark';
img.style.background = 'rgba(0,0,0,0.5)';
img.style.border = '1px solid black';
img.style.borderRadius = '5px';
img.style.opacity = '0.3';
img.style.filter = 'alpha(opacity=30)';
return img;
},
OnRemove: function(map) {
//nothing
}
});
L.control.watermark = function(opts) {
return new L.Control.Watermark(opts);
}
L.control.watermark({position: 'bottomright'}).addTo(map);
var hash = new L.Hash(map);
/*
* MeshMap Legend
*/
legend.addTo(map);
legendHidden.addTo(map);
/*
* Layer Control
*/
var layerControls = L.control.groupedLayers(baseLayers, groupedOverlays, {position: 'topleft'}).addTo(map);
var layerControls = L.control.groupedLayers(baseLayers, groupedOverlays, {position: 'verticalcenterleft'}).addTo(map);
L.DomEvent.disableClickPropagation(layerControls._container);
L.DomEvent.disableScrollPropagation(layerControls._container);
/*
......@@ -1097,6 +1236,11 @@ function instantiate_Map()
*/
var contents = "";
/*
*admin control button
*/
L.control.admin().addTo(map);
EOD;
......@@ -1112,11 +1256,10 @@ EOD;
}else {
$Content .= "alert('Could not open help_msg.html');\n";
}
$Content .= "\nL.control.slideMenu(contents, {width: '400px'}).addTo(map);\n";
$Content .= "\nL.control.slideMenu(contents, {width: '400px', position: 'verticalcenterleft'}).addTo(map);\n";
/* Attribution */
//attributionCtrl({position: 'bottomleft'}).addTo(map);\n
return $Content;
}
?>
......
......@@ -51,53 +51,55 @@ if($sysinfoJson === FALSE) {
$jsonFetchSuccess = 0;
$error = error_get_last();
wxc_checkErrorMessage($error, $ipAddr);
//got nothing...
//break;
//just skip the next IP
//continue;
//just skip to the next IP since there was an error
continue;
}else {
//node is there, get all the info we can
//get all the data from the json file and decode it
$result = json_decode($sysinfoJson,true);
//if there's nothing really there just skip to the next IP
if (!$result) {
//continue;
if (!$result || empty($result)) {
continue;
}
//first let's see what node we are dealing with
//$node = $GLOBALS['node'] = $result['node'];
$node = $result['node'];
//gather lots of other information from OLSRD about the node being polled (we hopefully can use this later)
//this requires a second connection to the node. no way around that.
//but only if we have a firmware version >= than 3.16.0 (or "develop-16")
$firmware_version = $result['firmware_version'];
$olsrdInfo = 0;
//chaged to always on for testing 10-10-2017
//changed again 10-21-2017 excluding a couple of nodes
//if (version_compare($result['firmware_version'], "3.16.0.0", ">") || strpos($result['firmware_version'], "evelop-16") || $result['firmware_version'] === "linux" || $result['firmware_version'] === "Linux") {
//if ($ipAddr !== "10.162.170.94" && $ipAddr !== "10.242.25.124" && $ipAddr !== "10.108.102.244") {
/************
* Temporarily REMOVED due to issues
************/
//uncommented 11:30pm oct11 2017
//commented out again 14:20 oct13 2017
//enabled again 10.20.2017
// $olsrdInfo = wxc_netcat("$ipAddr");
// $noPort9090 = 1;
//}
//maybe in the future we'll be able to get this info remotely too and use it for something
//$olsrdDotDrawInfo = wxc_netcat("$nodeName.local.mesh","2004", null, null); //save the polled nodes local dot_draw info (never know we may want it for something)
//if it's nothing other than the node name, it's some other device
//or something else entirely...
//people hack things onto the mesh all the time
//
//kg6wxc is *not* guilty of such things... :)
//
//just a few checks for nothing usually catches it.
if ($result['node'] && $result['lat'] == "" && $result['lon'] == "" && $result['ssid'] == ""