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.

820 lines
21 KiB

6 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
6 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
5 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
5 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
​
​
​
6 years ago
5 years ago
6 years ago
​
​
​
​
​
​
​
​
​
6 years ago
5 years ago
​
​
​
​
6 years ago
5 years ago
​
6 years ago
​
​
5 years ago
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
6 years ago
​
6 years ago
​
6 years ago
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
6 years ago
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var resourceInfoWindow = null;
  3. function showResourceInfo( rid ){
  4. Ext.Ajax.request({
  5. url: '/lib/controller/getResourceInfo.php',
  6. params: {
  7. RID: rid,
  8. UID: <?=$UserID;?>,
  9. SID: '<?=$Session;?>',
  10. },
  11. success: function( response, opts ){
  12. // If the response is JSON, you have to decode it
  13. var data = Ext.decode(response.responseText);
  14. if( resourceInfoWindow == null ){
  15. resourceInfoWindow = new Ext.Window({
  16. title: 'Resource Info',
  17. modal: true,
  18. width: 800,
  19. height: 400,
  20. layout: 'fit',
  21. closeAction: 'hide',
  22. items: [],
  23. buttons:[{
  24. text: `close`
  25. }]
  26. });
  27. };
  28. resourceInfoWindow.removeAll( true );
  29. resourceInfoWindow.add( data );
  30. resourceInfoWindow.show();
  31. },
  32. failure: failureAJAXFunction
  33. });
  34. };
  35. function loadSettingsLidar3D( NodeID, Master ){
  36. SelectedNodeID = NodeID;
  37. Ext.Ajax.request({
  38. url: '/lib/controller/getSettingsLidsr3D.php',
  39. params: {
  40. NID: NodeID,
  41. MST: ((Master)?1:0),
  42. UID: <?=$UserID;?>,
  43. SID: '<?=$Session;?>',
  44. },
  45. success: function( response, opts ){
  46. // If the response is JSON, you have to decode it
  47. var data = Ext.decode(response.responseText);
  48. Ext.getCmp('setting_master_ip').setValue( data.ip_address );
  49. Ext.getCmp('setting_master_port').setValue( data.port );
  50. Ext.getCmp('setting_slave_ip').setValue( data.aux_ip_address );
  51. Ext.getCmp('setting_slave_port').setValue( data.aux_port );
  52. Ext.getCmp('setting_lat').setValue( data.lat );
  53. Ext.getCmp('setting_lon').setValue( data.lon );
  54. Ext.getCmp('setting_alt').setValue( data.alt );
  55. Ext.getCmp('setting_roll').setValue( data.roll );
  56. Ext.getCmp('setting_pitch').setValue( data.pitch );
  57. Ext.getCmp('setting_yaw').setValue( data.yaw );
  58. },
  59. failure: failureAJAXFunction
  60. });
  61. };
  62. function SaveSettingsLidar3D( ){
  63. if( SelectedNodeID == 0 ) return;
  64. t1 = Ext.getCmp('setting_master_ip').getValue();
  65. t2 = Ext.getCmp('setting_master_port').getValue();
  66. t3 = Ext.getCmp('setting_slave_ip').getValue();
  67. t4 = Ext.getCmp('setting_slave_port').getValue();
  68. t5 = Ext.getCmp('setting_lat').getValue();
  69. t6 = Ext.getCmp('setting_lon').getValue();
  70. t7 = Ext.getCmp('setting_alt').getValue();
  71. t8 = Ext.getCmp('setting_roll').getValue();
  72. t9 = Ext.getCmp('setting_pitch').getValue();
  73. t10 = Ext.getCmp('setting_yaw').getValue();
  74. Ext.Ajax.request({
  75. url: '/lib/controller/setSettingsLidsr3D.php',
  76. params: {
  77. NID: SelectedNodeID,
  78. UID: <?=$UserID;?>,
  79. SID: '<?=$Session;?>',
  80. MIP: t1,
  81. MPP: t2,
  82. SIP: t3,
  83. SPP: t4,
  84. LAT: t5,
  85. LON: t6,
  86. ALT: t7,
  87. ROL: t8,
  88. PCH: t9,
  89. YAW: t10
  90. },
  91. success: function( response, opts ){
  92. // If the response is JSON, you have to decode it
  93. var data = Ext.decode(response.responseText);
  94. if( data.success == true ) {
  95. Ext.Msg.show({
  96. title:'Info Message',
  97. msg: 'Settings are sucessfully saved.',
  98. buttons: Ext.Msg.OK,//YESNOCANCEL,
  99. fn: function(){
  100. SettingsLidar3D.hide();
  101. },
  102. //animEl: 'elId',
  103. icon: Ext.MessageBox.INFO //QUESTION
  104. });
  105. } else {
  106. Ext.Msg.show({
  107. title:'Error Message',
  108. msg: data['error'],
  109. buttons: Ext.Msg.OK,//YESNOCANCEL,
  110. fn: function(){
  111. SettingsLidar3D.hide();
  112. },
  113. //animEl: 'elId',
  114. icon: Ext.MessageBox.ERROR //QUESTION
  115. });
  116. };
  117. },
  118. failure: failureAJAXFunction
  119. });
  120. };
  121. function editSettingsLidar3D( NodeID, Master ){
  122. if( SettingsLidar3D == null ){
  123. SettingsLidar3D = new Ext.Window({
  124. modal: true,
  125. title: '<?=$Labels->GetLabel("_EDIT_LRF3D_SETTINGS_");?>',
  126. width: 773,
  127. height: 600,
  128. layout: 'fit',
  129. closeAction: 'hide',
  130. listeners:{
  131. beforehide : function(){
  132. Ext.getCmp('connectstarterbutton').toggle( false, false );
  133. }
  134. },
  135. items:[{
  136. layout: 'table',
  137. border: false,
  138. defaults: {
  139. // applied to each contained panel
  140. bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;'
  141. },
  142. layoutConfig: {
  143. // The total column count must be specified here
  144. columns: 4
  145. },
  146. items: [{
  147. border: false,
  148. html: 'Master IP Address:'
  149. },{
  150. xtype: 'textfield',
  151. id: 'setting_master_ip',
  152. width: '70%'
  153. },{
  154. border: false,
  155. html: 'Port:'
  156. },{
  157. xtype: 'textfield',
  158. id: 'setting_master_port',
  159. width: '30%'
  160. },{
  161. border: false,
  162. html: 'Slave IP Address:'
  163. },{
  164. xtype: 'textfield',
  165. id: 'setting_slave_ip',
  166. width: '70%'
  167. },{
  168. border: false,
  169. html: 'Port:'
  170. },{
  171. xtype: 'textfield',
  172. id: 'setting_slave_port',
  173. width: '30%'
  174. },{
  175. border: false,
  176. html: 'Position Lat/Lon/Alt:'
  177. },{
  178. xtype: 'textfield',
  179. id: 'setting_lat',
  180. width: '30%'
  181. },{
  182. xtype: 'textfield',
  183. id: 'setting_lon',
  184. width: '30%'
  185. },{
  186. xtype: 'textfield',
  187. id: 'setting_alt',
  188. width: '30%'
  189. },{
  190. border: false,
  191. html: 'Orientation Roll/Pitch/Yaw:'
  192. },{
  193. xtype: 'textfield',
  194. id: 'setting_roll',
  195. width: '30%'
  196. },{
  197. xtype: 'textfield',
  198. id: 'setting_pitch',
  199. width: '30%'
  200. },{
  201. xtype: 'textfield',
  202. id: 'setting_yaw',
  203. width: '30%'
  204. }]
  205. }],
  206. bbar: [{
  207. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  208. handler: function(){
  209. SettingsLidar3D.hide();
  210. }
  211. },{
  212. text: '<?=$Labels->GetLabel("_SAVE_");?>',
  213. handler: SaveSettingsLidar3D
  214. }]
  215. });
  216. };
  217. SettingsLidar3D.show();
  218. loadSettingsLidar3D( NodeID, Master );
  219. };
  220. function reloadNetworkData(){
  221. Ext.Ajax.request({
  222. url: '/lib/controller/getNetwork.php',
  223. params: {
  224. NID: SelectedSite,//<?=$SiteID;?>,
  225. UID: <?=$UserID;?>,
  226. SID: '<?=$Session;?>',
  227. },
  228. success: function( response, opts ){
  229. // If the response is JSON, you have to decode it
  230. var data = Ext.decode(response.responseText);
  231. netwodkData.nodes = new vis.DataSet( data.nodes );
  232. netwodkData.edges = new vis.DataSet( data.edges );
  233. networkObj.setData( netwodkData );
  234. networkObj.redraw();
  235. },
  236. failure: failureAJAXFunction
  237. });
  238. };
  239. function createNode( STYPE ){
  240. Ext.Ajax.request({
  241. url: '/lib/controller/addNetworkNode.php',
  242. params: {
  243. NID: <?=$SiteID;?>,
  244. UID: <?=$UserID;?>,
  245. SID: '<?=$Session;?>',
  246. TYPE: STYPE
  247. },
  248. success: function( response, opts ){
  249. // If the response is JSON, you have to decode it
  250. reloadNetworkData( <?=$SiteID;?> );
  251. },
  252. failure: failureAJAXFunction
  253. });
  254. };
  255. function loadNodeSockets( NID, store ){
  256. Ext.Ajax.request({
  257. url: '/lib/controller/listNodeSockets.php',
  258. params: {
  259. NID: <?=$SiteID;?>,
  260. UID: <?=$UserID;?>,
  261. SID: '<?=$Session;?>',
  262. DID: NID
  263. },
  264. success: function( response, opts ){
  265. var data = Ext.decode( response.responseText );
  266. if( data['success'] == true ){
  267. store.loadData( data, false );
  268. } else {
  269. Ext.Msg.show({
  270. title:'Error Message',
  271. msg: data['error'],
  272. buttons: Ext.Msg.OK,//YESNOCANCEL,
  273. //fn: processResult,
  274. //animEl: 'elId',
  275. icon: Ext.MessageBox.ERROR //QUESTION
  276. });
  277. };
  278. //Ext.getCmp('zigzag').getEl().unmask();
  279. },
  280. failure: failureAJAXFunction
  281. });
  282. };
  283. function createConnection( SID, EID, CTY ){
  284. if( addConnectionDialog == null ){
  285. addConnectionDialog = new Ext.Window({
  286. modal: true,
  287. title: '<?=$Labels->GetLabel("_ADD_CONNECTION_");?>',
  288. width: 773,
  289. height: 600,
  290. layout: 'hbox',
  291. closeAction: 'hide',
  292. listeners:{
  293. beforehide : function(){
  294. Ext.getCmp('connectstarterbutton').toggle( false, false );
  295. }
  296. },
  297. items:[{
  298. xtype: 'grid',
  299. width: 380,
  300. height: 400,
  301. ds: A_socketsListStore,
  302. cm: socketListColModel,
  303. sm: A_socketSelModel
  304. },{
  305. xtype: 'grid',
  306. width: 380,
  307. height: 400,
  308. ds: B_socketsListStore,
  309. cm: socketListColModel,
  310. sm: B_socketSelModel
  311. }],
  312. bbar: [{
  313. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  314. handler: function(){
  315. addConnectionDialog.hide();
  316. }
  317. },{
  318. id: 'con_to_src',
  319. text: '<?=$Labels->GetLabel("_ADD_");?>',
  320. disabled: true,
  321. handler: function(){
  322. if( selected_A_socket != null && selected_B_socket != null ){
  323. Ext.Ajax.request({
  324. url: '/lib/controller/addConnection.php',
  325. params: {
  326. NID: <?=$SiteID;?>,
  327. SNID: SID,
  328. SOSID: selected_A_socket.id,
  329. ENID: EID,
  330. SOEID: selected_B_socket.id,
  331. UID: <?=$UserID;?>,
  332. SID: '<?=$Session;?>'
  333. },
  334. success: function( response, opts ){
  335. var data = Ext.decode(response.responseText);
  336. if( data.status ){
  337. //reloadNetworkData( NID );
  338. netwodkData.edges.add( data.edge );
  339. } else {
  340. startCreateConnection();
  341. //alert( data.message );
  342. };
  343. Ext.getCmp('connectstarterbutton').toggle( false, false );
  344. },
  345. failure: function( response, opts ) {
  346. //Ext.fly('some_div').update('Fail!');
  347. }/*,
  348. callback: function(options,success,response){
  349. // use this if you need to perform your own success/failure checking
  350. }*/
  351. });
  352. };
  353. }
  354. }]
  355. });
  356. };
  357. loadNodeSockets( SID, A_socketsListStore );
  358. loadNodeSockets( EID, B_socketsListStore );
  359. addConnectionDialog.show();
  360. };
  361. function loadNodeProperties( NodeID ){
  362. //alert( 'Node: ' + NodeID );
  363. SelectedNodeID = NodeID;
  364. Ext.Ajax.request({
  365. url: '/lib/controller/getNetworkNodeProps.php',
  366. params: {
  367. NID: <?=$SiteID;?>,
  368. UID: <?=$UserID;?>,
  369. SID: '<?=$Session;?>',
  370. NODE: NodeID
  371. },
  372. success: function( response, opts ){
  373. // If the response is JSON, you have to decode it
  374. var data = Ext.decode(response.responseText);
  375. var tPanel = Ext.getCmp('prop_content');
  376. tPanel.remove(0);
  377. tPanel.add( data );
  378. tPanel.doLayout();
  379. },
  380. failure: failureAJAXFunction
  381. });
  382. };
  383. function loadServerProperties( NodeID ){
  384. Ext.Ajax.request({
  385. url: '/lib/controller/getNetworkServerProps.php',
  386. params: {
  387. NID: <?=$SiteID;?>,
  388. UID: <?=$UserID;?>,
  389. SID: '<?=$Session;?>',
  390. NODE: NodeID
  391. },
  392. success: function( response, opts ){
  393. var data = Ext.decode(response.responseText);
  394. var tPanel = Ext.getCmp('prop_content');
  395. tPanel.remove(0);
  396. tPanel.add( data );
  397. tPanel.doLayout();
  398. },
  399. failure: failureAJAXFunction
  400. });
  401. };
  402. var mp_FlyHunterWindow = null;
  403. function module_prop_FlyHunter( module_id ){
  404. if( mp_FlyHunterWindow == null ){
  405. mp_FlyHunterWindow = new Ext.Window({
  406. modal: true,
  407. title: '<?=$Labels->GetLabel("_FHM_PROPS_");?>',
  408. width: 773,
  409. height: 600,
  410. layout: 'table',
  411. closeAction: 'hide',
  412. flex: 1,
  413. defaults: {
  414. bodyStyle:'padding:20px'
  415. },
  416. layoutConfig: {
  417. // The total column count must be specified here
  418. columns: 2
  419. },
  420. items:[{
  421. html: 'Radio LINK UART Port'
  422. },{
  423. xtype: 'combo',
  424. editable: false,
  425. typeAhead: true,
  426. triggerAction: 'all',
  427. lazyRender:true,
  428. mode: 'local',
  429. store: new Ext.data.ArrayStore({
  430. id: 0,
  431. fields: ['myId', 'displayText' ],
  432. data: [ <?php
  433. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 ) AND site_id={$SiteID} ";
  434. $RR=$DATABASE->Query( $QS );
  435. if( count( $RR ) ){
  436. $RE=array();
  437. foreach( $RR as $R ){
  438. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  439. };
  440. echo implode( ',', $RE );
  441. } else {
  442. echo "[0, 'No UARTS DEFINED']";
  443. };
  444. ?>]
  445. }),
  446. valueField: 'myId',
  447. displayField: 'displayText'
  448. },{
  449. html: 'ChakaLaka DC Channel'
  450. },{
  451. xtype: 'combo',
  452. editable: false,
  453. typeAhead: true,
  454. triggerAction: 'all',
  455. lazyRender:true,
  456. mode: 'local',
  457. store: new Ext.data.ArrayStore({
  458. id: 1,
  459. fields: ['myId', 'displayText' ],
  460. data: [ <?php
  461. $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}";
  462. $RR=$DATABASE->Query( $QS );
  463. if( count( $RR ) ){
  464. $RE=array();
  465. foreach( $RR as $R ){
  466. $RE[] = "[ {$R['id']}, '{$R['serial_id']}_{$R['channel_id']}']";
  467. };
  468. echo implode( ',', $RE );
  469. } else {
  470. echo "[0, 'No DCB Connected']";
  471. };
  472. ?>]
  473. }),
  474. valueField: 'myId',
  475. displayField: 'displayText'
  476. }],
  477. bbar:[{
  478. text:'cancel'
  479. },{
  480. text:'submit'
  481. }]
  482. });
  483. };
  484. mp_FlyHunterWindow.show();
  485. Ext.Ajax.request({
  486. url: '/lib/controller/getModuleProps.php',
  487. params: {
  488. NID: <?=$SiteID;?>,
  489. UID: <?=$UserID;?>,
  490. SID: '<?=$Session;?>',
  491. MODULE: module_id
  492. },
  493. success: function( response, opts ){
  494. var data = Ext.decode(response.responseText);
  495. var tPanel = Ext.getCmp('prop_content');
  496. tPanel.remove(0);
  497. tPanel.add( data );
  498. tPanel.doLayout();
  499. },
  500. failure: function( response, opts ) {
  501. }
  502. });
  503. };
  504. function loadSystemEditor(){
  505. if( tlInterval!= null ){
  506. window.clearInterval( tlInterval );
  507. tlInterval = null;
  508. timelineObj = null;
  509. };
  510. var tPanel = Ext.getCmp('main_portal');
  511. tPanel.removeAll( true );
  512. Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel('_SYS_MAP_');?>' );
  513. tPanel.add({
  514. columnWidth: 0.83,
  515. frame: false,
  516. border: false,
  517. items: [{
  518. xtype: 'panel',
  519. layout: 'fit',
  520. layoutConfig: {
  521. align : 'stretch',
  522. pack : 'start'
  523. //padding:'5',
  524. //align:'middle'
  525. },
  526. height: PanelH-5,
  527. flex: 1,
  528. frame: false,
  529. border: false,
  530. items:{
  531. id: 'sys_map'
  532. },
  533. tbar: [{
  534. xtype: 'splitbutton',
  535. text: '<?=$Labels->GetLabel('_SMM_ADD_LSEN_');?>',
  536. split: true,
  537. enableToggle : undefined,
  538. menu : {
  539. items: [{
  540. text:'ALS',
  541. icon: '/style/assets/!cid_ii_jvmzuzrq10.png',
  542. handler: function(){
  543. createNode( 1 );
  544. }
  545. },{
  546. text:'LFS',
  547. icon: '/style/assets/!cid_ii_jvmzuzpt0.png',
  548. handler: function(){
  549. createNode( 2 );
  550. }
  551. },{
  552. text:'PLS-200',
  553. icon: '/style/assets/!cid_ii_jvmzuzql4.png',
  554. handler: function(){
  555. createNode( 3 );
  556. }
  557. },{
  558. text:'PLS-360',
  559. icon: '/style/assets/!cid_ii_jvmzuzr87.png',
  560. handler: function(){
  561. createNode( 4 );
  562. }
  563. },{
  564. text:'3DLIDAR',
  565. icon: '/style/assets/unnamed34.png',
  566. handler: function(){
  567. createNode( 5 );
  568. }
  569. }]
  570. }
  571. },{
  572. xtype: 'splitbutton',
  573. text: '<?=$Labels->GetLabel('_SMM_ADD_ADDIT_');?>',
  574. split: true,
  575. enableToggle : true,
  576. menu : {
  577. items: [{
  578. text:'Static Analog Camera',
  579. icon: '/style/assets/11_node.png',
  580. handler: function(){
  581. SelectedCamTYPE = 10;
  582. }
  583. },{
  584. text:'PTZ Analog Camera',
  585. icon: '/style/assets/12_node.png',
  586. handler: function(){
  587. SelectedCamTYPE = 11;
  588. }
  589. },{
  590. text:'Static IP Camera',
  591. icon: '/style/assets/11_node.png',
  592. handler: function(){
  593. SelectedCamTYPE = 12;
  594. addIpCam();
  595. }
  596. },{
  597. text:'PTZ IP Camera',
  598. icon: '/style/assets/12_node.png',
  599. handler: function(){
  600. SelectedCamTYPE = 13;
  601. addIpCam();
  602. }
  603. },{
  604. text:'DVR/Video Server/Streamer',
  605. icon: '/style/assets/videoServer.png',
  606. handler: function(){
  607. addMediaServer();
  608. }
  609. },{
  610. text:'Network Video Recorder',
  611. icon: '/style/assets/15_node.png'
  612. },{
  613. text:'Ethernet to UART transeiver',
  614. icon: '/style/assets/eth2uart.png',
  615. handler: function(){
  616. addEthernet2Uart();
  617. }
  618. },{
  619. text:'DC to Ethernet (ADAM)',
  620. icon: '/style/assets/adam-1.png',
  621. }]
  622. }
  623. },/*{
  624. xtype: 'button',
  625. id: 'connectstarterbutton',
  626. text: '<?=$Labels->GetLabel('_ADD_CONNECTION_');?>',
  627. enableToggle : undefined,
  628. handler: function(){
  629. if( InConnectEditMode ){
  630. Ext.getCmp('connectstarterbutton').toggle( false, false );
  631. InConnectEditMode = false;
  632. stopCreateConnection();
  633. } else {
  634. Ext.getCmp('connectstarterbutton').toggle( true, true );
  635. InConnectEditMode = true;
  636. startCreateConnection();
  637. };
  638. }
  639. }, */ {
  640. xtype: 'button',
  641. id: 'deletecomponentbutton',
  642. text: 'Remove Component',
  643. enableToggle: true,
  644. handler: function(){
  645. if( InComponentRemoveMode ){
  646. Ext.getCmp('deletecomponentbutton').toggle( false, false );
  647. InComponentRemoveMode = false;
  648. } else {
  649. Ext.getCmp('deletecomponentbutton').toggle( true, true );
  650. InComponentRemoveMode = true;
  651. };
  652. }
  653. }]
  654. }]
  655. });
  656. tPanel.add({
  657. title: '<?=$Labels->GetLabel('_PROPERTIES_');?>',
  658. xtype: 'panel',
  659. flex: 1,
  660. height: 700,
  661. //width: 210,
  662. columnWidth: 0.17,
  663. layout: 'fit',
  664. //frame: true,
  665. id: 'prop_content',
  666. // border: true
  667. items:{
  668. html: 'Select Item From Map'
  669. }
  670. });
  671. tPanel.doLayout();
  672. Ext.Ajax.request({
  673. url: '/lib/controller/getNetwork.php',
  674. params: {
  675. NID: SelectedSite,
  676. UID: <?=$UserID;?>,
  677. SID: '<?=$Session;?>'
  678. },
  679. success: function( response, opts ){
  680. // If the response is JSON, you have to decode it
  681. var data = Ext.decode(response.responseText);
  682. netwodkData.nodes = new vis.DataSet( data.nodes );
  683. netwodkData.edges = new vis.DataSet( data.edges );
  684. var container = document.getElementById(Ext.getCmp('sys_map').body.id);
  685. networkObj = new vis.Network(container, netwodkData, networkOpts );
  686. networkObj.on("click", function (params) {
  687. //if(!connectionAddMode){
  688. if( !InComponentRemoveMode ){
  689. if( params.nodes.length > 0 ){
  690. if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){
  691. loadServerProperties( params.nodes[0] );
  692. } else {
  693. loadNodeProperties( params.nodes[0] );
  694. };
  695. } else if( params.edges.length > 0 ){
  696. selectedConnection = netwodkData.edges.get(params.edges[0]);
  697. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  698. };
  699. } else {
  700. if( params.nodes.length > 0 ){
  701. if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){
  702. Ext.Msg.show({
  703. title:'Remove Server Component!',
  704. msg: 'You can not remove Server component!',
  705. buttons: Ext.Msg.OK,
  706. icon: Ext.MessageBox.INFO
  707. });
  708. } else {
  709. Ext.Msg.show({
  710. title:'Remove Component?',
  711. msg: 'You are about to remove.<br/>Are you sure to do so?',
  712. buttons: Ext.Msg.YESNOCANCEL,
  713. fn: function( result ){
  714. if( result=='yes' ){
  715. Ext.Ajax.request({
  716. url: '/lib/controller/removeNode.php',
  717. params: {
  718. SAID: <?=$SiteID;?>,
  719. NID: params.nodes[0],
  720. UID: <?=$UserID;?>,
  721. SID: '<?=$Session;?>'
  722. },
  723. success: function( response, opts ){
  724. var data = Ext.decode(response.responseText);
  725. if( data.sucess == false ){
  726. Ext.Msg.show({
  727. title:'Request Failure!',
  728. msg: data.error,
  729. buttons: Ext.Msg.OK,
  730. icon: Ext.MessageBox.INFO
  731. });
  732. } else {
  733. stopCreateConnection();
  734. InComponentRemoveMode = false;
  735. loadSystemEditor();
  736. };
  737. },
  738. failure: function( response, opts ) {
  739. Ext.Msg.show({
  740. title:'Request Failure!',
  741. msg: 'Ajax Request failed!',
  742. buttons: Ext.Msg.OK,
  743. icon: Ext.MessageBox.INFO
  744. });
  745. }
  746. });
  747. };
  748. },
  749. //animEl: 'elId',
  750. icon: Ext.MessageBox.QUESTION
  751. });
  752. };
  753. };
  754. };
  755. //};
  756. });
  757. /*
  758. networkObj.on("doubleClick", function (params) {
  759. //if(!connectionAddMode){
  760. if( !InComponentRemoveMode ){
  761. if( params.nodes.length > 0 ){
  762. loadNodeProperties( params.nodes[0] );
  763. } else if( params.edges.length > 0 ){
  764. selectedConnection = netwodkData.edges.get(params.edges[0]);
  765. loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to );
  766. };
  767. } else {
  768. alert( 'Remove' );
  769. };
  770. //};
  771. });
  772. */
  773. /*
  774. networkObj.on("dragStart", function (params) {
  775. if( connectionAddMode ){
  776. var tID = this.getNodeAt(params.pointer.DOM);
  777. if( tID != undefined ){
  778. newConnectionStart = tID;
  779. };
  780. };
  781. });
  782. networkObj.on("dragEnd", function (params) {
  783. if( connectionAddMode ){
  784. var tID = this.getNodeAt(params.pointer.DOM);
  785. if( tID != undefined ){
  786. newConnectionEnd = tID;
  787. //selectedConnection = netwodkData.edges[netwodkData.edges.length];
  788. //selectedConnection.color = {
  789. // color: '#ff0000',
  790. // opacity: 0.3,
  791. // highlight: 'blue'
  792. //};
  793. //networkObj.addEdgeMode(0);
  794. createConnection( newConnectionStart, newConnectionEnd );
  795. connectionAddMode = false;
  796. };
  797. };
  798. });
  799. */
  800. },
  801. failure: failureAJAXFunction
  802. });
  803. };