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.

892 lines
23 KiB

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