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.

643 lines
20 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. function makeEthernetInfo( $RessourceID ){
  4. global $DATABASE, $CUser, $Labels;
  5. $TTL = $Labels->GetLabel('_RES_ETHERNET_DESC_');
  6. $QS="SELECT * FROM `network_interfaces` WHERE `id`={$RessourceID}";
  7. $II = $DATABASE->Query( $QS );
  8. $CI = $II[0];
  9. switch( $CI['mode'] ){
  10. case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break;
  11. case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break;
  12. case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break;
  13. case 3: $MS = $Labels->GetLabel( 'MODE_ETHROUTER' ); break;
  14. };
  15. $QS="SELECT * FROM `networks` WHERE `nif_id`={$RessourceID}";
  16. $II = $DATABASE->Query( $QS );
  17. $NetInfo ='';
  18. $IP = array();
  19. foreach($II as $I){
  20. if( $I['type'] == 0 ){
  21. $IP = $I;
  22. $NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  23. } else {
  24. $NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  25. };
  26. };
  27. if( count( $IP ) ){
  28. $TArr = explode( '.', $IP['address'] );
  29. $Base = '';
  30. } else {
  31. };
  32. $R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo;
  33. $R_image = 'Ethernet-Cable-icon.png';
  34. $POPUS = 123;
  35. $A_EDIT = ( $CI['mode'] < 2 )?'true':'false';
  36. $TPL = <<<END_TEMPLATE
  37. {
  38. xtype: 'panel',
  39. border: false,
  40. frame: false,
  41. layout:'table',
  42. //autoHeight:true,
  43. autoWidth:true,
  44. defaults: {
  45. bodyStyle:'padding:0px'
  46. },
  47. layoutConfig: {
  48. tableAttrs: {
  49. style: {
  50. width: '100%'
  51. }
  52. },
  53. columns: 4
  54. },
  55. items: [{
  56. border: false,
  57. width: 10
  58. },{
  59. border: false,
  60. width: 270,
  61. html: '<img width="256px" id="res_info_image" src="/style/assets/{$R_image}">',
  62. },{
  63. xtype: 'panel',
  64. border: false,
  65. frame: false,
  66. width: 420,
  67. height: 320,
  68. items:[{
  69. frame: false,
  70. border: false,
  71. html: '<p style="font-size: 16px;">{$TTL}</p>'
  72. },{
  73. xtype: 'tabpanel',
  74. id: 'ifo_tab',
  75. activeTab: 0,
  76. items:[{
  77. title: 'Info',
  78. html: '{$R_nfo}'
  79. },{
  80. title: 'Settings',
  81. layout: 'form',
  82. labelAlign: 'right',
  83. labelWidth: 150,
  84. items:[{
  85. xtype: 'combo',
  86. fieldLabel: 'Address Allocation',
  87. lazyRender: true,
  88. id: 'aa_type',
  89. mode: 'local',
  90. forceSelection: true,
  91. triggerAction: 'all',
  92. editable: false,
  93. disableKeyFilter: true,
  94. listeners:{
  95. change: function(t,n,o){
  96. if( n < 2 ){
  97. Ext.getCmp('aa_adr').disable();
  98. } else {
  99. Ext.getCmp('aa_adr').enable();
  100. };
  101. }
  102. },
  103. store: new Ext.data.ArrayStore({
  104. fields: ['aa_t','aa_txt'],
  105. data: [
  106. [0,'Disabled'],
  107. [1,'Dynamic (DHCP)'],
  108. [2,'Static'],
  109. [3,'Router'],
  110. ]
  111. }),
  112. value: {$CI['mode']},
  113. valueField: 'aa_t',
  114. displayField: 'aa_txt'
  115. },{
  116. xtype: 'textfield',
  117. id: 'aa_adr',
  118. fieldLabel: 'Address',
  119. value: '{$IP['address']}',
  120. disabled: {$A_EDIT}
  121. },{
  122. xtype: 'textfield',
  123. id: 'aa_mask',
  124. fieldLabel: 'Net Mask',
  125. value: '{$IP['mask']}',
  126. disabled: {$A_EDIT}
  127. },{
  128. xtype: 'textfield',
  129. id: 'aa_gtw',
  130. fieldLabel: 'Gateway',
  131. value: '{$IP['gateway']}',
  132. disabled: true
  133. },{
  134. xtype: 'textfield',
  135. id: 'aa_bcast',
  136. fieldLabel: 'Broadcast',
  137. value: '{$IP['broadcast']}',
  138. disabled: true
  139. },{
  140. xtype: 'spacer',
  141. height: 100
  142. },{
  143. xtype: 'button',
  144. width: '100%',
  145. text: 'Apply Changes'
  146. },{
  147. xtype: 'spacer',
  148. height: 20
  149. }]
  150. },{
  151. title: 'Router',
  152. layout: 'form',
  153. labelAlign: 'right',
  154. labelWidth: 150,
  155. items:[{
  156. xtype: 'checkbox',
  157. fieldLabel: 'Act as DHCP Server',
  158. },{
  159. xtype: 'textfield',
  160. fieldLabel: 'Start IP Range'
  161. },{
  162. xtype: 'textfield',
  163. fieldLabel: 'End IP Range'
  164. }]
  165. }]
  166. }]
  167. },{
  168. border: false,
  169. width: 10
  170. }],
  171. koko: {$POPUS}
  172. }
  173. END_TEMPLATE;
  174. return $TPL;
  175. };
  176. if( $CUser->Data['id'] > 1 ){
  177. $EID = intval( $_POST['RID'] );
  178. $QS = "SELECT * FROM resources WHERE id = {$EID}";
  179. $Result = $DATABASE->Query( $QS, false );
  180. if( count( $Result ) ){
  181. $CR = $Result[0];
  182. switch( $CR['type'] ){
  183. case 1: //https://bufferwall.com/posts/330881001ji1a/
  184. $QS = "SELECT * FROM uart_settings WHERE id={$CR['aux_id']}";
  185. $Result = $DATABASE->Query( $QS );
  186. $Z = $Result[0];
  187. $R_name = $Labels->GetLabel('_RES_HW_UART_DESC_');
  188. $R_dev = $CR['device'];
  189. $R_nfo = 'Speed: ' . $Z['speed'] . ', Bits: ' . $Z['bit'] . ', Parity: ' . $Z['parity'] . ', Stop Bit: '. $Z['stop_bit'];
  190. $R_image = 'unnamed.png';
  191. $TPL =<<<EFUFU
  192. {
  193. xtype: 'form',
  194. labelAlign: 'right',
  195. items:[{
  196. border: false,
  197. frame: false,
  198. xtype: 'panel',
  199. html: '<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td width="65px"><img width="64px" src="/style/assets/unnamed.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table><br/>'
  200. },{
  201. id: 'uart_spd',
  202. xtype: 'combo',
  203. fieldLabel: '%%%SPD%%%',
  204. lazyRender: true,
  205. mode: 'local',
  206. forceSelection: true,
  207. triggerAction: 'all',
  208. editable: false,
  209. disableKeyFilter: true,
  210. store: new Ext.data.ArrayStore({
  211. fields: ['speed'],
  212. data: [[1200],[2400],[9600],[19200],[38400],[57600],[115200]]
  213. }),
  214. valueField: 'speed',
  215. displayField: 'speed',
  216. listeners:{
  217. change: function(){
  218. settingsChangeNotifier( 'uart_spd' );
  219. Ext.getCmp('ua_apply_btn').enable();
  220. }
  221. },
  222. value: %%%SPD_VAL%%%
  223. },{
  224. xtype: 'combo',
  225. fieldLabel: 'Bits',
  226. id: 'ued_bit',
  227. lazyRender:true,
  228. mode: 'local',
  229. forceSelection: true,
  230. triggerAction: 'all',
  231. editable: false,
  232. disableKeyFilter: true,
  233. store: new Ext.data.ArrayStore({
  234. fields: ['bits'],
  235. data: [[5],[6],[7],[8],[9]]
  236. }),
  237. value: %%%BITS_VAL%%%,
  238. valueField: 'bits',
  239. displayField: 'bits'
  240. },{
  241. xtype: 'combo',
  242. fieldLabel: 'Stop Bit',
  243. lazyRender:true,
  244. id: 'ued_stops',
  245. mode: 'local',
  246. forceSelection: true,
  247. triggerAction: 'all',
  248. editable: false,
  249. disableKeyFilter: true,
  250. store: new Ext.data.ArrayStore({
  251. fields: ['stops'],
  252. data: [[1],[1.5],[2]]
  253. }),
  254. value: %%%STOPS_VAL%%%,
  255. valueField: 'stops',
  256. displayField: 'stops'
  257. },{
  258. xtype: 'combo',
  259. fieldLabel: 'Parity',
  260. lazyRender:true,
  261. id: 'ued_parity',
  262. mode: 'local',
  263. forceSelection: true,
  264. triggerAction: 'all',
  265. editable: false,
  266. disableKeyFilter: true,
  267. store: new Ext.data.ArrayStore({
  268. fields: ['par_val','parity'],
  269. data: [['O','Odd'], ['E','Even'],['N','None']]
  270. }),
  271. value: '%%%PARITY_VAL%%%',
  272. valueField: 'par_val',
  273. displayField: 'parity'
  274. },{
  275. xtype: 'spacer',
  276. height: 10
  277. },{
  278. xtype: 'button',
  279. id: 'ua_apply_btn',
  280. disabled: true,
  281. width: '100%',
  282. text: 'Apply Changes',
  283. handler: function(){
  284. var UART_SPD = Ext.getCmp('uart_spd').getValue();
  285. var UART_BIT = Ext.getCmp('ued_bit').getValue();
  286. var UART_STP = Ext.getCmp('ued_stops').getValue();
  287. var UART_PAR = Ext.getCmp('ued_parity').getValue();
  288. Ext.Ajax.request({
  289. url: '/lib/controller/updateResource.php',
  290. params: {
  291. RID: %%%%RES_ID%%%,
  292. UID: %%%USER_ID%%%,
  293. SID: '%%%SESSION%%%',
  294. USPD: UART_SPD,
  295. UBIT: UART_BIT,
  296. USTP: UART_STP,
  297. UPAR: UART_PAR
  298. },
  299. success: function( response, opts ){
  300. data = Ext.decode(response.responseText);
  301. if( data.status ){
  302. cleanupChangeNotifier();
  303. editResource( %%%%RES_ID%%% );
  304. } else {
  305. Ext.Msg.show({
  306. title:'Error',
  307. msg: data.msg,
  308. buttons: Ext.Msg.OK,
  309. icon: Ext.MessageBox.ERROR,
  310. fn: function(btn, text){
  311. cleanupChangeNotifier();
  312. editResource( %%%%RES_ID%%% );
  313. }
  314. });
  315. };
  316. //doRefresh();
  317. },
  318. failure: failureAJAXFunction
  319. });
  320. }
  321. }]
  322. }
  323. EFUFU;
  324. $TPL = str_ireplace( '%%%NAME%%%', $R_name, $TPL );
  325. $TPL = str_ireplace( '%%%INFO%%%', $R_dev, $TPL );
  326. $TPL = str_ireplace( '%%%SPD%%%', $Labels->GetLabel('UART_COM_SPEED'), $TPL );
  327. $TPL = str_ireplace( '%%%SPD_VAL%%%', $Z['speed'], $TPL );
  328. $TPL = str_ireplace( '%%%BITS_VAL%%%',$Z['bit'], $TPL );
  329. $TPL = str_ireplace( '%%%PARITY_VAL%%%',$Z['parity'], $TPL );
  330. $TPL = str_ireplace( '%%%STOPS_VAL%%%',$Z['stop_bit'], $TPL );
  331. $TPL = str_ireplace( '%%%%RES_ID%%%',$EID, $TPL );
  332. $TPL = str_ireplace( '%%%USER_ID%%%',$UserID, $TPL );
  333. $TPL = str_ireplace( '%%%SESSION%%%',$Session, $TPL );
  334. echo $TPL;
  335. break;
  336. case 31: //Video In
  337. $R_name = 'Video Frame Grabber';
  338. $R_dev = $CR['device'];
  339. $STREAM = $CR['aux_id'];
  340. //$QS="SELECT * FROM `media_streams` WHERE `id`={$CR['aux_id']}";
  341. //$II = $DATABASE->Query( $QS );
  342. //$CI = $II[0];
  343. $R_nfo = 'Frame Size: '.$CI['img_width'].'x'.$CI['img_height'].'<br/>Driver: '.$CI['mrl_proto'];
  344. $R_image = 'RCA-Connector-Plug-icon.png';
  345. $QS = "SELECT * FROM `media_streams` WHERE `id`={$STREAM}";
  346. $Result = $DATABASE->Query( $QS, false );
  347. if( count( $Result ) ){
  348. $CS = $Result[0];
  349. $R_nfo = 'Frame Size: '.$CS['img_width'].'x'.$CS['img_height'].'<br/>Driver: '.$CS['mrl_proto'];
  350. $R_image = 'RCA-Connector-Plug-icon.png';
  351. if( $CS['source_type'] == 'A' ){
  352. $Sizes = array();
  353. $Formats = array();
  354. //If Source not assigned or not active
  355. if( $CS['source_id'] == 0 || $CR['active'] == 0 ){
  356. $CMD="v4l2-ctl -d {$CS['mrl']} --list-formats-ext";
  357. $Data = `$CMD`;
  358. $TArr = explode( "\n", $Data );
  359. foreach( $TArr as $R ){
  360. $CL = trim( $R );
  361. if( stripos($CL,']:')!== false ){
  362. $ID = intval( substr( $CL, 1 ) );
  363. $FCC = substr( $CL, stripos( $CL, ':' ) + 3, 4 );
  364. $DSC = substr( $CL, stripos( $CL, ':' ) + 9 );
  365. $Formats[] = array('id'=>$ID, '4cc'=>$FCC, 'desc'=>$DSC );
  366. };
  367. if( stripos($CL,'Size:')!== false ){
  368. $TBarr=explode( ' ', $CL );
  369. if( intval( $TBarr[1] ) ){
  370. $ZArr = explode( 'x', $TBarr[1] );
  371. $Sizes[$TBarr[1]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[1] );
  372. } else {
  373. $ZArr = explode( 'x', $TBarr[2] );
  374. $Sizes[$TBarr[2]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[2] );
  375. };
  376. };
  377. };
  378. };
  379. $CMD="v4l2-ctl -d {$CS['mrl']} --list-ctrls-menu";
  380. $Data = `$CMD`;
  381. $TArr = explode( "\n", $Data );
  382. $Controls = array();
  383. $MFlag = false;
  384. $MID = 0;
  385. $id = 0;
  386. foreach( $TArr as $R ){
  387. $CL = trim( $R );
  388. if( stripos( $CL, ':' ) !== false ){
  389. $ctrl = array();
  390. $RR = explode( ':', $CL );
  391. $TArr=explode( ' ', $CL );
  392. if( stripos( $CL, 'int' )!== false ){
  393. $ctrl['type'] = 'slider';
  394. $ctrl['name'] = trim( $TArr[0] );
  395. $ctrl['name_cod'] = md5( $ctrl['name'] );
  396. $ctrl['id'] = hexdec( $TArr[1] );
  397. $TArr=explode( ' ', $RR[1] );
  398. $TBrr = explode( '=', $TArr[1] );
  399. $ctrl['min'] = intval( $TBrr[1] );
  400. $TBrr = explode( '=', $TArr[2] );
  401. $ctrl['max'] = intval( $TBrr[1] );
  402. $TBrr = explode( '=', $TArr[3] );
  403. $ctrl['step'] = intval( $TBrr[1] );
  404. $TBrr = explode( '=', $TArr[5] );
  405. $ctrl['value'] = intval( $TBrr[1] );
  406. $MFlag = false;
  407. $Controls[$id] = $ctrl;
  408. $id++;
  409. } else if( stripos( $CL, 'bool' )!== false ){
  410. $ctrl['type'] = 'checkbox';
  411. $ctrl['name'] = trim( $TArr[0] );
  412. $ctrl['name_cod'] = md5( $ctrl['name'] );
  413. $ctrl['id'] = hexdec( $TArr[1] );
  414. $TArr=explode( ' ', $RR[1] );
  415. $TBrr = explode( '=', $TArr[2] );
  416. $ctrl['value'] = intval( $TBrr[1] );
  417. $MFlag = false;
  418. $Controls[$id] = $ctrl;
  419. $id++;
  420. } else if( stripos( $CL, 'menu' )!== false ){
  421. $ctrl['type'] = 'combo';
  422. $ctrl['name'] = trim( $TArr[0] );
  423. $ctrl['name_cod'] = md5( $ctrl['name'] );
  424. $ctrl['id'] = hexdec( $TArr[1] );
  425. $TArr=explode( ' ', $RR[1] );
  426. $TBrr = explode( '=', $TArr[4] );
  427. $ctrl['value'] = intval( $TBrr[1] );
  428. $MFlag = true;
  429. $MID = $id;
  430. $Controls[$id] = $ctrl;
  431. $id++;
  432. } else {
  433. if( $MFlag ){
  434. $ZV = explode( ':', $CL );
  435. $cmi= array();
  436. $cmi['id']=intval( $ZV[0] );
  437. $cmi['text']=trim( $ZV[1] );
  438. $Controls[$MID]['data'][]=$cmi;
  439. };
  440. };
  441. };
  442. };
  443. $CCC = 0;
  444. $OUT = array();
  445. if( count( $Formats ) ){
  446. $ll = "{
  447. xtype: 'combo',
  448. fieldLabel: '". $Labels->GetLabel('_FRAME_FORMAT_') ."',
  449. lazyRender: true,
  450. id: 'frmt_id',
  451. name: 'frame_format',
  452. mode: 'local',
  453. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  454. listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'frmt_id'); }},
  455. store: new Ext.data.ArrayStore({
  456. fields: ['fmt','fmt_txt'],
  457. data: [";
  458. $cl = array();
  459. foreach( $Formats as $F ){
  460. $cl[]="[{$F['id']},\"{$F['desc']}\"]";
  461. };
  462. $ll .= implode( ',', $cl );
  463. $ll .="]
  464. }),
  465. valueField: 'fmt',
  466. displayField: 'fmt_txt'
  467. }";
  468. $OUT[$CCC] = $ll;
  469. $CCC++;
  470. };
  471. if( count( $Sizes ) ){
  472. $ll = "{
  473. xtype: 'combo',
  474. fieldLabel: '". $Labels->GetLabel('_FRAME_SIZE_') ."',
  475. lazyRender: true,
  476. id: 'sizes_id',
  477. name: 'frame_size',
  478. mode: 'local',
  479. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  480. listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'sizes_id'); }},
  481. store: new Ext.data.ArrayStore({
  482. fields: ['size','size_txt'],
  483. data: [";
  484. $cl = array();
  485. $id = 0;
  486. $csid = 0;
  487. foreach( $Sizes as $Key=>$Val ){
  488. if( $Val['width'] == $CS['img_width'] && $Val['height'] == $CS['img_height'] ) $csid = $Key;//$id;
  489. //$cl[]="[{$id},\"{$Key}\"]";
  490. $cl[]="[\"{$Key}\",\"{$Key}\"]";
  491. $id++;
  492. };
  493. $ll .= implode( ',', $cl );
  494. $ll .="]
  495. }),
  496. valueField: 'size',
  497. displayField: 'size_txt',
  498. value: '{$csid}'
  499. }";
  500. $OUT[$CCC] = $ll;
  501. $CCC++;
  502. };
  503. //print_r( $Controls );
  504. if( count( $Controls )){
  505. foreach( $Controls as $CC ){
  506. $ll = "{ xtype: '{$CC['type']}', id: '{$CC['id']}', name: '{$CC['name']}', fieldLabel: '".$Labels->GetLabel($CC['name_cod'])."', value: {$CC['value']}, listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, '{$CC['id']}' ); } }, ";
  507. switch( $CC['type'] ){
  508. case 'slider':{
  509. $ll .= "minValue: {$CC['min']}, maxValue: {$CC['max']}, width: 235 }";
  510. break;
  511. };
  512. case 'checkbox':{
  513. if( $CC['value'] == 1 ){
  514. $ll .= "checked: true }";
  515. } else {
  516. $ll .= "checked: false }";
  517. };
  518. break;
  519. };
  520. case 'combo':{
  521. $ll .= "lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({
  522. fields: ['{$CC['id']}_id','{$CC['id']}_txt'],
  523. data: [";
  524. $cl = array();
  525. foreach( $CC['data'] as $D ) $cl[]="[{$D['id']},\"{$D['text']}\"]";
  526. $ll .= implode(',', $cl );
  527. $ll .="]
  528. }),
  529. valueField: '{$CC['id']}_id',
  530. displayField: '{$CC['id']}_txt'
  531. }";
  532. break;
  533. };
  534. };
  535. $OUT[$CCC] = $ll;
  536. $CCC++;
  537. };
  538. }; //https://www.waveshare.com/wiki/SIM7600E-H_4G_HAT
  539. $CCA = implode( ',', $OUT );
  540. echo "{ xtype: 'form', id:'an_str_edit', frame: false, autoScroll: true, border: false, layout: 'form', labelAlign: 'right', labelWidth: 150, items: [". $CCA ."] }";
  541. } else {
  542. echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
  543. };
  544. } else {
  545. echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
  546. };
  547. break;
  548. case 101: // Ethernet
  549. $R_name = $Labels->GetLabel('_RES_ETHERNET_DESC_');
  550. $R_dev = $CR['device'];
  551. $QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}";
  552. echo makeEthernetInfo( $CR['aux_id'] );
  553. exit;
  554. $II = $DATABASE->Query( $QS );
  555. $CI = $II[0];
  556. switch( $CI['mode'] ){
  557. case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break;
  558. case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break;
  559. case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break;
  560. case 1: $MS = $Labels->GetLabel( 'MODE_ETHROUTER' ); break;
  561. };
  562. $QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}";
  563. $II = $DATABASE->Query( $QS );
  564. $NetInfo ='';
  565. foreach($II as $I){
  566. if( $I['type'] == 0 ){
  567. $NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  568. } else {
  569. $NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  570. };
  571. };
  572. $R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo;
  573. $R_image = 'Ethernet-Cable-icon.png';
  574. break;
  575. case 102: // WiFi
  576. $R_name = $Labels->GetLabel('_RES_WIFI_DESC_');
  577. $R_dev = $CR['device'];
  578. $QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}";
  579. $II = $DATABASE->Query( $QS );
  580. $CI = $II[0];
  581. switch( $CI['mode'] ){
  582. case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break;
  583. case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break;
  584. case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break;
  585. case 3: $MS = $Labels->GetLabel( 'MODE_ACCESS_POINT' ); break;
  586. };
  587. $QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}";
  588. $II = $DATABASE->Query( $QS );
  589. $NetInfo ='';
  590. foreach($II as $I){
  591. if( $I['type'] == 0 ){
  592. $NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  593. } else {
  594. $NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  595. };
  596. };
  597. $R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo;
  598. $R_image = 'wifi-modem-Vista-icon.png';
  599. break;
  600. case 105:
  601. $R_name = $Labels->GetLabel('_RES_WAN_DESC_');
  602. $R_dev = $CR['device'];
  603. $QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}";
  604. $II = $DATABASE->Query( $QS );
  605. $CI = $II[0];
  606. switch( $CI['mode'] ){
  607. case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break;
  608. case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break;
  609. case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break;
  610. case 3: $MS = $Labels->GetLabel( 'MODE_ACCESS_POINT' ); break;
  611. };
  612. $QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}";
  613. $II = $DATABASE->Query( $QS );
  614. $NetInfo ='';
  615. foreach($II as $I){
  616. if( $I['type'] == 0 ){
  617. $NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  618. } else {
  619. $NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask'];
  620. };
  621. };
  622. $R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo;
  623. $R_image = 'wifi-modem-Vista-icon.png';
  624. break;
  625. };
  626. } else {
  627. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  628. };
  629. } else {
  630. header('location: /');
  631. };
  632. ?>