Web UI for ARGUS server
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.

1243 lines
40 KiB

5 years ago
​
​
​
6 years ago
5 years ago
​
​
​
​
6 years ago
​
​
5 years ago
5 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
4 years ago
5 years ago
4 years ago
5 years ago
​
​
​
​
4 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
5 years ago
​
​
​
4 years ago
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
5 years ago
​
​
​
​
4 years ago
5 years ago
​
​
4 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
5 years ago
4 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
5 years ago
5 years ago
​
5 years ago
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
5 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
4 years ago
​
4 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
4 years ago
5 years ago
​
​
​
4 years ago
​
​
​
5 years ago
​
​
6 years ago
​
​
​
6 years ago
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
5 years ago
5 years ago
​
​
5 years ago
5 years ago
​
5 years ago
​
5 years ago
5 years ago
5 years ago
5 years ago
​
​
6 years ago
​
​
5 years ago
​
​
5 years ago
5 years ago
​
5 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
6 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
5 years ago
​
4 years ago
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
5 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
5 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
5 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
4 years ago
5 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
4 years ago
​
​
​
​
​
5 years ago
​
​
​
​
4 years ago
5 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
4 years ago
​
5 years ago
​
​
4 years ago
5 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
5 years ago
6 years ago
5 years ago
​
5 years ago
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
5 years ago
4 years ago
​
5 years ago
​
​
4 years ago
5 years ago
6 years ago
5 years ago
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
5 years ago
​
​
6 years ago
6 years ago
​
5 years ago
6 years ago
​
​
5 years ago
  1. //<?php require_once('../../js_asm.php');
  2. $QS="SELECT * FROM sites WHERE id={$SiteID}";
  3. $RV = $DATABASE->Query( $QS );
  4. ?>
  5. var SiteLat=<?=$RV[0]['anchor_lat'];?>;
  6. var SiteLon=<?=$RV[0]['anchor_lon'];?>;
  7. var SiteAlt=<?=$RV[0]['anchor_alt'];?>;
  8. var map = null;
  9. var selectedMarker = null;
  10. var timelineObj = null;
  11. var tlGroups = new vis.DataSet();
  12. var tlItems = new vis.DataSet();
  13. var selecredActiveSourceFilter = 0;
  14. var ActiveZones = null;
  15. var selectedMarkerIcon = L.icon({
  16. iconUrl: '/style/assets/cursor.png',
  17. iconSize: [32, 32],
  18. iconAnchor: [16, 16]//,
  19. //popupAnchor: [-3, -76],
  20. //shadowUrl: 'my-icon-shadow.png',
  21. //shadowSize: [68, 95],
  22. //shadowAnchor: [22, 94]
  23. });
  24. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  25. var tlOptions = {
  26. groupOrder: 'content', // groupOrder can be a property name or a sorting function
  27. stack: true,
  28. showCurrentTime: true,
  29. //verticalScroll: true,
  30. //zoomKey: 'ctrlKey',
  31. minHeight: 308,
  32. maxHeight: 308
  33. };
  34. var tlLoadLocker = false;
  35. var tlLastTS = 0;
  36. var tlInterval = null;
  37. var tlMonitoring = false;
  38. // Calendar
  39. var CurrentDate=(new Date())/1000;
  40. var today=new Date();
  41. var SY=1900+today.getYear();
  42. var SMO=today.getMonth()+1;
  43. var SD=today.getDate();
  44. var SelectedDay = SD;
  45. var Dates = new Array();
  46. function CheckDate(D){
  47. for(j_index=0;j_index<Dates.length;j_index++){
  48. if (Dates[j_index]==D)return true;
  49. };
  50. return false;
  51. };
  52. function ShiftBAK(){
  53. CurrentDate=CurrentDate-24*3600*GetMonthLength(CurrentDate);
  54. BuildCalendar();
  55. SMO = GetMonthNum(CurrentDate);
  56. SY = GetYear(CurrentDate);
  57. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  58. loadCalendarDates();
  59. };
  60. function ShiftFWD(){
  61. CurrentDate=CurrentDate+24*3600*GetMonthLength(CurrentDate);
  62. BuildCalendar();
  63. SMO = GetMonthNum(CurrentDate);
  64. SY = GetYear(CurrentDate);
  65. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  66. loadCalendarDates();
  67. };
  68. function GetMonthName(UTS){ // Unix Time Stamp
  69. var MoNames= new Array();
  70. MoNames[0]='January';
  71. MoNames[1]='February';
  72. MoNames[2]='March';
  73. MoNames[3]='April';
  74. MoNames[4]='May';
  75. MoNames[5]='June';
  76. MoNames[6]='July';
  77. MoNames[7]='August';
  78. MoNames[8]='September';
  79. MoNames[9]='October';
  80. MoNames[10]='November';
  81. MoNames[11]='December';
  82. CDate=new Date();
  83. CDate.setTime(UTS*1000);
  84. CMo=CDate.getMonth();
  85. return MoNames[CMo];
  86. };
  87. function GetMonthShift(UTS){ // Unix Time Stamp
  88. CDate=new Date();
  89. CDate.setTime(UTS*1000);
  90. CDate.setTime((UTS-(CDate.getDate()-1)*86400)*1000);
  91. return CDate.getDay();
  92. };
  93. function GetMonthLength(UTS){ // Unix Time Stamp
  94. CDate=new Date();
  95. CDate.setTime(UTS*1000);
  96. CD=CDate.getDate();
  97. RetVal=31;
  98. CDate.setTime((UTS+(31-CD)*86400)*1000);
  99. if ( CDate.getDate()==31) return RetVal;
  100. RetVal=30;
  101. CDate.setTime((UTS+(30-CD)*86400)*1000);
  102. if ( CDate.getDate()==30) return RetVal;
  103. RetVal=29;
  104. CDate.setTime((UTS+(29-CD)*86400)*1000);
  105. if ( CDate.getDate()==29) return RetVal;
  106. RetVal=28;
  107. CDate.setTime((UTS+(28-CD)*86400)*1000);
  108. if ( CDate.getDate()==28) return RetVal;
  109. return -1;
  110. };
  111. function GetMonthNum(UTS){ // Unix Time Stamp
  112. CDate=new Date();
  113. CDate.setTime(UTS*1000);
  114. return CDate.getMonth()+1;
  115. };
  116. function GetYear(UTS){ // Unix Time Stamp
  117. CDate=new Date();
  118. CDate.setTime(UTS*1000);
  119. y=CDate.getYear();
  120. if (y<100)y+=2000;
  121. if (y<200)y+=1900;
  122. return y;
  123. };
  124. function GetDay(UTS){ // Unix Time Stamp
  125. CDate=new Date();
  126. CDate.setTime(UTS*1000);
  127. y=CDate.getDate();
  128. return y;
  129. };
  130. function selectDate( m, d ){
  131. SY = GetYear(CurrentDate);
  132. SMO = m;
  133. SD = d;
  134. SelectedDay = SD;
  135. getData( 'arch' );
  136. };
  137. function BuildCalendar( ){
  138. Msh=GetMonthShift(CurrentDate);
  139. Mnm=GetMonthName(CurrentDate);
  140. Mln=GetMonthLength(CurrentDate);
  141. Mid=GetMonthNum(CurrentDate);
  142. Mye=GetYear(CurrentDate);
  143. InDTA='<table cellpadding="2" cellspacing="0"><tr height="19px"><td valign="middle"><a href="#" onclick="ShiftBAK();"><img src="/style/img/calendar/l_cal_b.gif"></a></td><td colspan="5" class="CalendarMN" align="center">'+Mnm+' '+Mye+'</td><td><a href="#" onclick="ShiftFWD();"><img border=0 src="/style/img/calendar/r_cal_b.gif"></a></td></tr>';
  144. InDTA+='<tr><td class="CalendarWT" align="center">Su</td><td class="CalendarWT" align="center">Mo</td><td class="CalendarWT" align="center">Tu</td><td class="CalendarWT" align="center">We</td><td class="CalendarWT" align="center">Th</td><td class="CalendarWT" align="center">Fr</td><td class="CalendarWT" align="center">Sa</td></tr>';
  145. InDTA+='<tr>';
  146. for(index=0;index<Msh;index++){
  147. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  148. };
  149. for(;index<(Mln+Msh);index++){
  150. if( CheckDate(index-Msh+1) ){
  151. //InDTA+='<td style="padding: 1px"><div id="ds'+Mid.toString()+(index-Msh+1).toString()+'" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" href="#" title="'+(index-Msh+1).toString()+'" class="CalendarDE">'+(index-Msh+1).toString()+'</a></td>';
  152. if( SD == index ){
  153. InDTA+='<td style="padding: 1px"><div id="selected_day" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" title="Selected" class="calendar_t">'+(index-Msh+1).toString()+'</div></td>';
  154. } else {
  155. InDTA+='<td style="padding: 1px"><div id="have_data_day" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" title="Have Events" class="calendar_t">'+(index-Msh+1).toString()+'</div></td>';
  156. };
  157. } else {
  158. if( SD == index ){
  159. InDTA+='<td style="padding: 1px"><div id="selected_day" class="calendar_t" title="Selected">'+(index-Msh+1).toString()+'</a></td>';
  160. } else {
  161. InDTA+='<td style="padding: 1px"><div id="no_data_day" class="calendar_t" title="No Events">'+(index-Msh+1).toString()+'</a></td>';
  162. };
  163. };
  164. if ((index+1)%7==0){
  165. InDTA+='</tr><tr>';
  166. };
  167. };
  168. for(;(index)%7!=0;index++){
  169. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  170. };
  171. InDTA+='</tr></table>';
  172. tab=document.getElementById('calendar_TD');
  173. tab.innerHTML=InDTA;
  174. };
  175. function loadCalendarDates(){
  176. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  177. width: '100%',
  178. hidden: true,
  179. progress: true,
  180. closable: false
  181. });
  182. Ext.Ajax.request({
  183. url: '/lib/controller/getEventDates.php',
  184. params: {
  185. NID: selecredActiveSourceFilter,
  186. UID: <?=$UserID;?>,
  187. SID: '<?=$Session;?>',
  188. SYE: SY,
  189. SMO: SMO
  190. },
  191. success: function( response, opts ){
  192. Ext.MessageBox.hide();
  193. var data = Ext.decode( response.responseText );
  194. if( data.status == 'ok' ){
  195. Dates = data.days;
  196. BuildCalendar();
  197. //for( var i = 0; i < data.days.length; i++ ){
  198. //
  199. //};
  200. };
  201. },
  202. failure: function( response, opts ) {
  203. Ext.MessageBox.hide();
  204. }
  205. });
  206. };
  207. var eventsListStore = new Ext.data.JsonStore({
  208. root: 'log',
  209. totalProperty: 'totalCount',
  210. idProperty: 'id',
  211. remoteSort: true,
  212. fields: [{
  213. name: 'id',
  214. type: 'int'
  215. },{
  216. name: 'date',
  217. type: 'string'
  218. },{
  219. name: 'time',
  220. type: 'string'
  221. },{
  222. name: 'device',
  223. type: 'string'
  224. },{
  225. name: 'event',
  226. type: 'int'
  227. },{
  228. name: 'data',
  229. type: 'string',
  230. },{
  231. name: 'has_target',
  232. type: 'boolean'
  233. },{
  234. name: 'has_geo',
  235. type: 'boolean'
  236. },{
  237. name: 'has_images',
  238. type: 'boolean'
  239. },{
  240. name: 'images',
  241. type: 'Array'
  242. },{
  243. name: 'dev_type',
  244. type: 'int'
  245. },{
  246. name: 'geo',
  247. type: 'object'
  248. }] /*,
  249. proxy : new Ext.data.HttpProxy({
  250. method: 'POST',
  251. prettyUrls: false,
  252. url: '/lib/controller/getEventRecords.php',
  253. headers: {
  254. UID: <?=$UserID;?>,
  255. SID: '<?=$Session;?>',
  256. NID: 1
  257. }
  258. })*/
  259. });
  260. var SelectedEvent = 0;
  261. var EventPanelWindow = null;
  262. function showEventPanel(){
  263. if( EventPanelWindow == null ){
  264. EventPanelWindow = new Ext.Window({
  265. modal: true,
  266. title: '<?=$Labels->GetLabel("_EVENT_VIEWER_");?>',
  267. width: winW*0.66,
  268. height: winH*0.66,
  269. layout: 'fit',
  270. closeAction: 'hide',
  271. items:[{
  272. title: 'Cameras',
  273. html:'koko',
  274. autoScroll: true,
  275. height: 320
  276. },{
  277. html: 'koko22',
  278. height: 320
  279. }]
  280. });
  281. };
  282. EventPanelWindow .show();
  283. };
  284. function ModeRenderer(val){
  285. var p1, p2, p3;
  286. if( ( val & 1 ) == 1 ){
  287. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  288. } else {
  289. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  290. };
  291. if( ( val & 2 ) == 2 ){
  292. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  293. } else {
  294. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  295. };
  296. if( ( val & 4 ) == 4 ){
  297. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  298. } else {
  299. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  300. };
  301. return p1+p2+p3;
  302. };
  303. function LocRenderer( val ){
  304. if( val ){
  305. return '<img src="/style/icons/icons/accept.png" alt="Location" />';
  306. };
  307. return '<img src="/style/icons/icons/bullet_white.png" alt="NO Location" />';
  308. };
  309. function PicRenderer( val ){
  310. if( val ){
  311. return '<img src="/style/icons/icons/camera_link.png"/>';
  312. };
  313. return '<img src="/style/icons/icons/bullet_white.png"/>';
  314. };
  315. function EvtTypeRenderer( val ){
  316. switch( val ){
  317. case 6: return 'Device Enters Into Study Mode';
  318. case 7: return 'Device Is BUSY';
  319. case 8: return 'Flip Complete';
  320. case 9: return 'Scan Complete';
  321. case 10:
  322. case 11:
  323. case 12:
  324. case 13:
  325. case 14: return 'Target';
  326. case 36: return 'Region Of Interest';
  327. default: return 'Event ['+val+']';
  328. };
  329. };
  330. var eventsListColModel_ops = {
  331. columns: [
  332. {header: "ID", width: 100, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  333. {header: "Date",width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'date' },
  334. {header: "Time", width: 80, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'time' },
  335. {header: "Device", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'device' },
  336. {header: "Event", width: 120, sortable: false, dataIndex: 'event', renderer: EvtTypeRenderer },
  337. {header: "Info", width: 200, sortable: false, dataindex: 'data' },
  338. {header: "", width: 25, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer },
  339. {header: "", width: 25, sortable: false, dataIndex: 'has_images', renderer: PicRenderer }
  340. ],
  341. defaults: {
  342. sortable: true,
  343. menuDisabled: true,
  344. width: 100
  345. },
  346. listeners: {
  347. hiddenchange: function(cm, colIndex, hidden) {
  348. //saveConfig(colIndex, hidden);
  349. }
  350. }
  351. };
  352. var SelectedRow = -1;
  353. var eventsListSelModel_ops = {
  354. singleSelect: true,
  355. listeners: {
  356. rowselect: function(sm, row, rec ) {
  357. loadEventProperties( rec.data );
  358. SelectedEvent = rec.data.id;
  359. SelectedRow = row;
  360. //alert( SelectedEvent );
  361. //var CB = Ext.getCmp('con_to_src');
  362. //CB.enable();
  363. }
  364. }
  365. };
  366. function loadTimeLineGroups( NID ){
  367. Ext.Ajax.request({
  368. url: '/lib/controller/getTimeLineGroups.php',
  369. params: {
  370. NID: NID,
  371. UID: <?=$UserID;?>,
  372. SID: '<?=$Session;?>'
  373. },
  374. success: function( response, opts ){
  375. // If the response is JSON, you have to decode it
  376. var data = Ext.decode(response.responseText);
  377. //for(var i = 0; i < data.length; i++) {
  378. //tlGroups.add(data[i]);
  379. //};
  380. tlGroups.update( data );
  381. loadTimeLineItems( SelectedSite );
  382. tlInterval = window.setInterval( loadTimeLineItems, 333, SelectedSite );
  383. },
  384. failure: function( response, opts ) {
  385. //Ext.fly('some_div').update('Fail!');
  386. }/*,
  387. callback: function(options,success,response){
  388. // use this if you need to perform your own success/failure checking
  389. }*/
  390. });
  391. };
  392. function clickDeviceSelector( id ){
  393. var rr = document.getElementById(id+'_div');
  394. if( selecredActiveSourceFilter != id ){
  395. if( selecredActiveSourceFilter > 0 ){
  396. var oo = document.getElementById( selecredActiveSourceFilter + '_div');
  397. oo.classList.remove( "cardDeviceSourceSelected" );
  398. oo.classList.add( "cardDeviceSource" );
  399. };
  400. rr.classList.remove( "cardDeviceSource" );
  401. rr.classList.add( "cardDeviceSourceSelected" );
  402. selecredActiveSourceFilter = id;
  403. turnOffAllGzButThis( selecredActiveSourceFilter );
  404. } else {
  405. selecredActiveSourceFilter = 0;
  406. rr.classList.remove( "cardDeviceSourceSelected" );
  407. rr.classList.add( "cardDeviceSource" );
  408. turnAllGzOn();
  409. var tPanel = Ext.getCmp('prop_content');
  410. tPanel.remove(0);
  411. tPanel.add( {
  412. title: 'Event Information',
  413. border: false,
  414. frame: false,
  415. collapsible: false,
  416. draggable: false,
  417. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  418. } );
  419. tPanel.doLayout();
  420. };
  421. };
  422. function getZoneByNode( nid ){
  423. var rVal = -1;
  424. for( var i=0; i < ActiveZones.totalCount; i++ ){
  425. if( ActiveZones.zones[i].dev_id == nid ){
  426. rVal = i;
  427. break;
  428. };
  429. };
  430. return rVal;
  431. };
  432. function turnOffAllGzButThis( nid ){
  433. var chocho = -1;
  434. for( var i=0; i < ActiveZones.totalCount; i++ ){
  435. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  436. map.removeLayer( ActiveZones.fig[i] );
  437. map.removeLayer( ActiveZones.zang[i] );
  438. map.removeLayer( ActiveZones.center[i] );
  439. };
  440. if( chocho > -1 ){
  441. map.addLayer( ActiveZones.fig[chocho] );
  442. map.addLayer( ActiveZones.zang[chocho] );
  443. map.addLayer( ActiveZones.center[chocho] );
  444. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  445. map.flyToBounds( cVisible.getBounds() );
  446. };
  447. };
  448. function turnAllGzOn(){
  449. var tall = Array();
  450. for( var i=0; i < ActiveZones.totalCount; i++ ){
  451. tall[i*3] = ActiveZones.fig[i];
  452. tall[i*3+1] = ActiveZones.zang[i];
  453. tall[i*3+2] = ActiveZones.center[i];
  454. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  455. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  456. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  457. };
  458. var cVisible = L.featureGroup( tall );
  459. map.flyToBounds( cVisible.getBounds() );
  460. };
  461. function loadMapZones( SID ){
  462. Ext.Ajax.request({
  463. url: '/lib/controller/getGeoZones.php',
  464. params: {
  465. SITE: SID,
  466. UID: <?=$UserID;?>,
  467. SID: '<?=$Session;?>'
  468. },
  469. success: function( response, opts ){
  470. // If the response is JSON, you have to decode it
  471. var data = Ext.decode(response.responseText);
  472. var pp = Ext.getCmp('sources_panel');
  473. if( typeof pp !== 'undefined' ) pp.removeAll();
  474. ActiveZones = data;
  475. ActiveZones.fig = new Array();
  476. ActiveZones.zang = new Array();
  477. ActiveZones.center = new Array();
  478. for(var i = 0; i < data.totalCount; i++ ) {
  479. switch( data.zones[i].type ){
  480. case 'circle':{
  481. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  482. 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 } );
  483. //map.addLayer( ActiveZones.fig[i] );
  484. break;
  485. };
  486. case 'poly':{
  487. 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);
  488. //map.addLayer( ActiveZones.fig[i] );
  489. break;
  490. };
  491. case 'image':{
  492. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  493. //map.addLayer( ActiveZones.fig[i] );
  494. break;
  495. };
  496. case 'image_rot':{
  497. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  498. opacity: 0.8 //,
  499. //interactive: true,
  500. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geográfico Nacional de España</a>"
  501. });//.addTo( map );
  502. //map.addLayer( ActiveZones.fig[i] );
  503. break;
  504. };
  505. };
  506. if( data.zones[i].dev_is_source ){
  507. if( typeof pp !== 'undefined' ) {
  508. var sty = '';
  509. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  510. sty = 'cardDeviceSourceSelected';
  511. } else {
  512. sty = 'cardDeviceSource';
  513. };
  514. pp.add( {
  515. id: data.zones[i].dev_id+'_container',
  516. frame: false,
  517. border: false,
  518. width: 130,
  519. height: 130,
  520. 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>'
  521. });
  522. };
  523. };
  524. if( data.zones[i].zang != undefined ){
  525. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  526. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  527. };
  528. if( data.zones[i].center != undefined ){
  529. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  530. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map );
  531. };
  532. };
  533. if( selecredActiveSourceFilter == 0 ){
  534. turnAllGzOn();
  535. } else {
  536. turnOffAllGzButThis( selecredActiveSourceFilter );
  537. };
  538. if( typeof pp !== 'undefined' ) pp.doLayout();
  539. //LoadMapEvents( SelectedSite );
  540. //tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite );
  541. },
  542. failure: function( response, opts ) {
  543. //Ext.fly('some_div').update('Fail!');
  544. }
  545. });
  546. };
  547. var cevt = Array();
  548. var coz = Array();
  549. function showEventsOnMap( data, removeCursor = true ){
  550. if( removeCursor ) map.removeLayer( selectedMarker );
  551. if( cevt.length ){
  552. for( i=0; i< cevt.length; i++ ){
  553. if( cevt[i]!= null ){
  554. cevt[i].remove();
  555. delete( cevt[i] );
  556. cevt[i] = null;
  557. };
  558. };
  559. };
  560. if( coz.length ){
  561. for( i=0; i< coz.length; i++ ){
  562. if( coz[i]!= null ){
  563. coz[i].remove();
  564. delete( coz[i] );
  565. coz[i]=null;
  566. };
  567. };
  568. };
  569. var zz = ( 1.0 / ( data.log.length + 0 ) );
  570. var idx = 0;
  571. for( i=0; i < data.log.length; i++ ){
  572. if( data.log[i].has_geo ){
  573. var cp_color='#FF0000';
  574. switch( data.log[i].event ){
  575. case 36: cp_color='#0000FF'; break;
  576. };
  577. cevt[idx] = L.circleMarker( [data.log[i].geo.lat, data.log[i].geo.lon], {id:data.log[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: ( 1.0 - i * zz ) } ).on('click', function( e, a ){
  578. loadEventPropertiesByID( this.options.id );
  579. } );
  580. cevt[idx].addTo(map);
  581. idx++;
  582. };
  583. };
  584. };
  585. function LoadMapEventsZ( Mode ){
  586. if( tlLoadLocker ) return;
  587. tlLoadLocker = true;
  588. Ext.Ajax.request({
  589. url: '/lib/controller/getGeoAlerts.php',
  590. params: {
  591. SITE: <?=$SiteID;?>,
  592. UID: <?=$UserID;?>,
  593. SID: '<?=$Session;?>',
  594. MODE: Mode
  595. },
  596. success: function( response, opts ){
  597. if( cevt.length ){
  598. for( i=0; i< cevt.length; i++ ){
  599. if( cevt[i]!= null ){
  600. cevt[i].remove();
  601. delete( cevt[i] );
  602. cevt[i] = null;
  603. };
  604. };
  605. };
  606. if( coz.length ){
  607. for( i=0; i< coz.length; i++ ){
  608. if( coz[i]!= null ){
  609. coz[i].remove();
  610. delete( coz[i] );
  611. coz[i]=null;
  612. };
  613. };
  614. };
  615. var data = Ext.decode( response.responseText );
  616. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  617. for( i=0; i < data.evt.length; i++ ){
  618. 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 ){
  619. loadEventProperties( this.options.id );
  620. } );
  621. cevt[i].addTo(map);
  622. };
  623. for( i=0; i < data.other.length; i++ ){
  624. switch( data.other[i].type ){
  625. case 'circle':{
  626. 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 } );
  627. coz[i].addTo(map);
  628. break;
  629. };
  630. };
  631. };
  632. //eventsListStore.reload();
  633. tlLoadLocker = false;
  634. },
  635. failure: function( response, opts ) {
  636. //Ext.fly('some_div').update('Fail!');
  637. tlLoadLocker = false;
  638. }
  639. });
  640. };
  641. function loadEventPropertiesByID( id ){
  642. var d = eventsListStore.findExact( 'id', id );
  643. if( d > -1 ) {
  644. var EventRec = eventsListStore.getAt( d );
  645. loadEventProperties( EventRec.data );
  646. };
  647. };
  648. function loadEventProperties( EventRec ){
  649. var tPanel = Ext.getCmp('prop_content');
  650. tPanel.removeAll();// remove( 0 );
  651. var tt = '';
  652. if( selectedMarker!= null ){
  653. selectedMarker.remove();
  654. //map.removeLayer( selectedMarker );
  655. if( EventRec.has_geo ){
  656. tt = ''+EventRec.geo.lat+' '+EventRec.geo.lon;
  657. selectedMarker.setLatLng([EventRec.geo.lat, EventRec.geo.lon]);
  658. selectedMarker.addTo( map );
  659. };
  660. };
  661. tPanel.add( {
  662. title: 'Event Details',
  663. html: '<center><img src="/style/assets/'+EventRec.dev_type+'_node.png" /><p>' + EventRec.device+'</p>'+tt+'</center>'
  664. } );
  665. if( EventRec.has_images ){
  666. for( var i=0; i < EventRec.images.length; i++ ){
  667. tPanel.add( {
  668. frame: false,
  669. html: '<img width="100%" src="/lib/controller/getPicture.php?PID='+EventRec.images[i]+'" data-enlargeable000 ondblclick="fullScreen(\'img-'+EventRec.id+'\');" style="cursor: zoom-in" id="img-'+EventRec.id+'"/>'
  670. });
  671. };
  672. };
  673. tPanel.doLayout();
  674. };
  675. function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){
  676. if( tlLoadLocker ) return;
  677. tlLoadLocker = true;
  678. if( Mode == 'arch' ){
  679. Ext.MessageBox.wait("Loading Data","Please Wait",{
  680. width: '100%',
  681. hidden: true,
  682. animate: true,
  683. progress: true,
  684. closable: false
  685. });
  686. };
  687. Ext.Ajax.request({
  688. url: '/lib/controller/getEventRecords.php',
  689. params: {
  690. SITE: <?=$SiteID;?>,
  691. UID: <?=$UserID;?>,
  692. SID: '<?=$Session;?>',
  693. MODE: Mode,
  694. FIL: selecredActiveSourceFilter,
  695. SDA: SD,
  696. SMO: SMO,
  697. SYE: SY,
  698. STM: ST,
  699. ETM: ET,
  700. STR: SR,
  701. DIR: DR
  702. },
  703. success: function( response, opts ){
  704. tlLoadLocker = false;
  705. var data = Ext.decode(response.responseText);
  706. if( data.updateFROMTO ){
  707. Ext.getCmp('STimeFROM').setValue( data.STT );
  708. Ext.getCmp('STimeTO').setValue( data.ENT );
  709. if( data.SLD > 0 ){
  710. SMO = GetMonthNum(data.SLD);
  711. SY = GetYear(data.SLD);
  712. SD = GetDay(data.SLD);
  713. BuildCalendar();
  714. };
  715. };
  716. eventsListStore.loadData( data, false );
  717. if( Mode == 'arch' ){
  718. showEventsOnMap( data, true );
  719. Ext.MessageBox.hide();
  720. if( DR > 0 ){
  721. Ext.getCmp('evtArchLog').getView().focusRow( eventsListStore.getCount() - 1 );
  722. Ext.getCmp('evtArchLog').getSelectionModel().selectLastRow();
  723. };
  724. if( DR < 0 ){
  725. Ext.getCmp('evtArchLog').getView().focusRow( 0 );
  726. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  727. };
  728. } else {
  729. showEventsOnMap( data, false );
  730. //LoadMapEventsZ( Mode );
  731. };
  732. },
  733. failure: failureAJAXFunction
  734. });
  735. };
  736. function loadArchive(){
  737. if( tlInterval!= null ){
  738. window.clearInterval( tlInterval );
  739. tlInterval = null;
  740. timelineObj = null;
  741. };
  742. setUserContent( 2 );
  743. var tPanel = Ext.getCmp('main_portal');
  744. tPanel.removeAll( true );
  745. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  746. tPanel.add({
  747. columnWidth: 0.83,
  748. frame: false,
  749. border: false,
  750. items: [{
  751. title: 'Site Map',
  752. frame: false,
  753. border: false,
  754. layout: 'vbox',
  755. layoutConfig: {
  756. align : 'stretch',
  757. pack : 'start',
  758. },
  759. height: PanelH-300,
  760. items:[{
  761. height: PanelH-325,
  762. flex: 1,
  763. frame: false,
  764. border: false,
  765. layout: 'fit',
  766. items:{
  767. id: 'event_map',
  768. html: '&nbsp;'
  769. }
  770. }]
  771. },{
  772. frame: false,
  773. border: false,
  774. collapsible: false,
  775. draggable: false,
  776. layout: 'hbox',
  777. items:[{
  778. layout: 'form',
  779. title: 'Date/Time',
  780. width: 200,
  781. frame: true,
  782. border: false,
  783. labelAlign: 'right',
  784. labelWidth: 50,
  785. defaults: { width: 80},
  786. items: [{
  787. xtype: 'combo',
  788. id: 'STimeFROM',
  789. fieldLabel: 'From',
  790. editable: false,
  791. typeAhead: true,
  792. triggerAction: 'all',
  793. width: 120,
  794. lazyRender:true,
  795. mode: 'local',
  796. store: new Ext.data.ArrayStore({
  797. id: 0,
  798. fields: ['ss', 'displayText' ],
  799. data: [<?php
  800. $zuzu = array();
  801. for( $i = 0; $i < 24; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  802. echo implode( ',', $zuzu ); ?>]
  803. }),
  804. valueField: 'ss',
  805. displayField: 'displayText'
  806. },{
  807. xtype: 'combo',
  808. id: 'STimeTO',
  809. fieldLabel: 'Till',
  810. editable: false,
  811. typeAhead: true,
  812. triggerAction: 'all',
  813. width: 120,
  814. lazyRender:true,
  815. mode: 'local',
  816. store: new Ext.data.ArrayStore({
  817. id: 0,
  818. fields: ['ss', 'displayText' ],
  819. data: [<?php
  820. $zuzu = array();
  821. for( $i = 1; $i < 25; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  822. echo implode( ',', $zuzu ); ?>]
  823. }),
  824. valueField: 'ss',
  825. displayField: 'displayText'
  826. }],
  827. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  828. buttons: [{
  829. xtype: 'button',
  830. text: 'Display History',
  831. handler: function(){
  832. var STU = Ext.getCmp('STimeFROM').getValue();
  833. var ETU = Ext.getCmp('STimeTO').getValue();
  834. getData( 'arch', STU, ETU );
  835. }
  836. }]
  837. },{
  838. title: 'Event Log',
  839. frame: false,
  840. height: 303,
  841. id: 'evtArchLog',
  842. xtype: 'grid',
  843. ds: eventsListStore,
  844. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  845. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  846. listeners:{
  847. keydown: function( e ) {
  848. if( e.getKey() == e.UP ){
  849. if( SelectedRow == 0 ){
  850. var id = eventsListStore.getAt( 0 ).id;
  851. getData( 'arch', 0, 0, id, 1 );
  852. };
  853. };
  854. if( e.getKey() == e.DOWN ){
  855. if( SelectedRow == ( eventsListStore.getCount() - 1 ) ){
  856. var id = eventsListStore.getAt( SelectedRow ).id;
  857. getData( 'arch', 0, 0, id, -1 );
  858. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  859. Ext.getCmp('evtArchLog').focus( false, true );
  860. };
  861. };
  862. }
  863. }
  864. }]
  865. }]
  866. });
  867. tPanel.add({
  868. columnWidth: 0.17,
  869. frame: true,
  870. title: 'Event Information',
  871. id: 'prop_content',
  872. border: false,
  873. items: [{
  874. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  875. }]
  876. });
  877. tPanel.doLayout();
  878. /*
  879. Ext.getCmp('evtLog').getEl().set({tabindex: "0"});
  880. Ext.getCmp('evtLog').getEl().addKeyMap({
  881. eventName: "keyup",
  882. binding: [{
  883. key: Ext.EventObject.SPACE,
  884. fn: function(){ alert("Space key pressed"); }
  885. },{
  886. key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],
  887. shift: true,
  888. fn: function(){ alert("Left or right pressed while pressing shift"); }
  889. }]
  890. });
  891. */
  892. //BuildCalendar();
  893. loadCalendarDates();
  894. map = L.map('event_map',{
  895. attributionControl: true,
  896. //preferCanvas: true,
  897. zoomControl: true,
  898. center: [SiteLat, SiteLon],
  899. /*zoomControl: false,
  900. zoom: 17,
  901. minZoom: 17,
  902. maxZoom: 17,*/
  903. keyboard: false
  904. }).setView([SiteLat, SiteLon], 17);
  905. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  906. var mapLayers = [];
  907. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  908. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  909. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  910. detectRetina: true
  911. });*/
  912. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  913. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  914. maxNativeZoom: 18,
  915. maxZoom: 24,
  916. })
  917. // https://leaflet-extras.github.io/leaflet-providers/preview/
  918. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  919. 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',
  920. maxZoom: 19
  921. });
  922. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  923. 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',
  924. maxZoom: 19
  925. });
  926. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  927. 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',
  928. maxZoom: 24
  929. });
  930. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  931. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  932. maxZoom: 19
  933. });
  934. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  935. 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>) ',
  936. maxZoom: 19
  937. });
  938. /*
  939. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  940. 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>',
  941. maxZoom: 22
  942. });
  943. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  944. 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>',
  945. maxZoom: 22
  946. });
  947. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  948. 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>',
  949. maxZoom: 22
  950. });
  951. */
  952. var baseMaps = {
  953. "MyMap": mapLayers["MyMap"],
  954. "OpenStreetMap": mapLayers["OpenStreetMap"],
  955. "OpenTopoMap": mapLayers["OpenTopoMap"],
  956. "EsriSat": mapLayers["EsriSat"],
  957. "EsriStreet": mapLayers["EsriStreet"],
  958. "EsriTopo": mapLayers["EsriTopo"],
  959. //"Bing": mapLayers["Bing"],
  960. //"OSM-Cycle": mapLayers["Cycle"],
  961. //"Landscape": mapLayers["Landscape"],
  962. //"Outdoor": mapLayers["Outdoor"],
  963. };
  964. L.control.layers( baseMaps ).addTo(map);
  965. mapLayers["MyMap"].addTo(map);
  966. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  967. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  968. maxNativeZoom: 18,
  969. maxZoom: 24,
  970. }).addTo(map); */
  971. //loadTimeLineGroups( selectedSite );
  972. loadMapZones( SelectedSite );
  973. getData( 'arch' );
  974. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  975. };
  976. function loadMonitoring(){
  977. if( tlInterval!= null ){
  978. window.clearInterval( tlInterval );
  979. tlInterval = null;
  980. timelineObj = null;
  981. };
  982. setUserContent( 1 );
  983. var tPanel = Ext.getCmp('main_portal');
  984. tPanel.removeAll( true );
  985. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  986. tPanel.add({
  987. columnWidth: 0.83,
  988. frame: false,
  989. border: false,
  990. items: [{
  991. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  992. frame: false,
  993. border: false,
  994. collapsible: false,
  995. draggable: false,
  996. layout: 'vbox',
  997. layoutConfig: {
  998. align : 'stretch',
  999. pack : 'start',
  1000. },
  1001. height: PanelH-300,
  1002. items:[{
  1003. height: PanelH-325,
  1004. flex: 1,
  1005. frame: false,
  1006. border: false,
  1007. layout: 'fit',
  1008. items:{
  1009. id: 'event_map',
  1010. html: '&nbsp;'
  1011. }
  1012. }]
  1013. },{
  1014. frame: false,
  1015. border: true,
  1016. collapsible: false,
  1017. draggable: false,
  1018. layout: 'hbox',
  1019. items:[{
  1020. title: 'Alarm Sources',
  1021. xtype: 'panel',
  1022. border: false,
  1023. frame: false,
  1024. collapsible: false,
  1025. draggable: false,
  1026. id: 'sources_panel',
  1027. width: 160,
  1028. autoScroll: 'auto',
  1029. height: 303
  1030. },{
  1031. title: 'Event Log',
  1032. height: 303,
  1033. xtype: 'grid',
  1034. border: false,
  1035. frame: false,
  1036. collapsible: false,
  1037. draggable: false,
  1038. ds: eventsListStore,
  1039. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1040. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1041. bbar: [{
  1042. text: 'Clear',
  1043. handler: function(){
  1044. Ext.Ajax.request({
  1045. url: '/lib/controller/clearEventCloud.php',
  1046. params: {
  1047. UID: <?=$UserID;?>,
  1048. SID: '<?=$Session;?>'
  1049. },
  1050. success: function( response, opts ){
  1051. },
  1052. failure: function( response, opts ) {
  1053. }
  1054. });
  1055. }
  1056. }]
  1057. }]
  1058. }]
  1059. });
  1060. tPanel.add({
  1061. columnWidth: 0.17,
  1062. title: 'Event Information',
  1063. frame: true,
  1064. id: 'prop_content',
  1065. border: false,
  1066. items: [{
  1067. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1068. }]
  1069. });
  1070. tPanel.doLayout();
  1071. map = L.map('event_map',{
  1072. attributionControl: true,
  1073. //preferCanvas: true,
  1074. zoomControl: true,
  1075. center: [SiteLat, SiteLon],
  1076. /*zoomControl: false,
  1077. zoom: 17,
  1078. minZoom: 17,
  1079. maxZoom: 17,*/
  1080. keyboard: false
  1081. }).setView([SiteLat, SiteLon], 17);
  1082. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1083. var mapLayers = [];
  1084. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1085. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1086. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1087. detectRetina: true
  1088. });*/
  1089. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1090. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1091. maxNativeZoom: 18,
  1092. maxZoom: 24,
  1093. })
  1094. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1095. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1096. 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',
  1097. maxZoom: 19
  1098. });
  1099. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1100. 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',
  1101. maxZoom: 19
  1102. });
  1103. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1104. 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',
  1105. maxZoom: 24
  1106. });
  1107. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1108. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1109. maxZoom: 19
  1110. });
  1111. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1112. 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>) ',
  1113. maxZoom: 19
  1114. });
  1115. /*
  1116. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1117. 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>',
  1118. maxZoom: 22
  1119. });
  1120. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1121. 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>',
  1122. maxZoom: 22
  1123. });
  1124. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1125. 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>',
  1126. maxZoom: 22
  1127. });
  1128. */
  1129. var baseMaps = {
  1130. "MyMap": mapLayers["MyMap"],
  1131. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1132. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1133. "EsriSat": mapLayers["EsriSat"],
  1134. "EsriStreet": mapLayers["EsriStreet"],
  1135. "EsriTopo": mapLayers["EsriTopo"],
  1136. //"Bing": mapLayers["Bing"],
  1137. //"OSM-Cycle": mapLayers["Cycle"],
  1138. //"Landscape": mapLayers["Landscape"],
  1139. //"Outdoor": mapLayers["Outdoor"],
  1140. };
  1141. L.control.layers( baseMaps ).addTo(map);
  1142. mapLayers["MyMap"].addTo(map);
  1143. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1144. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1145. maxNativeZoom: 18,
  1146. maxZoom: 24,
  1147. }).addTo(map); */
  1148. loadMapZones( SelectedSite );
  1149. tlInterval = window.setInterval( getData, 333, 'live' );
  1150. };
  1151. function loadOnlineMonitoring(devID){
  1152. var tPanel = Ext.getCmp('main_content');
  1153. if( tlInterval!= null ){
  1154. window.clearInterval( tlInterval );
  1155. tlInterval = null;
  1156. timelineObj = null;
  1157. };
  1158. tPanel.remove(0);
  1159. tPanel.add({
  1160. html: 'Device Monitoring '+devID
  1161. });
  1162. tPanel.doLayout();
  1163. };