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.

1526 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
​
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. var tVL = '/lib/controller/data/reports/'+data.base+'/'+data.md5+'.'+data.ext;
  593. if( tVL != VideoLinks[data.node_id] ){
  594. VideoLinks[data.node_id] = tVL;
  595. alert( tVL );
  596. switch( data.ext ){
  597. case 'mp4':{
  598. ctype = 'video/mp4';
  599. VideoPlayer = videojs( video_t );
  600. VideoPlayer.src({
  601. type: ctype,
  602. fps: data.fps,
  603. src: VideoLinks[data.node_id]
  604. });
  605. VideoPlayer.poster('/style/assets/no-signal.png');
  606. break;
  607. };
  608. case 'mjpeg':{
  609. ctype = 'video/x-motion-jpeg';
  610. break;
  611. };
  612. };
  613. };
  614. var CT = cEventTSS - ( data.uts+data.uts_ms/1000 );
  615. VideoPlayer.currentTime( CT );
  616. VideoPlayer.play();
  617. };
  618. }
  619. });
  620. } else {
  621. var t = Ext.getCmp('db_download_video');
  622. if( t != undefined ){
  623. alert("ZagZag");
  624. t.toggle( false, true );
  625. t.disable();
  626. }
  627. //var video_t = document.getElementById( 'video-'+record.node_id );
  628. if( VideoPlayer != null ){
  629. //VideoPlayer.dispose();
  630. //VideoPlayer = null;
  631. VideoPlayer.pause();
  632. VideoPlayer.poster('/style/assets/no-signal.png');
  633. VideoPlayer.posterImage.show();
  634. };
  635. };
  636. };
  637. function clearAllRadars(){
  638. for( i=1; i< 1000; i++ ){
  639. var csvg = document.getElementById( 'draw_svgr_' + i );
  640. if( csvg!= undefined ){
  641. var roi = csvg.getElementById( "roi" );
  642. if( roi != null ) csvg.removeChild( roi );
  643. };
  644. };
  645. };
  646. function markEventOnRadar( rid, az, range ){
  647. var csvg = document.getElementById( 'draw_svgr_' + rid );
  648. if( csvg!= undefined ){
  649. var roi = csvg.getElementById( "roi" );
  650. if( roi != null ) csvg.removeChild( roi );
  651. var bBox = csvg.getBBox();
  652. var max = 2048;
  653. switch( drawZoomLevels[rid] ){
  654. case 50: max = 1024; break;
  655. case 25: max = 512; break;
  656. case 12: max = 256; break;
  657. };
  658. if( range < max ){
  659. var ak = 2.0*Math.PI/360;
  660. var ok = 1.0/35;
  661. var rk = bBox.width / ( max * 2 );
  662. var cpx = bBox.width / 2.0;
  663. var cpy = bBox.height / 2.0;
  664. x = cpx + rk * range * Math.cos( az*ak );
  665. y = cpy - rk * range * Math.sin( az*ak );
  666. var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
  667. var rz = bBox.width / csvg.clientWidth;
  668. cc.setAttributeNS(null, "cx", x );
  669. cc.setAttributeNS(null, "cy", y );
  670. cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
  671. cc.setAttributeNS(null, "stroke", "#800000" );
  672. cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
  673. cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
  674. cc.setAttributeNS(null, "fill", "#ff0000" );
  675. cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
  676. cc.setAttributeNS(null, "id", "roi" );
  677. csvg.appendChild( cc );
  678. };
  679. };
  680. };
  681. function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){
  682. if( tlLoadLocker ) return;
  683. tlLoadLocker = true;
  684. if( Mode == 'arch' ){
  685. Ext.MessageBox.wait("Loading Data","Please Wait",{
  686. width: '100%',
  687. hidden: true,
  688. animate: true,
  689. progress: true,
  690. closable: false
  691. });
  692. };
  693. Ext.Ajax.request({
  694. url: '/lib/controller/getEventRecords.php',
  695. params: {
  696. SITE: <?=$SiteID;?>,
  697. UID: <?=$UserID;?>,
  698. SID: '<?=$Session;?>',
  699. MODE: Mode,
  700. FIL: selecredActiveSourceFilter,
  701. SDA: SD,
  702. SMO: SMO,
  703. SYE: SY,
  704. STM: ST,
  705. ETM: ET,
  706. STR: SR,
  707. DIR: DR
  708. },
  709. success: function( response, opts ){
  710. tlLoadLocker = false;
  711. var data = Ext.decode(response.responseText);
  712. if( data.updateFROMTO ){
  713. Ext.getCmp('STimeFROM').setValue( data.STT );
  714. Ext.getCmp('STimeTO').setValue( data.ENT );
  715. if( data.SLD > 0 ){
  716. SMO = GetMonthNum(data.SLD);
  717. SY = GetYear(data.SLD);
  718. SD = GetDay(data.SLD);
  719. BuildCalendar();
  720. };
  721. };
  722. eventsListStore.loadData( data, false );
  723. if( Mode == 'arch' ){
  724. showEventsOnMap( data, true );
  725. Ext.MessageBox.hide();
  726. if( DR > 0 ){
  727. Ext.getCmp('evtArchLog').getView().focusRow( eventsListStore.getCount() - 1 );
  728. Ext.getCmp('evtArchLog').getSelectionModel().selectLastRow();
  729. };
  730. if( DR < 0 ){
  731. Ext.getCmp('evtArchLog').getView().focusRow( 0 );
  732. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  733. };
  734. } else {
  735. showEventsOnMap( data, false );
  736. //LoadMapEventsZ( Mode );
  737. };
  738. },
  739. failure: failureAJAXFunction
  740. });
  741. };
  742. function loadArchive(){
  743. if( tlInterval!= null ){
  744. window.clearInterval( tlInterval );
  745. tlInterval = null;
  746. timelineObj = null;
  747. };
  748. setUserContent( 2 );
  749. var tPanel = Ext.getCmp('main_portal');
  750. tPanel.removeAll( true );
  751. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  752. tPanel.add({
  753. columnWidth: 0.83,
  754. frame: false,
  755. border: false,
  756. items: [{
  757. title: 'Site Map',
  758. frame: false,
  759. border: false,
  760. layout: 'vbox',
  761. layoutConfig: {
  762. align : 'stretch',
  763. pack : 'start',
  764. },
  765. height: PanelH-300,
  766. items:[{
  767. height: PanelH-325,
  768. flex: 1,
  769. frame: false,
  770. border: false,
  771. layout: 'fit',
  772. items:{
  773. id: 'event_map',
  774. html: '&nbsp;'
  775. }
  776. }]
  777. },{
  778. frame: false,
  779. border: false,
  780. collapsible: false,
  781. draggable: false,
  782. layout: 'hbox',
  783. items:[{
  784. layout: 'form',
  785. title: 'Date/Time',
  786. width: 200,
  787. frame: true,
  788. border: false,
  789. labelAlign: 'right',
  790. labelWidth: 50,
  791. defaults: { width: 80},
  792. items: [{
  793. xtype: 'combo',
  794. id: 'STimeFROM',
  795. fieldLabel: 'From',
  796. editable: false,
  797. typeAhead: true,
  798. triggerAction: 'all',
  799. width: 120,
  800. lazyRender:true,
  801. mode: 'local',
  802. store: new Ext.data.ArrayStore({
  803. id: 0,
  804. fields: ['ss', 'displayText' ],
  805. data: [<?php
  806. $zuzu = array();
  807. for( $i = 0; $i < 24; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  808. echo implode( ',', $zuzu ); ?>]
  809. }),
  810. valueField: 'ss',
  811. displayField: 'displayText'
  812. },{
  813. xtype: 'combo',
  814. id: 'STimeTO',
  815. fieldLabel: 'Till',
  816. editable: false,
  817. typeAhead: true,
  818. triggerAction: 'all',
  819. width: 120,
  820. lazyRender:true,
  821. mode: 'local',
  822. store: new Ext.data.ArrayStore({
  823. id: 0,
  824. fields: ['ss', 'displayText' ],
  825. data: [<?php
  826. $zuzu = array();
  827. for( $i = 1; $i < 25; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  828. echo implode( ',', $zuzu ); ?>]
  829. }),
  830. valueField: 'ss',
  831. displayField: 'displayText'
  832. }],
  833. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  834. buttons: [{
  835. xtype: 'button',
  836. text: 'Display History',
  837. handler: function(){
  838. var STU = Ext.getCmp('STimeFROM').getValue();
  839. var ETU = Ext.getCmp('STimeTO').getValue();
  840. getData( 'arch', STU, ETU );
  841. }
  842. }]
  843. },{
  844. title: 'Event Log',
  845. frame: false,
  846. height: 303,
  847. id: 'evtArchLog',
  848. xtype: 'grid',
  849. ds: eventsListStore,
  850. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  851. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  852. listeners:{
  853. keydown: function( e ) {
  854. if( e.getKey() == e.UP ){
  855. if( SelectedRow == 0 ){
  856. var id = eventsListStore.getAt( 0 ).id;
  857. getData( 'arch', 0, 0, id, 1 );
  858. };
  859. };
  860. if( e.getKey() == e.DOWN ){
  861. if( SelectedRow == ( eventsListStore.getCount() - 1 ) ){
  862. var id = eventsListStore.getAt( SelectedRow ).id;
  863. getData( 'arch', 0, 0, id, -1 );
  864. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  865. Ext.getCmp('evtArchLog').focus( false, true );
  866. };
  867. };
  868. }
  869. }
  870. }]
  871. }]
  872. });
  873. tPanel.add({
  874. columnWidth: 0.17,
  875. frame: true,
  876. title: 'Event Information',
  877. id: 'prop_content',
  878. border: false,
  879. items: [{
  880. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  881. }]
  882. });
  883. tPanel.doLayout();
  884. /*
  885. Ext.getCmp('evtLog').getEl().set({tabindex: "0"});
  886. Ext.getCmp('evtLog').getEl().addKeyMap({
  887. eventName: "keyup",
  888. binding: [{
  889. key: Ext.EventObject.SPACE,
  890. fn: function(){ alert("Space key pressed"); }
  891. },{
  892. key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],
  893. shift: true,
  894. fn: function(){ alert("Left or right pressed while pressing shift"); }
  895. }]
  896. });
  897. */
  898. //BuildCalendar();
  899. loadCalendarDates();
  900. map = L.map('event_map',{
  901. attributionControl: true,
  902. //preferCanvas: true,
  903. zoomControl: true,
  904. center: [SiteLat, SiteLon],
  905. /*zoomControl: false,
  906. zoom: 17,
  907. minZoom: 17,
  908. maxZoom: 17,*/
  909. keyboard: false
  910. }).setView([SiteLat, SiteLon], 17);
  911. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  912. var mapLayers = [];
  913. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  914. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  915. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  916. detectRetina: true
  917. });*/
  918. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  919. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  920. maxNativeZoom: 18,
  921. maxZoom: 24,
  922. })
  923. // https://leaflet-extras.github.io/leaflet-providers/preview/
  924. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  925. 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',
  926. maxZoom: 19
  927. });
  928. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  929. 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',
  930. maxZoom: 19
  931. });
  932. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  933. 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',
  934. maxZoom: 24
  935. });
  936. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  937. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  938. maxZoom: 19
  939. });
  940. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  941. 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>) ',
  942. maxZoom: 19
  943. });
  944. /*
  945. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  946. 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>',
  947. maxZoom: 22
  948. });
  949. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  950. 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>',
  951. maxZoom: 22
  952. });
  953. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  954. 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>',
  955. maxZoom: 22
  956. });
  957. */
  958. var baseMaps = {
  959. "MyMap": mapLayers["MyMap"],
  960. "OpenStreetMap": mapLayers["OpenStreetMap"],
  961. "OpenTopoMap": mapLayers["OpenTopoMap"],
  962. "EsriSat": mapLayers["EsriSat"],
  963. "EsriStreet": mapLayers["EsriStreet"],
  964. "EsriTopo": mapLayers["EsriTopo"],
  965. //"Bing": mapLayers["Bing"],
  966. //"OSM-Cycle": mapLayers["Cycle"],
  967. //"Landscape": mapLayers["Landscape"],
  968. //"Outdoor": mapLayers["Outdoor"],
  969. };
  970. L.control.layers( baseMaps ).addTo(map);
  971. mapLayers["MyMap"].addTo(map);
  972. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  973. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  974. maxNativeZoom: 18,
  975. maxZoom: 24,
  976. }).addTo(map); */
  977. //loadTimeLineGroups( selectedSite );
  978. loadMapZones( SelectedSite );
  979. getData( 'arch' );
  980. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  981. };
  982. function loadMonitoring(){
  983. if( tlInterval!= null ){
  984. window.clearInterval( tlInterval );
  985. tlInterval = null;
  986. timelineObj = null;
  987. };
  988. setUserContent( 1 );
  989. var tPanel = Ext.getCmp('main_portal');
  990. tPanel.removeAll( true );
  991. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  992. tPanel.add({
  993. columnWidth: 0.83,
  994. frame: false,
  995. border: false,
  996. items: [{
  997. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  998. frame: false,
  999. border: false,
  1000. collapsible: false,
  1001. draggable: false,
  1002. layout: 'vbox',
  1003. layoutConfig: {
  1004. align : 'stretch',
  1005. pack : 'start',
  1006. },
  1007. height: PanelH-300,
  1008. items:[{
  1009. height: PanelH-325,
  1010. flex: 1,
  1011. frame: false,
  1012. border: false,
  1013. layout: 'fit',
  1014. items:{
  1015. id: 'event_map',
  1016. html: '&nbsp;'
  1017. }
  1018. }]
  1019. },{
  1020. frame: false,
  1021. border: true,
  1022. collapsible: false,
  1023. draggable: false,
  1024. layout: 'hbox',
  1025. items:[{
  1026. title: 'Alarm Sources',
  1027. xtype: 'panel',
  1028. border: false,
  1029. frame: false,
  1030. collapsible: false,
  1031. draggable: false,
  1032. id: 'sources_panel',
  1033. width: 160,
  1034. autoScroll: 'auto',
  1035. height: 303
  1036. },{
  1037. title: 'Event Log',
  1038. height: 303,
  1039. xtype: 'grid',
  1040. border: false,
  1041. frame: false,
  1042. collapsible: false,
  1043. draggable: false,
  1044. ds: eventsListStore,
  1045. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1046. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1047. bbar: [{
  1048. text: 'Clear',
  1049. handler: function(){
  1050. Ext.Ajax.request({
  1051. url: '/lib/controller/clearEventCloud.php',
  1052. params: {
  1053. UID: <?=$UserID;?>,
  1054. SID: '<?=$Session;?>'
  1055. },
  1056. success: function( response, opts ){
  1057. },
  1058. failure: function( response, opts ) {
  1059. }
  1060. });
  1061. }
  1062. }]
  1063. }]
  1064. }]
  1065. });
  1066. tPanel.add({
  1067. columnWidth: 0.17,
  1068. title: 'Event Information',
  1069. frame: true,
  1070. id: 'prop_content',
  1071. border: false,
  1072. items: [{
  1073. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1074. }]
  1075. });
  1076. tPanel.doLayout();
  1077. map = L.map('event_map',{
  1078. attributionControl: true,
  1079. //preferCanvas: true,
  1080. zoomControl: true,
  1081. center: [SiteLat, SiteLon],
  1082. /*zoomControl: false,
  1083. zoom: 17,
  1084. minZoom: 17,
  1085. maxZoom: 17,*/
  1086. keyboard: false
  1087. }).setView([SiteLat, SiteLon], 17);
  1088. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1089. var mapLayers = [];
  1090. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1091. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1092. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1093. detectRetina: true
  1094. });*/
  1095. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1096. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1097. maxNativeZoom: 18,
  1098. maxZoom: 24,
  1099. })
  1100. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1101. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1102. 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',
  1103. maxZoom: 19
  1104. });
  1105. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1106. 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',
  1107. maxZoom: 19
  1108. });
  1109. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1110. 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',
  1111. maxZoom: 24
  1112. });
  1113. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1114. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1115. maxZoom: 19
  1116. });
  1117. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1118. 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>) ',
  1119. maxZoom: 19
  1120. });
  1121. /*
  1122. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1123. 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>',
  1124. maxZoom: 22
  1125. });
  1126. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1127. 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>',
  1128. maxZoom: 22
  1129. });
  1130. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1131. 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>',
  1132. maxZoom: 22
  1133. });
  1134. */
  1135. var baseMaps = {
  1136. "MyMap": mapLayers["MyMap"],
  1137. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1138. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1139. "EsriSat": mapLayers["EsriSat"],
  1140. "EsriStreet": mapLayers["EsriStreet"],
  1141. "EsriTopo": mapLayers["EsriTopo"],
  1142. //"Bing": mapLayers["Bing"],
  1143. //"OSM-Cycle": mapLayers["Cycle"],
  1144. //"Landscape": mapLayers["Landscape"],
  1145. //"Outdoor": mapLayers["Outdoor"],
  1146. };
  1147. L.control.layers( baseMaps ).addTo(map);
  1148. mapLayers["MyMap"].addTo(map);
  1149. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1150. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1151. maxNativeZoom: 18,
  1152. maxZoom: 24,
  1153. }).addTo(map); */
  1154. loadMapZones( SelectedSite );
  1155. tlInterval = window.setInterval( getData, 333, 'live' );
  1156. };
  1157. function loadOnlineMonitoring(devID){
  1158. if( tlInterval!= null ){
  1159. window.clearInterval( tlInterval );
  1160. tlInterval = null;
  1161. timelineObj = null;
  1162. };
  1163. var tPanel = Ext.getCmp('main_content');
  1164. tPanel.removeAll( true );
  1165. tPanel.add({
  1166. html: 'Device Monitoring '+devID
  1167. });
  1168. tPanel.doLayout();
  1169. };
  1170. function shutImg( img, a = '' ){
  1171. if( a == '' ){
  1172. img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;';
  1173. } else {
  1174. img.src = a;
  1175. };
  1176. };
  1177. var ReportMask = null;
  1178. var ReportLayoutLoadded = false;
  1179. var ReportSelectionMode = 0; //All
  1180. function loadReportSegment( ts, bid, eid ){
  1181. if( !ReportLayoutLoadded ){
  1182. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1183. ReportMask.show();
  1184. Ext.Ajax.request({
  1185. url: '/lib/controller/getReportLayout.php',
  1186. params: {
  1187. UID: <?=$UserID;?>,
  1188. SID: '<?=$Session;?>'//,
  1189. //BID: nid,
  1190. //EID: evt_ts
  1191. },
  1192. success: function(response, opts ){
  1193. var data = Ext.decode( response.responseText );
  1194. var tPanel = Ext.getCmp('main_content');
  1195. tPanel.removeAll(true);
  1196. Ext.getCmp('main_content').add({
  1197. xtype: 'portal',
  1198. id: 'segment_portal',
  1199. frame: false,
  1200. border: false,
  1201. items:{
  1202. html: ''
  1203. },
  1204. listeners:{
  1205. drop: function( a ){
  1206. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  1207. }
  1208. }
  1209. });
  1210. Ext.getCmp('main_content').doLayout();
  1211. tPanel = Ext.getCmp('segment_portal');
  1212. //nodeDashboardStatuses = new Array();
  1213. for( i=0; i < data.length; i++) tPanel.add( data[i] );
  1214. tPanel.doLayout();
  1215. ReportMask.hide();
  1216. ReportLayoutLoadded = true;
  1217. loadReportData( ts, bid, eid );
  1218. },
  1219. error: function(){
  1220. ReportMask.hide();
  1221. }
  1222. });
  1223. } else {
  1224. loadReportData( ts, bid, eid );
  1225. };
  1226. };
  1227. function loadReportData( ts, bid, eid ){
  1228. ReportSelectionMode = 2; // Session Selected
  1229. Ext.Ajax.request({
  1230. url: '/lib/controller/getHistoryEvents.php',
  1231. params: {
  1232. UID: <?=$UserID;?>,
  1233. SID: '<?=$Session;?>',
  1234. TS: ts,
  1235. BID: bid,
  1236. EID: eid,
  1237. },
  1238. success: function(response, opts ){
  1239. hideVideo();
  1240. var data = Ext.decode( response.responseText );
  1241. if( data.log != undefined ){
  1242. if( data.log.length ){
  1243. rep_store_id = data.log[0].id;
  1244. rep_array = data.log;//.concat( rep_array );
  1245. //if( log_array.length > 32 ){
  1246. // log_array = log_array.slice( 0, 31 );
  1247. //};
  1248. rep_store.removeAll();
  1249. rep_store.loadData( rep_array );
  1250. };
  1251. } else {
  1252. alert('No Log');
  1253. // clear the log
  1254. //log_store.removeAll();
  1255. };
  1256. }
  1257. });
  1258. };
  1259. function loadReportDayTree( ts ){
  1260. ReportSelectionMode = 1;//Day Selected
  1261. ReportMask = new Ext.LoadMask(Ext.getCmp('left_side_menu').getEl(), {msg:"Please wait..."});
  1262. ReportMask.show();
  1263. Ext.Ajax.request({
  1264. url: '/lib/controller/getHistoryDay.php',
  1265. params: {
  1266. UID: <?=$UserID;?>,
  1267. SID: '<?=$Session;?>',
  1268. DTS: ts
  1269. },
  1270. success: function(response, opts ){
  1271. var data = Ext.decode( response.responseText );
  1272. var sPanel = Ext.getCmp('left_side_menu');
  1273. sPanel.removeAll( true );
  1274. sPanel.add({
  1275. xtype: 'panel',
  1276. layout: 'vbox',
  1277. frame: true,
  1278. border: false,
  1279. items:[{
  1280. xtype: 'spacer',
  1281. height: 3
  1282. },{
  1283. 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>',
  1284. frame: false,
  1285. width: '100%',
  1286. border: false
  1287. },{
  1288. xtype: 'spacer',
  1289. height: 5
  1290. },{
  1291. xtype: 'treepanel',
  1292. autoScroll: true,
  1293. width: '100%',
  1294. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1295. height: PanelH-260,
  1296. <?php } else { ?>
  1297. height: PanelH-209,
  1298. <?php }; ?>
  1299. border: true,
  1300. frame: true,
  1301. loader: new Ext.tree.TreeLoader(),
  1302. rootVisible: false,
  1303. root: new Ext.tree.AsyncTreeNode( data ),
  1304. listeners: {
  1305. click: function(n) {
  1306. if( n.attributes.leaf ){
  1307. Ext.getCmp('chu_adate').show();
  1308. sPanel.doLayout();
  1309. loadReportSegment( ts, n.attributes.bid, n.attributes.eid );
  1310. //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"');
  1311. };
  1312. }
  1313. }
  1314. },{
  1315. xtype: 'spacer',
  1316. height: 10
  1317. },{
  1318. xtype: 'button',
  1319. id: 'chu_adate',
  1320. text: 'Show Dates',
  1321. hidden: true,
  1322. width: '100%',
  1323. iconCls: 'reports_dates_btn',
  1324. scale: 'large',
  1325. handler: function(){
  1326. Ext.getCmp('chu_adate').hide();
  1327. initReportsView();
  1328. }
  1329. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1330. },{
  1331. xtype: 'spacer',
  1332. height: 10
  1333. },{
  1334. xtype: 'button',
  1335. width: '100%',
  1336. scale: 'large',
  1337. iconCls: 'reports_delete_btn',
  1338. text: 'Delete Selected',
  1339. handler: function(){
  1340. }
  1341. <?php }; ?>
  1342. }]
  1343. });
  1344. sPanel.doLayout();
  1345. ReportMask.hide();
  1346. }
  1347. });
  1348. };
  1349. function hideVideo(){
  1350. var juja = undefined;
  1351. for( i = 1; i++; i < 1000 ){
  1352. var juja = document.getElementById( 'video-'+i );
  1353. if( juja != undefined ) break;
  1354. };
  1355. if( juja != undefined ) juja.style.display = "none";
  1356. };
  1357. function showVideo(){
  1358. var juja = undefined;
  1359. for( i = 1; i++; i < 1000 ){
  1360. var juja = document.getElementById( 'video-'+i );
  1361. if( juja != undefined ) break;
  1362. };
  1363. if( juja != undefined ) juja.style.display = "block";
  1364. };
  1365. function initReportsView(){
  1366. ReportSelectionMode = 0; // All History
  1367. if( tlInterval!= null ){
  1368. window.clearInterval( tlInterval );
  1369. tlInterval = null;
  1370. timelineObj = null;
  1371. };
  1372. ReportLayoutLoadded = false;
  1373. var tPanel = Ext.getCmp('main_content');
  1374. var sPanel = Ext.getCmp('left_side_menu');
  1375. tPanel.removeAll( true );
  1376. sPanel.removeAll( true );
  1377. tPanel.add({
  1378. xtype: 'panel',
  1379. height: PanelH+15,
  1380. html: '<div id="activity_ph"></div>',
  1381. listeners:{
  1382. afterrender: function(){
  1383. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1384. ReportMask.show();
  1385. var jj = (PanelW - 230)/55;
  1386. changeStyleSheet('amap-empty-day','{width: '+jj+'px; height: '+jj+'px;}');
  1387. changeStyleSheet('amap-week-day','{width: '+jj+'px; height: '+jj+'px;}');
  1388. changeStyleSheet('amap-week-name','{width: '+jj+'px; height: '+jj+'px;}');
  1389. Ext.Ajax.request({
  1390. url: '/lib/controller/getHistoryDates.php',
  1391. params: {
  1392. UID: <?=$UserID;?>,
  1393. SID: '<?=$Session;?>'
  1394. },
  1395. success: function(response, opts ){
  1396. var data = Ext.decode( response.responseText );
  1397. var activityMap = new ActivityMap( data, {
  1398. id: "dji-volume-map",
  1399. parent: '#activity_ph',
  1400. showTitle: false,
  1401. showYears: true,
  1402. width: 100,
  1403. hue: 1,
  1404. fit: true,
  1405. compact: true,
  1406. timeColumn: "t",
  1407. valueColumn: "v"
  1408. });
  1409. activityMap.render();
  1410. ReportMask.hide();
  1411. }
  1412. });
  1413. }
  1414. }
  1415. });
  1416. tPanel.doLayout();
  1417. sPanel.add({
  1418. xtype: 'panel',
  1419. frame: true,
  1420. border: false,
  1421. items: [{
  1422. html: '<div class="setEd_infoPanel" id="NANA"><?=$Labels->GetLabel('_PLS_SEL_CAL_DATE_');?></div>',
  1423. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1424. height: PanelH - 70
  1425. },{
  1426. xtype: 'button',
  1427. width: '100%',
  1428. scale: 'large',
  1429. iconCls: 'reports_delete_btn',
  1430. text: 'Clear All History'
  1431. <?php } else { ?>
  1432. height: PanelH - 30
  1433. <?php }; ?>
  1434. }]
  1435. });
  1436. sPanel.doLayout();
  1437. };