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.

1514 lines
46 KiB

​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
4 years ago
3 years ago
​
​
​
​
4 years ago
3 years ago
4 years ago
​
​
​
​
3 years ago
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
3 years ago
​
4 years ago
​
​
​
​
3 years ago
4 years ago
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
4 years ago
3 years ago
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
4 years ago
​
​
​
​
​
3 years ago
4 years ago
​
​
3 years ago
4 years ago
​
​
​
​
3 years ago
​
4 years ago
​
3 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
4 years ago
3 years ago
4 years ago
​
4 years ago
​
​
​
​
​
3 years ago
​
3 years ago
​
​
​
​
​
​
​
​
4 years ago
3 years ago
​
4 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var map = null;
  3. var selectedMarker = null;
  4. var timelineObj = null;
  5. var tlGroups = new vis.DataSet();
  6. var tlItems = new vis.DataSet();
  7. var selecredActiveSourceFilter = 0;
  8. var rep_store_id = 0;
  9. var rep_array = new Array();
  10. var rep_store = new Ext.data.JsonStore({
  11. autoDestroy: false,
  12. storeId: 'log_store',
  13. //idIndex: 0,
  14. idProperty: 'id',
  15. fields: [
  16. {name: 'id', type: 'int' },
  17. {name: 'node_id', type: 'int' },
  18. {name: 'node_name', type: 'string' },
  19. {name: 'dts', type: 'string'},
  20. {name: 'ts', type: 'int'},
  21. {name: 'ms', type: 'string'},
  22. {name: 'type', type: 'int'},
  23. {name: 'range', type: 'string'},
  24. {name: 'az', type: 'string'},
  25. {name: 'el', type: 'string'},
  26. {name: 'r', type: 'int'},
  27. {name: 'width', type: 'int'},
  28. {name: 'video_id',type: 'int'}
  29. //{name: 'lat', type: 'float'},
  30. //{name: 'lon', type: 'float'},
  31. //{name: 'alt', type: 'float'},
  32. //{name: 'area', type: 'float'},
  33. //{name: 'video', type: 'string'},
  34. //{name: 'v_cpoint', type: 'int'}
  35. ]
  36. });
  37. function rep_sn_Renderer( value, meta, record ){
  38. //Must be set according to events
  39. var kaka = record.data.node_id % 3;
  40. return '<div class="log_line_' + kaka + '">'+value+'</div>';
  41. };
  42. function rep_et_Renderer( value, meta, record ){
  43. var kaka = record.data.node_id % 3;
  44. switch( value ){
  45. case 6: ov = 'Device Enters Into Study Mode'; break;
  46. case 7: ov = 'Device Is BUSY'; break;
  47. case 8: ov = 'Flip Complete'; break;
  48. case 9: ov = 'Scan Complete'; break;
  49. case 12: ov = 'Black 2D Target'; break;
  50. case 13: ov = 'White 2D Target'; break;
  51. case 36: ov = 'Region Of Interest'; break;
  52. case 39: ov = '[Train Filter] Check Target'; break;
  53. case 40: ov = '[Train Filter] Upper Sensor Detection'; break;
  54. case 41: ov = '[Train Filter] Bottom Sensor Detection'; break;
  55. case 42: ov = '[Train Filter] Train Detected'; break;
  56. case 43: ov = '[Train Filter] Train Updated'; break;
  57. case 44: ov = '[Train Filter] Suspicious Activity'; break;
  58. case 45: ov = '[Train Filter] Suspicious NACK'; break;
  59. case 46: ov = '[Train Filter] Regular Detection'; break;
  60. case 47: ov = '[Train Filter] Detection Disabled'; break;
  61. case 48: ov = '[Train Filter] Suspicious Detection'; break;
  62. case 49: ov = '[Train Filter] Differential Detection'; break;
  63. case 52: ov = 'Event Started'; break;
  64. case 53: ov = 'Event Ended'; break;
  65. case 54: ov = 'Event Closed Manual'; break;
  66. case 55: ov = 'Connected'; break;
  67. case 56: ov = 'Disconnection'; break;
  68. case 57: ov = 'Communication Jamed'; break;
  69. case 58: ov = 'Video Framerate Decreased'; break;
  70. case 59: ov = 'Video Framerate Increased'; break;
  71. default: ov = 'Event ['+value+']';
  72. };
  73. return '<div class="log_line_' + kaka + '">'+ov+'</div>';
  74. };
  75. var rep_ColModel_ops = {
  76. columns: [
  77. {header: "Time", width: 100, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' },
  78. {header: "Source", width: 100, renderer: rep_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' },
  79. {header: "Type", width: 180, renderer: rep_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' },
  80. {header: "Range", width: 100, dataIndex: 'range' },
  81. {header: "Azimuth", width: 100, dataIndex: 'az' },
  82. {header: "Width", width: 100, dataIndex: 'width' },
  83. ],
  84. defaults: {
  85. sortable: false,
  86. fixed: true,
  87. menuDisabled: true,
  88. width: 100
  89. }
  90. };
  91. var cRowSelected = -1;
  92. var rep_SelModel_ops = {
  93. singleSelect: true,
  94. listeners: {
  95. rowselect: function(sm, row, rec ) {
  96. cRowSelected = row;
  97. loadEventData( rec.data );
  98. //alert( rec.data.id );
  99. //loadEventProperties( rec.data );
  100. //SelectedEvent = rec.data.id;
  101. //alert( SelectedEvent );
  102. //var CB = Ext.getCmp('con_to_src');
  103. //CB.enable();
  104. //selectedArchiveRecord = rec;
  105. //if( rec.data.bk_type!=3 ){
  106. //
  107. //} else {
  108. //
  109. //};
  110. }
  111. }
  112. };
  113. var selectedMarkerIcon = L.icon({
  114. iconUrl: '/style/assets/cursor.png',
  115. iconSize: [32, 32],
  116. iconAnchor: [16, 16]//,
  117. //popupAnchor: [-3, -76],
  118. //shadowUrl: 'my-icon-shadow.png',
  119. //shadowSize: [68, 95],
  120. //shadowAnchor: [22, 94]
  121. });
  122. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  123. var tlOptions = {
  124. groupOrder: 'content', // groupOrder can be a property name or a sorting function
  125. stack: true,
  126. showCurrentTime: true,
  127. //verticalScroll: true,
  128. //zoomKey: 'ctrlKey',
  129. minHeight: 308,
  130. maxHeight: 308
  131. };
  132. var tlLoadLocker = false;
  133. var tlLastTS = 0;
  134. var tlInterval = null;
  135. var tlMonitoring = false;
  136. // Calendar
  137. var CurrentDate=(new Date())/1000;
  138. var today=new Date();
  139. var SY=1900+today.getYear();
  140. var SMO=today.getMonth()+1;
  141. var SD=today.getDate();
  142. var SelectedDay = SD;
  143. var Dates = new Array();
  144. function CheckDate(D){
  145. for(j_index=0;j_index<Dates.length;j_index++){
  146. if (Dates[j_index]==D)return true;
  147. };
  148. return false;
  149. };
  150. function ShiftBAK(){
  151. CurrentDate=CurrentDate-24*3600*GetMonthLength(CurrentDate);
  152. BuildCalendar();
  153. SMO = GetMonthNum(CurrentDate);
  154. SY = GetYear(CurrentDate);
  155. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  156. loadCalendarDates();
  157. };
  158. function ShiftFWD(){
  159. CurrentDate=CurrentDate+24*3600*GetMonthLength(CurrentDate);
  160. BuildCalendar();
  161. SMO = GetMonthNum(CurrentDate);
  162. SY = GetYear(CurrentDate);
  163. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  164. loadCalendarDates();
  165. };
  166. function GetMonthName(UTS){ // Unix Time Stamp
  167. var MoNames= new Array();
  168. MoNames[0]='January';
  169. MoNames[1]='February';
  170. MoNames[2]='March';
  171. MoNames[3]='April';
  172. MoNames[4]='May';
  173. MoNames[5]='June';
  174. MoNames[6]='July';
  175. MoNames[7]='August';
  176. MoNames[8]='September';
  177. MoNames[9]='October';
  178. MoNames[10]='November';
  179. MoNames[11]='December';
  180. CDate=new Date();
  181. CDate.setTime(UTS*1000);
  182. CMo=CDate.getMonth();
  183. return MoNames[CMo];
  184. };
  185. function GetMonthShift(UTS){ // Unix Time Stamp
  186. CDate=new Date();
  187. CDate.setTime(UTS*1000);
  188. CDate.setTime((UTS-(CDate.getDate()-1)*86400)*1000);
  189. return CDate.getDay();
  190. };
  191. function GetMonthLength(UTS){ // Unix Time Stamp
  192. CDate=new Date();
  193. CDate.setTime(UTS*1000);
  194. CD=CDate.getDate();
  195. RetVal=31;
  196. CDate.setTime((UTS+(31-CD)*86400)*1000);
  197. if ( CDate.getDate()==31) return RetVal;
  198. RetVal=30;
  199. CDate.setTime((UTS+(30-CD)*86400)*1000);
  200. if ( CDate.getDate()==30) return RetVal;
  201. RetVal=29;
  202. CDate.setTime((UTS+(29-CD)*86400)*1000);
  203. if ( CDate.getDate()==29) return RetVal;
  204. RetVal=28;
  205. CDate.setTime((UTS+(28-CD)*86400)*1000);
  206. if ( CDate.getDate()==28) return RetVal;
  207. return -1;
  208. };
  209. function GetMonthNum(UTS){ // Unix Time Stamp
  210. CDate=new Date();
  211. CDate.setTime(UTS*1000);
  212. return CDate.getMonth()+1;
  213. };
  214. function GetYear(UTS){ // Unix Time Stamp
  215. CDate=new Date();
  216. CDate.setTime(UTS*1000);
  217. y=CDate.getYear();
  218. if (y<100)y+=2000;
  219. if (y<200)y+=1900;
  220. return y;
  221. };
  222. function GetDay(UTS){ // Unix Time Stamp
  223. CDate=new Date();
  224. CDate.setTime(UTS*1000);
  225. y=CDate.getDate();
  226. return y;
  227. };
  228. function selectDate( m, d ){
  229. SY = GetYear(CurrentDate);
  230. SMO = m;
  231. SD = d;
  232. SelectedDay = SD;
  233. getData( 'arch' );
  234. };
  235. function BuildCalendar( ){
  236. Msh=GetMonthShift(CurrentDate);
  237. Mnm=GetMonthName(CurrentDate);
  238. Mln=GetMonthLength(CurrentDate);
  239. Mid=GetMonthNum(CurrentDate);
  240. Mye=GetYear(CurrentDate);
  241. 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>';
  242. 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>';
  243. InDTA+='<tr>';
  244. for(index=0;index<Msh;index++){
  245. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  246. };
  247. for(;index<(Mln+Msh);index++){
  248. if( CheckDate(index-Msh+1) ){
  249. //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>';
  250. if( SD == index ){
  251. 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>';
  252. } else {
  253. 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>';
  254. };
  255. } else {
  256. if( SD == index ){
  257. InDTA+='<td style="padding: 1px"><div id="selected_day" class="calendar_t" title="Selected">'+(index-Msh+1).toString()+'</a></td>';
  258. } else {
  259. InDTA+='<td style="padding: 1px"><div id="no_data_day" class="calendar_t" title="No Events">'+(index-Msh+1).toString()+'</a></td>';
  260. };
  261. };
  262. if ((index+1)%7==0){
  263. InDTA+='</tr><tr>';
  264. };
  265. };
  266. for(;(index)%7!=0;index++){
  267. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  268. };
  269. InDTA+='</tr></table>';
  270. tab=document.getElementById('calendar_TD');
  271. tab.innerHTML=InDTA;
  272. };
  273. function loadCalendarDates(){
  274. ReportSelectionMode = 0;
  275. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  276. width: '100%',
  277. hidden: true,
  278. progress: true,
  279. closable: false
  280. });
  281. ReportLayoutLoadded = false;
  282. Ext.Ajax.request({
  283. url: '/lib/controller/getEventDates.php',
  284. params: {
  285. NID: selecredActiveSourceFilter,
  286. UID: <?=$UserID;?>,
  287. SID: '<?=$Session;?>',
  288. SYE: SY,
  289. SMO: SMO
  290. },
  291. success: function( response, opts ){
  292. Ext.MessageBox.hide();
  293. var data = Ext.decode( response.responseText );
  294. if( data.status == 'ok' ){
  295. Dates = data.days;
  296. BuildCalendar();
  297. //for( var i = 0; i < data.days.length; i++ ){
  298. //
  299. //};
  300. };
  301. },
  302. failure: function( response, opts ) {
  303. Ext.MessageBox.hide();
  304. }
  305. });
  306. };
  307. var eventsListStore = new Ext.data.JsonStore({
  308. root: 'log',
  309. totalProperty: 'totalCount',
  310. idProperty: 'id',
  311. remoteSort: true,
  312. fields: [{
  313. name: 'id',
  314. type: 'int'
  315. },{
  316. name: 'date',
  317. type: 'string'
  318. },{
  319. name: 'time',
  320. type: 'string'
  321. },{
  322. name: 'device',
  323. type: 'string'
  324. },{
  325. name: 'event',
  326. type: 'int'
  327. },{
  328. name: 'data',
  329. type: 'string',
  330. },{
  331. name: 'has_target',
  332. type: 'boolean'
  333. },{
  334. name: 'has_geo',
  335. type: 'boolean'
  336. },{
  337. name: 'has_images',
  338. type: 'boolean'
  339. },{
  340. name: 'images',
  341. type: 'Array'
  342. },{
  343. name: 'dev_type',
  344. type: 'int'
  345. },{
  346. name: 'geo',
  347. type: 'object'
  348. }] /*,
  349. proxy : new Ext.data.HttpProxy({
  350. method: 'POST',
  351. prettyUrls: false,
  352. url: '/lib/controller/getEventRecords.php',
  353. headers: {
  354. UID: <?=$UserID;?>,
  355. SID: '<?=$Session;?>',
  356. NID: 1
  357. }
  358. })*/
  359. });
  360. var SelectedEvent = 0;
  361. var EventPanelWindow = null;
  362. function showEventPanel(){
  363. if( EventPanelWindow == null ){
  364. EventPanelWindow = new Ext.Window({
  365. modal: true,
  366. title: '<?=$Labels->GetLabel("_EVENT_VIEWER_");?>',
  367. width: winW*0.66,
  368. height: winH*0.66,
  369. layout: 'fit',
  370. closeAction: 'hide',
  371. items:[{
  372. title: 'Cameras',
  373. html:'koko',
  374. autoScroll: true,
  375. height: 320
  376. },{
  377. html: 'koko22',
  378. height: 320
  379. }]
  380. });
  381. };
  382. EventPanelWindow .show();
  383. };
  384. function ModeRenderer(val){
  385. var p1, p2, p3;
  386. if( ( val & 1 ) == 1 ){
  387. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  388. } else {
  389. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  390. };
  391. if( ( val & 2 ) == 2 ){
  392. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  393. } else {
  394. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  395. };
  396. if( ( val & 4 ) == 4 ){
  397. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  398. } else {
  399. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  400. };
  401. return p1+p2+p3;
  402. };
  403. function LocRenderer( val ){
  404. if( val ){
  405. return '<img src="/style/icons/icons/accept.png" alt="Location" />';
  406. };
  407. return '<img src="/style/icons/icons/bullet_white.png" alt="NO Location" />';
  408. };
  409. function PicRenderer( val ){
  410. if( val ){
  411. return '<img src="/style/icons/icons/camera_link.png"/>';
  412. };
  413. return '<img src="/style/icons/icons/bullet_white.png"/>';
  414. };
  415. function EvtTypeRenderer( val ){
  416. switch( val ){
  417. case 6: return 'Device Enters Into Study Mode';
  418. case 7: return 'Device Is BUSY';
  419. case 8: return 'Flip Complete';
  420. case 9: return 'Scan Complete';
  421. case 10:
  422. case 11:
  423. case 12:
  424. case 13:
  425. case 14: return 'Target';
  426. case 36: return 'Region Of Interest';
  427. default: return 'Event ['+val+']';
  428. };
  429. };
  430. var eventsListColModel_ops = {
  431. columns: [
  432. {header: "ID", width: 100, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  433. {header: "Date",width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'date' },
  434. {header: "Time", width: 80, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'time' },
  435. {header: "Device", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'device' },
  436. {header: "Event", width: 120, sortable: false, dataIndex: 'event', renderer: EvtTypeRenderer },
  437. {header: "Info", width: 200, sortable: false, dataindex: 'data' },
  438. {header: "", width: 25, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer },
  439. {header: "", width: 25, sortable: false, dataIndex: 'has_images', renderer: PicRenderer }
  440. ],
  441. defaults: {
  442. sortable: true,
  443. menuDisabled: true,
  444. width: 100
  445. },
  446. listeners: {
  447. hiddenchange: function(cm, colIndex, hidden) {
  448. //saveConfig(colIndex, hidden);
  449. }
  450. }
  451. };
  452. var SelectedRow = -1;
  453. var eventsListSelModel_ops = {
  454. singleSelect: true,
  455. listeners: {
  456. rowselect: function(sm, row, rec ) {
  457. loadEventProperties( rec.data );
  458. SelectedEvent = rec.data.id;
  459. SelectedRow = row;
  460. //alert( SelectedEvent );
  461. //var CB = Ext.getCmp('con_to_src');
  462. //CB.enable();
  463. }
  464. }
  465. };
  466. function loadTimeLineGroups( NID ){
  467. Ext.Ajax.request({
  468. url: '/lib/controller/getTimeLineGroups.php',
  469. params: {
  470. NID: NID,
  471. UID: <?=$UserID;?>,
  472. SID: '<?=$Session;?>'
  473. },
  474. success: function( response, opts ){
  475. // If the response is JSON, you have to decode it
  476. var data = Ext.decode(response.responseText);
  477. //for(var i = 0; i < data.length; i++) {
  478. //tlGroups.add(data[i]);
  479. //};
  480. tlGroups.update( data );
  481. loadTimeLineItems( SelectedSite );
  482. tlInterval = window.setInterval( loadTimeLineItems, 333, SelectedSite );
  483. },
  484. failure: function( response, opts ) {
  485. //Ext.fly('some_div').update('Fail!');
  486. }/*,
  487. callback: function(options,success,response){
  488. // use this if you need to perform your own success/failure checking
  489. }*/
  490. });
  491. };
  492. function clickDeviceSelector( id ){
  493. var rr = document.getElementById(id+'_div');
  494. if( selecredActiveSourceFilter != id ){
  495. if( selecredActiveSourceFilter > 0 ){
  496. var oo = document.getElementById( selecredActiveSourceFilter + '_div');
  497. oo.classList.remove( "cardDeviceSourceSelected" );
  498. oo.classList.add( "cardDeviceSource" );
  499. };
  500. rr.classList.remove( "cardDeviceSource" );
  501. rr.classList.add( "cardDeviceSourceSelected" );
  502. selecredActiveSourceFilter = id;
  503. turnOffAllGzButThis( selecredActiveSourceFilter );
  504. } else {
  505. selecredActiveSourceFilter = 0;
  506. rr.classList.remove( "cardDeviceSourceSelected" );
  507. rr.classList.add( "cardDeviceSource" );
  508. turnAllGzOn();
  509. var tPanel = Ext.getCmp('prop_content');
  510. tPanel.remove(0);
  511. tPanel.add( {
  512. title: 'Event Information',
  513. border: false,
  514. frame: false,
  515. collapsible: false,
  516. draggable: false,
  517. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  518. } );
  519. tPanel.doLayout();
  520. };
  521. };
  522. function loadEventPropertiesByID( id ){
  523. var d = eventsListStore.findExact( 'id', id );
  524. if( d > -1 ) {
  525. var EventRec = eventsListStore.getAt( d );
  526. loadEventProperties( EventRec.data );
  527. };
  528. };
  529. function loadEventProperties( EventRec ){
  530. var tPanel = Ext.getCmp('prop_content');
  531. tPanel.removeAll();// remove( 0 );
  532. var tt = '';
  533. if( selectedMarker!= null ){
  534. selectedMarker.remove();
  535. //map.removeLayer( selectedMarker );
  536. if( EventRec.has_geo ){
  537. tt = ''+EventRec.geo.lat+' '+EventRec.geo.lon;
  538. selectedMarker.setLatLng([EventRec.geo.lat, EventRec.geo.lon]);
  539. selectedMarker.addTo( map );
  540. };
  541. };
  542. tPanel.add( {
  543. title: 'Event Details',
  544. html: '<center><img src="/style/assets/'+EventRec.dev_type+'_node.png" /><p>' + EventRec.device+'</p>'+tt+'</center>'
  545. } );
  546. if( EventRec.has_images ){
  547. for( var i=0; i < EventRec.images.length; i++ ){
  548. tPanel.add( {
  549. frame: false,
  550. 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+'"/>'
  551. });
  552. };
  553. };
  554. tPanel.doLayout();
  555. };
  556. var VideoLinks = [];
  557. var VideoPlayer = null;
  558. var cEventTSS = 0;
  559. var cEventETS = 0;
  560. function loadEventData( record ){
  561. ReportSelectionMode = 3; // Just One Event
  562. cEventTSS = record.ts+record.ms/1000;
  563. clearAllRadars();
  564. if( record.type == 13 || record.type == 14 || record.type == 36 ){
  565. markEventOnRadar( record.node_id, record.az, record.r );
  566. };
  567. if( record.video_id > 0 ){
  568. showVideo();
  569. Ext.Ajax.request({
  570. url: '/lib/controller/getVideoInfo.php',
  571. params: {
  572. UID: <?=$UserID;?>,
  573. SID: '<?=$Session;?>',
  574. TS: record.ts,
  575. VID: record.video_id
  576. },
  577. success: function( response, opts ){
  578. var data = Ext.decode(response.responseText);
  579. var t = Ext.getCmp('db_download_video');
  580. if( t != undefined ){
  581. t.toggle( true, true );
  582. t.enable();
  583. }
  584. var video_t = document.getElementById( 'video-'+data.node_id );
  585. if( video_t != undefined ){
  586. if( cRowSelected+1 < rep_array.length ) {
  587. var ddd = rep_array[cRowSelected+1];
  588. cEventETS = ( ddd.ts + ddd.ms/1000 ) - ( data.uts+data.uts_ms/1000 );
  589. } else {
  590. cEventETS = 0;
  591. };
  592. VideoPlayer = videojs( video_t );
  593. var tVL = '/lib/controller/data/reports/'+data.base+'/'+data.md5+'.'+data.ext;
  594. if( tVL != VideoLinks[data.node_id] ){
  595. VideoLinks[data.node_id] = tVL;
  596. VideoPlayer.src({
  597. type: 'video/mp4',
  598. src: VideoLinks[data.node_id]
  599. });
  600. VideoPlayer.poster('/style/assets/no-signal.png');
  601. };
  602. var CT = cEventTSS - ( data.uts+data.uts_ms/1000 );
  603. VideoPlayer.currentTime( CT );
  604. VideoPlayer.play();
  605. };
  606. }
  607. });
  608. } else {
  609. var t = Ext.getCmp('db_download_video');
  610. if( t != undefined ){
  611. alert("ZagZag");
  612. t.toggle( false, true );
  613. t.disable();
  614. }
  615. //var video_t = document.getElementById( 'video-'+record.node_id );
  616. if( VideoPlayer != null ){
  617. //VideoPlayer.dispose();
  618. //VideoPlayer = null;
  619. VideoPlayer.pause();
  620. VideoPlayer.poster('/style/assets/no-signal.png');
  621. VideoPlayer.posterImage.show();
  622. };
  623. };
  624. };
  625. function clearAllRadars(){
  626. for( i=1; i< 1000; i++ ){
  627. var csvg = document.getElementById( 'draw_svgr_' + i );
  628. if( csvg!= undefined ){
  629. var roi = csvg.getElementById( "roi" );
  630. if( roi != null ) csvg.removeChild( roi );
  631. };
  632. };
  633. };
  634. function markEventOnRadar( rid, az, range ){
  635. var csvg = document.getElementById( 'draw_svgr_' + rid );
  636. if( csvg!= undefined ){
  637. var roi = csvg.getElementById( "roi" );
  638. if( roi != null ) csvg.removeChild( roi );
  639. var bBox = csvg.getBBox();
  640. var max = 2048;
  641. switch( drawZoomLevels[rid] ){
  642. case 50: max = 1024; break;
  643. case 25: max = 512; break;
  644. case 12: max = 256; break;
  645. };
  646. if( range < max ){
  647. var ak = 2.0*Math.PI/360;
  648. var ok = 1.0/35;
  649. var rk = bBox.width / ( max * 2 );
  650. var cpx = bBox.width / 2.0;
  651. var cpy = bBox.height / 2.0;
  652. x = cpx + rk * range * Math.cos( az*ak );
  653. y = cpy - rk * range * Math.sin( az*ak );
  654. var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
  655. var rz = bBox.width / csvg.clientWidth;
  656. cc.setAttributeNS(null, "cx", x );
  657. cc.setAttributeNS(null, "cy", y );
  658. cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
  659. cc.setAttributeNS(null, "stroke", "#800000" );
  660. cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
  661. cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
  662. cc.setAttributeNS(null, "fill", "#ff0000" );
  663. cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
  664. cc.setAttributeNS(null, "id", "roi" );
  665. csvg.appendChild( cc );
  666. };
  667. };
  668. };
  669. function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){
  670. if( tlLoadLocker ) return;
  671. tlLoadLocker = true;
  672. if( Mode == 'arch' ){
  673. Ext.MessageBox.wait("Loading Data","Please Wait",{
  674. width: '100%',
  675. hidden: true,
  676. animate: true,
  677. progress: true,
  678. closable: false
  679. });
  680. };
  681. Ext.Ajax.request({
  682. url: '/lib/controller/getEventRecords.php',
  683. params: {
  684. SITE: <?=$SiteID;?>,
  685. UID: <?=$UserID;?>,
  686. SID: '<?=$Session;?>',
  687. MODE: Mode,
  688. FIL: selecredActiveSourceFilter,
  689. SDA: SD,
  690. SMO: SMO,
  691. SYE: SY,
  692. STM: ST,
  693. ETM: ET,
  694. STR: SR,
  695. DIR: DR
  696. },
  697. success: function( response, opts ){
  698. tlLoadLocker = false;
  699. var data = Ext.decode(response.responseText);
  700. if( data.updateFROMTO ){
  701. Ext.getCmp('STimeFROM').setValue( data.STT );
  702. Ext.getCmp('STimeTO').setValue( data.ENT );
  703. if( data.SLD > 0 ){
  704. SMO = GetMonthNum(data.SLD);
  705. SY = GetYear(data.SLD);
  706. SD = GetDay(data.SLD);
  707. BuildCalendar();
  708. };
  709. };
  710. eventsListStore.loadData( data, false );
  711. if( Mode == 'arch' ){
  712. showEventsOnMap( data, true );
  713. Ext.MessageBox.hide();
  714. if( DR > 0 ){
  715. Ext.getCmp('evtArchLog').getView().focusRow( eventsListStore.getCount() - 1 );
  716. Ext.getCmp('evtArchLog').getSelectionModel().selectLastRow();
  717. };
  718. if( DR < 0 ){
  719. Ext.getCmp('evtArchLog').getView().focusRow( 0 );
  720. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  721. };
  722. } else {
  723. showEventsOnMap( data, false );
  724. //LoadMapEventsZ( Mode );
  725. };
  726. },
  727. failure: failureAJAXFunction
  728. });
  729. };
  730. function loadArchive(){
  731. if( tlInterval!= null ){
  732. window.clearInterval( tlInterval );
  733. tlInterval = null;
  734. timelineObj = null;
  735. };
  736. setUserContent( 2 );
  737. var tPanel = Ext.getCmp('main_portal');
  738. tPanel.removeAll( true );
  739. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  740. tPanel.add({
  741. columnWidth: 0.83,
  742. frame: false,
  743. border: false,
  744. items: [{
  745. title: 'Site Map',
  746. frame: false,
  747. border: false,
  748. layout: 'vbox',
  749. layoutConfig: {
  750. align : 'stretch',
  751. pack : 'start',
  752. },
  753. height: PanelH-300,
  754. items:[{
  755. height: PanelH-325,
  756. flex: 1,
  757. frame: false,
  758. border: false,
  759. layout: 'fit',
  760. items:{
  761. id: 'event_map',
  762. html: '&nbsp;'
  763. }
  764. }]
  765. },{
  766. frame: false,
  767. border: false,
  768. collapsible: false,
  769. draggable: false,
  770. layout: 'hbox',
  771. items:[{
  772. layout: 'form',
  773. title: 'Date/Time',
  774. width: 200,
  775. frame: true,
  776. border: false,
  777. labelAlign: 'right',
  778. labelWidth: 50,
  779. defaults: { width: 80},
  780. items: [{
  781. xtype: 'combo',
  782. id: 'STimeFROM',
  783. fieldLabel: 'From',
  784. editable: false,
  785. typeAhead: true,
  786. triggerAction: 'all',
  787. width: 120,
  788. lazyRender:true,
  789. mode: 'local',
  790. store: new Ext.data.ArrayStore({
  791. id: 0,
  792. fields: ['ss', 'displayText' ],
  793. data: [<?php
  794. $zuzu = array();
  795. for( $i = 0; $i < 24; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  796. echo implode( ',', $zuzu ); ?>]
  797. }),
  798. valueField: 'ss',
  799. displayField: 'displayText'
  800. },{
  801. xtype: 'combo',
  802. id: 'STimeTO',
  803. fieldLabel: 'Till',
  804. editable: false,
  805. typeAhead: true,
  806. triggerAction: 'all',
  807. width: 120,
  808. lazyRender:true,
  809. mode: 'local',
  810. store: new Ext.data.ArrayStore({
  811. id: 0,
  812. fields: ['ss', 'displayText' ],
  813. data: [<?php
  814. $zuzu = array();
  815. for( $i = 1; $i < 25; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  816. echo implode( ',', $zuzu ); ?>]
  817. }),
  818. valueField: 'ss',
  819. displayField: 'displayText'
  820. }],
  821. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  822. buttons: [{
  823. xtype: 'button',
  824. text: 'Display History',
  825. handler: function(){
  826. var STU = Ext.getCmp('STimeFROM').getValue();
  827. var ETU = Ext.getCmp('STimeTO').getValue();
  828. getData( 'arch', STU, ETU );
  829. }
  830. }]
  831. },{
  832. title: 'Event Log',
  833. frame: false,
  834. height: 303,
  835. id: 'evtArchLog',
  836. xtype: 'grid',
  837. ds: eventsListStore,
  838. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  839. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  840. listeners:{
  841. keydown: function( e ) {
  842. if( e.getKey() == e.UP ){
  843. if( SelectedRow == 0 ){
  844. var id = eventsListStore.getAt( 0 ).id;
  845. getData( 'arch', 0, 0, id, 1 );
  846. };
  847. };
  848. if( e.getKey() == e.DOWN ){
  849. if( SelectedRow == ( eventsListStore.getCount() - 1 ) ){
  850. var id = eventsListStore.getAt( SelectedRow ).id;
  851. getData( 'arch', 0, 0, id, -1 );
  852. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  853. Ext.getCmp('evtArchLog').focus( false, true );
  854. };
  855. };
  856. }
  857. }
  858. }]
  859. }]
  860. });
  861. tPanel.add({
  862. columnWidth: 0.17,
  863. frame: true,
  864. title: 'Event Information',
  865. id: 'prop_content',
  866. border: false,
  867. items: [{
  868. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  869. }]
  870. });
  871. tPanel.doLayout();
  872. /*
  873. Ext.getCmp('evtLog').getEl().set({tabindex: "0"});
  874. Ext.getCmp('evtLog').getEl().addKeyMap({
  875. eventName: "keyup",
  876. binding: [{
  877. key: Ext.EventObject.SPACE,
  878. fn: function(){ alert("Space key pressed"); }
  879. },{
  880. key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],
  881. shift: true,
  882. fn: function(){ alert("Left or right pressed while pressing shift"); }
  883. }]
  884. });
  885. */
  886. //BuildCalendar();
  887. loadCalendarDates();
  888. map = L.map('event_map',{
  889. attributionControl: true,
  890. //preferCanvas: true,
  891. zoomControl: true,
  892. center: [SiteLat, SiteLon],
  893. /*zoomControl: false,
  894. zoom: 17,
  895. minZoom: 17,
  896. maxZoom: 17,*/
  897. keyboard: false
  898. }).setView([SiteLat, SiteLon], 17);
  899. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  900. var mapLayers = [];
  901. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  902. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  903. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  904. detectRetina: true
  905. });*/
  906. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  907. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  908. maxNativeZoom: 18,
  909. maxZoom: 24,
  910. })
  911. // https://leaflet-extras.github.io/leaflet-providers/preview/
  912. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  913. 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',
  914. maxZoom: 19
  915. });
  916. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  917. 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',
  918. maxZoom: 19
  919. });
  920. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  921. 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',
  922. maxZoom: 24
  923. });
  924. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  925. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  926. maxZoom: 19
  927. });
  928. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  929. 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>) ',
  930. maxZoom: 19
  931. });
  932. /*
  933. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  934. 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>',
  935. maxZoom: 22
  936. });
  937. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  938. 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>',
  939. maxZoom: 22
  940. });
  941. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  942. 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>',
  943. maxZoom: 22
  944. });
  945. */
  946. var baseMaps = {
  947. "MyMap": mapLayers["MyMap"],
  948. "OpenStreetMap": mapLayers["OpenStreetMap"],
  949. "OpenTopoMap": mapLayers["OpenTopoMap"],
  950. "EsriSat": mapLayers["EsriSat"],
  951. "EsriStreet": mapLayers["EsriStreet"],
  952. "EsriTopo": mapLayers["EsriTopo"],
  953. //"Bing": mapLayers["Bing"],
  954. //"OSM-Cycle": mapLayers["Cycle"],
  955. //"Landscape": mapLayers["Landscape"],
  956. //"Outdoor": mapLayers["Outdoor"],
  957. };
  958. L.control.layers( baseMaps ).addTo(map);
  959. mapLayers["MyMap"].addTo(map);
  960. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  961. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  962. maxNativeZoom: 18,
  963. maxZoom: 24,
  964. }).addTo(map); */
  965. //loadTimeLineGroups( selectedSite );
  966. loadMapZones( SelectedSite );
  967. getData( 'arch' );
  968. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  969. };
  970. function loadMonitoring(){
  971. if( tlInterval!= null ){
  972. window.clearInterval( tlInterval );
  973. tlInterval = null;
  974. timelineObj = null;
  975. };
  976. setUserContent( 1 );
  977. var tPanel = Ext.getCmp('main_portal');
  978. tPanel.removeAll( true );
  979. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  980. tPanel.add({
  981. columnWidth: 0.83,
  982. frame: false,
  983. border: false,
  984. items: [{
  985. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  986. frame: false,
  987. border: false,
  988. collapsible: false,
  989. draggable: false,
  990. layout: 'vbox',
  991. layoutConfig: {
  992. align : 'stretch',
  993. pack : 'start',
  994. },
  995. height: PanelH-300,
  996. items:[{
  997. height: PanelH-325,
  998. flex: 1,
  999. frame: false,
  1000. border: false,
  1001. layout: 'fit',
  1002. items:{
  1003. id: 'event_map',
  1004. html: '&nbsp;'
  1005. }
  1006. }]
  1007. },{
  1008. frame: false,
  1009. border: true,
  1010. collapsible: false,
  1011. draggable: false,
  1012. layout: 'hbox',
  1013. items:[{
  1014. title: 'Alarm Sources',
  1015. xtype: 'panel',
  1016. border: false,
  1017. frame: false,
  1018. collapsible: false,
  1019. draggable: false,
  1020. id: 'sources_panel',
  1021. width: 160,
  1022. autoScroll: 'auto',
  1023. height: 303
  1024. },{
  1025. title: 'Event Log',
  1026. height: 303,
  1027. xtype: 'grid',
  1028. border: false,
  1029. frame: false,
  1030. collapsible: false,
  1031. draggable: false,
  1032. ds: eventsListStore,
  1033. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1034. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1035. bbar: [{
  1036. text: 'Clear',
  1037. handler: function(){
  1038. Ext.Ajax.request({
  1039. url: '/lib/controller/clearEventCloud.php',
  1040. params: {
  1041. UID: <?=$UserID;?>,
  1042. SID: '<?=$Session;?>'
  1043. },
  1044. success: function( response, opts ){
  1045. },
  1046. failure: function( response, opts ) {
  1047. }
  1048. });
  1049. }
  1050. }]
  1051. }]
  1052. }]
  1053. });
  1054. tPanel.add({
  1055. columnWidth: 0.17,
  1056. title: 'Event Information',
  1057. frame: true,
  1058. id: 'prop_content',
  1059. border: false,
  1060. items: [{
  1061. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1062. }]
  1063. });
  1064. tPanel.doLayout();
  1065. map = L.map('event_map',{
  1066. attributionControl: true,
  1067. //preferCanvas: true,
  1068. zoomControl: true,
  1069. center: [SiteLat, SiteLon],
  1070. /*zoomControl: false,
  1071. zoom: 17,
  1072. minZoom: 17,
  1073. maxZoom: 17,*/
  1074. keyboard: false
  1075. }).setView([SiteLat, SiteLon], 17);
  1076. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1077. var mapLayers = [];
  1078. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1079. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1080. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1081. detectRetina: true
  1082. });*/
  1083. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1084. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1085. maxNativeZoom: 18,
  1086. maxZoom: 24,
  1087. })
  1088. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1089. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1090. 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',
  1091. maxZoom: 19
  1092. });
  1093. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1094. 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',
  1095. maxZoom: 19
  1096. });
  1097. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1098. 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',
  1099. maxZoom: 24
  1100. });
  1101. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1102. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1103. maxZoom: 19
  1104. });
  1105. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1106. 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>) ',
  1107. maxZoom: 19
  1108. });
  1109. /*
  1110. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1111. 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>',
  1112. maxZoom: 22
  1113. });
  1114. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1115. 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>',
  1116. maxZoom: 22
  1117. });
  1118. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1119. 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>',
  1120. maxZoom: 22
  1121. });
  1122. */
  1123. var baseMaps = {
  1124. "MyMap": mapLayers["MyMap"],
  1125. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1126. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1127. "EsriSat": mapLayers["EsriSat"],
  1128. "EsriStreet": mapLayers["EsriStreet"],
  1129. "EsriTopo": mapLayers["EsriTopo"],
  1130. //"Bing": mapLayers["Bing"],
  1131. //"OSM-Cycle": mapLayers["Cycle"],
  1132. //"Landscape": mapLayers["Landscape"],
  1133. //"Outdoor": mapLayers["Outdoor"],
  1134. };
  1135. L.control.layers( baseMaps ).addTo(map);
  1136. mapLayers["MyMap"].addTo(map);
  1137. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1138. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1139. maxNativeZoom: 18,
  1140. maxZoom: 24,
  1141. }).addTo(map); */
  1142. loadMapZones( SelectedSite );
  1143. tlInterval = window.setInterval( getData, 333, 'live' );
  1144. };
  1145. function loadOnlineMonitoring(devID){
  1146. if( tlInterval!= null ){
  1147. window.clearInterval( tlInterval );
  1148. tlInterval = null;
  1149. timelineObj = null;
  1150. };
  1151. var tPanel = Ext.getCmp('main_content');
  1152. tPanel.removeAll( true );
  1153. tPanel.add({
  1154. html: 'Device Monitoring '+devID
  1155. });
  1156. tPanel.doLayout();
  1157. };
  1158. function shutImg( img, a = '' ){
  1159. if( a == '' ){
  1160. img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;';
  1161. } else {
  1162. img.src = a;
  1163. };
  1164. };
  1165. var ReportMask = null;
  1166. var ReportLayoutLoadded = false;
  1167. var ReportSelectionMode = 0; //All
  1168. function loadReportSegment( ts, bid, eid ){
  1169. if( !ReportLayoutLoadded ){
  1170. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1171. ReportMask.show();
  1172. Ext.Ajax.request({
  1173. url: '/lib/controller/getReportLayout.php',
  1174. params: {
  1175. UID: <?=$UserID;?>,
  1176. SID: '<?=$Session;?>'//,
  1177. //BID: nid,
  1178. //EID: evt_ts
  1179. },
  1180. success: function(response, opts ){
  1181. var data = Ext.decode( response.responseText );
  1182. var tPanel = Ext.getCmp('main_content');
  1183. tPanel.removeAll(true);
  1184. Ext.getCmp('main_content').add({
  1185. xtype: 'portal',
  1186. id: 'segment_portal',
  1187. frame: false,
  1188. border: false,
  1189. items:{
  1190. html: ''
  1191. },
  1192. listeners:{
  1193. drop: function( a ){
  1194. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  1195. }
  1196. }
  1197. });
  1198. Ext.getCmp('main_content').doLayout();
  1199. tPanel = Ext.getCmp('segment_portal');
  1200. //nodeDashboardStatuses = new Array();
  1201. for( i=0; i < data.length; i++) tPanel.add( data[i] );
  1202. tPanel.doLayout();
  1203. ReportMask.hide();
  1204. ReportLayoutLoadded = true;
  1205. loadReportData( ts, bid, eid );
  1206. },
  1207. error: function(){
  1208. ReportMask.hide();
  1209. }
  1210. });
  1211. } else {
  1212. loadReportData( ts, bid, eid );
  1213. };
  1214. };
  1215. function loadReportData( ts, bid, eid ){
  1216. ReportSelectionMode = 2; // Session Selected
  1217. Ext.Ajax.request({
  1218. url: '/lib/controller/getHistoryEvents.php',
  1219. params: {
  1220. UID: <?=$UserID;?>,
  1221. SID: '<?=$Session;?>',
  1222. TS: ts,
  1223. BID: bid,
  1224. EID: eid,
  1225. },
  1226. success: function(response, opts ){
  1227. hideVideo();
  1228. var data = Ext.decode( response.responseText );
  1229. if( data.log != undefined ){
  1230. if( data.log.length ){
  1231. rep_store_id = data.log[0].id;
  1232. rep_array = data.log;//.concat( rep_array );
  1233. //if( log_array.length > 32 ){
  1234. // log_array = log_array.slice( 0, 31 );
  1235. //};
  1236. rep_store.removeAll();
  1237. rep_store.loadData( rep_array );
  1238. };
  1239. } else {
  1240. alert('No Log');
  1241. // clear the log
  1242. //log_store.removeAll();
  1243. };
  1244. }
  1245. });
  1246. };
  1247. function loadReportDayTree( ts ){
  1248. ReportSelectionMode = 1;//Day Selected
  1249. ReportMask = new Ext.LoadMask(Ext.getCmp('left_side_menu').getEl(), {msg:"Please wait..."});
  1250. ReportMask.show();
  1251. Ext.Ajax.request({
  1252. url: '/lib/controller/getHistoryDay.php',
  1253. params: {
  1254. UID: <?=$UserID;?>,
  1255. SID: '<?=$Session;?>',
  1256. DTS: ts
  1257. },
  1258. success: function(response, opts ){
  1259. var data = Ext.decode( response.responseText );
  1260. var sPanel = Ext.getCmp('left_side_menu');
  1261. sPanel.removeAll( true );
  1262. sPanel.add({
  1263. xtype: 'panel',
  1264. layout: 'vbox',
  1265. frame: true,
  1266. border: false,
  1267. items:[{
  1268. xtype: 'spacer',
  1269. height: 3
  1270. },{
  1271. html: '<p class="cur_date">'+( new Date( ts * 1000)).toLocaleDateString()+'</p><p class="cur_sessions">'+data.sessions+'</p><p class="cur_events">'+data.events+'</p><p class="cur_videos">'+data.videos+'</p>',
  1272. frame: false,
  1273. width: '100%',
  1274. border: false
  1275. },{
  1276. xtype: 'spacer',
  1277. height: 5
  1278. },{
  1279. xtype: 'treepanel',
  1280. autoScroll: true,
  1281. width: '100%',
  1282. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1283. height: PanelH-260,
  1284. <?php } else { ?>
  1285. height: PanelH-209,
  1286. <?php }; ?>
  1287. border: true,
  1288. frame: true,
  1289. loader: new Ext.tree.TreeLoader(),
  1290. rootVisible: false,
  1291. root: new Ext.tree.AsyncTreeNode( data ),
  1292. listeners: {
  1293. click: function(n) {
  1294. if( n.attributes.leaf ){
  1295. Ext.getCmp('chu_adate').show();
  1296. sPanel.doLayout();
  1297. loadReportSegment( ts, n.attributes.bid, n.attributes.eid );
  1298. //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"');
  1299. };
  1300. }
  1301. }
  1302. },{
  1303. xtype: 'spacer',
  1304. height: 10
  1305. },{
  1306. xtype: 'button',
  1307. id: 'chu_adate',
  1308. text: 'Show Dates',
  1309. hidden: true,
  1310. width: '100%',
  1311. iconCls: 'reports_dates_btn',
  1312. scale: 'large',
  1313. handler: function(){
  1314. Ext.getCmp('chu_adate').hide();
  1315. initReportsView();
  1316. }
  1317. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1318. },{
  1319. xtype: 'spacer',
  1320. height: 10
  1321. },{
  1322. xtype: 'button',
  1323. width: '100%',
  1324. scale: 'large',
  1325. iconCls: 'reports_delete_btn',
  1326. text: 'Delete Selected',
  1327. handler: function(){
  1328. }
  1329. <?php }; ?>
  1330. }]
  1331. });
  1332. sPanel.doLayout();
  1333. ReportMask.hide();
  1334. }
  1335. });
  1336. };
  1337. function hideVideo(){
  1338. var juja = undefined;
  1339. for( i = 1; i++; i < 1000 ){
  1340. var juja = document.getElementById( 'video-'+i );
  1341. if( juja != undefined ) break;
  1342. };
  1343. if( juja != undefined ) juja.style.display = "none";
  1344. };
  1345. function showVideo(){
  1346. var juja = undefined;
  1347. for( i = 1; i++; i < 1000 ){
  1348. var juja = document.getElementById( 'video-'+i );
  1349. if( juja != undefined ) break;
  1350. };
  1351. if( juja != undefined ) juja.style.display = "block";
  1352. };
  1353. function initReportsView(){
  1354. ReportSelectionMode = 0; // All History
  1355. if( tlInterval!= null ){
  1356. window.clearInterval( tlInterval );
  1357. tlInterval = null;
  1358. timelineObj = null;
  1359. };
  1360. ReportLayoutLoadded = false;
  1361. var tPanel = Ext.getCmp('main_content');
  1362. var sPanel = Ext.getCmp('left_side_menu');
  1363. tPanel.removeAll( true );
  1364. sPanel.removeAll( true );
  1365. tPanel.add({
  1366. xtype: 'panel',
  1367. height: PanelH+15,
  1368. html: '<div id="activity_ph"></div>',
  1369. listeners:{
  1370. afterrender: function(){
  1371. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1372. ReportMask.show();
  1373. var jj = (PanelW - 230)/55;
  1374. changeStyleSheet('amap-empty-day','{width: '+jj+'px; height: '+jj+'px;}');
  1375. changeStyleSheet('amap-week-day','{width: '+jj+'px; height: '+jj+'px;}');
  1376. changeStyleSheet('amap-week-name','{width: '+jj+'px; height: '+jj+'px;}');
  1377. Ext.Ajax.request({
  1378. url: '/lib/controller/getHistoryDates.php',
  1379. params: {
  1380. UID: <?=$UserID;?>,
  1381. SID: '<?=$Session;?>'
  1382. },
  1383. success: function(response, opts ){
  1384. var data = Ext.decode( response.responseText );
  1385. var activityMap = new ActivityMap( data, {
  1386. id: "dji-volume-map",
  1387. parent: '#activity_ph',
  1388. showTitle: false,
  1389. showYears: true,
  1390. width: 100,
  1391. hue: 1,
  1392. fit: true,
  1393. compact: true,
  1394. timeColumn: "t",
  1395. valueColumn: "v"
  1396. });
  1397. activityMap.render();
  1398. ReportMask.hide();
  1399. }
  1400. });
  1401. }
  1402. }
  1403. });
  1404. tPanel.doLayout();
  1405. sPanel.add({
  1406. xtype: 'panel',
  1407. frame: true,
  1408. border: false,
  1409. items: [{
  1410. html: '<div class="setEd_infoPanel" id="NANA"><?=$Labels->GetLabel('_PLS_SEL_CAL_DATE_');?></div>',
  1411. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1412. height: PanelH - 70
  1413. },{
  1414. xtype: 'button',
  1415. width: '100%',
  1416. scale: 'large',
  1417. iconCls: 'reports_delete_btn',
  1418. text: 'Clear All History'
  1419. <?php } else { ?>
  1420. height: PanelH - 30
  1421. <?php }; ?>
  1422. }]
  1423. });
  1424. sPanel.doLayout();
  1425. };