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.

1641 lines
51 KiB

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