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.

1478 lines
38 KiB

​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
3 years ago
​
3 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
​
​
​
​
2 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
2 years ago
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
4 years ago
2 years ago
4 years ago
​
2 years ago
​
2 years ago
​
​
​
​
​
2 years ago
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
4 years ago
2 years ago
​
4 years ago
​
​
​
4 years ago
4 years ago
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
5 months ago
5 months ago
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
5 months ago
​
​
​
​
​
​
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
5 months 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. // Embedded MediaMTX (live view / recording); defaults match la_mojo when a column is missing
  459. $LV_MODE = isset( $CI['live_mode'] ) ? intval( $CI['live_mode'] ) : 1;
  460. $LV_PORT = isset( $CI['live_port'] ) ? intval( $CI['live_port'] ) : 8889;
  461. $LV_REC = isset( $CI['live_record'] ) ? intval( $CI['live_record'] ) : 1;
  462. $LV_SEG = isset( $CI['live_record_segment'] ) ? intval( $CI['live_record_segment'] ) : 60;
  463. $LV_BR = isset( $CI['live_bitrate'] ) ? intval( $CI['live_bitrate'] ) : 2000;
  464. $LV_FPS = isset( $CI['live_fps'] ) ? intval( $CI['live_fps'] ) : 15;
  465. $LV_ICE = json_encode( isset( $CI['live_ice_servers'] ) ? strval( $CI['live_ice_servers'] ) : '' );
  466. $LV_ENC_DIS = ( $LV_MODE == 2 ) ? 'false' : 'true';
  467. $LV_SEG_DIS = ( $LV_REC ) ? 'false' : 'true';
  468. // OpenCV line types; old values 0 / 1 mean 8 / 4 connected
  469. $EVE_LT = function( $V ){ $V = intval( $V ); if( $V == 0 ) return 8; if( $V == 1 ) return 4; return in_array( $V, array( 4, 8, 16 ) ) ? $V : 8; };
  470. $TS_LT = $EVE_LT( $CI['ts_line_type'] );
  471. $LBL_LT = $EVE_LT( $CI['label_line_type'] );
  472. $LOGO_URL = ( isset( $CI['logo_md5'] ) && preg_match( '/^[0-9a-f]{32}$/', $CI['logo_md5'] ) && is_file( __DIR__.'/data/assets/images/'.$CI['logo_md5'].'.png' ) ) ? '/lib/controller/data/assets/images/'.$CI['logo_md5'].'.png' : '/lib/controller/data/assets/images/7shields.png';
  473. $TPL =<<<EFUFU
  474. {
  475. xtype: 'tabpanel',
  476. activeTab: 0,
  477. id: 'mod_set_content',
  478. saveSettings: function(){
  479. var sz = Ext.getCmp('FRM_SIZE').getValue();
  480. var prt = Ext.getCmp('WA_PORT').getValue();
  481. var cq = Ext.getCmp('COMP_QUAL').getValue();
  482. var shts = Ext.getCmp('eve_show_ts').getValue();
  483. var shlb = Ext.getCmp('eve_show_lbl').getValue();
  484. var shlo = Ext.getCmp('eve_show_logo').getValue();
  485. var tspx = Ext.getCmp('TS_POSX').getValue();
  486. var tspy = Ext.getCmp('TS_POSY').getValue();
  487. var tsts = Ext.getCmp('eve_transp_ts').getValue();
  488. var tsfo = Ext.getCmp('TS_FONT').getValue();
  489. var tsfs = Ext.getCmp('TS_FSCALE').getValue();
  490. var tsft = Ext.getCmp('TS_FTHICK').getValue();
  491. var tslt = Ext.getCmp('TS_LINET').getValue();
  492. var lblpx = Ext.getCmp('LBL_POSX').getValue();
  493. var lblpy = Ext.getCmp('LBL_POSY').getValue();
  494. var lblts = Ext.getCmp('eve_transp_lbl').getValue();
  495. var lblfo = Ext.getCmp('LBL_FONT').getValue();
  496. var lblfs = Ext.getCmp('LBL_FSCALE').getValue();
  497. var lblft = Ext.getCmp('LBL_FTHICK').getValue();
  498. var lbllt = Ext.getCmp('LBL_LINET').getValue();
  499. var logpx = Ext.getCmp('LOGO_POSX').getValue();
  500. var logpy = Ext.getCmp('LOGO_POSY').getValue();
  501. var logw = Ext.getCmp('LOGO_WIDTH').getValue();
  502. var logh = Ext.getCmp('LOGO_HEIGHT').getValue();
  503. Ext.Ajax.request({
  504. url: '/lib/controller/updateServerModuleSettings.php',
  505. params: {
  506. MID: {$EID},
  507. UID: {$UserID},
  508. SID: '{$Session}',
  509. SIZE: sz,
  510. PORT: prt,
  511. COMPRESSION: cq,
  512. SHOW1: shts,
  513. SHOW2: shlb,
  514. SHOW3: shlo,
  515. TS_POSX: tspx,
  516. TS_POSY: tspy,
  517. TS_TRANS: tsts,
  518. TS_FONT: tsfo,
  519. TS_FONT_SCALE: tsfs,
  520. TS_FONT_THICK: tsft,
  521. TS_LINE: tslt,
  522. LBL_POSX: lblpx,
  523. LBL_POSY: lblpy,
  524. LBL_TRANS: lblts,
  525. LBL_FONT: lblfo,
  526. LBL_FONT_SCALE: lblfs,
  527. LBL_FONT_THICK: lblft,
  528. LBL_LINE: lbllt,
  529. LOG_POSX: logpx,
  530. LOG_POSY: logpy,
  531. LOG_W: logw,
  532. LOG_H: logh
  533. },
  534. success: function( response, opts ){
  535. var data = Ext.decode(response.responseText);
  536. if( data.success == true ) {
  537. moduleSettingsEditorWindow.hide();
  538. } else {
  539. Ext.Msg.show({
  540. title:'{$Labels->GetLabel("_ERROR_MSG_")}',
  541. msg: data['msg'],
  542. buttons: Ext.Msg.OK,
  543. icon: Ext.MessageBox.ERROR
  544. });
  545. };
  546. },
  547. failure: failureAJAXFunction
  548. });
  549. },
  550. items:[{
  551. xtype: 'panel',
  552. title: 'Output Settings',
  553. items:[{
  554. xtype: 'panel',
  555. id: 'eve_frm_prev',
  556. html: '<canvas id="eve_frame_preview" width="760" height="400" style="background: #eeeeee; display: block; margin: 0 auto;"></canvas>',
  557. height: 400,
  558. width: 760,
  559. border: false
  560. },{
  561. xtype: 'form',
  562. labelWidth: 180,
  563. labelAlign: 'right',
  564. border: false,
  565. items: [{
  566. xtype: 'combo',
  567. fieldLabel: '{$Labels->GetLabel('_WORKING_MODE_')}',
  568. id: 'W_MODE',
  569. typeAhead: false,
  570. triggerAction: 'all',
  571. lazyRender:true,
  572. mode: 'local',
  573. store: {
  574. xtype: 'arraystore',
  575. fields: [ 'moId', 'moText' ],
  576. data: [
  577. [1, 'Pictures'],
  578. [2, 'Videos']
  579. ]
  580. },
  581. valueField: 'moId',
  582. displayField: 'moText',
  583. value: '{$CI['output_mode']}',
  584. listeners:{
  585. select: function( t, r, i ){
  586. doModuleOperation( {$EID}, 3, r.data.moId, false );
  587. }
  588. }
  589. },{
  590. xtype: 'combo',
  591. fieldLabel: '{$Labels->GetLabel('_OUTPUT_FRAME_SIZE_')}',
  592. id: 'FRM_SIZE',
  593. //width: 120,
  594. typeAhead: false,
  595. triggerAction: 'all',
  596. lazyRender:true,
  597. mode: 'local',
  598. store: {
  599. xtype: 'arraystore',
  600. fields: [ 'szId', 'szText' ],
  601. data: [
  602. [0, '320x240'],
  603. [1, '640x480'],
  604. [2, '800x600'],
  605. [3, '1280x720'],
  606. [4, '1024x768'],
  607. [5, '1920x1080']
  608. ]
  609. },
  610. valueField: 'szId',
  611. displayField: 'szText',
  612. value: {$CSID},
  613. listeners:{
  614. select: updateFramePreview,
  615. change: updateFramePreview
  616. }
  617. },{
  618. xtype: 'numberfield',
  619. fieldLabel: '{$Labels->GetLabel('_EVE_PORT_')}',
  620. id: 'WA_PORT',
  621. width: 120,
  622. minValue: 1000,
  623. maxValue: 65535,
  624. value: {$CI['web_port']}
  625. },{
  626. xtype: 'slider',
  627. fieldLabel: '{$Labels->GetLabel('_EVE_COMPRESS_QUA_')}',
  628. id: 'COMP_QUAL',
  629. width: 120,
  630. minValue: 0,
  631. maxValue: 100,
  632. value: {$CI['compression_quality']}
  633. },{
  634. xtype: 'checkbox',
  635. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_TS_')}',
  636. id: 'eve_show_ts',
  637. checked: {$CI['show_ts']},
  638. handler: updateFramePreview
  639. },{
  640. xtype: 'checkbox',
  641. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LBL_')}',
  642. id: 'eve_show_lbl',
  643. checked: {$CI['show_label']},
  644. handler: updateFramePreview
  645. },{
  646. xtype: 'checkbox',
  647. fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LOGO_')}',
  648. id: 'eve_show_logo',
  649. checked: {$CI['show_logo']},
  650. handler: updateFramePreview
  651. }]
  652. }]
  653. },{
  654. xtype: 'form',
  655. title: '{$Labels->GetLabel('_EVE_LIVE_TAB_')}',
  656. labelWidth: 250,
  657. labelAlign: 'right',
  658. items:[{
  659. xtype: 'spacer',
  660. height: 10
  661. },{
  662. xtype: 'combo',
  663. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_MODE_')}',
  664. id: 'LV_MODE',
  665. width: 260,
  666. typeAhead: false,
  667. editable: false,
  668. forceSelection: true,
  669. triggerAction: 'all',
  670. lazyRender:true,
  671. mode: 'local',
  672. store: {
  673. xtype: 'arraystore',
  674. fields: [ 'lmId', 'lmText' ],
  675. data: [
  676. [0, '{$Labels->GetLabel('_EVE_LIVE_OFF_')}'],
  677. [1, '{$Labels->GetLabel('_EVE_LIVE_PASS_')}'],
  678. [2, '{$Labels->GetLabel('_EVE_LIVE_ENC_')}']
  679. ]
  680. },
  681. valueField: 'lmId',
  682. displayField: 'lmText',
  683. value: {$LV_MODE},
  684. listeners:{
  685. select: function( t, r, i ){
  686. doModuleOperation( {$EID}, 20, r.data.lmId, false );
  687. Ext.getCmp('LV_BITRATE').setDisabled( r.data.lmId != 2 );
  688. Ext.getCmp('LV_FPS').setDisabled( r.data.lmId != 2 );
  689. }
  690. }
  691. },{
  692. xtype: 'numberfield',
  693. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_PORT_')}',
  694. id: 'LV_PORT',
  695. width: 120,
  696. allowDecimals: false,
  697. minValue: 1,
  698. maxValue: 65535,
  699. value: {$LV_PORT},
  700. listeners:{
  701. change: function( t, n, o ){
  702. doModuleOperation( {$EID}, 21, n, false );
  703. }
  704. }
  705. },{
  706. xtype: 'numberfield',
  707. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_BITRATE_')}',
  708. id: 'LV_BITRATE',
  709. width: 120,
  710. allowDecimals: false,
  711. minValue: 100,
  712. maxValue: 20000,
  713. disabled: {$LV_ENC_DIS},
  714. value: {$LV_BR},
  715. listeners:{
  716. change: function( t, n, o ){
  717. doModuleOperation( {$EID}, 24, n, false );
  718. }
  719. }
  720. },{
  721. xtype: 'numberfield',
  722. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_FPS_')}',
  723. id: 'LV_FPS',
  724. width: 120,
  725. allowDecimals: false,
  726. minValue: 1,
  727. maxValue: 60,
  728. disabled: {$LV_ENC_DIS},
  729. value: {$LV_FPS},
  730. listeners:{
  731. change: function( t, n, o ){
  732. doModuleOperation( {$EID}, 25, n, false );
  733. }
  734. }
  735. },{
  736. xtype: 'textfield',
  737. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_ICE_')}',
  738. id: 'LV_ICE',
  739. width: 400,
  740. emptyText: 'stun:stun.l.google.com:19302',
  741. value: {$LV_ICE},
  742. listeners:{
  743. change: function( t, n, o ){
  744. doModuleOperation( {$EID}, 26, n, false );
  745. }
  746. }
  747. },{
  748. xtype: 'spacer',
  749. height: 10
  750. },{
  751. xtype: 'checkbox',
  752. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_RECORD_')}',
  753. id: 'LV_RECORD',
  754. checked: {$LV_REC},
  755. handler: function( c, v ){
  756. doModuleOperation( {$EID}, 22, v ? 1 : 0, false );
  757. Ext.getCmp('LV_SEGMENT').setDisabled( !v );
  758. }
  759. },{
  760. xtype: 'numberfield',
  761. fieldLabel: '{$Labels->GetLabel('_EVE_LIVE_SEGMENT_')}',
  762. id: 'LV_SEGMENT',
  763. width: 120,
  764. allowDecimals: false,
  765. minValue: 10,
  766. maxValue: 3600,
  767. disabled: {$LV_SEG_DIS},
  768. value: {$LV_SEG},
  769. listeners:{
  770. change: function( t, n, o ){
  771. doModuleOperation( {$EID}, 23, n, false );
  772. }
  773. }
  774. },{
  775. xtype: 'spacer',
  776. height: 10
  777. },{
  778. xtype: 'panel',
  779. border: false,
  780. bodyStyle: 'padding: 0 10px',
  781. html: '<p>{$Labels->GetLabel('_EVE_LIVE_HINT_')}</p>'
  782. }]
  783. },{
  784. xtype: 'form',
  785. title: 'Time Stamp',
  786. labelWidth: 180,
  787. labelAlign: 'right',
  788. items:[{
  789. xtype: 'numberfield',
  790. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}',
  791. id: 'TS_POSX',
  792. width: 120,
  793. allowDecimals: false,
  794. minValue: -1920,
  795. maxValue: 1920,
  796. value: {$CI['ts_x']}
  797. },{
  798. xtype: 'numberfield',
  799. fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}',
  800. id: 'TS_POSY',
  801. width: 120,
  802. allowDecimals: false,
  803. minValue: -1920,
  804. maxValue: 1920,
  805. value: {$CI['ts_y']}
  806. },{
  807. xtype: 'checkbox',
  808. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_TS_')}',
  809. id: 'eve_transp_ts',
  810. checked: {$CI['ts_transperant']}
  811. },{
  812. xtype: 'combo',
  813. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_TS_')}',
  814. id: 'TS_FONT',
  815. width: 120,
  816. typeAhead: true,
  817. triggerAction: 'all',
  818. lazyRender:true,
  819. mode: 'local',
  820. store: {
  821. xtype: 'arraystore',
  822. fields: [ 'szId', 'szText' ],
  823. data: [
  824. [0, 'SIMPLEX'],
  825. [1, 'PLAIN'],
  826. [2, 'DUPLEX'],
  827. [3, 'COMPLEX'],
  828. [4, 'TRIPLEX'],
  829. [5, 'COMPLEX_SMALL'],
  830. [6, 'SCRIPT_SIMPLEX'],
  831. [7, 'SCRIPT_COMPLEX']
  832. ]
  833. },
  834. valueField: 'szId',
  835. displayField: 'szText',
  836. value: {$CI['ts_font_face']}
  837. },{
  838. xtype: 'numberfield',
  839. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}',
  840. id: 'TS_FSCALE',
  841. width: 120,
  842. decimalPrecision: 1,
  843. minValue: 0.1,
  844. maxValue: 4.0,
  845. value: {$CI['ts_font_scale']}
  846. },{
  847. xtype: 'numberfield',
  848. fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}',
  849. id: 'TS_FTHICK',
  850. width: 120,
  851. allowDecimals: false,
  852. minValue: 1,
  853. maxValue: 8,
  854. value: {$CI['ts_font_thickness']}
  855. },{
  856. xtype: 'combo',
  857. fieldLabel: '{$Labels->GetLabel('_EVE_TS_LINE_T_')}',
  858. id: 'TS_LINET',
  859. width: 120,
  860. typeAhead: true,
  861. triggerAction: 'all',
  862. lazyRender:true,
  863. mode: 'local',
  864. store: {
  865. xtype: 'arraystore',
  866. fields: [ 'szId', 'szText' ],
  867. data: [
  868. [8, 'NORMAL'],
  869. [4, 'THIN'],
  870. [16, 'ANTIALIASED']
  871. ]
  872. },
  873. valueField: 'szId',
  874. displayField: 'szText',
  875. value: {$TS_LT}
  876. },{
  877. xtype: 'panel',
  878. border: false,
  879. bodyStyle: 'padding: 10px',
  880. html: '<p>{$Labels->GetLabel('_EVE_POS_HINT_')}</p><p>{$Labels->GetLabel('_EVE_TS_HINT_')}</p>'
  881. }]
  882. },{
  883. xtype: 'form',
  884. title: 'Label',
  885. labelWidth: 180,
  886. labelAlign: 'right',
  887. items:[{
  888. xtype: 'numberfield',
  889. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}',
  890. id: 'LBL_POSX',
  891. width: 120,
  892. allowDecimals: false,
  893. minValue: -1920,
  894. maxValue: 1920,
  895. value: {$CI['label_x']}
  896. },{
  897. xtype: 'numberfield',
  898. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}',
  899. id: 'LBL_POSY',
  900. width: 120,
  901. allowDecimals: false,
  902. minValue: -1920,
  903. maxValue: 1920,
  904. value: {$CI['label_y']}
  905. },{
  906. xtype: 'checkbox',
  907. fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_LBL_')}',
  908. id: 'eve_transp_lbl',
  909. checked: {$CI['label_transperant']}
  910. },{
  911. xtype: 'combo',
  912. fieldLabel: '{$Labels->GetLabel('_EVE_FONT_LBL_')}',
  913. id: 'LBL_FONT',
  914. width: 120,
  915. typeAhead: true,
  916. triggerAction: 'all',
  917. lazyRender:true,
  918. mode: 'local',
  919. store:{
  920. xtype: 'arraystore',
  921. fields: [ 'szId', 'szText' ],
  922. data: [
  923. [0, 'SIMPLEX'],
  924. [1, 'PLAIN'],
  925. [2, 'DUPLEX'],
  926. [3, 'COMPLEX'],
  927. [4, 'TRIPLEX'],
  928. [5, 'COMPLEX_SMALL'],
  929. [6, 'SCRIPT_SIMPLEX'],
  930. [7, 'SCRIPT_COMPLEX']
  931. ]
  932. },
  933. valueField: 'szId',
  934. displayField: 'szText',
  935. value: {$CI['label_font_face']}
  936. },{
  937. xtype: 'numberfield',
  938. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}',
  939. id: 'LBL_FSCALE',
  940. width: 120,
  941. decimalPrecision: 1,
  942. minValue: 0.1,
  943. maxValue: 4.0,
  944. value: {$CI['label_font_scale']}
  945. },{
  946. xtype: 'numberfield',
  947. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}',
  948. id: 'LBL_FTHICK',
  949. width: 120,
  950. allowDecimals: false,
  951. minValue: 1,
  952. maxValue: 8,
  953. value: {$CI['label_font_thickness']}
  954. },{
  955. fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}',
  956. xtype: 'combo',
  957. id: 'LBL_LINET',
  958. width: 120,
  959. typeAhead: true,
  960. triggerAction: 'all',
  961. lazyRender:true,
  962. mode: 'local',
  963. store: {
  964. xtype: 'arraystore',
  965. fields: [ 'szId', 'szText' ],
  966. data: [
  967. [8, 'NORMAL'],
  968. [4, 'THIN'],
  969. [16, 'ANTIALIASED']
  970. ]
  971. },
  972. valueField: 'szId',
  973. displayField: 'szText',
  974. value: {$LBL_LT}
  975. },{
  976. xtype: 'panel',
  977. border: false,
  978. bodyStyle: 'padding: 10px',
  979. html: '<p>{$Labels->GetLabel('_EVE_POS_HINT_')}</p>'
  980. }]
  981. },{
  982. xtype: 'form',
  983. title: 'Logo',
  984. labelWidth: 180,
  985. labelAlign: 'right',
  986. items:[{
  987. xtype: 'numberfield',
  988. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}',
  989. id: 'LOGO_POSX',
  990. width: 120,
  991. allowDecimals: false,
  992. minValue: -1920,
  993. maxValue: 1920,
  994. value: {$CI['logo_x']}
  995. },{
  996. xtype: 'numberfield',
  997. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}',
  998. id: 'LOGO_POSY',
  999. width: 120,
  1000. allowDecimals: false,
  1001. minValue: -1920,
  1002. maxValue: 1920,
  1003. value: {$CI['logo_y']}
  1004. },{
  1005. xtype: 'numberfield',
  1006. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_WIDTH_')}',
  1007. id: 'LOGO_WIDTH',
  1008. width: 120,
  1009. minValue: 0,
  1010. maxValue: 256,
  1011. value: {$CI['logo_w']}
  1012. },{
  1013. xtype: 'numberfield',
  1014. fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_HEIGHT_')}',
  1015. id: 'LOGO_HEIGHT',
  1016. width: 120,
  1017. minValue: 0,
  1018. maxValue: 256,
  1019. value: {$CI['logo_h']}
  1020. },{
  1021. xtype: 'panel',
  1022. id: 'eve_logo_ph',
  1023. html: '<center><img width="100px" id="eve_logo_img" src="{$LOGO_URL}"></center>'
  1024. },{
  1025. xtype: 'panel',
  1026. html: '<input id="eve_logo_upload" style="width: 120px;" type="file" onchange="uploadEveLogo();"/>'
  1027. }]
  1028. }],
  1029. listeners: {
  1030. afterlayout: updateFramePreview
  1031. },
  1032. status: 'ok',
  1033. wTitle: '{$Labels->GetLabel('_EMBED_VIDEO_ENCODER_')}'
  1034. }
  1035. EFUFU;
  1036. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL );
  1037. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL );
  1038. $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL );
  1039. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  1040. $Data['status'] = 'ok';
  1041. $Data['title'] = $Labels->GetLabel('_EMBED_VIDEO_ENCODER_');
  1042. $Data['content'] = json_decode( $TPL );
  1043. echo $TPL; //json_encode($Data);
  1044. break;
  1045. case 9: //Modem
  1046. $MANU = json_decode( `mmcli -L -J`, true );
  1047. //$TA = explode( "\n", $MANU );
  1048. $MODEMS_PARTS=array();
  1049. $MODEMS_PARTS[] ="[ -1, '-NO-MODEM-ASSIGNED-']";
  1050. foreach( $MANU['modem-list'] as $A ){
  1051. $CA = explode('/', $A );
  1052. $MID = intval( $CA[count($CA)-1] );
  1053. $MANU = json_decode( `mmcli -m $MID -J`, true );
  1054. //$CMD = "echo \"terrarium\" | sudo -S mmcli -m {$MID} --location-get -J";
  1055. //$LOFO = json_decode( `$CMD`, true );
  1056. //print_r( $MANU );
  1057. //exit();
  1058. $MODEMS_PARTS[] = '['.$MID.',\''. $MANU['modem']['generic']['model'].'\']';
  1059. };
  1060. $MODEMS = '[' . implode( ',', $MODEMS_PARTS ) .']';
  1061. $QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}";
  1062. $II = $DATABASE->Query( $QS );
  1063. $CI = $II[0];
  1064. $TPL =<<<EFUFU
  1065. {
  1066. xtype: 'form',
  1067. labelAlign: 'right',
  1068. autoScroll: 'auto',
  1069. labelWidth: 250,
  1070. items:[{
  1071. border: false,
  1072. frame: false,
  1073. xtype: 'panel',
  1074. 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>'
  1075. },{
  1076. xtype: 'spacer',
  1077. height: 5
  1078. },{
  1079. xtype: 'combo',
  1080. fieldLabel: '{$Labels->GetLabel('_SELD_MODEM_')}',
  1081. id: 'mod_dev',
  1082. width: 220,
  1083. lazyRender:true,
  1084. mode: 'local',
  1085. forceSelection: true,
  1086. triggerAction: 'all',
  1087. editable: false,
  1088. disableKeyFilter: true,
  1089. store: new Ext.data.ArrayStore({
  1090. fields: ['modem_id','modem_txt'],
  1091. data: {$MODEMS}
  1092. }),
  1093. value: '{$CI['modem_id']}',
  1094. valueField: 'modem_id',
  1095. displayField: 'modem_txt',
  1096. listeners:{
  1097. select: function( t, r, i ){
  1098. doModuleOperation( {$EID}, 4, r.data.modem_id, false );
  1099. }
  1100. }
  1101. },{
  1102. xtype: 'spacer',
  1103. height: 5
  1104. },{
  1105. xtype: 'combo',
  1106. fieldLabel: '{$Labels->GetLabel('_WORKING_MODE_')}',
  1107. id: 'mod_mode',
  1108. width: 220,
  1109. lazyRender:true,
  1110. mode: 'local',
  1111. forceSelection: true,
  1112. triggerAction: 'all',
  1113. editable: false,
  1114. disableKeyFilter: true,
  1115. store: new Ext.data.ArrayStore({
  1116. fields: ['wm_id','wm_txt'],
  1117. data: [[1,'Sending SMS'],[2,'Making Call'],[3,'Uppon Phonebook Record']]
  1118. }),
  1119. value: ('{$CI['sms_enabled']}' =='1'&&'{$CI['call_enabled']}' =='1')?'3':(('{$CI['sms_enabled']}' =='1')?'1':'2'),
  1120. valueField: 'wm_id',
  1121. displayField: 'wm_txt',
  1122. listeners:{
  1123. select: function( t, r, i ){
  1124. doModuleOperation( {$EID}, 5, r.data.wm_id, false );
  1125. }
  1126. }
  1127. },{
  1128. xtype: 'spacer',
  1129. height: 5
  1130. },{
  1131. xtype: 'numberfield',
  1132. id: 'trig_window',
  1133. name: 'trig_window',
  1134. fieldLabel: '{$Labels->GetLabel('_CALL_HU_DELAY_')}',
  1135. width: 220,
  1136. value: '{$CI['call_hangup_wait']}',
  1137. listeners:{
  1138. change: function( t, n, o ){
  1139. doModuleOperation( {$EID}, 6, n, false );
  1140. }
  1141. }
  1142. },{
  1143. xtype: 'spacer',
  1144. height: 5
  1145. },{
  1146. xtype: 'grid',
  1147. id: 'phone_book_grid',
  1148. border: false,
  1149. frame: false,
  1150. autoScroll: true,
  1151. //width: '100%',
  1152. lazyRender: true,
  1153. tbar:[{
  1154. text: '{$Labels->GetLabel('__ADD__')}',
  1155. handler: addNewPhoneNumber
  1156. },{
  1157. text: '{$Labels->GetLabel('_DEL_SELECTED_')}',
  1158. id: 'ph_bo_de_bu',
  1159. disabled: true,
  1160. handler: deletePhoneNumber
  1161. }],
  1162. height: 420,
  1163. ds: modem_pb_store,
  1164. cm: new Ext.grid.ColumnModel( modem_pb_ColModel_ops ),
  1165. sm: new Ext.grid.RowSelectionModel( modem_pb_SelModel_ops ),
  1166. viewConfig: {
  1167. forceFit: true
  1168. },
  1169. },{
  1170. xtype: 'spacer',
  1171. height: 5
  1172. }],
  1173. listeners:{
  1174. afterrender: loadPhoneBook
  1175. }
  1176. }
  1177. EFUFU;
  1178. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
  1179. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
  1180. $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL );
  1181. $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
  1182. echo $TPL;
  1183. break;
  1184. case 12: // BOSCH VMS
  1185. $QS="SELECT * FROM `module_bvms` WHERE `id`={$CR['aux_id']}";
  1186. $II = $DATABASE->Query( $QS );
  1187. $CI = $II[0];
  1188. $TPL =<<<EFUFU
  1189. {
  1190. xtype: 'form',
  1191. labelAlign: 'right',
  1192. autoScroll: 'auto',
  1193. labelWidth: 350,
  1194. items:[{
  1195. border: false,
  1196. frame: false,
  1197. xtype: 'panel',
  1198. html: '<table width="100%" border=0 class="setEd_infoPanel" id="BOSCH"><tr><td width="65px"><img width="64px" src="/style/assets/bosch.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
  1199. },{
  1200. xtype: 'spacer',
  1201. height: 5
  1202. },{
  1203. xtype: 'textfield',
  1204. fieldLabel: '{$Labels->GetLabel('_DEVICE_IP_')}',
  1205. id: 'srv_ip',
  1206. width: 220,
  1207. value: '{$CI['ip']}',
  1208. listeners:{
  1209. change: function( t, n, o ){
  1210. doModuleOperation( {$EID}, 7, n, false );
  1211. }
  1212. }
  1213. },{
  1214. xtype: 'spacer',
  1215. height: 5
  1216. },{
  1217. xtype: 'numberfield',
  1218. fieldLabel: '{$Labels->GetLabel('_DEVICE_PORT_')}',
  1219. id: 'srv_por',
  1220. width: 220,
  1221. value: '{$CI['port']}',
  1222. listeners:{
  1223. change: function( t, n, o ){
  1224. doModuleOperation( {$EID}, 8, n, false );
  1225. }
  1226. }
  1227. },{
  1228. xtype: 'spacer',
  1229. height: 5
  1230. },{
  1231. xtype: 'textfield',
  1232. fieldLabel: '{$Labels->GetLabel('_API_ACC_URI_')}',
  1233. id: 'api_acc',
  1234. width: 220,
  1235. value: '{$CI['api_uri']}',
  1236. listeners:{
  1237. change: function( t, n, o ){
  1238. doModuleOperation( {$EID}, 9, n, false );
  1239. }
  1240. }
  1241. },{
  1242. xtype: 'spacer',
  1243. height: 5
  1244. },{
  1245. xtype: 'combo',
  1246. id: 'am_auth_mode',
  1247. fieldLabel: '{$Labels->GetLabel('_AUTH_MODE_0_')}',
  1248. lazyRender: true,
  1249. mode: 'local',
  1250. forceSelection: true,
  1251. triggerAction: 'all',
  1252. editable: false,
  1253. disableKeyFilter: true,
  1254. store: new Ext.data.ArrayStore({
  1255. fields: ['mode','mode_txt'],
  1256. data: [
  1257. [0,'BASIC'],
  1258. [1,'DIGEST'],
  1259. [2,'DIGEST_IE'],
  1260. [3,'BEARER'],
  1261. [4,'NEGOTIATE'],
  1262. [5,'NTLM'],
  1263. [6,'NTLM_WB'],
  1264. [7,'ANY'],
  1265. [8,'ANYSAFE'],
  1266. [9,'ONLY'],
  1267. [10,'AWS_SIGV4']
  1268. ]
  1269. }),
  1270. valueField: 'mode',
  1271. displayField: 'mode_txt',
  1272. value: '{$CI['auth_mode']}',
  1273. width: 220,
  1274. listeners:{
  1275. select: function( t, r, i ){
  1276. doModuleOperation( {$EID}, 15, r.data.wm_id, false );
  1277. }
  1278. }
  1279. },{
  1280. xtype: 'spacer',
  1281. height: 5
  1282. },{
  1283. xtype: 'textfield',
  1284. fieldLabel: '{$Labels->GetLabel('_API_USER_')}',
  1285. id: 'api_user',
  1286. width: 220,
  1287. value: '{$CI['access_user']}',
  1288. listeners:{
  1289. change: function( t, n, o ){
  1290. doModuleOperation( {$EID}, 10, n, false );
  1291. }
  1292. }
  1293. },{
  1294. xtype: 'spacer',
  1295. height: 5
  1296. },{
  1297. xtype: 'textfield',
  1298. fieldLabel: '{$Labels->GetLabel('_API_PASSWORD_')}',
  1299. id: 'api_pass',
  1300. width: 220,
  1301. value: '{$CI['access_pass']}',
  1302. listeners:{
  1303. change: function( t, n, o ){
  1304. doModuleOperation( {$EID}, 11, n, false );
  1305. }
  1306. }
  1307. },{
  1308. xtype: 'spacer',
  1309. height: 5
  1310. },{
  1311. xtype: 'combo',
  1312. fieldLabel: '{$Labels->GetLabel('_DET_EVT_ENA_')}',
  1313. id: 'det_evt_ena',
  1314. lazyRender:true,
  1315. mode: 'local',
  1316. forceSelection: true,
  1317. triggerAction: 'all',
  1318. editable: false,
  1319. disableKeyFilter: true,
  1320. store: new Ext.data.ArrayStore({
  1321. fields: ['status_val','status_txt'],
  1322. data: [[0,'Disabled'],[1,'Enabled']]
  1323. }),
  1324. value: '{$CI['detection_evt_ena']}',
  1325. valueField: 'status_val',
  1326. displayField: 'status_txt',
  1327. listeners:{
  1328. select: function( t, r, i ){
  1329. if( r.data.status_val ) doModuleOperation( {$EID}, 16, 1, false ); else doModuleOperation( {$EID}, 16, 0, false );
  1330. }
  1331. }
  1332. },{
  1333. xtype: 'spacer',
  1334. height: 5
  1335. },{
  1336. xtype: 'numberfield',
  1337. fieldLabel: '{$Labels->GetLabel('_DETECTION_ID_')}',
  1338. id: 'det_evt_id',
  1339. width: 220,
  1340. value: '{$CI['detection_evt_id']}',
  1341. listeners:{
  1342. change: function( t, n, o ){
  1343. doModuleOperation( {$EID}, 17, n, false );
  1344. }
  1345. }
  1346. },{
  1347. xtype: 'spacer',
  1348. height: 5
  1349. },{
  1350. xtype: 'combo',
  1351. fieldLabel: '{$Labels->GetLabel('_CAM_EVT_ENA_')}',
  1352. id: 'cam_evt_ena',
  1353. lazyRender:true,
  1354. mode: 'local',
  1355. forceSelection: true,
  1356. triggerAction: 'all',
  1357. editable: false,
  1358. disableKeyFilter: true,
  1359. store: new Ext.data.ArrayStore({
  1360. fields: ['status_val','status_txt'],
  1361. data: [[0,'Disabled'],[1,'Enabled']]
  1362. }),
  1363. value: '{$CI['camera_evt_ena']}',
  1364. valueField: 'status_val',
  1365. displayField: 'status_txt',
  1366. listeners:{
  1367. select: function( t, r, i ){
  1368. if( r.data.status_val ) doModuleOperation( {$EID}, 18, 1, false ); else doModuleOperation( {$EID}, 18, 0, false );
  1369. }
  1370. }
  1371. },{
  1372. xtype: 'spacer',
  1373. height: 5
  1374. },{
  1375. xtype: 'numberfield',
  1376. fieldLabel: '{$Labels->GetLabel('_CAM_EVT_ID_')}',
  1377. id: 'cam_evt_id',
  1378. width: 220,
  1379. value: '{$CI['camera_evt_id']}',
  1380. listeners:{
  1381. change: function( t, n, o ){
  1382. doModuleOperation( {$EID}, 19, n, false );
  1383. }
  1384. }
  1385. },{
  1386. xtype: 'spacer',
  1387. height: 5
  1388. }]
  1389. }
  1390. EFUFU;
  1391. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_BVMS_DESC_SHO_') , $TPL );
  1392. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_BVMS_DESC_LOO_'), $TPL );
  1393. echo $TPL;
  1394. break;
  1395. case 13: // Attention Cloud
  1396. $QS="SELECT * FROM `module_attention` WHERE `id`={$CR['aux_id']}";
  1397. $II = $DATABASE->Query( $QS );
  1398. $CI = $II[0];
  1399. $TPL =<<<EFUFU
  1400. {
  1401. xtype: 'form',
  1402. labelAlign: 'right',
  1403. autoScroll: 'auto',
  1404. labelWidth: 300,
  1405. items:[{
  1406. border: false,
  1407. frame: false,
  1408. xtype: 'panel',
  1409. html: '<table width="100%" border=0 class="setEd_infoPanel" id="ATTEN"><tr><td width="65px"><img width="64px" src="/style/assets/1203179.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
  1410. },{
  1411. xtype: 'spacer',
  1412. height: 5
  1413. },{
  1414. xtype: 'numberfield',
  1415. fieldLabel: '{$Labels->GetLabel('_PERSIST_ON_TARG_')}',
  1416. id: 'pota',
  1417. width: 220,
  1418. value: '{$CI['persist']}',
  1419. listeners:{
  1420. change: function( t, n, o ){
  1421. doModuleOperation( {$EID}, 12, n, false );
  1422. }
  1423. }
  1424. },{
  1425. xtype: 'spacer',
  1426. height: 5
  1427. },{
  1428. xtype: 'numberfield',
  1429. fieldLabel: '{$Labels->GetLabel('_REST_AFTR_TARG_')}',
  1430. id: 'refta',
  1431. width: 220,
  1432. value: '{$CI['rest']}',
  1433. listeners:{
  1434. change: function( t, n, o ){
  1435. doModuleOperation( {$EID}, 13, n, false );
  1436. }
  1437. }
  1438. },{
  1439. xtype: 'spacer',
  1440. height: 5
  1441. },{
  1442. xtype: 'numberfield',
  1443. fieldLabel: '{$Labels->GetLabel('_ATT_ZONE_RANGE_')}',
  1444. id: 'attzar',
  1445. width: 220,
  1446. value: '{$CI['range']}',
  1447. listeners:{
  1448. change: function( t, n, o ){
  1449. doModuleOperation( {$EID}, 14, n, false );
  1450. }
  1451. }
  1452. },{
  1453. xtype: 'spacer',
  1454. height: 5
  1455. }]
  1456. }
  1457. EFUFU;
  1458. $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MOATTEN_DESC_SHO_'), $TPL );
  1459. $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MOATTEN_DESC_LONG_'), $TPL );
  1460. echo $TPL;
  1461. break;
  1462. };
  1463. } else {
  1464. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  1465. };
  1466. } else {
  1467. header('location: /');
  1468. };
  1469. ?>