Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1906 lines
62 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var ActiveZones = null;
  3. var map = null;
  4. var map_ed = null;
  5. var markers = [];
  6. var mapListStore = new Ext.data.JsonStore({
  7. root: 'maps',
  8. totalProperty: 'totalCount',
  9. idProperty: 'map_id',
  10. remoteSort: false,
  11. baseParams: {
  12. UID: '<?=$CUser->Data['id'];?>',
  13. SID: '<?=$Session;?>'//,
  14. //SITE: <?=$SiteID;?>
  15. },
  16. fields: [{
  17. name: 'map_id',
  18. type: 'int'
  19. },{
  20. name: 'map_name',
  21. type: 'string'
  22. }],
  23. proxy : new Ext.data.HttpProxy({
  24. method: 'POST',
  25. prettyUrls: false,
  26. url: '/lib/controller/listMaps.php'
  27. })
  28. });
  29. var selectedMarkerIcon = L.icon({
  30. iconUrl: '/style/assets/cursor.png',
  31. iconSize: [32, 32],
  32. iconAnchor: [16, 16]//,
  33. //popupAnchor: [-3, -76],
  34. //shadowUrl: 'my-icon-shadow.png',
  35. //shadowSize: [68, 95],
  36. //shadowAnchor: [22, 94]
  37. });
  38. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  39. function getZoneByNode( nid ){
  40. var rVal = -1;
  41. for( var i=0; i < ActiveZones.totalCount; i++ ){
  42. if( ActiveZones.zones[i].dev_id == nid ){
  43. rVal = i;
  44. break;
  45. };
  46. };
  47. return rVal;
  48. };
  49. function turnOffAllGzButThis( nid ){
  50. var chocho = -1;
  51. for( var i=0; i < ActiveZones.totalCount; i++ ){
  52. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  53. map.removeLayer( ActiveZones.fig[i] );
  54. map.removeLayer( ActiveZones.zang[i] );
  55. map.removeLayer( ActiveZones.center[i] );
  56. };
  57. if( chocho > -1 ){
  58. map.addLayer( ActiveZones.fig[chocho] );
  59. map.addLayer( ActiveZones.zang[chocho] );
  60. map.addLayer( ActiveZones.center[chocho] );
  61. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  62. map.flyToBounds( cVisible.getBounds() );
  63. };
  64. };
  65. function turnAllGzOn(){
  66. var tall = Array();
  67. for( var i=0; i < ActiveZones.totalCount; i++ ){
  68. tall[i*3] = ActiveZones.fig[i];
  69. tall[i*3+1] = ActiveZones.zang[i];
  70. tall[i*3+2] = ActiveZones.center[i];
  71. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  72. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  73. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  74. };
  75. var cVisible = L.featureGroup( tall );
  76. //window.setTimeout(() => {
  77. // map.flyToBounds( cVisible.getBounds() );
  78. //}, 500);
  79. map.flyToBounds( cVisible.getBounds() );
  80. };
  81. function loadMapZones( SiteID ){
  82. Ext.Ajax.request({
  83. url: '/lib/controller/getGeoZones.php',
  84. params: {
  85. SITE: SiteID,
  86. UID: <?=$UserID;?>,
  87. SID: '<?=$Session;?>'
  88. },
  89. success: function( response, opts ){
  90. // If the response is JSON, you have to decode it
  91. var data = Ext.decode(response.responseText);
  92. var pp = Ext.getCmp('sources_panel');
  93. if( typeof pp !== 'undefined' ) pp.removeAll();
  94. ActiveZones = data;
  95. ActiveZones.fig = new Array();
  96. ActiveZones.zang = new Array();
  97. ActiveZones.center = new Array();
  98. for(var i = 0; i < data.totalCount; i++ ) {
  99. switch( data.zones[i].type ){
  100. case 'circle':{
  101. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  102. ActiveZones.fig[i] = new L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } );
  103. //map.addLayer( ActiveZones.fig[i] );
  104. break;
  105. };
  106. case 'poly':{
  107. ActiveZones.fig[i] = new L.polygon( data.zones[i].points, {color: data.zones[i].color, dashArray: "4 1 2 3", weight: 1, opacity: 0.8, clickable: false, interactive: false, bubblingMouseEvents: false });//.addTo(map);
  108. //map.addLayer( ActiveZones.fig[i] );
  109. break;
  110. };
  111. case 'image':{
  112. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  113. //map.addLayer( ActiveZones.fig[i] );
  114. break;
  115. };
  116. case 'image_rot':{
  117. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  118. opacity: 0.8 //,
  119. //interactive: true,
  120. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geogr?fico Nacional de Espa?a</a>"
  121. });//.addTo( map );
  122. //map.addLayer( ActiveZones.fig[i] );
  123. break;
  124. };
  125. };
  126. /*
  127. if( data.zones[i].dev_is_source ){
  128. if( typeof pp !== 'undefined' ) {
  129. var sty = '';
  130. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  131. sty = 'cardDeviceSourceSelected';
  132. } else {
  133. sty = 'cardDeviceSource';
  134. };
  135. pp.add( {
  136. id: data.zones[i].dev_id+'_container',
  137. frame: false,
  138. border: false,
  139. width: 130,
  140. height: 130,
  141. html: '<div id="'+data.zones[i].dev_id+'_div" class="'+sty+'" onclick="clickDeviceSelector('+data.zones[i].dev_id+');"><img id="'+data.zones[i].dev_id+'_ind" width="16px" src="/style/assets/led_green_blink_300ms.gif"><center><img src="/style/assets/'+data.zones[i].dev_type+'_node.png"><br/><p class="dev_name">'+data.zones[i].dev_name+'</p></center></div>'
  142. });
  143. };
  144. };*/
  145. if( data.zones[i].zang != undefined ){
  146. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  147. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  148. };
  149. if( data.zones[i].center != undefined ){
  150. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  151. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  152. };
  153. };
  154. //if( selecredActiveSourceFilter == 0 ){
  155. turnAllGzOn();
  156. //} else {
  157. // turnOffAllGzButThis( selecredActiveSourceFilter );
  158. //};
  159. //if( typeof pp !== 'undefined' ) pp.doLayout();
  160. },
  161. failure: function( response, opts ) {
  162. //Ext.fly('some_div').update('Fail!');
  163. }
  164. });
  165. };
  166. var cevt = Array();
  167. var coz = Array();
  168. function showEventsOnMap( data, removeCursor ){
  169. if( removeCursor == undefined ) removeCursor = true;
  170. if( removeCursor ) map.removeLayer( selectedMarker );
  171. if( cevt.length ){
  172. for( i=0; i< cevt.length; i++ ){
  173. if( cevt[i]!= null ){
  174. cevt[i].remove();
  175. delete( cevt[i] );
  176. cevt[i] = null;
  177. };
  178. };
  179. };
  180. if( coz.length ){
  181. for( i=0; i< coz.length; i++ ){
  182. if( coz[i]!= null ){
  183. coz[i].remove();
  184. delete( coz[i] );
  185. coz[i]=null;
  186. };
  187. };
  188. };
  189. var idx = 0;
  190. for( i=0; i < data.length; i++ ){
  191. if( data[i].targets != undefined ){
  192. var zz = ( 1.0 / ( data[i].targets.length + 0 ) );
  193. var cp_color='#FF0000';
  194. for( j = 0; j < data[i].targets.length; j++ ){
  195. //switch( data.log[i].event ){
  196. // case 36: cp_color='#0000FF'; break;
  197. //};
  198. cLon = data[i].targets[j].lon;
  199. cLat = data[i].targets[j].lat;
  200. cevt[idx] = L.circleMarker( [cLat, cLon], {id:data[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } );//.on('click', function( e, a ){
  201. // loadEventPropertiesByID( this.options.id );
  202. //} );
  203. cevt[idx].addTo(map);
  204. idx++;
  205. };
  206. };
  207. };
  208. };
  209. function LoadMapEventsZ( Mode ){
  210. if( tlLoadLocker ) return;
  211. tlLoadLocker = true;
  212. Ext.Ajax.request({
  213. url: '/lib/controller/getGeoAlerts.php',
  214. params: {
  215. SITE: <?=$SiteID;?>,
  216. UID: <?=$UserID;?>,
  217. SID: '<?=$Session;?>',
  218. MODE: Mode
  219. },
  220. success: function( response, opts ){
  221. if( cevt.length ){
  222. for( i=0; i< cevt.length; i++ ){
  223. if( cevt[i]!= null ){
  224. cevt[i].remove();
  225. delete( cevt[i] );
  226. cevt[i] = null;
  227. };
  228. };
  229. };
  230. if( coz.length ){
  231. for( i=0; i< coz.length; i++ ){
  232. if( coz[i]!= null ){
  233. coz[i].remove();
  234. delete( coz[i] );
  235. coz[i]=null;
  236. };
  237. };
  238. };
  239. var data = Ext.decode( response.responseText );
  240. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  241. for( i=0; i < data.evt.length; i++ ){
  242. cevt[i] = L.circleMarker( [data.evt[i].lat,data.evt[i].lon], {id:data.evt[i].id, color: '#FF0000', radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
  243. loadEventProperties( this.options.id );
  244. } );
  245. cevt[i].addTo(map);
  246. };
  247. for( i=0; i < data.other.length; i++ ){
  248. switch( data.other[i].type ){
  249. case 'circle':{
  250. coz[i] = L.circleMarker( data.other[i].loc, {id:data.other[i].id, color: data.other[i].color, radius: 5, stroke: false, fillOpacity: 1.0 } );
  251. coz[i].addTo(map);
  252. break;
  253. };
  254. };
  255. };
  256. //eventsListStore.reload();
  257. tlLoadLocker = false;
  258. },
  259. failure: function( response, opts ) {
  260. //Ext.fly('some_div').update('Fail!');
  261. tlLoadLocker = false;
  262. }
  263. });
  264. };
  265. function initMapMonitoring__00(){
  266. map = L.map('event_map',{
  267. attributionControl: true,
  268. //preferCanvas: true,
  269. zoomControl: true,
  270. center: [SiteLat, SiteLon],
  271. /*zoomControl: false,
  272. zoom: 17,
  273. minZoom: 17,
  274. maxZoom: 17,*/
  275. keyboard: false
  276. }).setView([SiteLat, SiteLon], 17);
  277. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  278. var mapLayers = [];
  279. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  280. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  281. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  282. detectRetina: true
  283. });*/
  284. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  285. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  286. maxNativeZoom: 18,
  287. maxZoom: 24,
  288. })
  289. // https://leaflet-extras.github.io/leaflet-providers/preview/
  290. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  291. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  292. maxZoom: 19
  293. });
  294. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  295. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  296. maxZoom: 19
  297. });
  298. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  299. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  300. maxZoom: 24
  301. });
  302. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  303. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  304. maxZoom: 19
  305. });
  306. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  307. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  308. maxZoom: 19
  309. });
  310. /*
  311. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  312. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  313. maxZoom: 22
  314. });
  315. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  316. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  317. maxZoom: 22
  318. });
  319. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  320. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  321. maxZoom: 22
  322. });
  323. */
  324. var baseMaps = {
  325. "MyMap": mapLayers["MyMap"],
  326. "OpenStreetMap": mapLayers["OpenStreetMap"],
  327. "OpenTopoMap": mapLayers["OpenTopoMap"],
  328. "EsriSat": mapLayers["EsriSat"],
  329. "EsriStreet": mapLayers["EsriStreet"],
  330. "EsriTopo": mapLayers["EsriTopo"],
  331. //"Bing": mapLayers["Bing"],
  332. //"OSM-Cycle": mapLayers["Cycle"],
  333. //"Landscape": mapLayers["Landscape"],
  334. //"Outdoor": mapLayers["Outdoor"],
  335. };
  336. //L.control.layers( baseMaps ).addTo(map);
  337. mapLayers["MyMap"].addTo(map);
  338. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  339. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  340. maxNativeZoom: 18,
  341. maxZoom: 24,
  342. }).addTo(map); */
  343. //loadTimeLineGroups( selectedSite );
  344. loadMapZones( 0 );
  345. //getData( 'arch' );
  346. };
  347. function initMapMonitoring(){
  348. var aK = true;
  349. if( MAP_SET.attribution == '' ) aK = false;
  350. var mapLayers = [];
  351. if( map != null ){
  352. //ToDo: must be moved to Upper Menu changer
  353. map.off();
  354. map.remove();
  355. map = null;
  356. };
  357. if( MAP_SET.type == 1 ){
  358. map = L.map( 'event_map',{
  359. //attributionControl: aK,
  360. attributionControl: false,
  361. preferCanvas: true,
  362. zoomControl: true,
  363. center: [SiteLat, SiteLon],
  364. /*zoomControl: false,
  365. zoom: 17,
  366. minZoom: 17,
  367. maxZoom: 17,*/
  368. keyboard: false
  369. });
  370. map.setView([SiteLat, SiteLon], 17 );
  371. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  372. // attribution: MAP_SET.attribution,
  373. // maxNativeZoom: MAP_SET.maxNativeZoom,
  374. // maxZoom: MAP_SET.maxZoom
  375. //});
  376. L.tileLayer( MAP_SET.layer_url, {
  377. attribution: MAP_SET.attribution,
  378. attributionControl: false,
  379. maxNativeZoom: MAP_SET.maxNativeZoom,
  380. //minZoom: 0,
  381. maxZoom: MAP_SET.maxZoom
  382. }).addTo( map );
  383. } else {
  384. map = L.map( 'event_map',{
  385. crs: L.CRS.Simple,
  386. attributionControl: false,
  387. preferCanvas: true,
  388. zoomControl: true,
  389. center: [SiteLat, SiteLon],
  390. /*zoomControl: false,*/
  391. zoom: 0,
  392. minZoom: -1,
  393. maxZoom: 4,
  394. keyboard: false
  395. });
  396. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  397. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map );
  398. //map.setView([SiteLat, SiteLon], -1 );
  399. };
  400. //ToDo: Fix Initial Zoom level -> May be saving into a user profile
  401. loadMapZones( 0 );
  402. };
  403. function initMapReporting(){
  404. var aK = true;
  405. if( MAP_SET.attribution == '' ) aK = false;
  406. var mapLayers = [];
  407. if( map != null ){
  408. //ToDo: must be moved to Upper Menu changer
  409. map.off();
  410. map.remove();
  411. map = null;
  412. };
  413. if( MAP_SET.type == 1 ){
  414. map = L.map( 'report_map',{
  415. //attributionControl: aK,
  416. attributionControl: false,
  417. preferCanvas: true,
  418. zoomControl: true,
  419. center: [SiteLat, SiteLon],
  420. /*zoomControl: false,
  421. zoom: 17,
  422. minZoom: 17,
  423. maxZoom: 17,*/
  424. keyboard: false
  425. });
  426. map.setView([SiteLat, SiteLon], 17 );
  427. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  428. // attribution: MAP_SET.attribution,
  429. // maxNativeZoom: MAP_SET.maxNativeZoom,
  430. // maxZoom: MAP_SET.maxZoom
  431. //});
  432. L.tileLayer( MAP_SET.layer_url, {
  433. attribution: MAP_SET.attribution,
  434. attributionControl: false,
  435. maxNativeZoom: MAP_SET.maxNativeZoom,
  436. minZoom: 0,
  437. maxZoom: MAP_SET.maxZoom
  438. }).addTo( map );
  439. } else {
  440. map = L.map( 'report_map',{
  441. crs: L.CRS.Simple,
  442. attributionControl: false,
  443. preferCanvas: true,
  444. zoomControl: true,
  445. center: [SiteLat, SiteLon],
  446. /*zoomControl: false,*/
  447. zoom: 0,
  448. minZoom: -1,
  449. maxZoom: 4,
  450. keyboard: false
  451. });
  452. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  453. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map );
  454. //map.setView([SiteLat, SiteLon], -1 );
  455. };
  456. //ToDo: Fix Initial Zoom level -> May be saving into a user profile
  457. loadMapZones( 0 );
  458. };
  459. var iconSaver = null;
  460. var markerSaver = null;
  461. function updateLocation( e ){
  462. locationSelectedNode = e.target.options.mycustomid;
  463. Ext.Ajax.request({
  464. url: '/lib/controller/updateLocation.php',
  465. params: {
  466. NODE: locationSelectedNode,
  467. SITE: <?=$SiteID;?>,
  468. UID: <?=$UserID;?>,
  469. TYPE: 0,
  470. SID: '<?=$Session;?>',
  471. LAT: e.target._latlng.lat,
  472. LON: e.target._latlng.lng
  473. },
  474. success: function( response, opts ){
  475. loadNodeLocationProps( locationSelectedNode );
  476. },
  477. failure: failureAJAXFunction
  478. });
  479. };
  480. function markerDblClick( e ){
  481. if( iconSaver == null ){
  482. iconSaver = e.target.options.icon;
  483. markerSaver = e.target;
  484. e.target.setIcon( SNAPE_Icon );
  485. for( i=0; i< markers.length; i++){
  486. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  487. markers[i].setOpacity( 0.1 );
  488. } else {
  489. markers[i].setOpacity( 1.0 );
  490. }
  491. };
  492. } else {
  493. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  494. e.target.setIcon( iconSaver );
  495. iconSaver = null;
  496. markerSaver = null;
  497. for( i=0; i< markers.length; i++){
  498. markers[i].setOpacity( 1.0 );
  499. };
  500. } else {
  501. markerSaver.setIcon( iconSaver );
  502. iconSaver = e.target.options.icon;
  503. markerSaver = e.target;
  504. e.target.setIcon( SNAPE_Icon );
  505. for( i=0; i< markers.length; i++){
  506. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  507. markers[i].setOpacity( 0.1 );
  508. } else {
  509. markers[i].setOpacity( 1.0 );
  510. }
  511. };
  512. };
  513. };
  514. };
  515. function setNodeLocationToAnchor(){
  516. Ext.Ajax.request({
  517. url: '/lib/controller/updateLocation.php',
  518. params: {
  519. NODE: locationSelectedNode,
  520. SITE: <?=$SiteID;?>,
  521. UID: <?=$UserID;?>,
  522. TYPE: 0,
  523. SID: '<?=$Session;?>',
  524. LAT: SiteLat,
  525. LON: SiteLon,
  526. ALT: SiteAlt
  527. },
  528. success: function( response, opts ){
  529. loadLocationEditor('sys_location_map');
  530. },
  531. failure: failureAJAXFunction
  532. });
  533. };
  534. function setNodeLocationByDelta(){
  535. var dx = Ext.getCmp('dx').getValue();
  536. var dy = Ext.getCmp('dy').getValue();
  537. var dz = Ext.getCmp('dz').getValue();
  538. Ext.Ajax.request({
  539. url: '/lib/controller/updateLocation.php',
  540. params: {
  541. NODE: locationSelectedNode,
  542. SITE: <?=$SiteID;?>,
  543. UID: <?=$UserID;?>,
  544. TYPE: 3,
  545. SID: '<?=$Session;?>',
  546. LAT: dx,
  547. LON: dy,
  548. ALT: dz
  549. },
  550. success: function( response, opts ){
  551. loadLocationEditor('sys_location_map');
  552. },
  553. failure: failureAJAXFunction
  554. });
  555. };
  556. var LRF3D_Icon = L.icon({
  557. iconUrl: '/style/assets/5_node.png',
  558. //shadowUrl: 'leaf-shadow.png',
  559. iconSize: [64, 64], // size of the icon
  560. //shadowSize: [50, 64], // size of the shadow
  561. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  562. //shadowAnchor: [4, 62], // the same for the shadow
  563. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  564. });
  565. var LFS_Icon = L.icon({
  566. iconUrl: '/style/assets/2_node.png',
  567. //shadowUrl: 'leaf-shadow.png',
  568. iconSize: [64, 64], // size of the icon
  569. //shadowSize: [50, 64], // size of the shadow
  570. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  571. //shadowAnchor: [4, 62], // the same for the shadow
  572. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  573. });
  574. var PLS200_Icon = L.icon({
  575. iconUrl: '/style/assets/3_node.png',
  576. //shadowUrl: 'leaf-shadow.png',
  577. iconSize: [64, 64], // size of the icon
  578. //shadowSize: [50, 64], // size of the shadow
  579. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  580. //shadowAnchor: [4, 62], // the same for the shadow
  581. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  582. });
  583. var PLSNET200_Icon = L.icon({
  584. iconUrl: '/style/assets/6_node.png',
  585. //shadowUrl: 'leaf-shadow.png',
  586. iconSize: [64, 64], // size of the icon
  587. //shadowSize: [50, 64], // size of the shadow
  588. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  589. //shadowAnchor: [4, 62], // the same for the shadow
  590. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  591. });
  592. var PLS360_Icon = L.icon({
  593. iconUrl: '/style/assets/4_node.png',
  594. //shadowUrl: 'leaf-shadow.png',
  595. iconSize: [64, 64], // size of the icon
  596. //shadowSize: [50, 64], // size of the shadow
  597. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  598. //shadowAnchor: [4, 62], // the same for the shadow
  599. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  600. });
  601. var ALS_Icon = L.icon({
  602. iconUrl: '/style/assets/1_node.png',
  603. //shadowUrl: 'leaf-shadow.png',
  604. iconSize: [64, 64], // size of the icon
  605. //shadowSize: [50, 64], // size of the shadow
  606. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  607. //shadowAnchor: [4, 62], // the same for the shadow
  608. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  609. });
  610. var PTZCAM_Icon = L.icon({
  611. iconUrl: '/style/assets/12_node.png',
  612. //shadowUrl: 'leaf-shadow.png',
  613. iconSize: [64, 64], // size of the icon
  614. //shadowSize: [50, 64], // size of the shadow
  615. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  616. //shadowAnchor: [4, 62], // the same for the shadow
  617. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  618. });
  619. var FIXCAM_Icon = L.icon({
  620. iconUrl: '/style/assets/11_node.png',
  621. //shadowUrl: 'leaf-shadow.png',
  622. iconSize: [64, 64], // size of the icon
  623. //shadowSize: [50, 64], // size of the shadow
  624. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  625. //shadowAnchor: [4, 62], // the same for the shadow
  626. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  627. });
  628. var SITEZ_Icon = L.icon({
  629. iconUrl: '/style/assets/centre_1.png',
  630. //shadowUrl: 'leaf-shadow.png',
  631. iconSize: [32, 32], // size of the icon
  632. //shadowSize: [50, 64], // size of the shadow
  633. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  634. //shadowAnchor: [4, 62], // the same for the shadow
  635. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  636. });
  637. var SNAPE_Icon = L.icon({
  638. iconUrl: '/style/assets/cursor.png',
  639. //shadowUrl: 'leaf-shadow.png',
  640. iconSize: [32, 32], // size of the icon
  641. //shadowSize: [50, 64], // size of the shadow
  642. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  643. //shadowAnchor: [4, 62], // the same for the shadow
  644. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  645. });
  646. function loadLocationNodes(){
  647. Ext.Ajax.request({
  648. url: '/lib/controller/getLocationItems.php',
  649. params: {
  650. SITE: <?=$SiteID;?>,
  651. UID: <?=$UserID;?>,
  652. SID: '<?=$Session;?>'
  653. },
  654. success: function( response, opts ){
  655. var data = Ext.decode(response.responseText);
  656. if( data!= null ){
  657. var i = 0;
  658. var tall = Array();
  659. for( ; i < data.length; i++){
  660. switch( data[i].type ){
  661. case 1:{
  662. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  663. break;
  664. };
  665. case 2:{
  666. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LFS_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  667. break;
  668. };
  669. case 3:{
  670. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS200_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  671. break;
  672. };
  673. case 4:{
  674. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS360_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  675. break;
  676. };
  677. case 5:{
  678. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LRF3D_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  679. break;
  680. };
  681. case 6:{
  682. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLSNET200_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  683. break;
  684. };
  685. case 10:
  686. case 12:{
  687. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: FIXCAM_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  688. break;
  689. };
  690. case 11:
  691. case 13:{
  692. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PTZCAM_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  693. break;
  694. };
  695. };
  696. tall[i] = markers[i];
  697. };
  698. tall[i++] = ed_anchor;
  699. var cVisible = L.featureGroup( tall );
  700. map_ed.flyToBounds( cVisible.getBounds() );
  701. } else {
  702. map_ed.setView([SiteLat, SiteLon], 4 );
  703. };
  704. },
  705. failure: function( response, opts ) {
  706. //var tPanel = Ext.getCmp('main_portal');
  707. //tPanel.remove(0);
  708. //tPanel.add( { html: 'Failed to load dashboard!' } );
  709. //tPanel.doLayout();
  710. }
  711. });
  712. };
  713. function orientationEditor(){
  714. if( orientationEditorWindow == null ){
  715. orientationEditorWindow = new Ext.Window({
  716. modal: true,
  717. title: '<?=$Labels->GetLabel('_ORIENTATION_');?>',
  718. closeAction: 'hide',
  719. width: 640,
  720. height: 500,
  721. items:[{
  722. layout: 'table',
  723. defaults: {
  724. bodyStyle:'padding:5px'
  725. },
  726. layoutConfig: {
  727. columns: 3
  728. },
  729. items:[{
  730. html: 'Roll:'
  731. },{
  732. xtype: 'textfield',
  733. id: 'roll',
  734. name: 'roll',
  735. value: 30.0029,
  736. listeners:{
  737. change: function( sl, nv, tt ){
  738. setCubeOrientation( nv / 1.0, curY, curZ );
  739. }
  740. }
  741. },{
  742. xtype: 'slider',
  743. id: 'roll_sld',
  744. width: 200,
  745. value: 30.0029,
  746. minValue: -180.0,
  747. maxValue: 180.0,
  748. listeners:{
  749. change: function( sl, nv, tt ){
  750. setCubeOrientation( nv, curY, curZ );
  751. }
  752. }
  753. },{
  754. html: 'Pitch:'
  755. },{
  756. xtype: 'textfield',
  757. id: 'pitch',
  758. name: 'pitch',
  759. value: 30.0029,
  760. listeners:{
  761. change: function( sl, nv, tt ){
  762. setCubeOrientation( curX, nv / 1.0, curZ );
  763. }
  764. }
  765. },{
  766. xtype: 'slider',
  767. id: 'pitch_sld',
  768. width: 200,
  769. value: 30.0029,
  770. minValue: -180.0,
  771. maxValue: 180.0,
  772. listeners:{
  773. change: function( sl, nv, tt ){
  774. setCubeOrientation( curX, nv, curZ );
  775. }
  776. }
  777. },{
  778. html: 'Yaw:'
  779. },{
  780. xtype: 'textfield',
  781. id: 'yaw',
  782. name: 'yaw',
  783. value: 30.0029,
  784. listeners:{
  785. change: function( sl, nv, tt ){
  786. //alert( nv );
  787. setCubeOrientation( curX, curY, nv / 1.0 );
  788. }
  789. }
  790. },{
  791. xtype: 'slider',
  792. id: 'yaw_sld',
  793. width: 200,
  794. value: 30.0029,
  795. minValue: -180.0,
  796. maxValue: 180.0,
  797. listeners:{
  798. change: function( sl, nv, tt ){
  799. setCubeOrientation( curX, curY, nv );
  800. }
  801. }
  802. }]
  803. },{
  804. html: '<div id="wrapper"><div class="viewport"><div class="cube"><div class="side"><div class="cube-image top">FRONT</div></div><div class="side"><div class="cube-image">TOP</div></div><div class="side"><div class="cube-image">RIGHT</div></div><div class="side"><div class="cube-image">BOTTOM</div></div><div class="side"><div class="cube-image">LEFT</div></div><div class="side"><div class="cube-image active">BACK</div></div></div></div></div>'
  805. }],
  806. buttons:[{
  807. text: 'Cancel',
  808. width: 200,
  809. handler: function(){
  810. orientationEditorWindow.hide();
  811. }
  812. },{
  813. text: 'Apply',
  814. width: 200,
  815. handler: function(){
  816. Ext.getCmp('sroll').setValue( Ext.getCmp('roll').getValue() );
  817. Ext.getCmp('spitch').setValue( Ext.getCmp('pitch').getValue() );
  818. Ext.getCmp('syaw').setValue( Ext.getCmp('yaw').getValue() );
  819. orientationEditorWindow.hide();
  820. }
  821. }]
  822. });
  823. orientationEditorWindow.show();
  824. cubeViewport = new Viewport({
  825. element: document.getElementsByClassName('cube')[0],
  826. fps: 20,
  827. sensivity: .1,
  828. sensivityFade: .93,
  829. speed: 2,
  830. touchSensivity: 1.5
  831. });
  832. cube = new Cube({
  833. viewport: cubeViewport,
  834. element: document.getElementsByClassName('cube')[0]
  835. });
  836. } else {
  837. orientationEditorWindow.show();
  838. };
  839. setCubeOrientation( Ext.getCmp('sroll').getValue(), Ext.getCmp('spitch').getValue(), Ext.getCmp('syaw').getValue() );
  840. };
  841. var locationSelectedNode = 0;
  842. function loadLoactionProps( e ){
  843. if( typeof e == 'number' ){
  844. locationSelectedNode = e;
  845. } else {
  846. locationSelectedNode = e.sourceTarget.options.mycustomid;
  847. }
  848. loadNodeLocationProps( locationSelectedNode );
  849. };
  850. function loadNodeLocationProps( NodeID ){
  851. //alert( 'Node: ' + NodeID );
  852. Ext.Ajax.request({
  853. url: '/lib/controller/getLocationNodeProps.php',
  854. params: {
  855. NID: <?=$SiteID;?>,
  856. UID: <?=$UserID;?>,
  857. SID: '<?=$Session;?>',
  858. NODE: NodeID
  859. },
  860. success: function( response, opts ){
  861. // If the response is JSON, you have to decode it
  862. var data = Ext.decode(response.responseText);
  863. var tPanel = Ext.getCmp('prop_content');
  864. tPanel.remove(0);
  865. tPanel.add( data );
  866. tPanel.doLayout();
  867. },
  868. failure: failureAJAXFunction
  869. });
  870. };
  871. function LoadNodesList(){
  872. Ext.Ajax.request({
  873. url: '/lib/controller/getLocationNodes.php',
  874. params: {
  875. SITE: <?=$SiteID;?>,
  876. UID: <?=$UserID;?>,
  877. SID: '<?=$Session;?>'
  878. },
  879. success: function( response, opts ){
  880. var data = Ext.decode(response.responseText);
  881. var tPanel = Ext.getCmp('prop_content');
  882. tPanel.remove(0);
  883. tPanel.add( data );
  884. tPanel.doLayout();
  885. },
  886. failure: failureAJAXFunction
  887. });
  888. };
  889. function reloadSiteMapData(){
  890. Ext.Ajax.request({
  891. url: '/lib/controller/getMapData.php',
  892. params: {
  893. SITE: <?=$SiteID;?>,
  894. UID: <?=$UserID;?>,
  895. SID: '<?=$Session;?>'
  896. },
  897. success: function( response, opts ){
  898. var data = Ext.decode(response.responseText);
  899. MAP_ID = parseInt( data.selected_map );
  900. MAP_IS_LOCAL = (MAP_ID)?data.local_binding:false;
  901. MAP_SET = data.maps;
  902. Ext.getCmp('lab_123').update( '<?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> '+((MAP_IS_LOCAL)?'Pos X':'<?=$Labels->GetLabel('_LON_SHORT_LBL_');?>')+':' );
  903. Ext.getCmp('lab_124').update( ((MAP_IS_LOCAL)?'Pos Y':'<?=$Labels->GetLabel('_LAT_SHORT_LBL_');?>')+':' );
  904. document.getElementById('lab_125').src = ((MAP_IS_LOCAL)?'/style/assets/map_mode_decart.png':'/style/assets/map_mode_wgs84.png');
  905. loadLocationEditor('sys_location_map');
  906. },
  907. failure: failureAJAXFunction
  908. });
  909. };
  910. var ed_anchor = null;
  911. function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
  912. if( tlInterval!= null ){
  913. window.clearInterval( tlInterval );
  914. tlInterval = null;
  915. timelineObj = null;
  916. };
  917. if( node_type == undefined ) node_type = 0;
  918. if( lat == undefined ){
  919. lat = SiteLat;
  920. lon = SiteLon;
  921. };
  922. //var cMSET = mapListStore.getAt( MAP_ID );
  923. //alert( MAP_SET.id );
  924. var aK = true;
  925. if( MAP_SET.attribution == '' ) aK = false;
  926. var mapLayers = [];
  927. if( map_ed != undefined ){
  928. map_ed.off();
  929. map_ed.remove();
  930. };
  931. if( MAP_SET.type == 1 ){
  932. map_ed = L.map( el_id,{
  933. attributionControl: aK,
  934. //preferCanvas: true,
  935. zoomControl: true,
  936. center: [SiteLat,SiteLon],
  937. /*zoomControl: false,
  938. zoom: 17,
  939. minZoom: 17,
  940. maxZoom: 17,*/
  941. keyboard: false
  942. });
  943. //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
  944. // attribution: MAP_SET.attribution,
  945. // maxNativeZoom: MAP_SET.maxNativeZoom,
  946. // maxZoom: MAP_SET.maxZoom
  947. //});
  948. L.tileLayer( MAP_SET.layer_url, {
  949. attribution: MAP_SET.attribution,
  950. maxNativeZoom: MAP_SET.maxNativeZoom,
  951. minZoom: 0,
  952. maxZoom: MAP_SET.maxZoom
  953. }).addTo( map_ed );
  954. } else {
  955. map_ed = L.map( el_id,{
  956. crs: L.CRS.Simple,
  957. attributionControl: false,
  958. preferCanvas: true,
  959. zoomControl: true,
  960. center: [SiteLat,SiteLon],
  961. /*zoomControl: false,*/
  962. zoom: 0,
  963. minZoom: 0,
  964. maxZoom: 4,
  965. keyboard: false
  966. });
  967. var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
  968. var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map_ed );
  969. }
  970. map_ed.setView([SiteLat,SiteLon], MAP_SET.maxZoom);
  971. if( node_type ){
  972. ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  973. } else {
  974. ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  975. };
  976. /*
  977. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  978. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  979. maxNativeZoom: 18,
  980. maxZoom: 24,
  981. })
  982. // https://leaflet-extras.github.io/leaflet-providers/preview/
  983. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  984. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  985. maxZoom: 19
  986. });
  987. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  988. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  989. maxZoom: 19
  990. });
  991. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  992. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  993. maxZoom: 24
  994. });
  995. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  996. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  997. maxZoom: 19
  998. });
  999. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1000. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  1001. maxZoom: 19
  1002. });
  1003. var baseMaps = {
  1004. "MyMap": mapLayers["MyMap"],
  1005. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1006. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1007. "EsriSat": mapLayers["EsriSat"],
  1008. "EsriStreet": mapLayers["EsriStreet"],
  1009. "EsriTopo": mapLayers["EsriTopo"],
  1010. //"Bing": mapLayers["Bing"],
  1011. //"OSM-Cycle": mapLayers["Cycle"],
  1012. //"Landscape": mapLayers["Landscape"],
  1013. //"Outdoor": mapLayers["Outdoor"],
  1014. };
  1015. L.control.layers( baseMaps ).addTo( map_ed );
  1016. mapLayers["MyMap"].addTo( map_ed );
  1017. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1018. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  1019. }).addTo( map_ed );
  1020. */
  1021. if( node_type ){
  1022. switch( node_type ){
  1023. case 1:{
  1024. markers[0] = L.marker([lat,lon], {draggable: true,icon: ALS_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1025. break;
  1026. };
  1027. case 2:{
  1028. markers[0] = L.marker([lat,lon], {draggable: true,icon: LFS_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1029. break;
  1030. };
  1031. case 3:{
  1032. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLS200_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1033. break;
  1034. };
  1035. case 4:{
  1036. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLS360_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1037. break;
  1038. };
  1039. case 5:{
  1040. markers[0] = L.marker([lat,lon], {draggable: true,icon: LRF3D_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1041. break;
  1042. };
  1043. case 6:{
  1044. markers[0] = L.marker([lat,lon], {draggable: true,icon: PLSNET200_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1045. break;
  1046. };
  1047. case 10:
  1048. case 12:{
  1049. markers[0] = L.marker([lat,lon], {draggable: true,icon: FIXCAM_Icon, mycustomid: node_id} ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1050. break;
  1051. };
  1052. case 11:
  1053. case 13:{
  1054. markers[0] = L.marker([lat,lon], {draggable: true,icon: PTZCAM_Icon, mycustomid: node_id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  1055. break;
  1056. };
  1057. };
  1058. } else loadLocationNodes();
  1059. };
  1060. function updateSiteAnchor(){
  1061. SiteLat = Ext.getCmp('siteLat').getValue();
  1062. SiteLon = Ext.getCmp('siteLon').getValue();
  1063. SiteAlt = Ext.getCmp('siteAlt').getValue();
  1064. Ext.Ajax.request({
  1065. url: '/lib/controller/updateLocation.php',
  1066. params: {
  1067. SITE: <?=$SiteID;?>,
  1068. UID: <?=$UserID;?>,
  1069. TYPE: 1,
  1070. SID: '<?=$Session;?>',
  1071. LAT: SiteLat,
  1072. LON: SiteLon,
  1073. ALT: SiteAlt
  1074. },
  1075. success: function(){
  1076. loadLocationEditor('sys_location_map');
  1077. },
  1078. failure: failureAJAXFunction
  1079. });
  1080. };
  1081. function updateSiteMap(){
  1082. MAP_ID = Ext.getCmp('siteMap').getValue();
  1083. Ext.Ajax.request({
  1084. url: '/lib/controller/updateLocation.php',
  1085. params: {
  1086. SITE: <?=$SiteID;?>,
  1087. UID: <?=$UserID;?>,
  1088. TYPE: 4,
  1089. SID: '<?=$Session;?>',
  1090. MID: MAP_ID
  1091. },
  1092. success: function( response, opts ){
  1093. reloadSiteMapData();
  1094. },
  1095. failure: failureAJAXFunction
  1096. });
  1097. };
  1098. var mapDataLoadded = false;
  1099. // Call this to prepare all data once in Session
  1100. function prepareMapData(){
  1101. //if( ap_type == 1 ) return;//Metro No Map ...
  1102. if( !mapDataLoadded ){
  1103. mapListStore.load();
  1104. };
  1105. };
  1106. function updateLocationOrientation(){
  1107. var tLat = Ext.getCmp('slat').getValue();
  1108. var tLon = Ext.getCmp('slon').getValue();
  1109. var tAlt = Ext.getCmp('salt').getValue();
  1110. var tRoll = Ext.getCmp('sroll').getValue();
  1111. var tPitch = Ext.getCmp('spitch').getValue();
  1112. var tYaw = Ext.getCmp('syaw').getValue();
  1113. Ext.Ajax.request({
  1114. url: '/lib/controller/updateLocation.php',
  1115. params: {
  1116. NODE: locationSelectedNode,
  1117. UID: <?=$UserID;?>,
  1118. TYPE: 2,
  1119. SID: '<?=$Session;?>',
  1120. LAT: tLat,
  1121. LON: tLon,
  1122. ALT: tAlt,
  1123. YAW: tYaw,
  1124. ROLL: tRoll,
  1125. PITCH: tPitch
  1126. },
  1127. failure: failureAJAXFunction
  1128. });
  1129. };
  1130. var iconSaver = null;
  1131. var markerSaver = null;
  1132. function updateLocation( e ){
  1133. locationSelectedNode = e.target.options.mycustomid;
  1134. Ext.Ajax.request({
  1135. url: '/lib/controller/updateLocation.php',
  1136. params: {
  1137. NODE: locationSelectedNode,
  1138. SITE: <?=$SiteID;?>,
  1139. UID: <?=$UserID;?>,
  1140. TYPE: 0,
  1141. SID: '<?=$Session;?>',
  1142. LAT: e.target._latlng.lat,
  1143. LON: e.target._latlng.lng
  1144. },
  1145. success: function( response, opts ){
  1146. loadNodeLocationProps( locationSelectedNode );
  1147. },
  1148. failure: failureAJAXFunction
  1149. });
  1150. };
  1151. function markerDblClick( e ){
  1152. if( iconSaver == null ){
  1153. iconSaver = e.target.options.icon;
  1154. markerSaver = e.target;
  1155. e.target.setIcon( SNAPE_Icon );
  1156. for( i=0; i< markers.length; i++){
  1157. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  1158. markers[i].setOpacity( 0.1 );
  1159. } else {
  1160. markers[i].setOpacity( 1.0 );
  1161. }
  1162. };
  1163. } else {
  1164. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  1165. e.target.setIcon( iconSaver );
  1166. iconSaver = null;
  1167. markerSaver = null;
  1168. for( i=0; i< markers.length; i++){
  1169. markers[i].setOpacity( 1.0 );
  1170. };
  1171. } else {
  1172. markerSaver.setIcon( iconSaver );
  1173. iconSaver = e.target.options.icon;
  1174. markerSaver = e.target;
  1175. e.target.setIcon( SNAPE_Icon );
  1176. for( i=0; i< markers.length; i++){
  1177. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  1178. markers[i].setOpacity( 0.1 );
  1179. } else {
  1180. markers[i].setOpacity( 1.0 );
  1181. }
  1182. };
  1183. };
  1184. };
  1185. };
  1186. /*
  1187. function setNodeLocationToAnchor(){
  1188. Ext.Ajax.request({
  1189. url: '/lib/controller/updateLocation.php',
  1190. params: {
  1191. NODE: locationSelectedNode,
  1192. SITE: <?=$SiteID;?>,
  1193. UID: <?=$UserID;?>,
  1194. TYPE: 0,
  1195. SID: '<?=$Session;?>',
  1196. LAT: SiteLat,
  1197. LON: SiteLon,
  1198. ALT: SiteAlt
  1199. },
  1200. success: function( response, opts ){
  1201. loadLocationEditor('sys_location_map');
  1202. },
  1203. failure: failureAJAXFunction
  1204. });
  1205. };
  1206. function setNodeLocationByDelta(){
  1207. var dx = Ext.getCmp('dx').getValue();
  1208. var dy = Ext.getCmp('dy').getValue();
  1209. var dz = Ext.getCmp('dz').getValue();
  1210. Ext.Ajax.request({
  1211. url: '/lib/controller/updateLocation.php',
  1212. params: {
  1213. NODE: locationSelectedNode,
  1214. SITE: <?=$SiteID;?>,
  1215. UID: <?=$UserID;?>,
  1216. TYPE: 3,
  1217. SID: '<?=$Session;?>',
  1218. LAT: dx,
  1219. LON: dy,
  1220. ALT: dz
  1221. },
  1222. success: function( response, opts ){
  1223. loadLocationEditor();
  1224. },
  1225. failure: failureAJAXFunction
  1226. });
  1227. };
  1228. */
  1229. var mapCreatorWindow = null;
  1230. function createNewMap(){
  1231. if( mapCreatorWindow == null ){
  1232. mapCreatorWindow = new Ext.Window({
  1233. width: 800,
  1234. height: 540,
  1235. title: '<?=$Labels->GetLabel('_CREATE_CUSTOM_MAP_');?>',
  1236. modal: true,
  1237. frame: true,
  1238. border: false,
  1239. resizable: false,
  1240. items: [{
  1241. xtype: 'tabpanel',
  1242. id: 'mcr_tbp',
  1243. activeTab: 0,
  1244. items:[{
  1245. xtype: 'form',
  1246. title: '<?=$Labels->GetLabel('_INTER_MAP_');?>',
  1247. id: 'map_map_frm',
  1248. fileUpload: true,
  1249. labelWidth: 250,
  1250. labelAlign: 'right',
  1251. height: 450,
  1252. items:[{
  1253. xtype: 'textfield',
  1254. fieldLabel: '<?=$Labels->GetLabel('_NAME_MAP_');?>',
  1255. name: 'map_name',
  1256. width: 540,
  1257. },{
  1258. xtype: 'hidden',
  1259. name: 'ctype',
  1260. value: 1
  1261. },{
  1262. xtype: 'textfield',
  1263. fieldLabel: '<?=$Labels->GetLabel('_TILE_URL_MAP_');?>',
  1264. name: 'map_url',
  1265. width: 540,
  1266. },{
  1267. xtype: 'textfield',
  1268. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1269. name: 'map_attr',
  1270. width: 540,
  1271. },{
  1272. xtype: 'textarea',
  1273. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1274. name: 'map_desc',
  1275. width: 540,
  1276. },{
  1277. xtype: 'combo',
  1278. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1279. name: 'map_maxz',
  1280. editable: false,
  1281. typeAhead: true,
  1282. triggerAction: 'all',
  1283. width: 100,
  1284. lazyRender:true,
  1285. mode: 'local',
  1286. store: new Ext.data.ArrayStore({
  1287. fields: ['zoom_l'],
  1288. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1289. }),
  1290. value: '18',
  1291. valueField: 'zoom_l',
  1292. displayField: 'zoom_l'
  1293. },{
  1294. xtype: 'combo',
  1295. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1296. name: 'map_maxnz',
  1297. editable: false,
  1298. typeAhead: true,
  1299. triggerAction: 'all',
  1300. width: 100,
  1301. lazyRender:true,
  1302. mode: 'local',
  1303. store: new Ext.data.ArrayStore({
  1304. fields: ['zoom_l'],
  1305. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1306. }),
  1307. value: '16',
  1308. valueField: 'zoom_l',
  1309. displayField: 'zoom_l'
  1310. }]
  1311. },{
  1312. xtype: 'form',
  1313. title: '<?=$Labels->GetLabel('_LOCAL_PIC_MAP_');?>',
  1314. id: 'map_pic_frm',
  1315. fileUpload: true,
  1316. height: 450,
  1317. //autoHeight: true,
  1318. //bodyStyle: 'padding: 10px 10px 0 10px;',
  1319. labelWidth: 250,
  1320. labelAlign: 'right',
  1321. defaults: {
  1322. //anchor: '95%',
  1323. //allowBlank: false,
  1324. msgTarget: 'side'
  1325. },
  1326. items: [{
  1327. xtype: 'textfield',
  1328. fieldLabel: '<?=$Labels->GetLabel('_MAP_NAME_');?>',
  1329. id: 'map_name_2',
  1330. name: 'map_name',
  1331. width: 540
  1332. },{
  1333. xtype: 'hidden',
  1334. name: 'ctype',
  1335. value: 2
  1336. },{
  1337. xtype: 'fileuploadfield',
  1338. id: 'form-file',
  1339. emptyText: '<?=$Labels->GetLabel('_SELE_ANIMAGE_');?>',
  1340. fieldLabel: '<?=$Labels->GetLabel('_MAP_PICTURE_');?>',
  1341. width: 500,
  1342. name: 'map_image',
  1343. buttonText: '<?=$Labels->GetLabel('_BROWSE_');?>'
  1344. },{
  1345. xtype: 'textfield',
  1346. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1347. name: 'map_attr',
  1348. width: 540,
  1349. },{
  1350. xtype: 'textarea',
  1351. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1352. name: 'map_desc',
  1353. width: 540,
  1354. },{
  1355. xtype: 'combo',
  1356. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1357. editable: false,
  1358. typeAhead: true,
  1359. name: 'map_maxz',
  1360. triggerAction: 'all',
  1361. width: 100,
  1362. lazyRender:true,
  1363. mode: 'local',
  1364. store: new Ext.data.ArrayStore({
  1365. fields: ['zoom_l'],
  1366. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1367. }),
  1368. value: '16',
  1369. valueField: 'zoom_l',
  1370. displayField: 'zoom_l'
  1371. },{
  1372. xtype: 'combo',
  1373. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1374. editable: false,
  1375. typeAhead: true,
  1376. name: 'map_maxnz',
  1377. triggerAction: 'all',
  1378. width: 100,
  1379. lazyRender:true,
  1380. mode: 'local',
  1381. store: new Ext.data.ArrayStore({
  1382. fields: ['zoom_l'],
  1383. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1384. }),
  1385. value: '16',
  1386. valueField: 'zoom_l',
  1387. displayField: 'zoom_l'
  1388. },{
  1389. xtype: 'numberfield',
  1390. fieldLabel: '<?=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
  1391. name: 'map_tpb',
  1392. value: 0,
  1393. width: 540,
  1394. },{
  1395. xtype: 'numberfield',
  1396. fieldLabel: '<?=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
  1397. name: 'map_lpb',
  1398. value: 0,
  1399. width: 540,
  1400. },{
  1401. xtype: 'numberfield',
  1402. fieldLabel: '<?=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
  1403. name: 'map_rpb',
  1404. value: 0,
  1405. width: 540,
  1406. },{
  1407. xtype: 'numberfield',
  1408. fieldLabel: '<?=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
  1409. name: 'map_bpb',
  1410. value: 0,
  1411. width: 540,
  1412. },{
  1413. xtype: 'numberfield',
  1414. fieldLabel: '<?=$Labels->GetLabel('_MAP_WIDTH_');?>',
  1415. name: 'map_height',
  1416. decimalPrecision: 2,
  1417. value: 1000.00,
  1418. width: 540,
  1419. },{
  1420. xtype: 'numberfield',
  1421. fieldLabel: '<?=$Labels->GetLabel('_MAP_HEIGHT_');?>',
  1422. name: 'map_width',
  1423. decimalPrecision: 2,
  1424. value: 1000.00,
  1425. width: 540,
  1426. },{
  1427. xtype: 'panel',
  1428. frame: false,
  1429. border: false,
  1430. layout: 'table',
  1431. layoutConfig: {
  1432. columns: 5
  1433. },
  1434. items:[{
  1435. xtype: 'spacer',
  1436. width: 250,
  1437. html: '<p style="text-align:right; margin-right: 5px;"><?=$Labels->GetLabel('_MAP_CENTER_MODE_');?>:</p>'
  1438. },{
  1439. xtype: 'radio',
  1440. name: 'bounds_mode',
  1441. inputValue: 0,
  1442. checked: 1
  1443. },{
  1444. width: 80,
  1445. html: '<img src="/style/assets/cust_map_cord_sys-0.png">'
  1446. },{
  1447. xtype: 'radio',
  1448. name: 'bounds_mode',
  1449. checked: 0,
  1450. inputValue: 1
  1451. },{
  1452. html: '<img src="/style/assets/cust_map_cord_sys-1.png">'
  1453. }]
  1454. }]
  1455. }]
  1456. }],
  1457. bbar:[ '->',{
  1458. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1459. handler: function(){
  1460. //Ext.getCmp('map_map_frm').getForm().reset();
  1461. //Ext.getCmp('map_pic_frm').getForm().reset();
  1462. mapCreatorWindow.destroy();
  1463. }
  1464. },{
  1465. text: '<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>',
  1466. handler: function(){
  1467. var tt = Ext.getCmp('mcr_tbp').getActiveTab();
  1468. if( tt.id == 'map_map_frm' ){
  1469. if( Ext.getCmp('map_map_frm').getForm().isValid()){
  1470. Ext.getCmp('map_map_frm').getForm().submit({
  1471. url: '/lib/controller/addMap.php',
  1472. waitMsg: 'Uploading Data...',
  1473. encoding: 'multipart/form-data',
  1474. success: function(fp, o){
  1475. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1476. //alert('Processed file on the server');
  1477. mapCreatorWindow.destroy();
  1478. }
  1479. });
  1480. };
  1481. } else {
  1482. if( Ext.getCmp('map_pic_frm').getForm().isValid()){
  1483. Ext.getCmp('map_pic_frm').getForm().submit({
  1484. url: '/lib/controller/addMap.php',
  1485. waitMsg: 'Uploading Image...',
  1486. encoding: 'multipart/form-data',
  1487. success: function(fp, o){
  1488. //msg('Success', 'Processed file "'+o.result.file+'" on the server');
  1489. //alert('Processed file on the server');
  1490. mapCreatorWindow.destroy();
  1491. }
  1492. });
  1493. };
  1494. };
  1495. }
  1496. }],
  1497. listeners:{
  1498. beforedestroy: function(){
  1499. mapCreatorWindow = null;
  1500. }
  1501. }
  1502. });
  1503. };
  1504. mapCreatorWindow.show();
  1505. };
  1506. var mapEditorWindow = null;
  1507. function editCurrentMap(){
  1508. Ext.Ajax.request({
  1509. url: '/lib/controller/getMapData.php',
  1510. params: {
  1511. SITE: <?=$SiteID;?>,
  1512. UID: <?=$UserID;?>,
  1513. MID: MAP_ID
  1514. },
  1515. success: function( response, opts ){
  1516. var newMapData = Ext.decode( response.responseText );
  1517. if( mapEditorWindow == null ){
  1518. switch( newMapData.type ){
  1519. case 1:{
  1520. mapEditorWindow = new Ext.Window({
  1521. width: 800,
  1522. height: 440,
  1523. title: 'Edit Current Map',
  1524. modal: true,
  1525. //closeAction: 'hide',
  1526. frame: true,
  1527. border: false,
  1528. resizable: false,
  1529. items: [{
  1530. xtype: 'form',
  1531. id: 'map_map_frm',
  1532. labelWidth: 250,
  1533. labelAlign: 'right',
  1534. height: 350,
  1535. items:[{
  1536. xtype: 'textfield',
  1537. fieldLabel: 'Map Name',
  1538. id: 'map_name_1',
  1539. name: 'map_name',
  1540. width: 540,
  1541. },{
  1542. xtype: 'hidden',
  1543. name: 'ctype',
  1544. value: 1
  1545. },{
  1546. xtype: 'textfield',
  1547. fieldLabel: 'Tiles URL Pattern',
  1548. name: 'map_url',
  1549. width: 540,
  1550. },{
  1551. xtype: 'textfield',
  1552. fieldLabel: 'Layer Attribution',
  1553. name: 'map_attr',
  1554. width: 540,
  1555. },{
  1556. xtype: 'textarea',
  1557. fieldLabel: 'Description',
  1558. name: 'map_desc',
  1559. width: 540,
  1560. },{
  1561. xtype: 'combo',
  1562. fieldLabel: 'Max Zoom',
  1563. name: 'map_maxz',
  1564. editable: false,
  1565. typeAhead: true,
  1566. triggerAction: 'all',
  1567. width: 100,
  1568. lazyRender:true,
  1569. mode: 'local',
  1570. store: new Ext.data.ArrayStore({
  1571. fields: ['zoom_l'],
  1572. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1573. }),
  1574. value: '18',
  1575. valueField: 'zoom_l',
  1576. displayField: 'zoom_l'
  1577. },{
  1578. xtype: 'combo',
  1579. fieldLabel: 'Max Native Zoom',
  1580. name: 'map_maxnz',
  1581. editable: false,
  1582. typeAhead: true,
  1583. triggerAction: 'all',
  1584. width: 100,
  1585. lazyRender:true,
  1586. mode: 'local',
  1587. store: new Ext.data.ArrayStore({
  1588. fields: ['zoom_l'],
  1589. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1590. }),
  1591. value: '16',
  1592. valueField: 'zoom_l',
  1593. displayField: 'zoom_l'
  1594. }]
  1595. }],
  1596. bbar:[ '->',{
  1597. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1598. handler: function(){
  1599. mapEditorWindow.destroy();
  1600. }
  1601. },{
  1602. text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
  1603. handler: function(){
  1604. var tt = Ext.getCmp('mcr_tbp').getActiveTab();
  1605. if( tt.id == 'map_map_frm' ){
  1606. if( Ext.getCmp('map_map_frm').getForm().isValid()){
  1607. Ext.getCmp('map_map_frm').getForm().submit({
  1608. url: '/lib/controller/updateMap.php',
  1609. waitMsg: '<?=$Labels->GetLabel('_UPDATING_DATA_');?>...',
  1610. clientValidation: false,
  1611. encoding: 'multipart/form-data',
  1612. success: function(f,a){
  1613. alert('Processed file on the server1');
  1614. //mapEditorWindow.hide();
  1615. //mapEditorWindow.destroy();
  1616. }
  1617. });
  1618. };
  1619. } else {
  1620. if( Ext.getCmp('map_pic_frm').getForm().isValid()){
  1621. Ext.getCmp('map_pic_frm').getForm().submit({
  1622. url: '/lib/controller/updateMap.php',
  1623. clientValidation: false,
  1624. waitMsg: '<?=$Labels->GetLabel('_UPDATING_DATA_');?>...',
  1625. encoding: 'multipart/form-data',
  1626. success: function( f, a ){
  1627. alert('Processed file on the server2');
  1628. //mapEditorWindow.hide();
  1629. //mapEditorWindow.destroy();
  1630. }
  1631. });
  1632. };
  1633. };
  1634. }
  1635. }],
  1636. listeners: {
  1637. beforedestroy: function(){
  1638. mapEditorWindow = null;
  1639. }
  1640. }
  1641. });
  1642. break;
  1643. };
  1644. default:{
  1645. mapEditorWindow = new Ext.Window({
  1646. width: 800,
  1647. height: 540,
  1648. title: '<?=$Labels->GetLabel('_EDIT_CUR_MAP_');?>',
  1649. modal: true,
  1650. frame: true,
  1651. border: false,
  1652. resizable: false,
  1653. items: [{
  1654. xtype: 'form',
  1655. id: 'map_edt_frm',
  1656. height: 480,
  1657. //autoHeight: true,
  1658. //bodyStyle: 'padding: 10px 10px 0 10px;',
  1659. labelWidth: 250,
  1660. labelAlign: 'right',
  1661. defaults: {
  1662. //anchor: '95%',
  1663. //allowBlank: false,
  1664. msgTarget: 'side'
  1665. },
  1666. items:[{
  1667. xtype: 'spacer',
  1668. height: 6
  1669. },{
  1670. xtype: 'textfield',
  1671. fieldLabel: '<?=$Labels->GetLabel('_MAP_NAME_');?>',
  1672. name: 'map_name',
  1673. value: newMapData.name,
  1674. width: 540
  1675. },{
  1676. xtype: 'hidden',
  1677. name: 'MID',
  1678. value: newMapData.id
  1679. },{
  1680. xtype: 'panel',
  1681. frame: false,
  1682. border: false,
  1683. html: '<center><img height="50px" SRC="/lib/controller/data/assets/images/'+MAP_SET.layer_url+'"></center>'
  1684. },{
  1685. xtype: 'textfield',
  1686. fieldLabel: '<?=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
  1687. name: 'map_attr',
  1688. value: newMapData.attribution,
  1689. width: 540,
  1690. },{
  1691. xtype: 'textarea',
  1692. fieldLabel: '<?=$Labels->GetLabel('_DESCRIPTION_');?>',
  1693. name: 'map_desc',
  1694. value: newMapData.desc,
  1695. width: 540,
  1696. },{
  1697. xtype: 'combo',
  1698. fieldLabel: '<?=$Labels->GetLabel('_MAX_ZOOM_');?>',
  1699. editable: false,
  1700. typeAhead: true,
  1701. name: 'map_maxz',
  1702. value: newMapData.maxZoom,
  1703. triggerAction: 'all',
  1704. width: 100,
  1705. lazyRender:true,
  1706. mode: 'local',
  1707. store: new Ext.data.ArrayStore({
  1708. fields: ['zoom_l'],
  1709. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1710. }),
  1711. value: '16',
  1712. valueField: 'zoom_l',
  1713. displayField: 'zoom_l'
  1714. },{
  1715. xtype: 'combo',
  1716. fieldLabel: '<?=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
  1717. editable: false,
  1718. typeAhead: true,
  1719. name: 'map_maxnz',
  1720. value: newMapData.maxNativeZoom,
  1721. triggerAction: 'all',
  1722. width: 100,
  1723. lazyRender:true,
  1724. mode: 'local',
  1725. store: new Ext.data.ArrayStore({
  1726. fields: ['zoom_l'],
  1727. data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
  1728. }),
  1729. value: '16',
  1730. valueField: 'zoom_l',
  1731. displayField: 'zoom_l'
  1732. },{
  1733. xtype: 'numberfield',
  1734. fieldLabel: '<?=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
  1735. name: 'map_tpb',
  1736. value: newMapData.img_tb,
  1737. width: 540,
  1738. },{
  1739. xtype: 'numberfield',
  1740. fieldLabel: '<?=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
  1741. name: 'map_lpb',
  1742. value: newMapData.img_lb,
  1743. width: 540,
  1744. },{
  1745. xtype: 'numberfield',
  1746. fieldLabel: '<?=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
  1747. name: 'map_rpb',
  1748. value: newMapData.img_rb,
  1749. width: 540,
  1750. },{
  1751. xtype: 'numberfield',
  1752. fieldLabel: '<?=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
  1753. name: 'map_bpb',
  1754. value: newMapData.img_bb,
  1755. width: 540,
  1756. },{
  1757. xtype: 'numberfield',
  1758. fieldLabel: '<?=$Labels->GetLabel('_MAP_WIDTH_');?>',
  1759. name: 'map_width',
  1760. decimalPrecision: 2,
  1761. value: newMapData.img_map_w,
  1762. width: 540,
  1763. },{
  1764. xtype: 'numberfield',
  1765. fieldLabel: '<?=$Labels->GetLabel('_MAP_HEIGHT_');?>',
  1766. name: 'map_height',
  1767. decimalPrecision: 2,
  1768. value: newMapData.img_map_h,
  1769. width: 540,
  1770. },{
  1771. xtype: 'panel',
  1772. frame: false,
  1773. border: false,
  1774. layout: 'table',
  1775. layoutConfig: {
  1776. columns: 5
  1777. },
  1778. items:[{
  1779. xtype: 'spacer',
  1780. width: 250,
  1781. html: '<p style="text-align:right; margin-right: 5px;"><?=$Labels->GetLabel('_MAP_CENTER_MODE_');?>:</p>'
  1782. },{
  1783. xtype: 'radio',
  1784. name: 'bounds_mode',
  1785. inputValue: 0,
  1786. checked: (newMapData.bounds_mode == 0)
  1787. },{
  1788. width: 80,
  1789. border: false,
  1790. html: '<img src="/style/assets/cust_map_cord_sys-0.png">'
  1791. },{
  1792. xtype: 'radio',
  1793. name: 'bounds_mode',
  1794. inputValue: 1,
  1795. checked: (newMapData.bounds_mode != 0)
  1796. },{
  1797. html: '<img src="/style/assets/cust_map_cord_sys-1.png">'
  1798. }]
  1799. }]
  1800. }],
  1801. bbar:[ '->',{
  1802. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1803. handler: function(){
  1804. mapEditorWindow.destroy();
  1805. }
  1806. },{
  1807. text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
  1808. handler: function(){
  1809. if( Ext.getCmp('map_edt_frm').getForm().isValid()){
  1810. Ext.getCmp('map_edt_frm').getForm().submit({
  1811. url: '/lib/controller/updateMap.php',
  1812. waitMsg: '<?=$Labels->GetLabel('_UPDATING_DATA_');?>...',
  1813. encoding: 'multipart/form-data',
  1814. success: function(fp, o){
  1815. mapEditorWindow.destroy();
  1816. }
  1817. });
  1818. };
  1819. }
  1820. }],
  1821. listeners: {
  1822. beforedestroy: function(){
  1823. mapEditorWindow = null;
  1824. }
  1825. }
  1826. });
  1827. break;
  1828. };
  1829. };
  1830. };
  1831. mapEditorWindow.show();
  1832. },
  1833. failure: failureAJAXFunction
  1834. });
  1835. };