Web app speed improvement with geolocation is off.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-02 14:00:28 -08:00
parent d4551d83c4
commit 14b6355282
8 changed files with 350 additions and 382 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.5-c", "version": "0.4.5-d",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

File diff suppressed because one or more lines are too long

View File

@ -29,8 +29,10 @@
<script keeplink=1 type="text/javascript" src="scripts/u2f-api.js"></script> <script keeplink=1 type="text/javascript" src="scripts/u2f-api.js"></script>
<script keeplink=1 type="text/javascript" src="scripts/charts.js"></script> <script keeplink=1 type="text/javascript" src="scripts/charts.js"></script>
<script keeplink=1 type="text/javascript" src="scripts/filesaver.js"></script> <script keeplink=1 type="text/javascript" src="scripts/filesaver.js"></script>
{{{StartGeoLocation}}}
<script keeplink=1 type="text/javascript" src="scripts/ol.js"></script> <script keeplink=1 type="text/javascript" src="scripts/ol.js"></script>
<script keeplink=1 type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <script keeplink=1 type="text/javascript" src="scripts/ol3-contextmenu.js"></script>
{{{EndGeoLocation}}}
<title>{{{title}}}</title> <title>{{{title}}}</title>
</head> </head>
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px"> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">
@ -1431,7 +1433,7 @@
if (updateNaggleFlags & 8) { drawNotifications(); } if (updateNaggleFlags & 8) { drawNotifications(); }
if (updateNaggleFlags & 16) { updateMapMarkers(); } if (updateNaggleFlags & 16) { updateMapMarkers(); }
if (updateNaggleFlags & 32) { eventsUpdate(); } if (updateNaggleFlags & 32) { eventsUpdate(); }
if (updateNaggleFlags & 64) { refreshMap(false, true); } {{{StartGeoLocationJS}}}if (updateNaggleFlags & 64) { refreshMap(false, true); }{{{EndGeoLocationJS}}}
if (updateNaggleFlags & 256) { drawDeviceTimeline(); } if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
if (updateNaggleFlags & 1024) { deviceEventsUpdate(); } if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
if (updateNaggleFlags & 2048) { userEventsUpdate(); } if (updateNaggleFlags & 2048) { userEventsUpdate(); }
@ -3697,6 +3699,8 @@
mapView: null, // Sets the initial view mapView: null, // Sets the initial view
} }
{{{StartGeoLocationJS}}}
// 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)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } } if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
@ -3967,18 +3971,16 @@
//text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) }) //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) })
}); });
/* //deviceMark.setStyle(new ol.style.Style({
deviceMark.setStyle(new ol.style.Style({ // text: new ol.style.Text({
text: new ol.style.Text({ // //font: '12px helvetica,sans-serif',
//font: '12px helvetica,sans-serif', // text: currentNode.name,
text: currentNode.name, // textAlign: 'right',
textAlign: 'right', // offsetX: -10,
offsetX: -10, // fill: new ol.style.Fill({ color: '#000' }),
fill: new ol.style.Fill({ color: '#000' }), // stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) // }),
}), // image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
*/
return [ style ]; return [ style ];
} }
@ -4125,18 +4127,16 @@
QV(nodes[i]._id + '-rowid', visible); QV(nodes[i]._id + '-rowid', visible);
} }
QV('noNodesMapPlace', count == 0); QV('noNodesMapPlace', count == 0);
/* //console.log(selected);
console.log(selected); //for (var i in nodes) {
for (var i in nodes) { // if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) { // console.log(selected.indexOf(nodes[i]._id));
console.log(selected.indexOf(nodes[i]._id)); // x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />';
x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />'; // x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>'; // }
} //}
} //if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; } //QH('placenode', '');
QH('placenode', '');
*/
} }
// Called when a user clicks on a device to toggle selection for placement on map. // Called when a user clicks on a device to toggle selection for placement on map.
@ -4152,42 +4152,38 @@
// Add option for available meshes in mesh Dropdown // Add option for available meshes in mesh Dropdown
function addMeshOptions(addMeshid, meshName) { function addMeshOptions(addMeshid, meshName) {
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (addMeshid && meshName) {
if (addMeshid && meshName) { // var option = document.createElement('option');
var option = document.createElement('option'); // option.value =addMeshid;
option.value =addMeshid; // option.text = meshName;
option.text = meshName; // meshOptions.add(option); // Add specific option
meshOptions.add(option); // Add specific option //}
} //else {
else { // for (var i in meshes) { // Add all options
for (var i in meshes) { // Add all options // var option = document.createElement('option');
var option = document.createElement('option'); // option.value = i;
option.value = i; // option.text = meshes[i].name;
option.text = meshes[i].name; // meshOptions.add(option);
meshOptions.add(option); // }
} //}
}
*/
} }
// Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove) // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
function meshOptionRmvMod(delMeshid, modMeshname){ function meshOptionRmvMod(delMeshid, modMeshname){
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (delMeshid) {
if (delMeshid) { // var index=-1;
var index=-1; // for (var i = 1; i < meshOptions.options.length; i++) {
for (var i = 1; i < meshOptions.options.length; i++) { // if (meshOptions[i].value === delMeshid) { index=i; }
if (meshOptions[i].value === delMeshid) { index=i; } // }
} // if (index > 0) {
if (index > 0) { // if (modMeshname) {
if (modMeshname) { // meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified // }
} // else { meshOptions.remove(index); }
else { meshOptions.remove(index); } // }
} //}
}
*/
} }
//Check if there is any mesh created //Check if there is any mesh created
@ -4205,10 +4201,8 @@
// Clear all mesh options except 'All' // Clear all mesh options except 'All'
function clearMeshOptions() { function clearMeshOptions() {
/* //var meshOptions=Q('select-mesh');
var meshOptions=Q('select-mesh'); //for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
*/
} }
// Make a http get call- Replace this with AJAX get if jquery is used // Make a http get call- Replace this with AJAX get if jquery is used
@ -4285,7 +4279,8 @@
var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857')); var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize()); xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
} }
{{{EndGeoLocationJS}}}
// //
// MY DEVICE // MY DEVICE

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,11 +27,13 @@
<script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script> <script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/charts.js"></script> <script keeplink="1" type="text/javascript" src="scripts/charts.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/filesaver.js"></script> <script keeplink="1" type="text/javascript" src="scripts/filesaver.js"></script>
</head><body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">{{{StartGeoLocation}}}
<script keeplink="1" type="text/javascript" src="scripts/ol.js"></script> <script keeplink="1" type="text/javascript" src="scripts/ol.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <script keeplink="1" type="text/javascript" src="scripts/ol3-contextmenu.js"></script>
{{{EndGeoLocation}}}
<title>{{{title}}}</title> <title>{{{title}}}</title>
</head>
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">
<!-- right click menu --> <!-- right click menu -->
<div id="contextMenu" class="contextMenu noselect" style="display:none"> <div id="contextMenu" class="contextMenu noselect" style="display:none">
<div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div> <div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div>
@ -1429,7 +1431,7 @@
if (updateNaggleFlags & 8) { drawNotifications(); } if (updateNaggleFlags & 8) { drawNotifications(); }
if (updateNaggleFlags & 16) { updateMapMarkers(); } if (updateNaggleFlags & 16) { updateMapMarkers(); }
if (updateNaggleFlags & 32) { eventsUpdate(); } if (updateNaggleFlags & 32) { eventsUpdate(); }
if (updateNaggleFlags & 64) { refreshMap(false, true); } {{{StartGeoLocationJS}}}if (updateNaggleFlags & 64) { refreshMap(false, true); }{{{EndGeoLocationJS}}}
if (updateNaggleFlags & 256) { drawDeviceTimeline(); } if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
if (updateNaggleFlags & 1024) { deviceEventsUpdate(); } if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
if (updateNaggleFlags & 2048) { userEventsUpdate(); } if (updateNaggleFlags & 2048) { userEventsUpdate(); }
@ -3695,6 +3697,8 @@
mapView: null, // Sets the initial view mapView: null, // Sets the initial view
} }
{{{StartGeoLocationJS}}}
// 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)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } } if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
@ -3965,18 +3969,16 @@
//text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) }) //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) })
}); });
/* //deviceMark.setStyle(new ol.style.Style({
deviceMark.setStyle(new ol.style.Style({ // text: new ol.style.Text({
text: new ol.style.Text({ // //font: '12px helvetica,sans-serif',
//font: '12px helvetica,sans-serif', // text: currentNode.name,
text: currentNode.name, // textAlign: 'right',
textAlign: 'right', // offsetX: -10,
offsetX: -10, // fill: new ol.style.Fill({ color: '#000' }),
fill: new ol.style.Fill({ color: '#000' }), // stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) // }),
}), // image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
*/
return [ style ]; return [ style ];
} }
@ -4123,18 +4125,16 @@
QV(nodes[i]._id + '-rowid', visible); QV(nodes[i]._id + '-rowid', visible);
} }
QV('noNodesMapPlace', count == 0); QV('noNodesMapPlace', count == 0);
/* //console.log(selected);
console.log(selected); //for (var i in nodes) {
for (var i in nodes) { // if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) { // console.log(selected.indexOf(nodes[i]._id));
console.log(selected.indexOf(nodes[i]._id)); // x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />';
x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />'; // x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>'; // }
} //}
} //if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; } //QH('placenode', '');
QH('placenode', '');
*/
} }
// Called when a user clicks on a device to toggle selection for placement on map. // Called when a user clicks on a device to toggle selection for placement on map.
@ -4150,42 +4150,38 @@
// Add option for available meshes in mesh Dropdown // Add option for available meshes in mesh Dropdown
function addMeshOptions(addMeshid, meshName) { function addMeshOptions(addMeshid, meshName) {
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (addMeshid && meshName) {
if (addMeshid && meshName) { // var option = document.createElement('option');
var option = document.createElement('option'); // option.value =addMeshid;
option.value =addMeshid; // option.text = meshName;
option.text = meshName; // meshOptions.add(option); // Add specific option
meshOptions.add(option); // Add specific option //}
} //else {
else { // for (var i in meshes) { // Add all options
for (var i in meshes) { // Add all options // var option = document.createElement('option');
var option = document.createElement('option'); // option.value = i;
option.value = i; // option.text = meshes[i].name;
option.text = meshes[i].name; // meshOptions.add(option);
meshOptions.add(option); // }
} //}
}
*/
} }
// Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove) // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
function meshOptionRmvMod(delMeshid, modMeshname){ function meshOptionRmvMod(delMeshid, modMeshname){
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (delMeshid) {
if (delMeshid) { // var index=-1;
var index=-1; // for (var i = 1; i < meshOptions.options.length; i++) {
for (var i = 1; i < meshOptions.options.length; i++) { // if (meshOptions[i].value === delMeshid) { index=i; }
if (meshOptions[i].value === delMeshid) { index=i; } // }
} // if (index > 0) {
if (index > 0) { // if (modMeshname) {
if (modMeshname) { // meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified // }
} // else { meshOptions.remove(index); }
else { meshOptions.remove(index); } // }
} //}
}
*/
} }
//Check if there is any mesh created //Check if there is any mesh created
@ -4203,10 +4199,8 @@
// Clear all mesh options except 'All' // Clear all mesh options except 'All'
function clearMeshOptions() { function clearMeshOptions() {
/* //var meshOptions=Q('select-mesh');
var meshOptions=Q('select-mesh'); //for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
*/
} }
// Make a http get call- Replace this with AJAX get if jquery is used // Make a http get call- Replace this with AJAX get if jquery is used
@ -4283,7 +4277,8 @@
var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857')); var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize()); xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
} }
{{{EndGeoLocationJS}}}
// //
// MY DEVICE // MY DEVICE

View File

@ -27,11 +27,13 @@
<script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script> <script keeplink="1" type="text/javascript" src="scripts/u2f-api.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/charts.js"></script> <script keeplink="1" type="text/javascript" src="scripts/charts.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/filesaver.js"></script> <script keeplink="1" type="text/javascript" src="scripts/filesaver.js"></script>
</head><body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">{{{StartGeoLocation}}}
<script keeplink="1" type="text/javascript" src="scripts/ol.js"></script> <script keeplink="1" type="text/javascript" src="scripts/ol.js"></script>
<script keeplink="1" type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <script keeplink="1" type="text/javascript" src="scripts/ol3-contextmenu.js"></script>
{{{EndGeoLocation}}}
<title>{{{title}}}</title> <title>{{{title}}}</title>
</head>
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">
<!-- right click menu --> <!-- right click menu -->
<div id="contextMenu" class="contextMenu noselect" style="display:none"> <div id="contextMenu" class="contextMenu noselect" style="display:none">
<div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div> <div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div>
@ -1429,7 +1431,7 @@
if (updateNaggleFlags & 8) { drawNotifications(); } if (updateNaggleFlags & 8) { drawNotifications(); }
if (updateNaggleFlags & 16) { updateMapMarkers(); } if (updateNaggleFlags & 16) { updateMapMarkers(); }
if (updateNaggleFlags & 32) { eventsUpdate(); } if (updateNaggleFlags & 32) { eventsUpdate(); }
if (updateNaggleFlags & 64) { refreshMap(false, true); } {{{StartGeoLocationJS}}}if (updateNaggleFlags & 64) { refreshMap(false, true); }{{{EndGeoLocationJS}}}
if (updateNaggleFlags & 256) { drawDeviceTimeline(); } if (updateNaggleFlags & 256) { drawDeviceTimeline(); }
if (updateNaggleFlags & 1024) { deviceEventsUpdate(); } if (updateNaggleFlags & 1024) { deviceEventsUpdate(); }
if (updateNaggleFlags & 2048) { userEventsUpdate(); } if (updateNaggleFlags & 2048) { userEventsUpdate(); }
@ -3695,6 +3697,8 @@
mapView: null, // Sets the initial view mapView: null, // Sets the initial view
} }
{{{StartGeoLocationJS}}}
// 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)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } } if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } }
@ -3965,18 +3969,16 @@
//text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) }) //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) })
}); });
/* //deviceMark.setStyle(new ol.style.Style({
deviceMark.setStyle(new ol.style.Style({ // text: new ol.style.Text({
text: new ol.style.Text({ // //font: '12px helvetica,sans-serif',
//font: '12px helvetica,sans-serif', // text: currentNode.name,
text: currentNode.name, // textAlign: 'right',
textAlign: 'right', // offsetX: -10,
offsetX: -10, // fill: new ol.style.Fill({ color: '#000' }),
fill: new ol.style.Fill({ color: '#000' }), // stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) // }),
}), // image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) }));
*/
return [ style ]; return [ style ];
} }
@ -4123,18 +4125,16 @@
QV(nodes[i]._id + '-rowid', visible); QV(nodes[i]._id + '-rowid', visible);
} }
QV('noNodesMapPlace', count == 0); QV('noNodesMapPlace', count == 0);
/* //console.log(selected);
console.log(selected); //for (var i in nodes) {
for (var i in nodes) { // if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) {
if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) { // console.log(selected.indexOf(nodes[i]._id));
console.log(selected.indexOf(nodes[i]._id)); // x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />';
x += '<div class=noselect id=' + nodes[i]._id + '-rowid onclick=selectNodeToPlace(event,\''+ nodes[i]._id +'\') style=background-color:lightgray;margin-bottom:4px;border-radius:2px><input name=PlaceMapDeviceCheckbox id=' + nodes[i]._id + '-checkid type=checkbox style=width:16px;display:inline ' + ((selected.indexOf(nodes[i]._id) >= 0)?'checked':'') + ' />'; // x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>';
x += '<div class=j' + nodes[i].icon + ' style=width:16px;height:16px;margin-top:2px;margin-right:4px;display:inline-block></div><div style=width:16px;display:inline>' + nodes[i].name + '</div></div>'; // }
} //}
} //if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; }
if (x == '') { x = '<div style=text-align:center;width:100%>No devices found.</div>'; } //QH('placenode', '');
QH('placenode', '');
*/
} }
// Called when a user clicks on a device to toggle selection for placement on map. // Called when a user clicks on a device to toggle selection for placement on map.
@ -4150,42 +4150,38 @@
// Add option for available meshes in mesh Dropdown // Add option for available meshes in mesh Dropdown
function addMeshOptions(addMeshid, meshName) { function addMeshOptions(addMeshid, meshName) {
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (addMeshid && meshName) {
if (addMeshid && meshName) { // var option = document.createElement('option');
var option = document.createElement('option'); // option.value =addMeshid;
option.value =addMeshid; // option.text = meshName;
option.text = meshName; // meshOptions.add(option); // Add specific option
meshOptions.add(option); // Add specific option //}
} //else {
else { // for (var i in meshes) { // Add all options
for (var i in meshes) { // Add all options // var option = document.createElement('option');
var option = document.createElement('option'); // option.value = i;
option.value = i; // option.text = meshes[i].name;
option.text = meshes[i].name; // meshOptions.add(option);
meshOptions.add(option); // }
} //}
}
*/
} }
// Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove) // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove)
function meshOptionRmvMod(delMeshid, modMeshname){ function meshOptionRmvMod(delMeshid, modMeshname){
/* //var meshOptions = Q('select-mesh');
var meshOptions = Q('select-mesh'); //if (delMeshid) {
if (delMeshid) { // var index=-1;
var index=-1; // for (var i = 1; i < meshOptions.options.length; i++) {
for (var i = 1; i < meshOptions.options.length; i++) { // if (meshOptions[i].value === delMeshid) { index=i; }
if (meshOptions[i].value === delMeshid) { index=i; } // }
} // if (index > 0) {
if (index > 0) { // if (modMeshname) {
if (modMeshname) { // meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified
meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified // }
} // else { meshOptions.remove(index); }
else { meshOptions.remove(index); } // }
} //}
}
*/
} }
//Check if there is any mesh created //Check if there is any mesh created
@ -4203,10 +4199,8 @@
// Clear all mesh options except 'All' // Clear all mesh options except 'All'
function clearMeshOptions() { function clearMeshOptions() {
/* //var meshOptions=Q('select-mesh');
var meshOptions=Q('select-mesh'); //for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); }
*/
} }
// Make a http get call- Replace this with AJAX get if jquery is used // Make a http get call- Replace this with AJAX get if jquery is used
@ -4283,7 +4277,8 @@
var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857')); var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize()); xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize());
} }
{{{EndGeoLocationJS}}}
// //
// MY DEVICE // MY DEVICE

View File

@ -1551,12 +1551,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Clean up the U2F challenge if needed // Clean up the U2F challenge if needed
if (req.session.u2fchallenge) { delete req.session.u2fchallenge; }; if (req.session.u2fchallenge) { delete req.session.u2fchallenge; };
// If geolocation is disabled, comment out all geolocation code to speed up the web application
var StartGeoLocation = '', EndGeoLocation = '', StartGeoLocationJS = '', EndGeoLocationJS = '';
if (domain.geolocation !== true) { StartGeoLocation = '<!--'; EndGeoLocation = '-->'; StartGeoLocationJS = '/*'; EndGeoLocationJS = '*/'; }
// Fetch the web state // Fetch the web state
parent.debug('web', 'handleRootRequestEx: success.'); parent.debug('web', 'handleRootRequestEx: success.');
obj.db.Get('ws' + user._id, function (err, states) { obj.db.Get('ws' + user._id, function (err, states) {
var webstate = (states.length == 1) ? obj.filterUserWebState(states[0].state) : ''; var webstate = (states.length == 1) ? obj.filterUserWebState(states[0].state) : '';
render(req, res, getRenderPage('default', req), { authCookie: authCookie, authRelayCookie: authRelayCookie, viewmode: viewmode, currentNode: currentNode, logoutControls: JSON.stringify(logoutcontrols), title: domain.title, title2: domain.title2, extitle: encodeURIComponent(domain.title), extitle2: encodeURIComponent(domain.title2), domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer, webstate: encodeURIComponent(webstate), pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports() }); render(req, res, getRenderPage('default', req), { authCookie: authCookie, authRelayCookie: authRelayCookie, viewmode: viewmode, currentNode: currentNode, logoutControls: JSON.stringify(logoutcontrols), title: domain.title, title2: domain.title2, extitle: encodeURIComponent(domain.title), extitle2: encodeURIComponent(domain.title2), domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer, webstate: encodeURIComponent(webstate), pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports(), StartGeoLocation: StartGeoLocation, EndGeoLocation: EndGeoLocation, StartGeoLocationJS: StartGeoLocationJS, EndGeoLocationJS: EndGeoLocationJS });
}); });
} else { } else {
// Send back the login application // Send back the login application