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.
 
 
 
 

65 lines
2.7 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Node = intval( $_POST['NODE'] );
$QS = "SELECT * FROM nodes WHERE id = {$Node}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$Props = $Result[0];
$QS = "SELECT * FROM servers WHERE id = {$Props['aux_id']}";
$Result = $DATABASE->Query( $QS, false );
$Server = $Result[0];
$TName = 'props/0_node_prop.js';
$Data = file_get_contents( $TName );
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data );
$Data = str_replace('%%%NODENAME%%%', $Props['name'] , $Data );
//Info
$InfoData = '';
$InfoParts = array();
$InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ID">'.$Server['identity'].'</div>\'}';
if($Props['online']){
$InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Online</div>\'}';
}else{
$InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_OFF">Offline</div>\'}';
};
$InfoData = implode( ',', $InfoParts );
$Data = str_replace('%%%INFO%%%', $InfoData, $Data );
// Get Sockets
$SocketsData = '';
$SockDataParts = array();
$QS = "SELECT * FROM sockets WHERE `node_id`={$Node}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
foreach( $Result as $R ){
switch( $R['type'] ){
case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:
//Uart
$SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="UART_'.(($R['state']==0)?'N':'O').'_'.(($R['binded']==0)?'N':'B').'">'.$R['name'].'</div>\'}';
break;
case ARGUS_NODE_SOCK_TYPE_VIDEO_GRABBER:
//Video Grabber
$SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="VIDEO_'.(($R['state']==0)?'N':'O').'_'.(($R['binded']==0)?'N':'B').'">'.$R['name'].'</div>\'}';
break;
case ARGUS_NODE_SOCK_TYPE_NETWORK:
//Network Interface
$SockDataParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="NET_'.(($R['state']==0)?'N':'O').'">'.$R['name'].'</div>\'}';
break;
default:
$SockDataParts[] = '{ xtype: \'panel\', html: \'<div align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['name'].'</div>\'}';
};
};
$SocketsData = implode( ',', $SockDataParts );
};
$Data = str_replace('%%%SOCKETS%%%', $SocketsData, $Data );
//Get Modules
$ModulesData = '{}';
$Data = str_replace('%%%MODULES%%%', $ModulesData, $Data );
echo $Data;
} else {
echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}';
};
} else {
header('location: /');
};
?>