Commit 12b091b3 authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

Enhancement: map_display.php

The check for internet access was using a POST variable to tell the page
if the client had access to the internet or not (it just tries to get
favicon.ico from google).
The problem with POST was that every time you refreshed the page, the
POST variable had to be resent, usually resulting in a dialog box from
the browser ("Do you want to resend this info?")

This drove me crazy, I could not stand that dialog box.

The check for internet access has been changed to use a cookie.
The cookie contains 1 item and expires after 30 minutes.
So after 30 minutes, the page will recheck for internet access and act
accordingly.

There is also a small change to the check for user-settings.ini.

The README.md/html files were slightly updated as well.
parent c32015e7
......@@ -14,7 +14,7 @@
Automated mapping of AREDN Networks.<br/>
2016-2018 - Eric Satterlee / KG6WXC<br/>
Addtional Credit to: Mark/N2MH and Glen/K6GSE for their work on this project.<br/>
Licensed under GPL v3<br/>
Licensed under GPL v3 and later.<br/>
Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.com in the meantime.)</p>
<p><a href="https://mapping.kg6wxc.net/meshmap">Demo Map</a></p>
......@@ -199,6 +199,8 @@ I&rsquo;ve tried to provide instructions on the admin pages themselves.<br/>
From the admin pages you can &ldquo;fix&rdquo; a nodes location, which can be helpful for those users that forget the &ldquo;-&rdquo; in front of their longitude. :)<br/>
The admin pages also allow for the addition of &ldquo;Non Mesh&rdquo; Markers, fire stations, police stations, EOC&rsquo;s , etc&hellip;</p>
<p>You can change the way the page looks by copying webpage/css/meshmap.css-default to webpage/css/meshmap.css.</p>
<h2>ToDo List</h2>
<hr />
......@@ -206,7 +208,7 @@ The admin pages also allow for the addition of &ldquo;Non Mesh&rdquo; Markers, f
<p>(In no particular order)<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/>
- [ ] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).<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/>
- [ ] Changes so sbarc.org can have the new version too!<br/>
- [ ] Change css file for the &ldquo;?&rdquo; slide-out menu.<br/>
......
......@@ -10,7 +10,7 @@
Automated mapping of AREDN Networks.
2016-2018 - Eric Satterlee / KG6WXC
Addtional Credit to: Mark/N2MH and Glen/K6GSE for their work on this project.
Licensed under GPL v3
Licensed under GPL v3 and later.
Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.com in the meantime.)
[Demo Map](https://mapping.kg6wxc.net/meshmap)
......@@ -156,13 +156,15 @@ Try to load up: http://(hostname)/meshmap/admin/admin.php in your web browser.
I've tried to provide instructions on the admin pages themselves.
From the admin pages you can "fix" a nodes location, which can be helpful for those users that forget the "-" in front of their longitude. :)
The admin pages also allow for the addition of "Non Mesh" Markers, fire stations, police stations, EOC's , etc...
You can change the way the page looks by copying webpage/css/meshmap.css-default to webpage/css/meshmap.css.
## ToDo List
----------
(In no particular order)
- [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.
- [ ] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).
- [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).
- [ ] Changes so sbarc.org can have the new version too!
- [ ] Change css file for the "?" slide-out menu.
......
......@@ -133,7 +133,7 @@ global $USER_SETTINGS;
if (file_exists($INCLUDE_DIR . "/scripts/user-settings.ini")) {
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
}else {
echo "You <strong><em>must</em></strong> copy the user-settings.ini-default file to user-settings.ini and edit it!\n";
exit("You <strong><em>must</em></strong> copy the user-settings.ini-default file to user-settings.ini and edit it!\n");
//$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini-default");
}
global $MESH_SETTINGS;
......@@ -161,6 +161,19 @@ date_default_timezone_set($USER_SETTINGS['localTimeZone']);
global $inetAccess;
global $mesh;
if (isset($_COOKIE['meshmapClientInetAccess'])) {
$inetAccess = $_COOKIE['meshmapClientInetAccess'];
if ($inetAccess == "1") {
$mesh = "0";
}elseif ($inetAccess == "0") {
$mesh = "1";
}
}else {
$inetAccess = "0";
$mesh = "1";
}
/*
if (isset($_POST['inetAccess'])) {
$inetAccess = $_POST['inetAccess'];
if ($inetAccess == "1") {
......@@ -172,10 +185,10 @@ if (isset($_POST['inetAccess'])) {
$inetAccess = "0";
$mesh = "1";
}
*/
@include $INCLUDE_DIR . "/custom.inc";
if (!isset($GLOBALS['internet_only'])) {
//if (!isset($GLOBALS['internet_only'])) {
function testForInet() {
$page = <<< EOD
<!DOCTYPE html>
......@@ -184,6 +197,15 @@ function testForInet() {
<title>meshmap internet check page</title>
<script src='javascripts/ping.min.js'></script>
<script>
var now = new Date();
//expire in 1 day
//var cookieExpireTime = new Date(now.getTime() + 1 * 24 * 3600 * 1000);
//expire in 30 minutes
var cookieExpireTime = new Date(now.getTime() + (30 * 60 * 1000));
function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + "; expires=" + cookieExpireTime.toGMTString();
}
function postData(path, params, method) {
method = method || "post";
var form = document.createElement("form");
......@@ -212,7 +234,9 @@ p.ping("//google.com", function(err, data) {
value = 1;
}
//window.location.replace("map_display.php?inetAccess="+value);
postData('map_display.php', {inetAccess: value});
//postData('map_display.php', {inetAccess: value});
setCookie("meshmapClientInetAccess", value);
window.location.replace("map_display.php");
});
</script>
</head>
......@@ -227,9 +251,9 @@ EOD;
//return;
exit("<br><br>reloading...");
}
}
//}
if (!isset($GLOBALS['internet_only'])) {
if (!isset($_POST['inetAccess'])) {
if (!isset($_COOKIE['meshmapClientInetAccess'])) {
testForInet();
}
}
......
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