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.

1661 lines
52 KiB

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