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.

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