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.

1688 lines
52 KiB

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