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.

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