Web Interface For Lite Argus Control modules
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.

575 lines
15 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var addMediaServerDialog = null;
  3. function addMediaServer(){
  4. if( addMediaServerDialog == null ){
  5. addMediaServerDialog = new Ext.Window({
  6. modal: true,
  7. title: '<?=$Labels->GetLabel("_ADD_MEDIA_SERVER_");?>',
  8. width: 800,
  9. height: 600,
  10. layout: 'fit',
  11. closeAction: 'hide',
  12. items:{
  13. xtype: 'panel',
  14. html: 'KOKO'
  15. },bbar: [{
  16. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  17. handler: function(){
  18. addMediaServerDialog.hide();
  19. }
  20. },{
  21. id: 'con_to_src',
  22. text: '<?=$Labels->GetLabel("_ADD_");?>',
  23. disabled: false,
  24. handler: connectToSeleced
  25. }]
  26. });
  27. };
  28. addMediaServerDialog.show();
  29. };
  30. var embedVideoEncoderId = 0;
  31. function updateFramePreview(){
  32. var canvas = document.getElementById("eve_frame_preview");
  33. if( canvas != null ){
  34. var ctx = canvas.getContext("2d");
  35. ctx.beginPath();
  36. ctx.fillStyle = "#eeeeee";
  37. ctx.rect( 0, 0, 760, 400 );
  38. ctx.fill();
  39. ctx.closePath();
  40. var f_w = 320;
  41. var f_h = 240;
  42. var f_p = 0;
  43. var fsid = Ext.getCmp('FRM_SIZE').getValue();
  44. switch( fsid ){
  45. case 1: f_w = 640; f_h = 480; f_p = 0; break;
  46. case 2: f_w = 800; f_h = 600; f_p = 0; break;
  47. case 3: f_w = 1280; f_h = 720; f_p = 1; break;
  48. case 4: f_w = 1024; f_h = 768; f_p = 0; break;
  49. case 5: f_w = 1920; f_h = 1080; f_p = 1; break;
  50. };
  51. ctx.beginPath();
  52. ctx.fillStyle = "#000000";
  53. ctx.font = "20px Arial";
  54. ctx.textAlign = "center";
  55. ctx.textBaseline = "middle";
  56. ctx.fillText( f_w+'x'+f_h, 380, 10 );
  57. ctx.fill();
  58. ctx.fillStyle = "#0000FF";
  59. if( f_p ){
  60. var t_w = 16 * ( 360 / 9 );
  61. ctx.rect( (760-t_w)/2, 20, t_w, 360 );
  62. } else {
  63. var t_w = 4 * ( 360 / 3 );
  64. ctx.rect( (760-t_w)/2, 20, t_w, 360 );
  65. };
  66. ctx.fill();
  67. ctx.closePath();
  68. if( Ext.getCmp('eve_show_logo').getValue() ){
  69. var image = document.getElementById('eve_logo_img');
  70. if( image != null && image.complete && image.naturalHeight !== 0 ){
  71. var i_w = Ext.getCmp('LOGO_WIDTH').getValue();
  72. var i_h = Ext.getCmp('LOGO_HEIGHT').getValue();
  73. ctx.drawImage( image, 120, 120, i_w, i_h );
  74. };
  75. };
  76. };
  77. };
  78. async function uploadFile() {
  79. let formData = new FormData();
  80. formData.append("file", fileupload.files[0]);
  81. await fetch( '/upload.php', {
  82. method: "POST",
  83. body: formData
  84. });
  85. alert('The file has been uploaded successfully.');
  86. }
  87. function uploadEveLogo(){
  88. var img_upload = document.getElementById('eve_logo_upload');
  89. if( embedVideoEncoderId < 1 || img_upload == null || img_upload.files.length == 0 ) return;
  90. var llMask = new Ext.LoadMask( Ext.getCmp('eve_logo_ph').getEl(), {msg:"Please wait..."});
  91. llMask.show();
  92. var formData = new FormData();
  93. formData.append("file", img_upload.files[0]);
  94. formData.append("type", 'eve_logo');
  95. formData.append("id", embedVideoEncoderId );
  96. formData.append("UID", <?=$UserID;?> );
  97. formData.append("SID", '<?=$Session;?>' );
  98. fetch( '/lib/controller/uploadAsset.php', { method: 'POST', body: formData, credentials: 'same-origin' } )
  99. .then( function( r ){ return r.json(); } )
  100. .then( function( data ){
  101. llMask.hide();
  102. if( data.success ){
  103. var image = document.getElementById('eve_logo_img');
  104. if( image ){
  105. image.onload = updateFramePreview;
  106. image.src = data.url;
  107. };
  108. // first upload: propose the picture size, kept inside 256x256
  109. var lw = Ext.getCmp('LOGO_WIDTH'), lh = Ext.getCmp('LOGO_HEIGHT');
  110. if( lw && lh && ( !lw.getValue() || !lh.getValue() ) ){
  111. var k = Math.min( 1, 256 / Math.max( data.width, data.height ) );
  112. lw.setValue( Math.round( data.width * k ) );
  113. lh.setValue( Math.round( data.height * k ) );
  114. };
  115. } else {
  116. Ext.Msg.show({ title: "<?=$Labels->GetLabel('_ERROR_MSG_');?>", msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR });
  117. };
  118. })
  119. .catch( function( e ){
  120. llMask.hide();
  121. Ext.Msg.show({ title: "<?=$Labels->GetLabel('_ERROR_MSG_');?>", msg: String( e ), buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR });
  122. });
  123. };
  124. var moduleSettingsEditorWindow = null;
  125. function showModuleSettingsEditor( ModuleID ){
  126. if( moduleSettingsEditorWindow == null ){
  127. moduleSettingsEditorWindow = new Ext.Window({
  128. modal: true,
  129. id: 'mo_se_ed_wi',
  130. title: '',
  131. width: 792,
  132. height: 700,
  133. layout: 'fit',
  134. closeAction: 'hide',
  135. resizable: false,
  136. items:[],
  137. buttons: [{
  138. id: 'mo_se_ed_save',
  139. text: "<?=$Labels->GetLabel('_SAVE_');?>",
  140. hidden: true,
  141. handler: function(){
  142. var c = Ext.getCmp('mod_set_content');
  143. if( c && typeof c.saveSettings == 'function' ) c.saveSettings();
  144. }
  145. },{
  146. text: "<?=$Labels->GetLabel('_CLOSE_');?>",
  147. handler: function(){
  148. moduleSettingsEditorWindow.hide();
  149. }
  150. }]
  151. });
  152. };
  153. embedVideoEncoderId = ModuleID;
  154. Ext.getCmp('mo_se_ed_save').hide();
  155. moduleSettingsEditorWindow.show();
  156. Ext.Ajax.request({
  157. url: '/lib/controller/getModuleSettings.php',
  158. params: {
  159. MID: ModuleID,
  160. UID: <?=$UserID;?>,
  161. SID: '<?=$Session;?>',
  162. },
  163. success: function( response, opts ){
  164. var data = Ext.decode( response.responseText );
  165. if( data.status = 'ok' ){
  166. moduleSettingsEditorWindow.setTitle( data.wTitle );
  167. moduleSettingsEditorWindow.removeAll( true );
  168. moduleSettingsEditorWindow.add( data );
  169. moduleSettingsEditorWindow.doLayout();
  170. Ext.getCmp('mo_se_ed_save').setVisible( typeof data.saveSettings == 'function' );
  171. } else {
  172. moduleSettingsEditorWindow.close();
  173. moduleSettingsEditorWindow = null;
  174. Ext.Msg.show({
  175. title: "<?=$Labels->GetLabel('_ERROR_MSG_');?>",
  176. msg: data.msg,
  177. buttons: Ext.Msg.OK,
  178. fn: function(){
  179. //SettingsLidar3D.hide();
  180. },
  181. icon: Ext.MessageBox.ERROR
  182. });
  183. };
  184. },
  185. failure: failureAJAXFunction
  186. });
  187. };
  188. /*
  189. function embedVideoEncoderSettings( ModuleID ){
  190. if( embedVideoEncoderSettingsWindow == null ){
  191. embedVideoEncoderSettingsWindow = new Ext.Window({
  192. modal: true,
  193. title: '<?=$Labels->GetLabel('_EMBED_VIDEO_ENCODER_');?>',
  194. width: 792,
  195. height: 700,
  196. layout: 'fit',
  197. closeAction: 'hide',
  198. resizable: false,
  199. items:[{
  200. layout: 'table',
  201. border: false,
  202. frame: false,
  203. autoScroll: true,
  204. defaults: {
  205. bodyStyle:'padding: 0px',
  206. border: false,
  207. },
  208. layoutConfig: {
  209. columns: 4
  210. },
  211. items:[{
  212. id: 'eve_frm_prev',
  213. html: '<canvas id="eve_frame_preview" width="760" height="400" style="background: #eeeeee; display: block; margin: 0 auto;"></canvas>',
  214. height: 400,
  215. width: 760,
  216. border: true,
  217. colspan: 4
  218. },{
  219. html: '<p><?=$Labels->GetLabel('_OUTPUT_FRAME_SIZE_');?>:</p>'
  220. },{
  221. xtype: 'combo',
  222. id: 'FRM_SIZE',
  223. width: 120,
  224. typeAhead: true,
  225. triggerAction: 'all',
  226. lazyRender:true,
  227. mode: 'local',
  228. store: new Ext.data.ArrayStore({
  229. id: 0,
  230. fields: [ 'szId', 'szText' ],
  231. data: [
  232. [0, '320x240'],
  233. [1, '640x480'],
  234. [2, '800x600'],
  235. [3, '1280x720'],
  236. [4, '1024x768'],
  237. [5, '1920x1080']
  238. ]
  239. }),
  240. valueField: 'szId',
  241. displayField: 'szText',
  242. value: 0,
  243. listeners:{
  244. beforeselect: updateFramePreview,
  245. //blur: updateFramePreview,
  246. change: updateFramePreview
  247. }
  248. },{
  249. html: '<p><?=$Labels->GetLabel('_EVE_COMPRESS_QUA_');?>:</p>'
  250. },{
  251. xtype: 'slider',
  252. id: 'COMP_QUAL',
  253. width: 120,
  254. minValue: 0,
  255. maxValue: 100,
  256. value: 70
  257. },{
  258. html: '<p><?=$Labels->GetLabel('_EVE_SHOW_TS_');?>:</p>'
  259. },{
  260. xtype: 'checkbox',
  261. id: 'eve_show_ts',
  262. value: 0,
  263. handler: updateFramePreview
  264. },{
  265. html: '<p><?=$Labels->GetLabel('_EVE_TS_POSX_');?>:</p>'
  266. },{
  267. xtype: 'slider',
  268. id: 'TS_POSX',
  269. width: 120,
  270. minValue: 0,
  271. maxValue: 100,
  272. value: 1.0
  273. },{
  274. html: '<p><?=$Labels->GetLabel('_EVE_TS_POSY_');?>:</p>'
  275. },{
  276. xtype: 'slider',
  277. id: 'TS_POSY',
  278. width: 120,
  279. minValue: 0,
  280. maxValue: 100,
  281. value: 1.0
  282. },{
  283. html: '<p><?=$Labels->GetLabel('_EVE_TRANSO_TS_');?>:</p>'
  284. },{
  285. xtype: 'checkbox',
  286. id: 'eve_transp_ts',
  287. value: 0
  288. },{
  289. html: '<p><?=$Labels->GetLabel('_EVE_FONT_TS_');?>:</p>'
  290. },{
  291. xtype: 'combo',
  292. id: 'TS_FONT',
  293. width: 120,
  294. typeAhead: true,
  295. triggerAction: 'all',
  296. lazyRender:true,
  297. mode: 'local',
  298. store: new Ext.data.ArrayStore({
  299. id: 0,
  300. fields: [ 'szId', 'szText' ],
  301. data: [
  302. [0, 'SIMPLEX'],
  303. [1, 'PLAIN'],
  304. [2, 'DUPLEX'],
  305. [3, 'COMPLEX'],
  306. [4, 'TRIPLEX'],
  307. [5, 'COMPLEX_SMALL'],
  308. [6, 'SCRIPT_SIMPLEX'],
  309. [7, 'SCRIPT_COMPLEX']
  310. ]
  311. }),
  312. valueField: 'szId',
  313. displayField: 'szText',
  314. value: 0
  315. },{
  316. html: '<p><?=$Labels->GetLabel('_EVE_TS_FSCALE_');?>:</p>'
  317. },{
  318. xtype: 'slider',
  319. id: 'TS_FSCALE',
  320. width: 120,
  321. minValue: 0.0,
  322. maxValue: 4.0,
  323. value: 1.0
  324. },{
  325. html: '<p><?=$Labels->GetLabel('_EVE_TS_FTHICK_');?>:</p>'
  326. },{
  327. xtype: 'slider',
  328. id: 'TS_FTHICK',
  329. width: 120,
  330. minValue: 1,
  331. maxValue: 8.0,
  332. value: 1.0
  333. },{
  334. html: '<p><?=$Labels->GetLabel('_EVE_TS_LINE_T_');?>:</p>'
  335. },{
  336. xtype: 'combo',
  337. id: 'TS_LINET',
  338. width: 120,
  339. typeAhead: true,
  340. triggerAction: 'all',
  341. lazyRender:true,
  342. mode: 'local',
  343. store: new Ext.data.ArrayStore({
  344. id: 0,
  345. fields: [ 'szId', 'szText' ],
  346. data: [
  347. [0, 'THIN'],
  348. [1, 'ANTIALIAZED'],
  349. [2, 'THICK']
  350. ]
  351. }),
  352. valueField: 'szId',
  353. displayField: 'szText',
  354. value: 0
  355. },{
  356. html: '<p><?=$Labels->GetLabel('_EVE_SHOW_LBL_');?>:</p>'
  357. },{
  358. xtype: 'checkbox',
  359. id: 'eve_show_lbl',
  360. value: 0,
  361. handler: updateFramePreview
  362. },{
  363. html: '<p><?=$Labels->GetLabel('_EVE_LBL_POSX_');?>:</p>'
  364. },{
  365. xtype: 'slider',
  366. id: 'LBL_POSX',
  367. width: 120,
  368. minValue: 0,
  369. maxValue: 100,
  370. value: 1.0
  371. },{
  372. html: '<p><?=$Labels->GetLabel('_EVE_LBL_POSY_');?>:</p>'
  373. },{
  374. xtype: 'slider',
  375. id: 'LBL_POSY',
  376. width: 120,
  377. minValue: 0,
  378. maxValue: 100,
  379. value: 1.0
  380. },{
  381. html: '<p><?=$Labels->GetLabel('_EVE_TRANSO_LBL_');?>:</p>'
  382. },{
  383. xtype: 'checkbox',
  384. id: 'eve_transp_lbl',
  385. value: 0
  386. },{
  387. html: '<p><?=$Labels->GetLabel('_EVE_FONT_LBL_');?>:</p>'
  388. },{
  389. xtype: 'combo',
  390. id: 'LBL_FONT',
  391. width: 120,
  392. typeAhead: true,
  393. triggerAction: 'all',
  394. lazyRender:true,
  395. mode: 'local',
  396. store: new Ext.data.ArrayStore({
  397. id: 0,
  398. fields: [ 'szId', 'szText' ],
  399. data: [
  400. [0, 'SIMPLEX'],
  401. [1, 'PLAIN'],
  402. [2, 'DUPLEX'],
  403. [3, 'COMPLEX'],
  404. [4, 'TRIPLEX'],
  405. [5, 'COMPLEX_SMALL'],
  406. [6, 'SCRIPT_SIMPLEX'],
  407. [7, 'SCRIPT_COMPLEX']
  408. ]
  409. }),
  410. valueField: 'szId',
  411. displayField: 'szText',
  412. value: 0
  413. },{
  414. html: '<p><?=$Labels->GetLabel('_EVE_LBL_FSCALE_');?>:</p>'
  415. },{
  416. xtype: 'slider',
  417. id: 'LBL_FSCALE',
  418. width: 120,
  419. minValue: 0.0,
  420. maxValue: 4.0,
  421. value: 1.0
  422. },{
  423. html: '<p><?=$Labels->GetLabel('_EVE_LBL_FTHICK_');?>:</p>'
  424. },{
  425. xtype: 'slider',
  426. id: 'LBL_FTHICK',
  427. width: 120,
  428. minValue: 1,
  429. maxValue: 8.0,
  430. value: 1.0
  431. },{
  432. html: '<p><?=$Labels->GetLabel('_EVE_LBL_LINE_T_');?>:</p>'
  433. },{
  434. xtype: 'combo',
  435. id: 'LBL_LINET',
  436. width: 120,
  437. typeAhead: true,
  438. triggerAction: 'all',
  439. lazyRender:true,
  440. mode: 'local',
  441. store: new Ext.data.ArrayStore({
  442. id: 0,
  443. fields: [ 'szId', 'szText' ],
  444. data: [
  445. [0, 'THIN'],
  446. [1, 'ANTIALIAZED'],
  447. [2, 'THICK']
  448. ]
  449. }),
  450. valueField: 'szId',
  451. displayField: 'szText',
  452. value: 0
  453. },{
  454. html: '<p><?=$Labels->GetLabel('_EVE_SHOW_LOGO_');?>:</p>'
  455. },{
  456. xtype: 'checkbox',
  457. id: 'eve_show_logo',
  458. value: 0,
  459. handler: updateFramePreview
  460. },{
  461. html: '<p><?=$Labels->GetLabel('_EVE_LOGO_POSX_');?>:</p>'
  462. },{
  463. xtype: 'slider',
  464. id: 'LOGO_POSX',
  465. width: 120,
  466. minValue: 0,
  467. maxValue: 100,
  468. value: 1.0
  469. },{
  470. html: '<p><?=$Labels->GetLabel('_EVE_LOGO_POSY_');?>:</p>'
  471. },{
  472. xtype: 'slider',
  473. id: 'LOGO_POSY',
  474. width: 120,
  475. minValue: 0,
  476. maxValue: 100,
  477. value: 1.0
  478. },{
  479. html: '<p><?=$Labels->GetLabel('_EVE_LOGO_WIDTH_');?>:</p>'
  480. },{
  481. xtype: 'numberfield',
  482. id: 'LOGO_WIDTH',
  483. width: 120,
  484. minValue: 0,
  485. maxValue: 256,
  486. value: 1.0
  487. },{
  488. html: '<p><?=$Labels->GetLabel('_EVE_LOGO_HEIGHT_');?>:</p>'
  489. },{
  490. xtype: 'numberfield',
  491. id: 'LOGO_HEIGHT',
  492. width: 120,
  493. minValue: 0,
  494. maxValue: 256,
  495. value: 1.0
  496. },{
  497. id: 'eve_logo_ph',
  498. html: '<center><img width="100px" id="eve_logo_img" src="/lib/controller/data/assets/images/7shields.png"></center>'
  499. },{
  500. html: '<input id="eve_logo_upload" style="width: 120px;" type="file" onchange="uploadEveLogo();"/>'
  501. },{
  502. html: '<p><?=$Labels->GetLabel('_EVE_PORT_');?>:</p>'
  503. },{
  504. xtype: 'numberfield',
  505. id: 'WA_PORT',
  506. width: 120,
  507. minValue: 1000,
  508. maxValue: 65535,
  509. value: 8080
  510. }]
  511. }],
  512. bbar: [{
  513. text: '<?=$Labels->GetLabel("_CANCEL_");?>',
  514. handler: function(){
  515. embedVideoEncoderSettingsWindow.hide();
  516. }
  517. },{
  518. id: 'con_to_src',
  519. text: '<?=$Labels->GetLabel("_OK_");?>',
  520. disabled: false,
  521. handler: function(){
  522. }
  523. }]
  524. });
  525. };
  526. embedVideoEncoderSettingsWindow.show();
  527. updateFramePreview();
  528. /*
  529. Ext.Ajax.request({
  530. url: '/lib/controller/getModuleSettings.php',
  531. params: {
  532. MID: ModuleID,
  533. UID: <?=$UserID;?>,
  534. SID: '<?=$Session;?>',
  535. },
  536. success: function( response, opts ){
  537. var data = Ext.decode( response.responseText );
  538. if( data.error = false ){
  539. embedVideoEncoderSettingsWindow.show();
  540. Ext.getCmp('setting_master_ip').setValue( data.ip_address );
  541. Ext.getCmp('setting_master_port').setValue( data.port );
  542. Ext.getCmp('setting_slave_ip').setValue( data.aux_ip_address );
  543. Ext.getCmp('setting_slave_port').setValue( data.aux_port );
  544. Ext.getCmp('setting_lat').setValue( data.lat );
  545. Ext.getCmp('setting_lon').setValue( data.lon );
  546. Ext.getCmp('setting_alt').setValue( data.alt );
  547. Ext.getCmp('setting_roll').setValue( data.roll );
  548. Ext.getCmp('setting_pitch').setValue( data.pitch );
  549. Ext.getCmp('setting_yaw').setValue( data.yaw );
  550. } else {
  551. Ext.Msg.show({
  552. title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
  553. msg: data.error_message,
  554. buttons: Ext.Msg.OK,
  555. fn: function(){
  556. //SettingsLidar3D.hide();
  557. },
  558. icon: Ext.MessageBox.ERROR
  559. });
  560. };
  561. },
  562. failure: failureAJAXFunction
  563. });
  564. * /
  565. };*/