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.

1022 lines
27 KiB

​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
​
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $EID = intval( $_POST['MID'] );
  5. $QS = "SELECT * FROM modules WHERE id = {$EID}";
  6. $Result = $DATABASE->Query( $QS, false );
  7. if( count( $Result ) ){
  8. $CR = $Result[0];
  9. switch( $CR['type'] ){
  10. case 1: //DCB USB
  11. break;
  12. case 2: //Kafka
  13. $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
  14. $II = $DATABASE->Query( $QS );
  15. $CI = $II[0];
  16. $R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'<img title="SSL Encription" src="/style/icons/icons/rosette.png">':'<img title="NO Encription" src="/style/icons/icons/flag_green.png">');
  17. $USSL = (intval($CI['use_ssl'])>0)?'true':'false';
  18. $TPL =<<<EFUFU
  19. {
  20. xtype: 'tabpanel',
  21. activeTab: 0,
  22. id: 'mod_set_content',
  23. saveSettings: function(){
  24. var adr = Ext.getCmp('b_address').getValue();
  25. var port = Ext.getCmp('b_port').getValue();
  26. var ussl = Ext.getCmp('b_ssl').getValue();
  27. var uan = Ext.getCmp('b_user').getValue();
  28. var uap = Ext.getCmp('b_password').getValue();
  29. Ext.Ajax.request({
  30. url: '/lib/controller/updateServerModuleSettings.php',
  31. params: {
  32. MID: {$EID},
  33. UID: {$UserID},
  34. SID: '{$Session}',
  35. ADDR: adr,
  36. PORT: port,
  37. SSL: ussl,
  38. UNAM: uan,
  39. UPWD: uap
  40. },
  41. success: function( response, opts ){
  42. var data = Ext.decode(response.responseText);
  43. if( data.success == true ) {
  44. moduleSettingsEditorWindow.hide();
  45. showSettings( SelectedNodeID, 2 );
  46. } else {
  47. Ext.Msg.show({
  48. title:'{$Labels->GetLabel("_ERROR_MSG_")}',
  49. msg: data['msg'],
  50. buttons: Ext.Msg.OK,
  51. fn: function(){
  52. SettingsLidar3D.hide();
  53. },
  54. icon: Ext.MessageBox.ERROR
  55. });
  56. };
  57. },
  58. failure: failureAJAXFunction
  59. });
  60. },
  61. items:[{
  62. xtype: 'form',
  63. id: 'ks_fp_ms',
  64. title: '{$Labels->GetLabel('_KAFKA_BROKER_')}',
  65. labelWidth: 480,
  66. labelAlign: 'right',
  67. border: false,
  68. frame: false,
  69. items:[{
  70. xtype: 'spacer',
  71. height: 10
  72. },{
  73. xtype: 'textfield',
  74. id: 'b_address',
  75. fieldLabel: 'Broker Address',
  76. value: '{$CI['brocker_address']}'
  77. },{
  78. xtype: 'numberfield',
  79. id: 'b_port',
  80. fieldLabel: 'Broker Port',
  81. value: {$CI['brocker_port']}
  82. },{
  83. xtype: 'checkbox',
  84. id: 'b_ssl',
  85. fieldLabel: 'Use SSL',
  86. checked: {$USSL}
  87. },{
  88. xtype: 'button',
  89. id: 'cl_cert_select',
  90. fieldLabel: 'CA Root certificate to verify the broker\'s certificate [truststore]',
  91. text: 'Upload New',
  92. handler: function(){
  93. currentSelectedFile = 1;
  94. }
  95. },{
  96. xtype: 'button',
  97. id: 'ca_cert_select',
  98. fieldLabel: 'Client\'s certificate [keystore]',
  99. text: 'Upload New',
  100. handler: function(){
  101. currentSelectedFile = 1;
  102. }
  103. },{
  104. xtype: 'button',
  105. id: 'cl_key_select',
  106. fieldLabel: 'Client\'s key [key]',
  107. text: 'Upload New',
  108. handler: function(){
  109. currentSelectedFile = 1;
  110. }
  111. },{
  112. xtype: 'textfield',
  113. fieldLabel: 'Access Username',
  114. id: 'b_user',
  115. value: '{$CI['cred_username']}'
  116. },{
  117. xtype: 'textfield',
  118. fieldLabel: 'Access Password',
  119. id: 'b_password',
  120. value: '{$CI['cred_password']}'
  121. },{
  122. xtype: 'panel',
  123. id: 'validator',
  124. html: '<p>%%%VALIDATION%%%</p>'
  125. }]
  126. },{
  127. title: '{$Labels->GetLabel('_KAFKA_TOP_EVTS_')}',
  128. html: ''
  129. }],
  130. listeners:{
  131. afterrender: function(){
  132. var currentSelectedFile = 0;
  133. var up_ca = new plupload.Uploader({
  134. runtimes : 'html5,html4',
  135. browse_button : Ext.getDom('ca_cert_select'),
  136. max_file_size : '256kb',
  137. chunk_size: '10kb',
  138. max_retries: 0,
  139. multi_selection: false,
  140. max_file_count: 1,
  141. url: '/lib/controller/uploadModuleKafkaData.php',
  142. filters : [
  143. {title : "Certificate files", extensions : "pem,crt,cert,jks"}
  144. ],
  145. init: {
  146. PostInit: function() {
  147. },
  148. FilesAdded: function( up, files ) {
  149. up_ca.start();
  150. },
  151. UploadProgress: function(up, file) {
  152. if( file.percent == 100 ){
  153. alert('Umpalumpa');
  154. };
  155. },
  156. Error: function(up, err) {
  157. Ext.Msg.show({
  158. title:'Upload Status',
  159. msg: "Error #" + err.code + ": " + err.message,
  160. buttons: Ext.Msg.OK,
  161. icon: Ext.MessageBox.ERROR
  162. });
  163. }
  164. }
  165. });
  166. var up_crt = new plupload.Uploader({
  167. runtimes : 'html5,html4',
  168. browse_button : Ext.getDom('cl_cert_select'),
  169. max_file_size : '256kb',
  170. chunk_size: '10kb',
  171. max_retries: 0,
  172. multi_selection: false,
  173. max_file_count: 1,
  174. url: '/lib/controller/uploadModuleKafkaData.php',
  175. filters : [
  176. {title : "Certificate files", extensions : "pem,crt,cert,jks"}
  177. ],
  178. init: {
  179. PostInit: function() {
  180. },
  181. FilesAdded: function( up, files ) {
  182. up_crt.start();
  183. },
  184. UploadProgress: function(up, file) {
  185. if( file.percent == 100 ){
  186. alert('Umpalumpa');
  187. };
  188. },
  189. Error: function(up, err) {
  190. Ext.Msg.show({
  191. title:'Upload Status',
  192. msg: "Error #" + err.code + ": " + err.message,
  193. buttons: Ext.Msg.OK,
  194. icon: Ext.MessageBox.ERROR
  195. });
  196. }
  197. }
  198. });
  199. var up_key = new plupload.Uploader({
  200. runtimes : 'html5,html4',
  201. browse_button : Ext.getDom('cl_key_select'),
  202. max_file_size : '256kb',
  203. chunk_size: '10kb',
  204. max_retries: 0,
  205. multi_selection: false,
  206. max_file_count: 1,
  207. url: '/lib/controller/uploadModuleKafkaData.php',
  208. filters : [
  209. {title : "Certificate files", extensions : "pem,crt,cert,jks"}
  210. ],
  211. init: {
  212. PostInit: function() {
  213. },
  214. FilesAdded: function( up, files ) {
  215. up_key.start();
  216. },
  217. UploadProgress: function(up, file) {
  218. if( file.percent == 100 ){
  219. alert('Umpalumpa');
  220. };
  221. },
  222. Error: function(up, err) {
  223. Ext.Msg.show({
  224. title:'Upload Status',
  225. msg: "Error #" + err.code + ": " + err.message,
  226. buttons: Ext.Msg.OK,
  227. icon: Ext.MessageBox.ERROR
  228. });
  229. }
  230. }
  231. });
  232. up_ca.init();
  233. up_crt.init();
  234. up_key.init();
  235. }
  236. },
  237. status: 'ok',
  238. wTitle: '{$Labels->GetLabel('_KAFKA_DESC_SHO_')}'
  239. }
  240. EFUFU;
  241. function CTS2UTS( $KAKA ){
  242. $parsed = date_parse_from_format( "M d H:i:s Y T", $KAKA );
  243. return mktime(
  244. $parsed['hour'],
  245. $parsed['minute'],
  246. $parsed['second'],
  247. $parsed['month'],
  248. $parsed['day'],
  249. $parsed['year']
  250. );
  251. };
  252. // Validate
  253. $BPath = './data/modules/VAULT/'.$CI['vault_md5'].'/';
  254. $CAValid = false;
  255. $PUValid = false;
  256. $PRValid = false;
  257. $PUMD5 = false;
  258. $PRMD5 = false;
  259. $ValidationOutput = "<div class=\"yellow-tag\">Vault ID: {$CI['vault_md5']}</div>";
  260. if( file_exists( $BPath.$CI['vault_md5'].'.CA.pem' ) ){
  261. $CMD = "openssl x509 -in {$BPath}{$CI['vault_md5']}.CA.pem -passin pass:{$CI['cred_password']} -noout -text 2>&1";
  262. $ININ = `$CMD`;
  263. $TArr = explode( "\n", $ININ );
  264. $CAValid = true;
  265. foreach( $TArr as $T ){
  266. $CL = trim( $T );
  267. if( stripos( $CL, 'Not Before' ) !== false ){
  268. if( time() < CTS2UTS( trim( substr( $CL, 11 ) ) ) ) $CAValid = false;
  269. };
  270. if( stripos( $CL, 'Not After' ) !== false ){
  271. if( time() > CTS2UTS( trim( substr( $CL, 11 ) ) ) ) $CAValid = false;
  272. };
  273. if( stripos( $CL, 'CA:FALSE' ) !== false ) $CAValid = false;
  274. };
  275. if( $CAValid ){
  276. $ValidationOutput .= "<div class=\"green-tag\">Root CA Certificate is Valid</div>";
  277. } else {
  278. $ValidationOutput .= "<div class=\"red-tag\">Root CA Certificate is Invalid!</div>";
  279. };
  280. } else {
  281. $ValidationOutput .= "<div class=\"yellow-tag\">Root CA Certificate is not present!<br/>[it\'s OK if the system uses Real Certs(not Self Signed)]</div>";
  282. };
  283. if( file_exists( $BPath.$CI['vault_md5'].'.key' ) ){
  284. $CMD = "openssl rsa -check -noout -in {$BPath}{$CI['vault_md5']}.key -passin pass:{$CI['cred_password']} 2>&1";
  285. $ChKey = trim( `$CMD` );
  286. if( stripos( $ChKey, 'RSA key ok' ) !== false ){
  287. $CMD = "openssl rsa -modulus -noout -in {$BPath}{$CI['vault_md5']}.key -passin pass:{$CI['cred_password']}";
  288. $PRMD5 = md5( trim( `$CMD` ) );
  289. $PRValid = true;
  290. };
  291. } else {
  292. $ValidationOutput .= "<div class=\"red-tag\">No Private Key is Set!</div>";
  293. };
  294. if( file_exists( $BPath.$CI['vault_md5'].'.CERT.pem' ) ){
  295. $CMD = "openssl x509 -modulus -noout -in {$BPath}{$CI['vault_md5']}.CERT.pem -passin pass:{$CI['cred_password']} 2>&1";
  296. $ChKey = trim( `$CMD` );
  297. if( stripos( $ChKey, 'RSA key ok' ) === false ){
  298. $CMD = "openssl x509 -modulus -noout -in {$BPath}{$CI['vault_md5']}.CERT.pem -passin pass:{$CI['cred_password']}";
  299. $PUMD5 = md5( trim( `$CMD` ) );
  300. $PUValid = true;
  301. };
  302. } else {
  303. $ValidationOutput .= "<div class=\"red-tag\">No Public Key Certificate is Set!</div>";
  304. };
  305. if( $PRValid && $PUValid ){
  306. if( $PUMD5 == $PRMD5 ){
  307. $ValidationOutput .= "<div class=\"green-tag\">Public Key Certificate is Matched With Private Key</div>";
  308. } else {
  309. $ValidationOutput .= "<div class=\"red-tag\">Public Key Certificate is Not Matched With Private Key!<br/>{$PUMD5}::{$PRMD5}</div>";
  310. };
  311. } else {
  312. $ValidationOutput .= "<div class=\"yellow-tag\">Private/Public Key Can not be checked!</div>";
  313. };
  314. $TPL = str_replace( '%%%VALIDATION%%%', $ValidationOutput, $TPL );
  315. echo $TPL;
  316. break;
  317. case 6: // SSDP
  318. $TPL =<<<EFUFU
  319. {
  320. xtype: 'form',
  321. labelAlign: 'right',
  322. autoScroll: 'auto',
  323. labelWidth: 120,
  324. items:[{
  325. border: false,
  326. frame: false,
  327. xtype: 'panel',
  328. html: '<table width="100%" border=0 class="setEd_infoPanel" id="SSDP"><tr><td width="65px"><img width="64px" src="/style/assets/upnp.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
  329. },{
  330. xtype: 'spacer',
  331. height: 5
  332. },{
  333. border: false,
  334. frame: false,
  335. xtype: 'panel',
  336. html: '<table width="100%" border=0 class="setEd_infoPanel" id="SSDP"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>'
  337. },{
  338. xtype: 'spacer',
  339. height: 5
  340. },{
  341. xtype: 'combo',
  342. fieldLabel: 'Module Status',
  343. id: 'mod_ena',
  344. lazyRender:true,
  345. mode: 'local',
  346. forceSelection: true,
  347. triggerAction: 'all',
  348. editable: false,
  349. disableKeyFilter: true,
  350. store: new Ext.data.ArrayStore({
  351. fields: ['status_val','status_txt'],
  352. data: [[0,'Disabled'],[1,'Enabled']]
  353. }),
  354. value: %%%ENA_VAL%%%,
  355. valueField: 'status_val',
  356. displayField: 'status_txt',
  357. listeners:{
  358. select: function( t, r, i ){
  359. if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID});
  360. }
  361. }
  362. },{
  363. xtype: 'spacer',
  364. height: 5
  365. },{
  366. xtype: 'button',
  367. id: 'mo_del_btn',
  368. disabled: false,
  369. width: '100%',
  370. text: 'Remove Module',
  371. handler: function(){
  372. removeModule({$EID});
  373. }
  374. }]
  375. }
  376. EFUFU;
  377. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL );
  378. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL );
  379. $TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL );
  380. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  381. echo $TPL;
  382. break;
  383. case 7: // Onvif
  384. $TPL =<<<EFUFU
  385. {
  386. xtype: 'form',
  387. labelAlign: 'right',
  388. autoScroll: 'auto',
  389. labelWidth: 120,
  390. items:[{
  391. border: false,
  392. frame: false,
  393. xtype: 'panel',
  394. html: '<table width="100%" border=0 class="setEd_infoPanel" id="ONVIF"><tr><td width="65px"><img width="64px" src="/style/assets/onvif.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
  395. },{
  396. xtype: 'spacer',
  397. height: 5
  398. },{
  399. border: false,
  400. frame: false,
  401. xtype: 'panel',
  402. html: '<table width="100%" border=0 class="setEd_infoPanel" id="ONVIF"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>'
  403. },{
  404. xtype: 'spacer',
  405. height: 5
  406. },{
  407. xtype: 'combo',
  408. fieldLabel: 'Module Status',
  409. id: 'mod_ena',
  410. lazyRender:true,
  411. mode: 'local',
  412. forceSelection: true,
  413. triggerAction: 'all',
  414. editable: false,
  415. disableKeyFilter: true,
  416. store: {
  417. xtype: 'arraystore',
  418. fields: ['status_val','status_txt'],
  419. data: [[0,'Disabled'],[1,'Enabled']]
  420. },
  421. value: %%%ENA_VAL%%%,
  422. valueField: 'status_val',
  423. displayField: 'status_txt',
  424. listeners:{
  425. select: function( t, r, i ){
  426. if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID});
  427. }
  428. }
  429. },{
  430. xtype: 'spacer',
  431. height: 5
  432. },{
  433. xtype: 'button',
  434. id: 'mo_del_btn',
  435. disabled: false,
  436. width: '100%',
  437. text: 'Remove Module',
  438. handler: function(){
  439. removeModule({$EID});
  440. }
  441. }]
  442. }
  443. EFUFU;
  444. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL );
  445. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL );
  446. $TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL );
  447. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  448. echo $TPL;
  449. break;
  450. case 8://Embed Video Encoder
  451. $QS="SELECT * FROM `module_eve` WHERE `id`={$CR['aux_id']}";
  452. $II = $DATABASE->Query( $QS );
  453. $CI = $II[0];
  454. $TS = array( '320x240', '640x480', '800x600', '1280x720', '1024x768', '1920x1080' );
  455. $YY = $CI['width'].'x'.$CI['height'];
  456. for( $i=0; $i<count( $TS ); $i++ ) if( $TS[$i] == $YY ) break;
  457. $CSID =($i==count($TS))?0:$i;
  458. $TPL =<<<EFUFU
  459. {
  460. xtype: 'tabpanel',
  461. activeTab: 0,
  462. id: 'mod_set_content',
  463. saveSettings: function(){
  464. var sz = Ext.getCmp('FRM_SIZE').getValue();
  465. var prt = Ext.getCmp('WA_PORT').getValue();
  466. var cq = Ext.getCmp('COMP_QUAL').getValue();
  467. var shts = Ext.getCmp('eve_show_ts').getValue();
  468. var shlb = Ext.getCmp('eve_show_lbl').getValue();
  469. var shlo = Ext.getCmp('eve_show_logo').getValue();
  470. var tspx = Ext.getCmp('TS_POSX').getValue();
  471. var tspy = Ext.getCmp('TS_POSY').getValue();
  472. var tsts = Ext.getCmp('eve_transp_ts').getValue();
  473. var tsfo = Ext.getCmp('TS_FONT').getValue();
  474. var tsfs = Ext.getCmp('TS_FSCALE').getValue();
  475. var tsft = Ext.getCmp('TS_FTHICK').getValue();
  476. var tslt = Ext.getCmp('TS_LINET').getValue();
  477. var lblpx = Ext.getCmp('LBL_POSX').getValue();
  478. var lblpy = Ext.getCmp('LBL_POSY').getValue();
  479. var lblts = Ext.getCmp('eve_transp_lbl').getValue();
  480. var lblfo = Ext.getCmp('LBL_FONT').getValue();
  481. var lblfs = Ext.getCmp('LBL_FSCALE').getValue();
  482. var lblft = Ext.getCmp('LBL_FTHICK').getValue();
  483. var lbllt = Ext.getCmp('LBL_LINET').getValue();
  484. var logpx = Ext.getCmp('LOGO_POSX').getValue();
  485. var logpy = Ext.getCmp('LOGO_POSY').getValue();
  486. var logw = Ext.getCmp('LOGO_WIDTH').getValue();
  487. var logh = Ext.getCmp('LOGO_HEIGHT').getValue();
  488. Ext.Ajax.request({
  489. url: '/lib/controller/updateServerModuleSettings.php',
  490. params: {
  491. MID: {$EID},
  492. UID: {$UserID},
  493. SID: '{$Session}',
  494. SIZE: sz,
  495. PORT: prt,
  496. COMPRESSION: cq,
  497. SHOW1: shts,
  498. SHOW2: shlb,
  499. SHOW3: shlo,
  500. TS_POSX: tspx,
  501. TS_POSY: tspy,
  502. TS_TRANS: tsts,
  503. TS_FONT: tsfo,
  504. TS_FONT_SCALE: tsfs,
  505. TS_FONT_THICK: tsft,
  506. TS_LINE: tslt,
  507. LBL_POSX: lblpx,
  508. LBL_POSY: lblpy,
  509. LBL_TRANS: lblts,
  510. LBL_FONT: lblfo,
  511. LBL_FONT_SCALE: lblfs,
  512. LBL_FONT_THICK: lblft,
  513. LBL_LINE: lbllt,
  514. LOG_POSX: logpx,
  515. LOG_POSY: logpy,
  516. LOG_W: logw,
  517. LOG_H: logh
  518. },
  519. success: function( response, opts ){
  520. var data = Ext.decode(response.responseText);
  521. if( data.success == true ) {
  522. moduleSettingsEditorWindow.hide();
  523. } else {
  524. Ext.Msg.show({
  525. title:'{$Labels->GetLabel("_ERROR_MSG_")}',
  526. msg: data['msg'],
  527. buttons: Ext.Msg.OK,
  528. fn: function(){
  529. SettingsLidar3D.hide();
  530. },
  531. icon: Ext.MessageBox.ERROR
  532. });
  533. };
  534. },
  535. failure: failureAJAXFunction
  536. });
  537. },
  538. items:[{
  539. xtype: 'panel',
  540. title: 'Output Settings',
  541. items:[{
  542. xtype: 'panel',
  543. id: 'eve_frm_prev',
  544. html: '<canvas id="eve_frame_preview" width="760" height="400" style="background: #eeeeee; display: block; margin: 0 auto;"></canvas>',
  545. height: 400,
  546. width: 760,
  547. border: false
  548. },{
  549. xtype: 'form',
  550. labelWidth: 180,
  551. labelAlign: 'right',
  552. border: false,
  553. items: [{
  554. xtype: 'combo',
  555. fieldLabel: '{$Labels->GetLabel('_WORKING_MODE_')}',
  556. id: 'W_MODE',
  557. typeAhead: false,
  558. triggerAction: 'all',
  559. lazyRender:true,
  560. mode: 'local',
  561. store: {
  562. xtype: 'arraystore',
  563. fields: [ 'moId', 'moText' ],
  564. data: [
  565. [1, 'Pictures'],
  566. [2, 'Videos']
  567. ]
  568. },
  569. valueField: 'moId',
  570. displayField: 'moText',
  571. value: {$CI['output_mode']},
  572. listeners:{
  573. select: function( t, r, i ){
  574. doModuleOperation( {$EID}, 3, r.data.moId, false );
  575. }
  576. }
  577. },{
  578. xtype: 'combo',
  579. fieldLabel: '{$Labels->GetLabel('_OUTPUT_FRAME_SIZE_')}',
  580. id: 'FRM_SIZE',
  581. //width: 120,
  582. typeAhead: false,
  583. triggerAction: 'all',
  584. lazyRender:true,
  585. mode: 'local',
  586. store: {
  587. xtype: 'arraystore',
  588. fields: [ 'szId', 'szText' ],
  589. data: [
  590. [0, '320x240'],
  591. [1, '640x480'],
  592. [2, '800x600'],
  593. [3, '1280x720'],
  594. [4, '1024x768'],
  595. [5, '1920x1080']
  596. ]
  597. },
  598. valueField: 'szId',
  599. displayField: 'szText',
  600. value: {$CSID},
  601. listeners:{
  602. select: updateFramePreview,
  603. change: updateFramePreview
  604. }
  605. },{
  606. xtype: 'numberfield',
  607. fieldLabel: '{$Labels->GetLabel('_EVE_PORT_')}',
  608. id: 'WA_PORT',
  609. width: 120,
  610. minValue: 1000,
  611. maxValue: 65535,
  612. value: {$CI['web_port']}
  613. },{
  614. xtype: 'slider',
  615. fieldLabel: '{$Labels->GetLabel('_EVE_COMPRESS_QUA_')}',
  616. id: 'COMP_QUAL',
  617. width: 120,
  618. minValue: 0,
  619. maxValue: 100,
  620. value: {$CI['compression_quality']}
  621. },{
  622. xtype: 'checkbox',
  623. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_TS_')}',
  624. id: 'eve_show_ts',
  625. disabled: true,
  626. checked: {$CI['show_ts']},
  627. handler: updateFramePreview
  628. },{
  629. xtype: 'checkbox',
  630. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LBL_')}',
  631. id: 'eve_show_lbl',
  632. disabled: true,
  633. checked: {$CI['show_label']},
  634. handler: updateFramePreview
  635. },{
  636. xtype: 'checkbox',
  637. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LOGO_')}',
  638. id: 'eve_show_logo',
  639. disabled: true,
  640. checked: {$CI['show_logo']},
  641. handler: updateFramePreview
  642. }]
  643. }]
  644. },{
  645. xtype: 'form',
  646. title: 'Time Stamp',
  647. labelWidth: 180,
  648. labelAlign: 'right',
  649. disabled: true,
  650. items:[{
  651. xtype: 'slider',
  652. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}',
  653. id: 'TS_POSX',
  654. width: 120,
  655. minValue: 0,
  656. maxValue: 100,
  657. value: {$CI['ts_x']}
  658. },{
  659. xtype: 'slider',
  660. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}',
  661. id: 'TS_POSY',
  662. width: 120,
  663. minValue: 0,
  664. maxValue: 100,
  665. value: {$CI['ts_y']}
  666. },{
  667. xtype: 'checkbox',
  668. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_TS_')}',
  669. id: 'eve_transp_ts',
  670. checked: {$CI['ts_transperant']}
  671. },{
  672. xtype: 'combo',
  673. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_TS_')}',
  674. id: 'TS_FONT',
  675. width: 120,
  676. typeAhead: true,
  677. triggerAction: 'all',
  678. lazyRender:true,
  679. mode: 'local',
  680. store: {
  681. xtype: 'arraystore',
  682. fields: [ 'szId', 'szText' ],
  683. data: [
  684. [0, 'SIMPLEX'],
  685. [1, 'PLAIN'],
  686. [2, 'DUPLEX'],
  687. [3, 'COMPLEX'],
  688. [4, 'TRIPLEX'],
  689. [5, 'COMPLEX_SMALL'],
  690. [6, 'SCRIPT_SIMPLEX'],
  691. [7, 'SCRIPT_COMPLEX']
  692. ]
  693. },
  694. valueField: 'szId',
  695. displayField: 'szText',
  696. value: {$CI['ts_font_face']}
  697. },{
  698. xtype: 'slider',
  699. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}',
  700. id: 'TS_FSCALE',
  701. width: 120,
  702. minValue: 0.0,
  703. maxValue: 4.0,
  704. value: {$CI['ts_font_scale']}
  705. },{
  706. xtype: 'slider',
  707. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}',
  708. id: 'TS_FTHICK',
  709. width: 120,
  710. minValue: 1,
  711. maxValue: 8.0,
  712. value: {$CI['ts_font_thickness']}
  713. },{
  714. xtype: 'combo',
  715. fieldLabel: '{$Labels->GetLabel('_EVE_TS_LINE_T_')}',
  716. id: 'TS_LINET',
  717. width: 120,
  718. typeAhead: true,
  719. triggerAction: 'all',
  720. lazyRender:true,
  721. mode: 'local',
  722. store: {
  723. xtype: 'arraystore',
  724. fields: [ 'szId', 'szText' ],
  725. data: [
  726. [0, 'THIN'],
  727. [1, 'ANTIALIAZED'],
  728. [2, 'THICK']
  729. ]
  730. },
  731. valueField: 'szId',
  732. displayField: 'szText',
  733. value: {$CI['ts_line_type']}
  734. }]
  735. },{
  736. xtype: 'form',
  737. title: 'Label',
  738. labelWidth: 180,
  739. labelAlign: 'right',
  740. disabled: true,
  741. items:[{
  742. xtype: 'slider',
  743. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}',
  744. id: 'LBL_POSX',
  745. width: 120,
  746. minValue: 0,
  747. maxValue: 100,
  748. value: {$CI['label_x']}
  749. },{
  750. xtype: 'slider',
  751. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}',
  752. id: 'LBL_POSY',
  753. width: 120,
  754. minValue: 0,
  755. maxValue: 100,
  756. value: {$CI['label_y']}
  757. },{
  758. xtype: 'checkbox',
  759. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_LBL_')}',
  760. id: 'eve_transp_lbl',
  761. checked: {$CI['label_transperant']}
  762. },{
  763. xtype: 'combo',
  764. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_LBL_')}',
  765. id: 'LBL_FONT',
  766. width: 120,
  767. typeAhead: true,
  768. triggerAction: 'all',
  769. lazyRender:true,
  770. mode: 'local',
  771. store:{
  772. xtype: 'arraystore',
  773. fields: [ 'szId', 'szText' ],
  774. data: [
  775. [0, 'SIMPLEX'],
  776. [1, 'PLAIN'],
  777. [2, 'DUPLEX'],
  778. [3, 'COMPLEX'],
  779. [4, 'TRIPLEX'],
  780. [5, 'COMPLEX_SMALL'],
  781. [6, 'SCRIPT_SIMPLEX'],
  782. [7, 'SCRIPT_COMPLEX']
  783. ]
  784. },
  785. valueField: 'szId',
  786. displayField: 'szText',
  787. value: {$CI['label_font_face']}
  788. },{
  789. xtype: 'slider',
  790. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}',
  791. id: 'LBL_FSCALE',
  792. width: 120,
  793. minValue: 0.0,
  794. maxValue: 4.0,
  795. value: {$CI['label_font_scale']}
  796. },{
  797. xtype: 'slider',
  798. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}',
  799. id: 'LBL_FTHICK',
  800. width: 120,
  801. minValue: 1,
  802. maxValue: 8.0,
  803. value: {$CI['label_font_thickness']}
  804. },{
  805. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}',
  806. xtype: 'combo',
  807. id: 'LBL_LINET',
  808. width: 120,
  809. typeAhead: true,
  810. triggerAction: 'all',
  811. lazyRender:true,
  812. mode: 'local',
  813. store: {
  814. xtype: 'arraystore',
  815. fields: [ 'szId', 'szText' ],
  816. data: [
  817. [0, 'THIN'],
  818. [1, 'ANTIALIAZED'],
  819. [2, 'THICK']
  820. ]
  821. },
  822. valueField: 'szId',
  823. displayField: 'szText',
  824. value: {$CI['label_line_type']}
  825. }]
  826. },{
  827. xtype: 'form',
  828. title: 'Logo',
  829. labelWidth: 180,
  830. labelAlign: 'right',
  831. disabled: true,
  832. items:[{
  833. xtype: 'slider',
  834. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}',
  835. id: 'LOGO_POSX',
  836. width: 120,
  837. minValue: 0,
  838. maxValue: 100,
  839. value: {$CI['logo_x']}
  840. },{
  841. xtype: 'slider',
  842. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}',
  843. id: 'LOGO_POSY',
  844. width: 120,
  845. minValue: 0,
  846. maxValue: 100,
  847. value: {$CI['logo_y']}
  848. },{
  849. xtype: 'numberfield',
  850. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_WIDTH_')}',
  851. id: 'LOGO_WIDTH',
  852. width: 120,
  853. minValue: 0,
  854. maxValue: 256,
  855. value: {$CI['logo_w']}
  856. },{
  857. xtype: 'numberfield',
  858. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_HEIGHT_')}',
  859. id: 'LOGO_HEIGHT',
  860. width: 120,
  861. minValue: 0,
  862. maxValue: 256,
  863. value: {$CI['logo_h']}
  864. },{
  865. xtype: 'panel',
  866. id: 'eve_logo_ph',
  867. html: '<center><img width="100px" id="eve_logo_img" src="/lib/controller/data/assets/images/7shields.png"></center>'
  868. },{
  869. xtype: 'panel',
  870. html: '<input id="eve_logo_upload" style="width: 120px;" type="file" onchange="uploadEveLogo();"/>'
  871. }]
  872. }],
  873. listeners: {
  874. afterlayout: updateFramePreview
  875. },
  876. status: 'ok',
  877. wTitle: '{$Labels->GetLabel('_EMBED_VIDEO_ENCODER_')}'
  878. }
  879. EFUFU;
  880. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL );
  881. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL );
  882. $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL );
  883. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  884. $Data['status'] = 'ok';
  885. $Data['title'] = $Labels->GetLabel('_EMBED_VIDEO_ENCODER_');
  886. $Data['content'] = json_decode( $TPL );
  887. echo $TPL; //json_encode($Data);
  888. break;
  889. case 9: //Modem
  890. $MANU = json_decode( `mmcli -L -J`, true );
  891. //$TA = explode( "\n", $MANU );
  892. $MODEMS_PARTS=array();
  893. $MODEMS_PARTS[] ="[ -1, '-NO-MODEM-ASSIGNED-']";
  894. foreach( $MANU['modem-list'] as $A ){
  895. $CA = explode('/', $A );
  896. $MID = intval( $CA[count($CA)-1] );
  897. $MANU = json_decode( `mmcli -m $MID -J`, true );
  898. //$CMD = "echo \"terrarium\" | sudo -S mmcli -m {$MID} --location-get -J";
  899. //$LOFO = json_decode( `$CMD`, true );
  900. //print_r( $MANU );
  901. //exit();
  902. $MODEMS_PARTS[] = '['.$MID.',\''. $MANU['modem']['generic']['model'].'\']';
  903. };
  904. $MODEMS = '[' . implode( ',', $MODEMS_PARTS ) .']';
  905. $QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}";
  906. $II = $DATABASE->Query( $QS );
  907. $CI = $II[0];
  908. $TPL =<<<EFUFU
  909. {
  910. xtype: 'form',
  911. labelAlign: 'right',
  912. autoScroll: 'auto',
  913. labelWidth: 200,
  914. items:[{
  915. border: false,
  916. frame: false,
  917. xtype: 'panel',
  918. html: '<table width="100%" border=0 class="setEd_infoPanel" id="MODEM"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
  919. },{
  920. xtype: 'spacer',
  921. height: 5
  922. },{
  923. xtype: 'combo',
  924. fieldLabel: 'Selected Modem',
  925. id: 'mod_dev',
  926. width: 220,
  927. lazyRender:true,
  928. mode: 'local',
  929. forceSelection: true,
  930. triggerAction: 'all',
  931. editable: false,
  932. disableKeyFilter: true,
  933. store: new Ext.data.ArrayStore({
  934. fields: ['modem_id','modem_txt'],
  935. data: {$MODEMS}
  936. }),
  937. value: '{$CI['modem_id']}',
  938. valueField: 'modem_id',
  939. displayField: 'modem_txt',
  940. listeners:{
  941. select: function( t, r, i ){
  942. doModuleOperation( {$EID}, 4, r.data.modem_id, false );
  943. }
  944. }
  945. },{
  946. xtype: 'spacer',
  947. height: 5
  948. },{
  949. xtype: 'numberfield',
  950. id: 'trig_window',
  951. name: 'trig_window',
  952. fieldLabel: 'Trigger Time (seconds)',
  953. width: 220,
  954. value: '{$CI['trigger_window']}'
  955. },{
  956. xtype: 'spacer',
  957. height: 5
  958. },{
  959. xtype: 'numberfield',
  960. id: 'alarm_window',
  961. name: 'alarm_window',
  962. fieldLabel: 'Alarm Time (seconds)',
  963. width: 220,
  964. value: '{$CI['alarm_window']}'
  965. },{
  966. xtype: 'spacer',
  967. height: 5
  968. },{
  969. xtype: 'grid',
  970. id: 'phone_book_grid',
  971. border: false,
  972. frame: false,
  973. autoScroll: true,
  974. //width: '100%',
  975. lazyRender: true,
  976. tbar:[{
  977. text: 'Add',
  978. handler: addNewPhoneNumber
  979. },{
  980. text: 'Delete',
  981. id: 'ph_bo_de_bu',
  982. disabled: true
  983. }],
  984. height: 420,
  985. ds: modem_pb_store,
  986. cm: new Ext.grid.ColumnModel( modem_pb_ColModel_ops ),
  987. sm: new Ext.grid.RowSelectionModel( modem_pb_SelModel_ops ),
  988. viewConfig: {
  989. forceFit: true
  990. },
  991. },{
  992. xtype: 'spacer',
  993. height: 5
  994. }],
  995. listeners:{
  996. afterrender: loadPhoneBook
  997. }
  998. }
  999. EFUFU;
  1000. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
  1001. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
  1002. $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL );
  1003. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  1004. echo $TPL;
  1005. break;
  1006. };
  1007. } else {
  1008. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  1009. };
  1010. } else {
  1011. header('location: /');
  1012. };
  1013. ?>