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.

1110 lines
30 KiB

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