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.

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