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
27 KiB

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