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.

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