Fixed issue where open layers did not work on some browsers

This commit is contained in:
Ylian Saint-Hilaire 2017-09-07 11:16:51 -07:00
parent ac53c7ae3c
commit b6c7403653
1 changed files with 85 additions and 78 deletions

View File

@ -122,7 +122,7 @@
<select id=viewselect onchange=onDeviceViewChange()> <select id=viewselect onchange=onDeviceViewChange()>
<option value=1>3 wide</option> <option value=1>3 wide</option>
<option value=2>List</option> <option value=2>List</option>
<option value=3>Map</option> <option id=viewselectmapoption value=3>Map</option>
</select> </select>
</div> </div>
<div style=float:right id=devListToolbarSort> <div style=float:right id=devListToolbarSort>
@ -1662,8 +1662,9 @@
// Add a feature for every Node and change style if connection status changes // Add a feature for every Node and change style if connection status changes
function updateMapMarkers(selectedMesh) { function updateMapMarkers(selectedMesh) {
if ((xxmap != null) && (xxmap.map == null)) loadmap();
if (xxmap == null) return;
var boundingBox = null; var boundingBox = null;
if (xxmap.map == null) loadmap();
for (var i in nodes) { for (var i in nodes) {
var loc = map_parseNodeLoc(nodes[i]); var loc = map_parseNodeLoc(nodes[i]);
if (loc) { // Draw markers for devices with locations if (loc) { // Draw markers for devices with locations
@ -1724,6 +1725,8 @@
// Load the entire map // Load the entire map
function loadmap() { function loadmap() {
if (xxmap == null) return;
try {
// Initialize a Source Vector // Initialize a Source Vector
xxmap.markersSource = new ol.source.Vector(); xxmap.markersSource = new ol.source.Vector();
@ -1811,6 +1814,10 @@
xxmap.map.addControl(xxmap.contextmenu); xxmap.map.addControl(xxmap.contextmenu);
*/ */
//addMeshOptions(); // Adds Mesh names to mesh dropdown //addMeshOptions(); // Adds Mesh names to mesh dropdown
} catch (e) {
QV('viewselectmapoption', false);
xxmap = null;
}
} }
// Add feature on to Map for a Node // Add feature on to Map for a Node
@ -2425,7 +2432,7 @@
if ((meshrights & 4) != 0) x += '<a style=cursor:pointer onclick=p10showDeleteNodeDialog("' + node._id + '")>Delete Device</a>'; if ((meshrights & 4) != 0) x += '<a style=cursor:pointer onclick=p10showDeleteNodeDialog("' + node._id + '")>Delete Device</a>';
x += '</div><div style=font-size:x-small>'; x += '</div><div style=font-size:x-small>';
if (mesh.mtype == 2) x += '<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("' + node._id + '")>Interfaces</a>&nbsp;'; if (mesh.mtype == 2) x += '<a style=cursor:pointer onclick=p10showNodeNetInfoDialog("' + node._id + '")>Interfaces</a>&nbsp;';
if (node.iploc) x += '<a style=cursor:pointer onclick=p10showNodeLocationDialog("' + node._id + '")>Location</a>&nbsp;'; if ((node.iploc) && (xxmap != null)) x += '<a style=cursor:pointer onclick=p10showNodeLocationDialog("' + node._id + '")>Location</a>&nbsp;';
x += '</div><br>' x += '</div><br>'
QH('p10html3', x); QH('p10html3', x);