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.

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