Web UI for ARGUS server
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.

64 lines
2.7 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $Node = intval( $_POST['NODE'] );
  5. $QS = "SELECT * FROM nodes WHERE id = {$Node}";
  6. $Result = $DATABASE->Query( $QS, false );
  7. if( count( $Result ) ){
  8. $Props = $Result[0];
  9. $QS = "SELECT * FROM servers WHERE id = {$Props['aux_id']}";
  10. $Result = $DATABASE->Query( $QS, false );
  11. $Server = $Result[0];
  12. $TName = 'props/0_node_prop.js';
  13. $Data = file_get_contents( $TName );
  14. $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data );
  15. $Data = str_replace('%%%NODENAME%%%', $Props['name'] , $Data );
  16. //Info
  17. $InfoData = '';
  18. $InfoParts = array();
  19. $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ID">'.$Server['identity'].'</div>\'}';
  20. if($Props['online']){
  21. $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Online</div>\'}';
  22. }else{
  23. $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_OFF">Offline</div>\'}';
  24. };
  25. $InfoData = implode( ',', $InfoParts );
  26. $Data = str_replace('%%%INFO%%%', $InfoData, $Data );
  27. // Get Sockets
  28. $SocketsData = '';
  29. $SockDataParts = array();
  30. $QS = "SELECT * FROM sockets WHERE `node_id`={$Node}";
  31. $Result = $DATABASE->Query( $QS, false );
  32. if( count( $Result ) ){
  33. foreach( $Result as $R ){
  34. switch( $R['type'] ){
  35. case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:
  36. //Uart
  37. $SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="UART_'.(($R['state']==0)?'N':'O').'_'.(($R['binded']==0)?'N':'B').'">'.$R['name'].'</div>\'}';
  38. break;
  39. case ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER:
  40. //Video Grabber
  41. $SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="VIDEO_'.(($R['state']==0)?'N':'O').'_'.(($R['binded']==0)?'N':'B').'">'.$R['name'].'</div>\'}';
  42. break;
  43. case ARGUS_NODE_SOCK_TYPE_NETWORK:
  44. //Network Interface
  45. $SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="NET_'.(($R['state']==0)?'N':'O').'">'.$R['name'].'</div>\'}';
  46. break;
  47. default:
  48. $SockDataParts[] = '{ xtype: \'panel\', html: \'<div align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['name'].'</div>\'}';
  49. };
  50. };
  51. $SocketsData = implode( ',', $SockDataParts );
  52. };
  53. $Data = str_replace('%%%SOCKETS%%%', $SocketsData, $Data );
  54. //Get Modules
  55. $ModulesData = '{}';
  56. $Data = str_replace('%%%MODULES%%%', $ModulesData, $Data );
  57. echo $Data;
  58. } else {
  59. echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}';
  60. };
  61. } else {
  62. header('location: /');
  63. };
  64. ?>