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.

817 lines
21 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
6 years ago
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
6 years ago
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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. var mp_FlyHunterWindow = null;
  407. function module_prop_FlyHunter( module_id ){
  408. if( mp_FlyHunterWindow == null ){
  409. mp_FlyHunterWindow = new Ext.Window({
  410. modal: true,
  411. title: '<?=$Labels->GetLabel("_FHM_PROPS_");?>',
  412. width: 773,
  413. height: 600,
  414. layout: 'table',
  415. closeAction: 'hide',
  416. flex: 1,
  417. defaults: {
  418. bodyStyle:'padding:20px'
  419. },
  420. layoutConfig: {
  421. // The total column count must be specified here
  422. columns: 2
  423. },
  424. items:[{
  425. html: 'Radio LINK UART Port'
  426. },{
  427. xtype: 'combo',
  428. editable: false,
  429. typeAhead: true,
  430. triggerAction: 'all',
  431. lazyRender:true,
  432. mode: 'local',
  433. store: new Ext.data.ArrayStore({
  434. id: 0,
  435. fields: ['myId', 'displayText' ],
  436. data: [ <?php
  437. $QS="SELECT so.id, so.name FROM nodes no LEFT JOIN sockets so ON( so.node_id = no.id ) WHERE ( no.type=0 OR no.type=20 ) AND no.site_id={$SiteID} AND so.type=1";
  438. $RR=$DATABASE->Query( $QS );
  439. if( count( $RR ) ){
  440. $RE=array();
  441. foreach( $RR as $R ){
  442. $RE[] = "[ {$R['id']}, '{$R['name']}']";
  443. };
  444. echo implode( ',', $RE );
  445. } else {
  446. echo "[0, 'No UARTS DEFINED']";
  447. };
  448. ?>]
  449. }),
  450. valueField: 'myId',
  451. displayField: 'displayText'
  452. },{
  453. html: 'ChakaLaka DC Channel'
  454. },{
  455. xtype: 'combo',
  456. editable: false,
  457. typeAhead: true,
  458. triggerAction: 'all',
  459. lazyRender:true,
  460. mode: 'local',
  461. store: new Ext.data.ArrayStore({
  462. id: 1,
  463. fields: ['myId', 'displayText' ],
  464. data: [ <?php
  465. $QS="SELECT ca.id, ca.channel_id, dcb.serial_id FROM module_dcr_chanels ca LEFT JOIN modules_dcr dcb ON( ca.dcr_id = dcb.id ) WHERE dcb.site_id={$SiteID}";
  466. $RR=$DATABASE->Query( $QS );
  467. if( count( $RR ) ){
  468. $RE=array();
  469. foreach( $RR as $R ){
  470. $RE[] = "[ {$R['id']}, '{$R['serial_id']}_{$R['channel_id']}']";
  471. };
  472. echo implode( ',', $RE );
  473. } else {
  474. echo "[0, 'No DCB Connected']";
  475. };
  476. ?>]
  477. }),
  478. valueField: 'myId',
  479. displayField: 'displayText'
  480. }],
  481. bbar:[{
  482. text:'cancel'
  483. },{
  484. text:'submit'
  485. }]
  486. });
  487. };
  488. mp_FlyHunterWindow.show();
  489. Ext.Ajax.request({
  490. url: '/lib/controller/getModuleProps.php',
  491. params: {
  492. NID: <?=$SiteID;?>,
  493. UID: <?=$UserID;?>,
  494. SID: '<?=$Session;?>',
  495. MODULE: module_id
  496. },
  497. success: function( response, opts ){
  498. var data = Ext.decode(response.responseText);
  499. var tPanel = Ext.getCmp('prop_content');
  500. tPanel.remove(0);
  501. tPanel.add( data );
  502. tPanel.doLayout();
  503. },
  504. failure: function( response, opts ) {
  505. }
  506. });
  507. };
  508. function loadSystemEditor(){
  509. if( tlInterval!= null ){
  510. window.clearInterval( tlInterval );
  511. tlInterval = null;
  512. timelineObj = null;
  513. };
  514. var tPanel = Ext.getCmp('main_portal');
  515. tPanel.removeAll( true );
  516. Ext.getCmp('main_content').setTitle( 'System Map' );
  517. tPanel.add({
  518. columnWidth: 0.83,
  519. frame: false,
  520. border: false,
  521. items: [{
  522. xtype: 'panel',
  523. layout: 'fit',
  524. layoutConfig: {
  525. align : 'stretch',
  526. pack : 'start'
  527. //padding:'5',
  528. //align:'middle'
  529. },
  530. height: PanelH-5,
  531. flex: 1,
  532. frame: false,
  533. border: false,
  534. items:{
  535. id: 'sys_map'
  536. },
  537. tbar: [{
  538. xtype: 'splitbutton',
  539. text: 'Add Laser Sensor',
  540. split: true,
  541. enableToggle : undefined,
  542. menu : {
  543. items: [{
  544. text:'ALS',
  545. icon: '/style/assets/!cid_ii_jvmzuzrq10.png',
  546. handler: function(){
  547. createNode( 1 );
  548. }
  549. },{
  550. text:'LFS',
  551. icon: '/style/assets/!cid_ii_jvmzuzpt0.png',
  552. handler: function(){
  553. createNode( 2 );
  554. }
  555. },{
  556. text:'PLS-200',
  557. icon: '/style/assets/!cid_ii_jvmzuzql4.png',
  558. handler: function(){
  559. createNode( 3 );
  560. }
  561. },{
  562. text:'PLS-360',
  563. icon: '/style/assets/!cid_ii_jvmzuzr87.png',
  564. handler: function(){
  565. createNode( 4 );
  566. }
  567. },{
  568. text:'3DLIDAR',
  569. icon: '/style/assets/unnamed34.png',
  570. handler: function(){
  571. createNode( 5 );
  572. }
  573. }]
  574. }
  575. },{
  576. xtype: 'splitbutton',
  577. text: 'Add Additional Equipment',
  578. split: true,
  579. enableToggle : true,
  580. menu : {
  581. items: [{
  582. text:'Static Analog Camera',
  583. icon: '/style/assets/11_node.png'
  584. },{
  585. text:'PTZ Analog Camera',
  586. icon: '/style/assets/12_node.png'
  587. },{
  588. text:'Static IP Camera',
  589. icon: '/style/assets/11_node.png',
  590. handler: function(){
  591. SelectedCamPTZ = false;
  592. addIpCam();
  593. }
  594. },{
  595. text:'PTZ IP Camera',
  596. icon: '/style/assets/12_node.png',
  597. handler: function(){
  598. SelectedCamPTZ = true;
  599. addIpCam();
  600. }
  601. },{
  602. text:'DVR/Video Server/Streamer',
  603. icon: '/style/assets/videoServer.png',
  604. handler: function(){
  605. addMediaServer();
  606. }
  607. },{
  608. text:'Network Video Recorder',
  609. icon: '/style/assets/15_node.png'
  610. },{
  611. text:'Ethernet to UART transeiver',
  612. icon: '/style/assets/eth2uart.png',
  613. handler: function(){
  614. addEthernet2Uart();
  615. }
  616. },{
  617. text:'DC to Ethernet (ADAM)',
  618. icon: '/style/assets/adam-1.png',
  619. }]
  620. }
  621. },{
  622. xtype: 'button',
  623. id: 'connectstarterbutton',
  624. text: 'Add Connection',
  625. enableToggle : undefined,
  626. handler: function(){
  627. if( InConnectEditMode ){
  628. Ext.getCmp('connectstarterbutton').toggle( false, false );
  629. InConnectEditMode = false;
  630. stopCreateConnection();
  631. } else {
  632. Ext.getCmp('connectstarterbutton').toggle( true, true );
  633. InConnectEditMode = true;
  634. startCreateConnection();
  635. };
  636. }
  637. },{
  638. xtype: 'button',
  639. id: 'deletecomponentbutton',
  640. text: 'Remove Component',
  641. enableToggle: true,
  642. handler: function(){
  643. if( InComponentRemoveMode ){
  644. Ext.getCmp('deletecomponentbutton').toggle( false, false );
  645. InComponentRemoveMode = false;
  646. } else {
  647. Ext.getCmp('deletecomponentbutton').toggle( true, true );
  648. InComponentRemoveMode = true;
  649. };
  650. }
  651. }]
  652. }]
  653. });
  654. tPanel.add({
  655. title: 'Properties',
  656. xtype: 'panel',
  657. flex: 1,
  658. height: 700,
  659. //width: 210,
  660. columnWidth: 0.17,
  661. layout: 'fit',
  662. //frame: true,
  663. id: 'prop_content',
  664. // border: true
  665. items:{
  666. html: 'Select Item From Map'
  667. }
  668. });
  669. tPanel.doLayout();
  670. Ext.Ajax.request({
  671. url: '/lib/controller/getNetwork.php',
  672. params: {
  673. NID: selectedSite,
  674. UID: <?=$UserID;?>,
  675. SID: '<?=$Session;?>'
  676. },
  677. success: function( response, opts ){
  678. // If the response is JSON, you have to decode it
  679. var data = Ext.decode(response.responseText);
  680. netwodkData.nodes = new vis.DataSet( data.nodes );
  681. netwodkData.edges = new vis.DataSet( data.edges );
  682. var container = document.getElementById(Ext.getCmp('sys_map').body.id);
  683. networkObj = new vis.Network(container, netwodkData, networkOpts );
  684. networkObj.on("click", function (params) {
  685. //if(!connectionAddMode){
  686. if( !InComponentRemoveMode ){
  687. if( params.nodes.length > 0 ){
  688. if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){
  689. loadServerProperties( params.nodes[0] );
  690. } else {
  691. loadNodeProperties( params.nodes[0] );
  692. };
  693. } else if( params.edges.length > 0 ){
  694. selectedConnection = netwodkData.edges.get(params.edges[0]);
  695. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  696. };
  697. } else {
  698. if( params.nodes.length > 0 ){
  699. if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){
  700. Ext.Msg.show({
  701. title:'Remove Server Component!',
  702. msg: 'You can not remove Server component!',
  703. buttons: Ext.Msg.OK,
  704. icon: Ext.MessageBox.INFO
  705. });
  706. } else {
  707. Ext.Msg.show({
  708. title:'Remove Component?',
  709. msg: 'You are about to remove.<br/>Are you sure to do so?',
  710. buttons: Ext.Msg.YESNOCANCEL,
  711. fn: function( result ){
  712. if( result=='yes' ){
  713. Ext.Ajax.request({
  714. url: '/lib/controller/removeNode.php',
  715. params: {
  716. SAID: <?=$SiteID;?>,
  717. NID: params.nodes[0],
  718. UID: <?=$UserID;?>,
  719. SID: '<?=$Session;?>'
  720. },
  721. success: function( response, opts ){
  722. var data = Ext.decode(response.responseText);
  723. if( data.sucess == false ){
  724. Ext.Msg.show({
  725. title:'Request Failure!',
  726. msg: data.error,
  727. buttons: Ext.Msg.OK,
  728. icon: Ext.MessageBox.INFO
  729. });
  730. } else {
  731. stopCreateConnection();
  732. InComponentRemoveMode = false;
  733. loadSystemEditor();
  734. };
  735. },
  736. failure: function( response, opts ) {
  737. Ext.Msg.show({
  738. title:'Request Failure!',
  739. msg: 'Ajax Request failed!',
  740. buttons: Ext.Msg.OK,
  741. icon: Ext.MessageBox.INFO
  742. });
  743. }
  744. });
  745. };
  746. },
  747. //animEl: 'elId',
  748. icon: Ext.MessageBox.QUESTION
  749. });
  750. };
  751. };
  752. };
  753. //};
  754. });
  755. /*
  756. networkObj.on("doubleClick", function (params) {
  757. //if(!connectionAddMode){
  758. if( !InComponentRemoveMode ){
  759. if( params.nodes.length > 0 ){
  760. loadNodeProperties( params.nodes[0] );
  761. } else if( params.edges.length > 0 ){
  762. selectedConnection = netwodkData.edges.get(params.edges[0]);
  763. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  764. };
  765. } else {
  766. alert( 'Remove' );
  767. };
  768. //};
  769. });
  770. */
  771. /*
  772. networkObj.on("dragStart", function (params) {
  773. if( connectionAddMode ){
  774. var tID = this.getNodeAt(params.pointer.DOM);
  775. if( tID != undefined ){
  776. newConnectionStart = tID;
  777. };
  778. };
  779. });
  780. networkObj.on("dragEnd", function (params) {
  781. if( connectionAddMode ){
  782. var tID = this.getNodeAt(params.pointer.DOM);
  783. if( tID != undefined ){
  784. newConnectionEnd = tID;
  785. //selectedConnection = netwodkData.edges[netwodkData.edges.length];
  786. //selectedConnection.color = {
  787. // color: '#ff0000',
  788. // opacity: 0.3,
  789. // highlight: 'blue'
  790. //};
  791. //networkObj.addEdgeMode(0);
  792. createConnection( newConnectionStart, newConnectionEnd );
  793. connectionAddMode = false;
  794. };
  795. };
  796. });
  797. */
  798. },
  799. failure: function( response, opts ) {
  800. //Ext.fly('some_div').update('Fail!');
  801. }
  802. });
  803. };