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.

1629 lines
49 KiB

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