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.

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