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.

1016 lines
26 KiB

​
​
​
​
​
​
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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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('_OUTPUT_FRAME_SIZE_')}',
  556. id: 'FRM_SIZE',
  557. //width: 120,
  558. typeAhead: true,
  559. triggerAction: 'all',
  560. lazyRender:true,
  561. mode: 'local',
  562. store: {
  563. xtype: 'arraystore',
  564. fields: [ 'szId', 'szText' ],
  565. data: [
  566. [0, '320x240'],
  567. [1, '640x480'],
  568. [2, '800x600'],
  569. [3, '1280x720'],
  570. [4, '1024x768'],
  571. [5, '1920x1080']
  572. ]
  573. },
  574. valueField: 'szId',
  575. displayField: 'szText',
  576. value: {$CSID},
  577. listeners:{
  578. select: updateFramePreview,
  579. change: updateFramePreview
  580. }
  581. },{
  582. xtype: 'numberfield',
  583. fieldLabel: '{$Labels->GetLabel('_EVE_PORT_')}',
  584. id: 'WA_PORT',
  585. width: 120,
  586. minValue: 1000,
  587. maxValue: 65535,
  588. value: {$CI['web_port']}
  589. },{
  590. xtype: 'slider',
  591. fieldLabel: '{$Labels->GetLabel('_EVE_COMPRESS_QUA_')}',
  592. id: 'COMP_QUAL',
  593. width: 120,
  594. minValue: 0,
  595. maxValue: 100,
  596. value: {$CI['compression_quality']}
  597. },{
  598. xtype: 'checkbox',
  599. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_TS_')}',
  600. id: 'eve_show_ts',
  601. disabled: true,
  602. checked: {$CI['show_ts']},
  603. handler: updateFramePreview
  604. },{
  605. xtype: 'checkbox',
  606. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LBL_')}',
  607. id: 'eve_show_lbl',
  608. disabled: true,
  609. checked: {$CI['show_label']},
  610. handler: updateFramePreview
  611. },{
  612. xtype: 'checkbox',
  613. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LOGO_')}',
  614. id: 'eve_show_logo',
  615. disabled: true,
  616. checked: {$CI['show_logo']},
  617. handler: updateFramePreview
  618. }]
  619. }]
  620. },{
  621. xtype: 'form',
  622. title: 'Time Stamp',
  623. labelWidth: 180,
  624. labelAlign: 'right',
  625. disabled: true,
  626. items:[{
  627. xtype: 'slider',
  628. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}',
  629. id: 'TS_POSX',
  630. width: 120,
  631. minValue: 0,
  632. maxValue: 100,
  633. value: {$CI['ts_x']}
  634. },{
  635. xtype: 'slider',
  636. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}',
  637. id: 'TS_POSY',
  638. width: 120,
  639. minValue: 0,
  640. maxValue: 100,
  641. value: {$CI['ts_y']}
  642. },{
  643. xtype: 'checkbox',
  644. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_TS_')}',
  645. id: 'eve_transp_ts',
  646. checked: {$CI['ts_transperant']}
  647. },{
  648. xtype: 'combo',
  649. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_TS_')}',
  650. id: 'TS_FONT',
  651. width: 120,
  652. typeAhead: true,
  653. triggerAction: 'all',
  654. lazyRender:true,
  655. mode: 'local',
  656. store: {
  657. xtype: 'arraystore',
  658. fields: [ 'szId', 'szText' ],
  659. data: [
  660. [0, 'SIMPLEX'],
  661. [1, 'PLAIN'],
  662. [2, 'DUPLEX'],
  663. [3, 'COMPLEX'],
  664. [4, 'TRIPLEX'],
  665. [5, 'COMPLEX_SMALL'],
  666. [6, 'SCRIPT_SIMPLEX'],
  667. [7, 'SCRIPT_COMPLEX']
  668. ]
  669. },
  670. valueField: 'szId',
  671. displayField: 'szText',
  672. value: {$CI['ts_font_face']}
  673. },{
  674. xtype: 'slider',
  675. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}',
  676. id: 'TS_FSCALE',
  677. width: 120,
  678. minValue: 0.0,
  679. maxValue: 4.0,
  680. value: {$CI['ts_font_scale']}
  681. },{
  682. xtype: 'slider',
  683. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}',
  684. id: 'TS_FTHICK',
  685. width: 120,
  686. minValue: 1,
  687. maxValue: 8.0,
  688. value: {$CI['ts_font_thickness']}
  689. },{
  690. xtype: 'combo',
  691. fieldLabel: '{$Labels->GetLabel('_EVE_TS_LINE_T_')}',
  692. id: 'TS_LINET',
  693. width: 120,
  694. typeAhead: true,
  695. triggerAction: 'all',
  696. lazyRender:true,
  697. mode: 'local',
  698. store: {
  699. xtype: 'arraystore',
  700. fields: [ 'szId', 'szText' ],
  701. data: [
  702. [0, 'THIN'],
  703. [1, 'ANTIALIAZED'],
  704. [2, 'THICK']
  705. ]
  706. },
  707. valueField: 'szId',
  708. displayField: 'szText',
  709. value: {$CI['ts_line_type']}
  710. }]
  711. },{
  712. xtype: 'form',
  713. title: 'Label',
  714. labelWidth: 180,
  715. labelAlign: 'right',
  716. disabled: true,
  717. items:[{
  718. xtype: 'slider',
  719. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}',
  720. id: 'LBL_POSX',
  721. width: 120,
  722. minValue: 0,
  723. maxValue: 100,
  724. value: {$CI['label_x']}
  725. },{
  726. xtype: 'slider',
  727. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}',
  728. id: 'LBL_POSY',
  729. width: 120,
  730. minValue: 0,
  731. maxValue: 100,
  732. value: {$CI['label_y']}
  733. },{
  734. xtype: 'checkbox',
  735. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_LBL_')}',
  736. id: 'eve_transp_lbl',
  737. checked: {$CI['label_transperant']}
  738. },{
  739. xtype: 'combo',
  740. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_LBL_')}',
  741. id: 'LBL_FONT',
  742. width: 120,
  743. typeAhead: true,
  744. triggerAction: 'all',
  745. lazyRender:true,
  746. mode: 'local',
  747. store:{
  748. xtype: 'arraystore',
  749. fields: [ 'szId', 'szText' ],
  750. data: [
  751. [0, 'SIMPLEX'],
  752. [1, 'PLAIN'],
  753. [2, 'DUPLEX'],
  754. [3, 'COMPLEX'],
  755. [4, 'TRIPLEX'],
  756. [5, 'COMPLEX_SMALL'],
  757. [6, 'SCRIPT_SIMPLEX'],
  758. [7, 'SCRIPT_COMPLEX']
  759. ]
  760. },
  761. valueField: 'szId',
  762. displayField: 'szText',
  763. value: {$CI['label_font_face']}
  764. },{
  765. xtype: 'slider',
  766. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}',
  767. id: 'LBL_FSCALE',
  768. width: 120,
  769. minValue: 0.0,
  770. maxValue: 4.0,
  771. value: {$CI['label_font_scale']}
  772. },{
  773. xtype: 'slider',
  774. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}',
  775. id: 'LBL_FTHICK',
  776. width: 120,
  777. minValue: 1,
  778. maxValue: 8.0,
  779. value: {$CI['label_font_thickness']}
  780. },{
  781. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}',
  782. xtype: 'combo',
  783. id: 'LBL_LINET',
  784. width: 120,
  785. typeAhead: true,
  786. triggerAction: 'all',
  787. lazyRender:true,
  788. mode: 'local',
  789. store: {
  790. xtype: 'arraystore',
  791. fields: [ 'szId', 'szText' ],
  792. data: [
  793. [0, 'THIN'],
  794. [1, 'ANTIALIAZED'],
  795. [2, 'THICK']
  796. ]
  797. },
  798. valueField: 'szId',
  799. displayField: 'szText',
  800. value: {$CI['label_line_type']}
  801. }]
  802. },{
  803. xtype: 'form',
  804. title: 'Logo',
  805. labelWidth: 180,
  806. labelAlign: 'right',
  807. disabled: true,
  808. items:[{
  809. xtype: 'slider',
  810. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}',
  811. id: 'LOGO_POSX',
  812. width: 120,
  813. minValue: 0,
  814. maxValue: 100,
  815. value: {$CI['logo_x']}
  816. },{
  817. xtype: 'slider',
  818. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}',
  819. id: 'LOGO_POSY',
  820. width: 120,
  821. minValue: 0,
  822. maxValue: 100,
  823. value: {$CI['logo_y']}
  824. },{
  825. xtype: 'numberfield',
  826. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_WIDTH_')}',
  827. id: 'LOGO_WIDTH',
  828. width: 120,
  829. minValue: 0,
  830. maxValue: 256,
  831. value: {$CI['logo_w']}
  832. },{
  833. xtype: 'numberfield',
  834. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_HEIGHT_')}',
  835. id: 'LOGO_HEIGHT',
  836. width: 120,
  837. minValue: 0,
  838. maxValue: 256,
  839. value: {$CI['logo_h']}
  840. },{
  841. xtype: 'panel',
  842. id: 'eve_logo_ph',
  843. html: '<center><img width="100px" id="eve_logo_img" src="/lib/controller/data/assets/images/7shields.png"></center>'
  844. },{
  845. xtype: 'panel',
  846. html: '<input id="eve_logo_upload" style="width: 120px;" type="file" onchange="uploadEveLogo();"/>'
  847. }]
  848. }],
  849. listeners: {
  850. afterlayout: updateFramePreview
  851. },
  852. status: 'ok',
  853. wTitle: '{$Labels->GetLabel('_EMBED_VIDEO_ENCODER_')}'
  854. }
  855. EFUFU;
  856. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL );
  857. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL );
  858. $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL );
  859. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  860. $Data['status'] = 'ok';
  861. $Data['title'] = $Labels->GetLabel('_EMBED_VIDEO_ENCODER_');
  862. $Data['content'] = json_decode( $TPL );
  863. echo $TPL; //json_encode($Data);
  864. break;
  865. case 9: //Modem
  866. $QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}";
  867. $II = $DATABASE->Query( $QS );
  868. $CI = $II[0];
  869. $TPL =<<<EFUFU
  870. {
  871. xtype: 'form',
  872. labelAlign: 'right',
  873. autoScroll: 'auto',
  874. labelWidth: 200,
  875. items:[{
  876. border: false,
  877. frame: false,
  878. xtype: 'panel',
  879. 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>'
  880. },{
  881. xtype: 'spacer',
  882. height: 5
  883. },{
  884. xtype: 'spacer',
  885. height: 5
  886. },{
  887. xtype: 'textfield',
  888. id: 'num_prefix',
  889. name: 'num_prefix',
  890. fieldLabel: 'Default Prefix',
  891. value: '{$CI['default_prefix']}'
  892. },{
  893. xtype: 'spacer',
  894. height: 5
  895. },{
  896. xtype: 'slider',
  897. id: 'trig_window',
  898. name: 'trig_window',
  899. fieldLabel: 'Trigger Time (seconds)',
  900. maxValue: 15,
  901. width: '80%',
  902. minValue: 0,
  903. increment: 3,
  904. value: {$CI['trigger_window']}
  905. },{
  906. xtype: 'spacer',
  907. height: 5
  908. },{
  909. xtype: 'slider',
  910. id: 'alarm_window',
  911. name: 'alarm_window',
  912. fieldLabel: 'Alarm Time (seconds)',
  913. width: '80%',
  914. increment: 60,
  915. maxValue: 3600,
  916. minValue: 180,
  917. value: {$CI['alarm_window']}
  918. },{
  919. xtype: 'spacer',
  920. height: 5
  921. },{
  922. xtype: 'grid',
  923. id: 'phone_book_grid',
  924. border: false,
  925. frame: false,
  926. autoScroll: true,
  927. //width: '100%',
  928. lazyRender: true,
  929. tbar:[{
  930. text: 'Add',
  931. handler: addNewPhoneNumber
  932. },{
  933. text: 'Delete',
  934. id: 'ph_bo_de_bu',
  935. disabled: true
  936. }],
  937. height: 225,
  938. ds: archives_store,
  939. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  940. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  941. viewConfig: {
  942. // forceFit: true
  943. },
  944. },{
  945. xtype: 'spacer',
  946. height: 5,
  947. html: '<hr>'
  948. },{
  949. xype: 'panel',
  950. layout: 'vbox',
  951. frame: false,
  952. height: 120,
  953. items:[{
  954. xtype: 'panel',
  955. layout: 'table',
  956. width: '100%',
  957. defaults: {
  958. // applied to each contained panel
  959. bodyStyle:'padding:20px'
  960. },
  961. layoytConfig:{
  962. columns: 4
  963. },
  964. items: [{
  965. xtype: 'spacer',
  966. html: '<p>New Phone Number:</p>'
  967. },{
  968. xtype: 'textfield',
  969. id: 'n_ph_n',
  970. name: 'n_ph_n'
  971. },{
  972. xtype: 'spacer',
  973. html: '<p>Custom Message:</p>'
  974. },{
  975. xtype: 'textarea',
  976. id: 'n_ph_l',
  977. name: 'n_ph_l',
  978. fieldLabel: 'Custom Message',
  979. }]
  980. },{
  981. xtype: 'button',
  982. width: '100%',
  983. text: 'Add Phone Number',
  984. handler: function(){
  985. }
  986. }]
  987. }],
  988. listeners:{
  989. afterrender: loadPhoneBook
  990. }
  991. }
  992. EFUFU;
  993. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
  994. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
  995. $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL );
  996. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  997. echo $TPL;
  998. break;
  999. };
  1000. } else {
  1001. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  1002. };
  1003. } else {
  1004. header('location: /');
  1005. };
  1006. ?>