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.

1668 lines
51 KiB

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