Web UI for ARGUS server
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.

1178 lines
38 KiB

5 years ago
​
​
​
6 years ago
5 years ago
​
​
​
​
6 years ago
​
​
5 years ago
5 years ago
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
5 years ago
5 years ago
​
5 years ago
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
5 years ago
​
​
5 years ago
​
​
6 years ago
​
​
​
6 years ago
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
5 years ago
​
​
5 years ago
​
5 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
5 years ago
5 years ago
​
​
5 years ago
5 years ago
​
5 years ago
​
5 years ago
5 years ago
5 years ago
5 years ago
​
​
6 years ago
​
​
5 years ago
​
​
5 years ago
5 years ago
​
5 years ago
5 years ago
​
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
5 years ago
6 years ago
5 years ago
​
5 years ago
​
​
​
5 years ago
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
6 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
5 years ago
​
​
6 years ago
6 years ago
​
5 years ago
6 years ago
​
​
5 years ago
  1. //<?php require_once('../../js_asm.php');
  2. $QS="SELECT * FROM sites WHERE id={$SiteID}";
  3. $RV = $DATABASE->Query( $QS );
  4. ?>
  5. var SiteLat=<?=$RV[0]['anchor_lat'];?>;
  6. var SiteLon=<?=$RV[0]['anchor_lon'];?>;
  7. var SiteAlt=<?=$RV[0]['anchor_alt'];?>;
  8. var map = null;
  9. var selectedMarker = null;
  10. var timelineObj = null;
  11. var tlGroups = new vis.DataSet();
  12. var tlItems = new vis.DataSet();
  13. var selecredActiveSourceFilter = 0;
  14. var ActiveZones = null;
  15. var tlOptions = {
  16. groupOrder: 'content', // groupOrder can be a property name or a sorting function
  17. stack: true,
  18. showCurrentTime: true,
  19. //verticalScroll: true,
  20. //zoomKey: 'ctrlKey',
  21. minHeight: 308,
  22. maxHeight: 308
  23. };
  24. var tlLoadLocker = false;
  25. var tlLastTS = 0;
  26. var tlInterval = null;
  27. var tlMonitoring = false;
  28. // Global Variables
  29. var Dates = new Array();
  30. var HTTPO_Calendar = null;
  31. var SelectedDay='';
  32. var CurrentDate=(new Date())/1000;
  33. // Calendar Functions
  34. function Calendar_QURL(RQT){
  35. RetVal="feed.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentDate;
  36. return RetVal;
  37. };
  38. function StartCalendarSession( httpRequestType ){
  39. var QURL='';
  40. if (HTTPO_Calendar == null ){
  41. HTTPO_Calendar = getHTTPObject();
  42. };
  43. if (HTTPO_Calendar != null) {
  44. QURL=Calendar_QURL( httpRequestType );
  45. HTTPO_Calendar.open("GET", QURL , true);
  46. HTTPO_Calendar.send('');
  47. HTTPO_Calendar.onreadystatechange = HGDT_Calendar;
  48. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Histo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  49. width: '100%',
  50. hidden: true,
  51. progress: true,
  52. closable: false
  53. });
  54. } else {
  55. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CCXL00231');
  56. };
  57. };
  58. function HGDT_Calendar(){
  59. switch( HTTPO_Calendar.readyState ){
  60. case 0: window.status = 'C:Communication is Uninitialized';
  61. break;
  62. case 1: window.status = 'C:Loading Data';
  63. break;
  64. case 2: window.status = 'C:Data is Loaded';
  65. break;
  66. case 3: window.status = 'C:Communication is Interactive';
  67. break;
  68. case 4: window.status = 'C:Data Load Complete';
  69. break;
  70. };
  71. if( HTTPO_Calendar.readyState == 4 ){
  72. var T_Arr;
  73. //alert(HTTPO_Calendar.responseText);
  74. T_Arr = JSON_parse( HTTPO_Calendar.responseText,'' );
  75. httpRequestType=T_Arr.type/1;
  76. //alert(httpRequestType);
  77. Dates=new Array();
  78. for (index=0;index<T_Arr.data.length;index++){
  79. Dates[index]=T_Arr.data[index];
  80. };
  81. T_Arr=null;
  82. BuildCalendar();
  83. Ext.MessageBox.hide();
  84. };
  85. };
  86. function selectDate( m, d ){
  87. SY = GetYear(CurrentDate);
  88. SMO = m;
  89. SD = d;
  90. a = ''+m+d;
  91. if (SelectedDay!=''){
  92. try{
  93. document.getElementById('ds'+SelectedDay).setAttribute("class", 'CalendarDE');
  94. document.getElementById('ds'+SelectedDay).setAttribute("className", 'CalendarDE');
  95. } catch(e){};
  96. };
  97. document.getElementById('ds'+a).setAttribute("class", 'CalendarDS');
  98. document.getElementById('ds'+a).setAttribute("className", 'CalendarDS');
  99. SelectedDay=a;
  100. };
  101. // Calendar
  102. var today=new Date();
  103. var SY=1900+today.getYear();
  104. var SMO=today.getMonth()+1;
  105. var SD=today.getDate();
  106. var Dates = new Array();
  107. function CheckDate(D){
  108. for(j_index=0;j_index<Dates.length;j_index++){
  109. if (Dates[j_index]==D)return true;
  110. };
  111. return false;
  112. };
  113. function ShiftBAK(){
  114. CurrentDate=CurrentDate-24*3600*GetMonthLength(CurrentDate);
  115. BuildCalendar();
  116. StartCalendarSession(5);
  117. };
  118. function ShiftFWD(){
  119. CurrentDate=CurrentDate+24*3600*GetMonthLength(CurrentDate);
  120. BuildCalendar();
  121. StartCalendarSession(5);
  122. };
  123. function GetMonthName(UTS){ // Unix Time Stamp
  124. var MoNames= new Array();
  125. MoNames[0]='January';
  126. MoNames[1]='February';
  127. MoNames[2]='March';
  128. MoNames[3]='April';
  129. MoNames[4]='May';
  130. MoNames[5]='June';
  131. MoNames[6]='July';
  132. MoNames[7]='August';
  133. MoNames[8]='September';
  134. MoNames[9]='October';
  135. MoNames[10]='November';
  136. MoNames[11]='December';
  137. CDate=new Date();
  138. CDate.setTime(UTS*1000);
  139. CMo=CDate.getMonth();
  140. return MoNames[CMo];
  141. };
  142. function GetMonthShift(UTS){ // Unix Time Stamp
  143. CDate=new Date();
  144. CDate.setTime(UTS*1000);
  145. CDate.setTime((UTS-(CDate.getDate()-1)*86400)*1000);
  146. return CDate.getDay();
  147. };
  148. function GetMonthLength(UTS){ // Unix Time Stamp
  149. CDate=new Date();
  150. CDate.setTime(UTS*1000);
  151. CD=CDate.getDate();
  152. RetVal=31;
  153. CDate.setTime((UTS+(31-CD)*86400)*1000);
  154. if ( CDate.getDate()==31) return RetVal;
  155. RetVal=30;
  156. CDate.setTime((UTS+(30-CD)*86400)*1000);
  157. if ( CDate.getDate()==30) return RetVal;
  158. RetVal=29;
  159. CDate.setTime((UTS+(29-CD)*86400)*1000);
  160. if ( CDate.getDate()==29) return RetVal;
  161. RetVal=28;
  162. CDate.setTime((UTS+(28-CD)*86400)*1000);
  163. if ( CDate.getDate()==28) return RetVal;
  164. return -1;
  165. };
  166. function GetMonthNum(UTS){ // Unix Time Stamp
  167. CDate=new Date();
  168. CDate.setTime(UTS*1000);
  169. return CDate.getMonth()+1;
  170. };
  171. function GetYear(UTS){ // Unix Time Stamp
  172. CDate=new Date();
  173. CDate.setTime(UTS*1000);
  174. y=CDate.getYear();
  175. if (y<100)y+=2000;
  176. if (y<200)y+=1900;
  177. return y;
  178. };
  179. function selectDate( m, d ){
  180. SY = GetYear(CurrentDate);
  181. SMO = m;
  182. SD = d;
  183. //a = ''+m+d;
  184. //if (SelectedDay!=''){
  185. // try{
  186. // document.getElementById('ds'+SelectedDay).setAttribute("class", 'CalendarDE');
  187. // document.getElementById('ds'+SelectedDay).setAttribute("className", 'CalendarDE');
  188. // } catch(e){};
  189. //};
  190. //document.getElementById('ds'+a).setAttribute("class", 'CalendarDS');
  191. //document.getElementById('ds'+a).setAttribute("className", 'CalendarDS');
  192. //SelectedDay=a;
  193. getData( 'arch' );
  194. };
  195. function BuildCalendar(){
  196. Msh=GetMonthShift(CurrentDate);
  197. Mnm=GetMonthName(CurrentDate);
  198. Mln=GetMonthLength(CurrentDate);
  199. Mid=GetMonthNum(CurrentDate);
  200. Mye=GetYear(CurrentDate);
  201. 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>';
  202. 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>';
  203. InDTA+='<tr>';
  204. for(index=0;index<Msh;index++){
  205. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  206. };
  207. for(;index<(Mln+Msh);index++){
  208. if( CheckDate(index-Msh+1) ){
  209. //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>';
  210. InDTA+='<td style="padding: 1px"><div id="have_data_day" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" title="'+(index-Msh+1).toString()+'" class="calendar_t">'+(index-Msh+1).toString()+'</div></td>';
  211. } else {
  212. if( ( SD - 1 ) == index ){
  213. InDTA+='<td style="padding: 1px"><div id="selected_day" class="calendar_t" title="Selected">'+(index-Msh+1).toString()+'</a></td>';
  214. } else {
  215. InDTA+='<td style="padding: 1px"><div id="no_data_day" class="calendar_t" title="No Events">'+(index-Msh+1).toString()+'</a></td>';
  216. };
  217. };
  218. if ((index+1)%7==0){
  219. InDTA+='</tr><tr>';
  220. };
  221. };
  222. for(;(index)%7!=0;index++){
  223. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  224. };
  225. InDTA+='</tr></table>';
  226. tab=document.getElementById('calendar_TD');
  227. tab.innerHTML=InDTA;
  228. };
  229. function loadCalendarDates(){
  230. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  231. width: '100%',
  232. hidden: true,
  233. progress: true,
  234. closable: false
  235. });
  236. Ext.Ajax.request({
  237. url: '/lib/controller/getEventDates.php',
  238. params: {
  239. NID: selecredActiveSourceFilter,
  240. UID: <?=$UserID;?>,
  241. SID: '<?=$Session;?>',
  242. SYE: SY,
  243. SMO: SMO
  244. },
  245. success: function( response, opts ){
  246. Ext.MessageBox.hide();
  247. var data = Ext.decode( response.responseText );
  248. if( data.status == 'ok' ){
  249. Dates = data.days;
  250. BuildCalendar();
  251. //for( var i = 0; i < data.days.length; i++ ){
  252. //
  253. //};
  254. };
  255. },
  256. failure: function( response, opts ) {
  257. Ext.MessageBox.hide();
  258. }
  259. });
  260. };
  261. var eventsListStore = new Ext.data.JsonStore({
  262. root: 'log',
  263. totalProperty: 'totalCount',
  264. idProperty: 'id',
  265. remoteSort: true,
  266. fields: [{
  267. name: 'id',
  268. type: 'int'
  269. },{
  270. name: 'date',
  271. type: 'string'
  272. },{
  273. name: 'time',
  274. type: 'string'
  275. },{
  276. name: 'device',
  277. type: 'string'
  278. },{
  279. name: 'event',
  280. type: 'string'
  281. },{
  282. name: 'data',
  283. type: 'string',
  284. },{
  285. name: 'has_target',
  286. type: 'boolean'
  287. },{
  288. name: 'has_geo',
  289. type: 'boolean'
  290. },{
  291. name: 'has_images',
  292. type: 'boolean'
  293. },{
  294. name: 'images',
  295. type: 'Array'
  296. },{
  297. name: 'dev_type',
  298. type: 'int'
  299. },{
  300. name: 'geo',
  301. type: 'object'
  302. }] /*,
  303. proxy : new Ext.data.HttpProxy({
  304. method: 'POST',
  305. prettyUrls: false,
  306. url: '/lib/controller/getEventRecords.php',
  307. headers: {
  308. UID: <?=$UserID;?>,
  309. SID: '<?=$Session;?>',
  310. NID: 1
  311. }
  312. })*/
  313. });
  314. var SelectedEvent = 0;
  315. var EventPanelWindow = null;
  316. function showEventPanel(){
  317. if( EventPanelWindow == null ){
  318. EventPanelWindow = new Ext.Window({
  319. modal: true,
  320. title: '<?=$Labels->GetLabel("_EVENT_VIEWER_");?>',
  321. width: winW*0.66,
  322. height: winH*0.66,
  323. layout: 'fit',
  324. closeAction: 'hide',
  325. items:[{
  326. title: 'Cameras',
  327. html:'koko',
  328. autoScroll: true,
  329. height: 320
  330. },{
  331. html: 'koko22',
  332. height: 320
  333. }]
  334. });
  335. };
  336. EventPanelWindow .show();
  337. };
  338. function ModeRenderer(val){
  339. var p1, p2, p3;
  340. if( ( val & 1 ) == 1 ){
  341. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  342. } else {
  343. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  344. };
  345. if( ( val & 2 ) == 2 ){
  346. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  347. } else {
  348. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  349. };
  350. if( ( val & 4 ) == 4 ){
  351. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  352. } else {
  353. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  354. };
  355. return p1+p2+p3;
  356. };
  357. function LocRenderer( val ){
  358. if( val ){
  359. return '<img src="/style/icons/icons/accept.png" alt="Location" />';
  360. };
  361. return '<img src="/style/icons/icons/bullet_white.png" alt="NO Location" />';
  362. };
  363. function PicRenderer( val ){
  364. if( val ){
  365. return '<img src="/style/icons/icons/camera_link.png"/>';
  366. };
  367. return '<img src="/style/icons/icons/bullet_white.png"/>';
  368. };
  369. var eventsListColModel_ops = {
  370. columns: [
  371. {header: "ID", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  372. {header: "Date",width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'date' },
  373. {header: "Time", width: 80, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'time' },
  374. {header: "Device", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'device' },
  375. {header: "Event", width: 80, sortable: false, dataIndex: 'event' },
  376. {header: "Info", width: 200, sortable: false, dataindex: 'data' },
  377. {header: "", width: 25, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer },
  378. {header: "", width: 25, sortable: false, dataIndex: 'has_images', renderer: PicRenderer }
  379. ],
  380. defaults: {
  381. sortable: true,
  382. menuDisabled: true,
  383. width: 100
  384. },
  385. listeners: {
  386. hiddenchange: function(cm, colIndex, hidden) {
  387. //saveConfig(colIndex, hidden);
  388. }
  389. }
  390. };
  391. var eventsListSelModel_ops = {
  392. singleSelect: true,
  393. listeners: {
  394. rowselect: function(sm, row, rec ) {
  395. loadEventProperties( rec.data );
  396. //SelectedEvent = rec.data.id;
  397. //alert( SelectedEvent );
  398. //var CB = Ext.getCmp('con_to_src');
  399. //CB.enable();
  400. }
  401. }
  402. };
  403. function loadTimeLineGroups( NID ){
  404. Ext.Ajax.request({
  405. url: '/lib/controller/getTimeLineGroups.php',
  406. params: {
  407. NID: NID,
  408. UID: <?=$UserID;?>,
  409. SID: '<?=$Session;?>'
  410. },
  411. success: function( response, opts ){
  412. // If the response is JSON, you have to decode it
  413. var data = Ext.decode(response.responseText);
  414. //for(var i = 0; i < data.length; i++) {
  415. //tlGroups.add(data[i]);
  416. //};
  417. tlGroups.update( data );
  418. loadTimeLineItems( SelectedSite );
  419. tlInterval = window.setInterval( loadTimeLineItems, 333, SelectedSite );
  420. },
  421. failure: function( response, opts ) {
  422. //Ext.fly('some_div').update('Fail!');
  423. }/*,
  424. callback: function(options,success,response){
  425. // use this if you need to perform your own success/failure checking
  426. }*/
  427. });
  428. };
  429. function clickDeviceSelector( id ){
  430. var rr = document.getElementById(id+'_div');
  431. if( selecredActiveSourceFilter != id ){
  432. if( selecredActiveSourceFilter > 0 ){
  433. var oo = document.getElementById( selecredActiveSourceFilter + '_div');
  434. oo.classList.remove( "cardDeviceSourceSelected" );
  435. oo.classList.add( "cardDeviceSource" );
  436. };
  437. rr.classList.remove( "cardDeviceSource" );
  438. rr.classList.add( "cardDeviceSourceSelected" );
  439. selecredActiveSourceFilter = id;
  440. turnOffAllGzButThis( selecredActiveSourceFilter );
  441. } else {
  442. selecredActiveSourceFilter = 0;
  443. rr.classList.remove( "cardDeviceSourceSelected" );
  444. rr.classList.add( "cardDeviceSource" );
  445. turnAllGzOn();
  446. var tPanel = Ext.getCmp('prop_content');
  447. tPanel.remove(0);
  448. tPanel.add( {
  449. title: 'Event Information',
  450. border: false,
  451. frame: false,
  452. collapsible: false,
  453. draggable: false,
  454. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  455. } );
  456. tPanel.doLayout();
  457. };
  458. };
  459. function getZoneByNode( nid ){
  460. var rVal = -1;
  461. for( var i=0; i < ActiveZones.totalCount; i++ ){
  462. if( ActiveZones.zones[i].dev_id == nid ){
  463. rVal = i;
  464. break;
  465. };
  466. };
  467. return rVal;
  468. };
  469. function turnOffAllGzButThis( nid ){
  470. var chocho = -1;
  471. for( var i=0; i < ActiveZones.totalCount; i++ ){
  472. if( ActiveZones.zones[i].dev_id == nid ) chocho = i;
  473. map.removeLayer( ActiveZones.fig[i] );
  474. map.removeLayer( ActiveZones.zang[i] );
  475. map.removeLayer( ActiveZones.center[i] );
  476. };
  477. if( chocho > -1 ){
  478. map.addLayer( ActiveZones.fig[chocho] );
  479. map.addLayer( ActiveZones.zang[chocho] );
  480. map.addLayer( ActiveZones.center[chocho] );
  481. var cVisible = L.featureGroup( Array( ActiveZones.fig[chocho], ActiveZones.zang[chocho], ActiveZones.center[chocho] ) );
  482. map.flyToBounds( cVisible.getBounds() );
  483. };
  484. };
  485. function turnAllGzOn(){
  486. var tall = Array();
  487. for( var i=0; i < ActiveZones.totalCount; i++ ){
  488. tall[i*3] = ActiveZones.fig[i];
  489. tall[i*3+1] = ActiveZones.zang[i];
  490. tall[i*3+2] = ActiveZones.center[i];
  491. if(!map.hasLayer(ActiveZones.fig[i])) map.addLayer( ActiveZones.fig[i] );
  492. if(!map.hasLayer(ActiveZones.zang[i])) map.addLayer( ActiveZones.zang[i] );
  493. if(!map.hasLayer(ActiveZones.center[i])) map.addLayer( ActiveZones.center[i] );
  494. };
  495. var cVisible = L.featureGroup( tall );
  496. map.flyToBounds( cVisible.getBounds() );
  497. };
  498. function loadMapZones( SID ){
  499. Ext.Ajax.request({
  500. url: '/lib/controller/getGeoZones.php',
  501. params: {
  502. SITE: SID,
  503. UID: <?=$UserID;?>,
  504. SID: '<?=$Session;?>'
  505. },
  506. success: function( response, opts ){
  507. // If the response is JSON, you have to decode it
  508. var data = Ext.decode(response.responseText);
  509. var pp = Ext.getCmp('sources_panel');
  510. if( typeof pp !== 'undefined' ) pp.removeAll();
  511. ActiveZones = data;
  512. ActiveZones.fig = new Array();
  513. ActiveZones.zang = new Array();
  514. ActiveZones.center = new Array();
  515. for(var i = 0; i < data.totalCount; i++ ) {
  516. switch( data.zones[i].type ){
  517. case 'circle':{
  518. //L.circle( data.zones[i].center, {radius: data.zones[i].radius, color: data.zones[i].color, weight: 1, opacity: 0.8 } ).addTo( map );
  519. 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 } );
  520. //map.addLayer( ActiveZones.fig[i] );
  521. break;
  522. };
  523. case 'poly':{
  524. 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);
  525. //map.addLayer( ActiveZones.fig[i] );
  526. break;
  527. };
  528. case 'image':{
  529. ActiveZones.fig[i] = L.imageOverlay( data.zones[i].url, data.zones[i].bounds, { opacity: 1.0 });//.addTo( map );
  530. //map.addLayer( ActiveZones.fig[i] );
  531. break;
  532. };
  533. case 'image_rot':{
  534. ActiveZones.fig[i] = L.imageOverlay.rotated( data.zones[i].url, data.zones[i].topleft, data.zones[i].topright, data.zones[i].bottomleft, {
  535. opacity: 0.8 //,
  536. //interactive: true,
  537. //attribution: "Historical building plan &copy; <a href='http://www.ign.es'>Instituto Geográfico Nacional de España</a>"
  538. });//.addTo( map );
  539. //map.addLayer( ActiveZones.fig[i] );
  540. break;
  541. };
  542. };
  543. if( data.zones[i].dev_is_source ){
  544. if( typeof pp !== 'undefined' ) {
  545. var sty = '';
  546. if( selecredActiveSourceFilter == data.zones[i].dev_id ){
  547. sty = 'cardDeviceSourceSelected';
  548. } else {
  549. sty = 'cardDeviceSource';
  550. };
  551. pp.add( {
  552. id: data.zones[i].dev_id+'_container',
  553. frame: false,
  554. border: false,
  555. width: 130,
  556. height: 130,
  557. 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>'
  558. });
  559. };
  560. };
  561. if( data.zones[i].zang != undefined ){
  562. //L.polygon( data.zones[i].zang, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  563. ActiveZones.zang[i] = L.circle( data.zones[i].zang, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } );//.addTo( map );
  564. };
  565. if( data.zones[i].center != undefined ){
  566. //L.polygon( data.zones[i].zmark, {color: '#ffff00', weight: 1, opacity: 1.0, clickable: false, interactive: false, bubblingMouseEvents: false }).addTo(map);
  567. ActiveZones.center[i] = L.circle( data.zones[i].center, {radius: 0.3, color: '#ffff00', weight: 1, opacity: 1.0, fillOpacity: 1.0 } ).addTo( map );
  568. };
  569. };
  570. if( selecredActiveSourceFilter == 0 ){
  571. turnAllGzOn();
  572. } else {
  573. turnOffAllGzButThis( selecredActiveSourceFilter );
  574. };
  575. if( typeof pp !== 'undefined' ) pp.doLayout();
  576. //LoadMapEvents( SelectedSite );
  577. //tlInterval = window.setInterval( LoadMapEvents, 333, SelectedSite );
  578. },
  579. failure: function( response, opts ) {
  580. //Ext.fly('some_div').update('Fail!');
  581. }
  582. });
  583. };
  584. var cevt = Array();
  585. var coz = Array();
  586. function LoadMapEventsZ( Mode ){
  587. if( tlLoadLocker ) return;
  588. tlLoadLocker = true;
  589. Ext.Ajax.request({
  590. url: '/lib/controller/getGeoAlerts.php',
  591. params: {
  592. SITE: <?=$SiteID;?>,
  593. UID: <?=$UserID;?>,
  594. SID: '<?=$Session;?>',
  595. MODE: Mode
  596. },
  597. success: function( response, opts ){
  598. if( cevt.length ){
  599. for( i=0; i< cevt.length; i++ ){
  600. if( cevt[i]!= null ){
  601. cevt[i].remove();
  602. delete( cevt[i] );
  603. cevt[i] = null;
  604. };
  605. };
  606. };
  607. if( coz.length ){
  608. for( i=0; i< coz.length; i++ ){
  609. if( coz[i]!= null ){
  610. coz[i].remove();
  611. delete( coz[i] );
  612. coz[i]=null;
  613. };
  614. };
  615. };
  616. var data = Ext.decode( response.responseText );
  617. var zz = ( 1.0 / ( data.evt.length + 0 ) );
  618. for( i=0; i < data.evt.length; i++ ){
  619. 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 ){
  620. loadEventProperties( this.options.id );
  621. } );
  622. cevt[i].addTo(map);
  623. };
  624. for( i=0; i < data.other.length; i++ ){
  625. switch( data.other[i].type ){
  626. case 'circle':{
  627. 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 } );
  628. coz[i].addTo(map);
  629. break;
  630. };
  631. };
  632. };
  633. //eventsListStore.reload();
  634. tlLoadLocker = false;
  635. },
  636. failure: function( response, opts ) {
  637. //Ext.fly('some_div').update('Fail!');
  638. tlLoadLocker = false;
  639. }
  640. });
  641. };
  642. function loadEventProperties( EventRec ){
  643. //alert( 'Node: ' + NodeID );
  644. var tPanel = Ext.getCmp('prop_content');
  645. tPanel.removeAll();// remove( 0 );
  646. var tt = ''
  647. map.removeLayer( selectedMarker );
  648. if( EventRec.has_geo ){
  649. tt = ''+EventRec.geo.lat+' '+EventRec.geo.lon;
  650. selectedMarker.setLatLng([EventRec.geo.lat, EventRec.geo.lon]);
  651. selectedMarker.addTo( map );
  652. };
  653. tPanel.add( {
  654. title: 'Event Details',
  655. html: '<center><img src="/style/assets/'+EventRec.dev_type+'_node.png" /><p>' + EventRec.device+'</p>'+tt+'</center>'
  656. } );
  657. if( EventRec.has_images ){
  658. for( var i=0; i < EventRec.images.length; i++ ){
  659. tPanel.add( {
  660. frame: false,
  661. 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+'"/>'
  662. });
  663. };
  664. };
  665. tPanel.doLayout();
  666. /*
  667. Ext.Ajax.request({
  668. url: '/lib/controller/getEventProps.php',
  669. params: {
  670. NID: <?=$SiteID;?>,
  671. UID: <?=$UserID;?>,
  672. SID: '<?=$Session;?>',
  673. EVENT: EventRec.id
  674. },
  675. success: function( response, opts ){
  676. // If the response is JSON, you have to decode it
  677. var data = Ext.decode(response.responseText);
  678. var tPanel = Ext.getCmp('prop_content');
  679. tPanel.remove(0);
  680. tPanel.add( data );
  681. tPanel.doLayout();
  682. },
  683. failure: function( response, opts ) {
  684. //Ext.fly('some_div').update('Fail!');
  685. }
  686. });
  687. */
  688. };
  689. function getData( Mode ){
  690. if( tlLoadLocker ) return;
  691. tlLoadLocker = true;
  692. Ext.Ajax.request({
  693. url: '/lib/controller/getEventRecords.php',
  694. params: {
  695. SITE: <?=$SiteID;?>,
  696. UID: <?=$UserID;?>,
  697. SID: '<?=$Session;?>',
  698. MODE: Mode,
  699. FIL: selecredActiveSourceFilter,
  700. SDA: SD,
  701. SMO: SMO,
  702. SYE: SY,
  703. STM: 0,
  704. ETM: 0,
  705. },
  706. success: function( response, opts ){
  707. tlLoadLocker = false;
  708. var data = Ext.decode(response.responseText);
  709. eventsListStore.loadData( data, false );
  710. LoadMapEventsZ( Mode );
  711. },
  712. failure: failureAJAXFunction
  713. });
  714. };
  715. function loadArchive(){
  716. if( tlInterval!= null ){
  717. window.clearInterval( tlInterval );
  718. tlInterval = null;
  719. timelineObj = null;
  720. };
  721. setUserContent( 2 );
  722. var tPanel = Ext.getCmp('main_portal');
  723. tPanel.removeAll( true );
  724. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  725. tPanel.add({
  726. columnWidth: 0.83,
  727. frame: false,
  728. border: false,
  729. items: [{
  730. title: 'Site Map',
  731. frame: false,
  732. border: false,
  733. layout: 'vbox',
  734. layoutConfig: {
  735. align : 'stretch',
  736. pack : 'start',
  737. },
  738. height: PanelH-300,
  739. items:[{
  740. height: PanelH-325,
  741. flex: 1,
  742. frame: false,
  743. border: false,
  744. layout: 'fit',
  745. items:{
  746. id: 'event_map',
  747. html: '&nbsp;'
  748. }
  749. }]
  750. },{
  751. frame: false,
  752. border: false,
  753. collapsible: false,
  754. draggable: false,
  755. layout: 'hbox',
  756. items:[{
  757. layout: 'form',
  758. title: 'Date/Time',
  759. width: 200,
  760. frame: true,
  761. border: false,
  762. labelAlign: 'right',
  763. labelWidth: 50,
  764. defaults: { width: 80},
  765. items: [{
  766. xtype: 'timefield',
  767. id: 'STimeFROM',
  768. width: 120,
  769. fieldLabel: 'From',
  770. minValue: '00:00',
  771. maxValue: '24:00',
  772. increment: 30
  773. },{
  774. xtype: 'timefield',
  775. id: 'STimeTO',
  776. width: 120,
  777. fieldLabel: 'Till',
  778. minValue: '00:00',
  779. maxValue: '24:00',
  780. increment: 30
  781. }],
  782. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  783. buttons: [{
  784. xtype: 'button',
  785. text: 'Display History'
  786. }]
  787. },{
  788. title: 'Event Log',
  789. frame: false,
  790. height: 303,
  791. xtype: 'grid',
  792. ds: eventsListStore,
  793. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  794. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops )
  795. }]
  796. }]
  797. });
  798. tPanel.add({
  799. columnWidth: 0.17,
  800. frame: false,
  801. id: 'prop_content',
  802. border: false,
  803. items: [{
  804. title: 'Event Information',
  805. border: true,
  806. frame: true,
  807. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  808. }]
  809. });
  810. tPanel.doLayout();
  811. //BuildCalendar();
  812. loadCalendarDates();
  813. map = L.map('event_map',{
  814. attributionControl: true,
  815. //preferCanvas: true,
  816. zoomControl: true,
  817. center: [SiteLat, SiteLon],
  818. /*zoomControl: false,
  819. zoom: 17,
  820. minZoom: 17,
  821. maxZoom: 17,*/
  822. keyboard: false
  823. }).setView([SiteLat, SiteLon], 17);
  824. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  825. var selectedMarkerIcon = L.icon({
  826. iconUrl: '/style/assets/cursor.png',
  827. iconSize: [32, 32],
  828. iconAnchor: [16, 16]//,
  829. //popupAnchor: [-3, -76],
  830. //shadowUrl: 'my-icon-shadow.png',
  831. //shadowSize: [68, 95],
  832. //shadowAnchor: [22, 94]
  833. });
  834. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  835. var mapLayers = [];
  836. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  837. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  838. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  839. detectRetina: true
  840. });*/
  841. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  842. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  843. maxNativeZoom: 18,
  844. maxZoom: 24,
  845. })
  846. // https://leaflet-extras.github.io/leaflet-providers/preview/
  847. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  848. 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',
  849. maxZoom: 19
  850. });
  851. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  852. 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',
  853. maxZoom: 19
  854. });
  855. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  856. 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',
  857. maxZoom: 24
  858. });
  859. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  860. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  861. maxZoom: 19
  862. });
  863. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  864. 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>) ',
  865. maxZoom: 19
  866. });
  867. /*
  868. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  869. 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>',
  870. maxZoom: 22
  871. });
  872. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  873. 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>',
  874. maxZoom: 22
  875. });
  876. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  877. 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>',
  878. maxZoom: 22
  879. });
  880. */
  881. var baseMaps = {
  882. "MyMap": mapLayers["MyMap"],
  883. "OpenStreetMap": mapLayers["OpenStreetMap"],
  884. "OpenTopoMap": mapLayers["OpenTopoMap"],
  885. "EsriSat": mapLayers["EsriSat"],
  886. "EsriStreet": mapLayers["EsriStreet"],
  887. "EsriTopo": mapLayers["EsriTopo"],
  888. //"Bing": mapLayers["Bing"],
  889. //"OSM-Cycle": mapLayers["Cycle"],
  890. //"Landscape": mapLayers["Landscape"],
  891. //"Outdoor": mapLayers["Outdoor"],
  892. };
  893. L.control.layers( baseMaps ).addTo(map);
  894. mapLayers["MyMap"].addTo(map);
  895. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  896. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  897. maxNativeZoom: 18,
  898. maxZoom: 24,
  899. }).addTo(map); */
  900. //loadTimeLineGroups( selectedSite );
  901. loadMapZones( SelectedSite );
  902. getData( 'arch' );
  903. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  904. };
  905. function loadMonitoring(){
  906. if( tlInterval!= null ){
  907. window.clearInterval( tlInterval );
  908. tlInterval = null;
  909. timelineObj = null;
  910. };
  911. setUserContent( 1 );
  912. var tPanel = Ext.getCmp('main_portal');
  913. tPanel.removeAll( true );
  914. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  915. tPanel.add({
  916. columnWidth: 0.83,
  917. frame: false,
  918. border: false,
  919. items: [{
  920. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  921. frame: false,
  922. border: false,
  923. collapsible: false,
  924. draggable: false,
  925. layout: 'vbox',
  926. layoutConfig: {
  927. align : 'stretch',
  928. pack : 'start',
  929. },
  930. height: PanelH-300,
  931. items:[{
  932. height: PanelH-325,
  933. flex: 1,
  934. frame: false,
  935. border: false,
  936. layout: 'fit',
  937. items:{
  938. id: 'event_map',
  939. html: '&nbsp;'
  940. }
  941. }]
  942. },{
  943. frame: false,
  944. border: true,
  945. collapsible: false,
  946. draggable: false,
  947. layout: 'hbox',
  948. items:[{
  949. title: 'Alarm Sources',
  950. xtype: 'panel',
  951. border: false,
  952. frame: false,
  953. collapsible: false,
  954. draggable: false,
  955. id: 'sources_panel',
  956. width: 160,
  957. autoScroll: 'auto',
  958. height: 303
  959. },{
  960. title: 'Event Log',
  961. height: 303,
  962. xtype: 'grid',
  963. border: false,
  964. frame: false,
  965. collapsible: false,
  966. draggable: false,
  967. ds: eventsListStore,
  968. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  969. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  970. bbar: [{
  971. text: 'Clear',
  972. handler: function(){
  973. Ext.Ajax.request({
  974. url: '/lib/controller/clearEventCloud.php',
  975. params: {
  976. UID: <?=$UserID;?>,
  977. SID: '<?=$Session;?>'
  978. },
  979. success: function( response, opts ){
  980. },
  981. failure: function( response, opts ) {
  982. }
  983. });
  984. }
  985. }]
  986. }]
  987. }]
  988. });
  989. tPanel.add({
  990. columnWidth: 0.17,
  991. frame: false,
  992. id: 'prop_content',
  993. border: false,
  994. items: [{
  995. title: 'Event Information',
  996. border: true,
  997. frame: true,
  998. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  999. }]
  1000. });
  1001. tPanel.doLayout();
  1002. map = L.map('event_map',{
  1003. attributionControl: true,
  1004. //preferCanvas: true,
  1005. zoomControl: true,
  1006. center: [SiteLat, SiteLon],
  1007. /*zoomControl: false,
  1008. zoom: 17,
  1009. minZoom: 17,
  1010. maxZoom: 17,*/
  1011. keyboard: false
  1012. }).setView([SiteLat, SiteLon], 17);
  1013. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1014. var mapLayers = [];
  1015. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1016. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1017. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1018. detectRetina: true
  1019. });*/
  1020. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1021. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1022. maxNativeZoom: 18,
  1023. maxZoom: 24,
  1024. })
  1025. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1026. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1027. 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',
  1028. maxZoom: 19
  1029. });
  1030. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1031. 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',
  1032. maxZoom: 19
  1033. });
  1034. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1035. 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',
  1036. maxZoom: 24
  1037. });
  1038. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1039. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1040. maxZoom: 19
  1041. });
  1042. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1043. 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>) ',
  1044. maxZoom: 19
  1045. });
  1046. /*
  1047. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1048. 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>',
  1049. maxZoom: 22
  1050. });
  1051. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1052. 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>',
  1053. maxZoom: 22
  1054. });
  1055. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1056. 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>',
  1057. maxZoom: 22
  1058. });
  1059. */
  1060. var baseMaps = {
  1061. "MyMap": mapLayers["MyMap"],
  1062. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1063. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1064. "EsriSat": mapLayers["EsriSat"],
  1065. "EsriStreet": mapLayers["EsriStreet"],
  1066. "EsriTopo": mapLayers["EsriTopo"],
  1067. //"Bing": mapLayers["Bing"],
  1068. //"OSM-Cycle": mapLayers["Cycle"],
  1069. //"Landscape": mapLayers["Landscape"],
  1070. //"Outdoor": mapLayers["Outdoor"],
  1071. };
  1072. L.control.layers( baseMaps ).addTo(map);
  1073. mapLayers["MyMap"].addTo(map);
  1074. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1075. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1076. maxNativeZoom: 18,
  1077. maxZoom: 24,
  1078. }).addTo(map); */
  1079. loadMapZones( SelectedSite );
  1080. tlInterval = window.setInterval( getData, 333, 'live' );
  1081. };
  1082. function loadOnlineMonitoring(devID){
  1083. var tPanel = Ext.getCmp('main_content');
  1084. if( tlInterval!= null ){
  1085. window.clearInterval( tlInterval );
  1086. tlInterval = null;
  1087. timelineObj = null;
  1088. };
  1089. tPanel.remove(0);
  1090. tPanel.add({
  1091. html: 'Device Monitoring '+devID
  1092. });
  1093. tPanel.doLayout();
  1094. };