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.

1041 lines
26 KiB

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