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.

614 lines
16 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var selectedSite = <?=$SiteID;?>;
  3. var SettingsLidar3D = null;
  4. var SelectedNodeID = 0;
  5. function loadSettingsLidar3D( NodeID, Master ){
  6. SelectedNodeID = NodeID;
  7. Ext.Ajax.request({
  8. url: '/lib/controller/getSettingsLidsr3D.php',
  9. params: {
  10. NID: NodeID,
  11. MST: ((Master)?1:0),
  12. UID: <?=$UserID;?>,
  13. SID: '<?=$Session;?>',
  14. },
  15. success: function( response, opts ){
  16. // If the response is JSON, you have to decode it
  17. var data = Ext.decode(response.responseText);
  18. Ext.getCmp('setting_master_ip').setValue( data.ip_address );
  19. Ext.getCmp('setting_master_port').setValue( data.port );
  20. Ext.getCmp('setting_slave_ip').setValue( data.aux_ip_address );
  21. Ext.getCmp('setting_slave_port').setValue( data.aux_port );
  22. Ext.getCmp('setting_lat').setValue( data.lat );
  23. Ext.getCmp('setting_lon').setValue( data.lon );
  24. Ext.getCmp('setting_alt').setValue( data.alt );
  25. Ext.getCmp('setting_roll').setValue( data.roll );
  26. Ext.getCmp('setting_pitch').setValue( data.pitch );
  27. Ext.getCmp('setting_yaw').setValue( data.yaw );
  28. },
  29. failure: function( response, opts ) {
  30. //Ext.fly('some_div').update('Fail!');
  31. }/*,
  32. callback: function(options,success,response){
  33. // use this if you need to perform your own success/failure checking
  34. }*/
  35. });
  36. };
  37. function SaveSettingsLidar3D( ){
  38. if( SelectedNodeID == 0 ) return;
  39. t1 = Ext.getCmp('setting_master_ip').getValue();
  40. t2 = Ext.getCmp('setting_master_port').getValue();
  41. t3 = Ext.getCmp('setting_slave_ip').getValue();
  42. t4 = Ext.getCmp('setting_slave_port').getValue();
  43. t5 = Ext.getCmp('setting_lat').getValue();
  44. t6 = Ext.getCmp('setting_lon').getValue();
  45. t7 = Ext.getCmp('setting_alt').getValue();
  46. t8 = Ext.getCmp('setting_roll').getValue();
  47. t9 = Ext.getCmp('setting_pitch').getValue();
  48. t10 = Ext.getCmp('setting_yaw').getValue();
  49. Ext.Ajax.request({
  50. url: '/lib/controller/setSettingsLidsr3D.php',
  51. params: {
  52. NID: SelectedNodeID,
  53. UID: <?=$UserID;?>,
  54. SID: '<?=$Session;?>',
  55. MIP: t1,
  56. MPP: t2,
  57. SIP: t3,
  58. SPP: t4,
  59. LAT: t5,
  60. LON: t6,
  61. ALT: t7,
  62. ROL: t8,
  63. PCH: t9,
  64. YAW: t10
  65. },
  66. success: function( response, opts ){
  67. // If the response is JSON, you have to decode it
  68. var data = Ext.decode(response.responseText);
  69. if( data.success == true ) {
  70. Ext.Msg.show({
  71. title:'Info Message',
  72. msg: 'Settings are sucessfully saved.',
  73. buttons: Ext.Msg.OK,//YESNOCANCEL,
  74. fn: function(){
  75. SettingsLidar3D.hide();
  76. },
  77. //animEl: 'elId',
  78. icon: Ext.MessageBox.INFO //QUESTION
  79. });
  80. } else {
  81. Ext.Msg.show({
  82. title:'Error Message',
  83. msg: data['error'],
  84. buttons: Ext.Msg.OK,//YESNOCANCEL,
  85. fn: function(){
  86. SettingsLidar3D.hide();
  87. },
  88. //animEl: 'elId',
  89. icon: Ext.MessageBox.ERROR //QUESTION
  90. });
  91. };
  92. },
  93. failure: function( response, opts ) {
  94. //Ext.fly('some_div').update('Fail!');
  95. }/*,
  96. callback: function(options,success,response){
  97. // use this if you need to perform your own success/failure checking
  98. }*/
  99. });
  100. };
  101. function editSettingsLidar3D( NodeID, Master ){
  102. if( SettingsLidar3D == null ){
  103. SettingsLidar3D = new Ext.Window({
  104. modal: true,
  105. title: '<?=$Labels->GetLabel("_EDIT_LRF3D_SETTINGS_");?>',
  106. width: 773,
  107. height: 600,
  108. layout: 'fit',
  109. closeAction: 'hide',
  110. listeners:{
  111. beforehide : function(){
  112. Ext.getCmp('connectstarterbutton').toggle( false, false );
  113. }
  114. },
  115. items:[{
  116. layout: 'table',
  117. border: false,
  118. defaults: {
  119. // applied to each contained panel
  120. bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;'
  121. },
  122. layoutConfig: {
  123. // The total column count must be specified here
  124. columns: 4
  125. },
  126. items: [{
  127. border: false,
  128. html: 'Master IP Address:'
  129. },{
  130. xtype: 'textfield',
  131. id: 'setting_master_ip',
  132. width: '70%'
  133. },{
  134. border: false,
  135. html: 'Port:'
  136. },{
  137. xtype: 'textfield',
  138. id: 'setting_master_port',
  139. width: '30%'
  140. },{
  141. border: false,
  142. html: 'Slave IP Address:'
  143. },{
  144. xtype: 'textfield',
  145. id: 'setting_slave_ip',
  146. width: '70%'
  147. },{
  148. border: false,
  149. html: 'Port:'
  150. },{
  151. xtype: 'textfield',
  152. id: 'setting_slave_port',
  153. width: '30%'
  154. },{
  155. border: false,
  156. html: 'Position Lat/Lon/Alt:'
  157. },{
  158. xtype: 'textfield',
  159. id: 'setting_lat',
  160. width: '30%'
  161. },{
  162. xtype: 'textfield',
  163. id: 'setting_lon',
  164. width: '30%'
  165. },{
  166. xtype: 'textfield',
  167. id: 'setting_alt',
  168. width: '30%'
  169. },{
  170. border: false,
  171. html: 'Orientation Roll/Pitch/Yaw:'
  172. },{
  173. xtype: 'textfield',
  174. id: 'setting_roll',
  175. width: '30%'
  176. },{
  177. xtype: 'textfield',
  178. id: 'setting_pitch',
  179. width: '30%'
  180. },{
  181. xtype: 'textfield',
  182. id: 'setting_yaw',
  183. width: '30%'
  184. }]
  185. }],
  186. bbar: [{
  187. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  188. handler: function(){
  189. SettingsLidar3D.hide();
  190. }
  191. },{
  192. text: '<?=$Labels->GetLabel("_SAVE_");?>',
  193. handler: SaveSettingsLidar3D
  194. }]
  195. });
  196. };
  197. SettingsLidar3D.show();
  198. loadSettingsLidar3D( NodeID, Master );
  199. };
  200. function reloadNetworkData(){
  201. Ext.Ajax.request({
  202. url: '/lib/controller/getNetwork.php',
  203. params: {
  204. NID: <?=$SiteID;?>,
  205. UID: <?=$UserID;?>,
  206. SID: '<?=$Session;?>',
  207. },
  208. success: function( response, opts ){
  209. // If the response is JSON, you have to decode it
  210. var data = Ext.decode(response.responseText);
  211. netwodkData.nodes = new vis.DataSet( data.nodes );
  212. netwodkData.edges = new vis.DataSet( data.edges );
  213. networkObj.setData( netwodkData );
  214. networkObj.redraw();
  215. },
  216. failure: function( response, opts ) {
  217. //Ext.fly('some_div').update('Fail!');
  218. }/*,
  219. callback: function(options,success,response){
  220. // use this if you need to perform your own success/failure checking
  221. }*/
  222. });
  223. };
  224. function createNode( STYPE ){
  225. Ext.Ajax.request({
  226. url: '/lib/controller/addNetworkNode.php',
  227. params: {
  228. NID: <?=$SiteID;?>,
  229. UID: <?=$UserID;?>,
  230. SID: '<?=$Session;?>',
  231. TYPE: STYPE
  232. },
  233. success: function( response, opts ){
  234. // If the response is JSON, you have to decode it
  235. reloadNetworkData( <?=$SiteID;?> );
  236. },
  237. failure: function( response, opts ) {
  238. //Ext.fly('some_div').update('Fail!');
  239. }/*,
  240. callback: function(options,success,response){
  241. // use this if you need to perform your own success/failure checking
  242. }*/
  243. });
  244. };
  245. function loadNodeSockets( NID, store ){
  246. Ext.Ajax.request({
  247. url: '/lib/controller/listNodeSockets.php',
  248. params: {
  249. NID: <?=$SiteID;?>,
  250. UID: <?=$UserID;?>,
  251. SID: '<?=$Session;?>',
  252. DID: NID
  253. },
  254. success: function( response, opts ){
  255. var data = Ext.decode( response.responseText );
  256. if( data['success'] == true ){
  257. store.loadData( data, false );
  258. } else {
  259. Ext.Msg.show({
  260. title:'Error Message',
  261. msg: data['error'],
  262. buttons: Ext.Msg.OK,//YESNOCANCEL,
  263. //fn: processResult,
  264. //animEl: 'elId',
  265. icon: Ext.MessageBox.ERROR //QUESTION
  266. });
  267. };
  268. //Ext.getCmp('zigzag').getEl().unmask();
  269. },
  270. failure: function( response, opts ) {
  271. //Ext.fly('some_div').update('Fail!');
  272. }/*,
  273. callback: function(options,success,response){
  274. // use this if you need to perform your own success/failure checking
  275. }*/
  276. });
  277. };
  278. function createConnection( SID, EID, CTY ){
  279. if( addConnectionDialog == null ){
  280. addConnectionDialog = new Ext.Window({
  281. modal: true,
  282. title: '<?=$Labels->GetLabel("_ADD_CONNECTION_");?>',
  283. width: 773,
  284. height: 600,
  285. layout: 'hbox',
  286. closeAction: 'hide',
  287. listeners:{
  288. beforehide : function(){
  289. Ext.getCmp('connectstarterbutton').toggle( false, false );
  290. }
  291. },
  292. items:[{
  293. xtype: 'grid',
  294. width: 380,
  295. height: 400,
  296. ds: A_socketsListStore,
  297. cm: socketListColModel,
  298. sm: A_socketSelModel
  299. },{
  300. xtype: 'grid',
  301. width: 380,
  302. height: 400,
  303. ds: B_socketsListStore,
  304. cm: socketListColModel,
  305. sm: B_socketSelModel
  306. }],
  307. bbar: [{
  308. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  309. handler: function(){
  310. addConnectionDialog.hide();
  311. }
  312. },{
  313. id: 'con_to_src',
  314. text: '<?=$Labels->GetLabel("_ADD_");?>',
  315. disabled: true,
  316. handler: function(){
  317. if( selected_A_socket != null && selected_B_socket != null ){
  318. Ext.Ajax.request({
  319. url: '/lib/controller/addConnection.php',
  320. params: {
  321. NID: <?=$SiteID;?>,
  322. SNID: SID,
  323. SOSID: selected_A_socket.id,
  324. ENID: EID,
  325. SOEID: selected_B_socket.id,
  326. UID: <?=$UserID;?>,
  327. SID: '<?=$Session;?>'
  328. },
  329. success: function( response, opts ){
  330. var data = Ext.decode(response.responseText);
  331. if( data.status ){
  332. //reloadNetworkData( NID );
  333. netwodkData.edges.add( data.edge );
  334. } else {
  335. startCreateConnection();
  336. //alert( data.message );
  337. };
  338. Ext.getCmp('connectstarterbutton').toggle( false, false );
  339. },
  340. failure: function( response, opts ) {
  341. //Ext.fly('some_div').update('Fail!');
  342. }/*,
  343. callback: function(options,success,response){
  344. // use this if you need to perform your own success/failure checking
  345. }*/
  346. });
  347. };
  348. }
  349. }]
  350. });
  351. };
  352. loadNodeSockets( SID, A_socketsListStore );
  353. loadNodeSockets( EID, B_socketsListStore );
  354. addConnectionDialog.show();
  355. };
  356. function loadNodeProperties( NodeID ){
  357. //alert( 'Node: ' + NodeID );
  358. Ext.Ajax.request({
  359. url: '/lib/controller/getNetworkNodeProps.php',
  360. params: {
  361. NID: <?=$SiteID;?>,
  362. UID: <?=$UserID;?>,
  363. SID: '<?=$Session;?>',
  364. NODE: NodeID
  365. },
  366. success: function( response, opts ){
  367. // If the response is JSON, you have to decode it
  368. var data = Ext.decode(response.responseText);
  369. var tPanel = Ext.getCmp('prop_content');
  370. tPanel.remove(0);
  371. tPanel.add( data );
  372. tPanel.doLayout();
  373. },
  374. failure: function( response, opts ) {
  375. //Ext.fly('some_div').update('Fail!');
  376. }/*,
  377. callback: function(options,success,response){
  378. // use this if you need to perform your own success/failure checking
  379. }*/
  380. });
  381. };
  382. function loadServerProperties( NodeID ){
  383. Ext.Ajax.request({
  384. url: '/lib/controller/getNetworkServerProps.php',
  385. params: {
  386. NID: <?=$SiteID;?>,
  387. UID: <?=$UserID;?>,
  388. SID: '<?=$Session;?>',
  389. NODE: NodeID
  390. },
  391. success: function( response, opts ){
  392. var data = Ext.decode(response.responseText);
  393. var tPanel = Ext.getCmp('prop_content');
  394. tPanel.remove(0);
  395. tPanel.add( data );
  396. tPanel.doLayout();
  397. },
  398. failure: function( response, opts ) {
  399. //Ext.fly('some_div').update('Fail!');
  400. }/*,
  401. callback: function(options,success,response){
  402. // use this if you need to perform your own success/failure checking
  403. }*/
  404. });
  405. };
  406. function loadSystemEditor(){
  407. var tPanel = Ext.getCmp('main_content');
  408. if( tlInterval!= null ){
  409. window.clearInterval( tlInterval );
  410. tlInterval = null;
  411. timelineObj = null;
  412. };
  413. tPanel.remove(0);
  414. tPanel.add({
  415. title: 'System Map',
  416. // id: 'sys_map',
  417. frame: false,
  418. border: false,
  419. //layout: 'column', // Specifies that the items will now be arranged in columns
  420. layout:'hbox',
  421. layoutConfig: {
  422. align : 'stretch',
  423. pack : 'start',
  424. //padding:'5',
  425. //align:'middle'
  426. },
  427. items: [{
  428. //columnWidth: 0.60,
  429. layout: 'fit',
  430. //height: 700,
  431. flex: 1,
  432. border: true,
  433. items:{
  434. id: 'sys_map'
  435. }
  436. },{
  437. title: 'Properties',
  438. flex: 1,
  439. width: 210,
  440. layout: 'fit',
  441. frame: true,
  442. id: 'prop_content',
  443. // border: true
  444. items:{
  445. html: 'Select Item From Map'
  446. }
  447. }],
  448. tbar: [{
  449. xtype: 'splitbutton',
  450. text: 'Add Laser Sensor',
  451. split: true,
  452. enableToggle : undefined,
  453. menu : {
  454. items: [{
  455. text:'ALS',
  456. icon: '/style/assets/!cid_ii_jvmzuzrq10.png',
  457. handler: function(){
  458. createNode( 1 );
  459. }
  460. },{
  461. text:'LFS',
  462. handler: function(){
  463. createNode( 2 );
  464. }
  465. },{
  466. text:'PLS-200',
  467. handler: function(){
  468. createNode( 3 );
  469. }
  470. },{
  471. text:'PLS-360',
  472. handler: function(){
  473. createNode( 4 );
  474. }
  475. },{
  476. text:'3DLIDAR',
  477. handler: function(){
  478. createNode( 5 );
  479. }
  480. }]
  481. }
  482. },{
  483. xtype: 'splitbutton',
  484. text: 'Add Additional Equipment',
  485. split: true,
  486. enableToggle : true,
  487. menu : {
  488. items: [{
  489. text:'Static Analog Camera'
  490. },{
  491. text:'PTZ Analog Camera'
  492. },{
  493. text:'Static IP Camera',
  494. handler: function(){
  495. SelectedCamPTZ = false;
  496. addIpCam();
  497. }
  498. },{
  499. text:'PTZ IP Camera',
  500. handler: function(){
  501. SelectedCamPTZ = true;
  502. addIpCam();
  503. }
  504. },{
  505. text:'DVR/Video Server/Streamer',
  506. handler: function(){
  507. addMediaServer();
  508. }
  509. },{
  510. text:'Network Video Recorder'
  511. },{
  512. text:'Ethernet to UART transeiver'
  513. },{
  514. text:'DC to Ethernet (ADAM)'
  515. }]
  516. }
  517. },{
  518. xtype: 'button',
  519. id: 'connectstarterbutton',
  520. text: 'Add Connection',
  521. enableToggle : undefined,
  522. handler: function(){
  523. Ext.getCmp('connectstarterbutton').toggle( true, true );
  524. startCreateConnection(1);
  525. }
  526. }]
  527. });
  528. tPanel.doLayout();
  529. Ext.Ajax.request({
  530. url: '/lib/controller/getNetwork.php',
  531. params: {
  532. NID: selectedSite,
  533. UID: <?=$UserID;?>,
  534. SID: '<?=$Session;?>'
  535. },
  536. success: function( response, opts ){
  537. // If the response is JSON, you have to decode it
  538. var data = Ext.decode(response.responseText);
  539. netwodkData.nodes = new vis.DataSet( data.nodes );
  540. netwodkData.edges = new vis.DataSet( data.edges );
  541. var container = document.getElementById(Ext.getCmp('sys_map').body.id);
  542. networkObj = new vis.Network(container, netwodkData, networkOpts );
  543. networkObj.on("click", function (params) {
  544. //if(!connectionAddMode){
  545. if( params.nodes.length > 0 ){
  546. if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){
  547. loadServerProperties( params.nodes[0] );
  548. } else {
  549. loadNodeProperties( params.nodes[0] );
  550. };
  551. } else if( params.edges.length > 0 ){
  552. selectedConnection = netwodkData.edges.get(params.edges[0]);
  553. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  554. };
  555. //};
  556. });
  557. networkObj.on("doubleClick", function (params) {
  558. //if(!connectionAddMode){
  559. if( params.nodes.length > 0 ){
  560. loadNodeProperties( params.nodes[0] );
  561. } else if( params.edges.length > 0 ){
  562. selectedConnection = netwodkData.edges.get(params.edges[0]);
  563. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  564. };
  565. //};
  566. });
  567. /*
  568. networkObj.on("dragStart", function (params) {
  569. if( connectionAddMode ){
  570. var tID = this.getNodeAt(params.pointer.DOM);
  571. if( tID != undefined ){
  572. newConnectionStart = tID;
  573. };
  574. };
  575. });
  576. networkObj.on("dragEnd", function (params) {
  577. if( connectionAddMode ){
  578. var tID = this.getNodeAt(params.pointer.DOM);
  579. if( tID != undefined ){
  580. newConnectionEnd = tID;
  581. //selectedConnection = netwodkData.edges[netwodkData.edges.length];
  582. //selectedConnection.color = {
  583. // color: '#ff0000',
  584. // opacity: 0.3,
  585. // highlight: 'blue'
  586. //};
  587. //networkObj.addEdgeMode(0);
  588. createConnection( newConnectionStart, newConnectionEnd );
  589. connectionAddMode = false;
  590. };
  591. };
  592. });
  593. */
  594. },
  595. failure: function( response, opts ) {
  596. //Ext.fly('some_div').update('Fail!');
  597. }/*,
  598. callback: function(options,success,response){
  599. // use this if you need to perform your own success/failure checking
  600. }*/
  601. });
  602. };