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.

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