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.

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