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.

1664 lines
51 KiB

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