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.
 
 
 
 

233 lines
8.7 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Z = intval( $_POST['NID'] );
if( $Z ){
$QS = "SELECT * FROM `nodes` WHERE `id`={$Z}";
$NN = $DATABASE->Query( $QS );
if( count( $NN ) ){
$Node = $NN[0];
switch( $Node['type'] ){
case 0:{
$QS="SELECT * FROM `servers` WHERE `id`={$Node['aux_id']}";
$SDD = $DATABASE->Query( $QS );
$NData = $SDD[0];
$QS="SELECT * FROM `resources` WHERE `node_id`={$Z} AND ( `type`=101 OR `type`=102 )";
$CN = $DATABASE->Query( $QS );
$IL=array();
foreach( $CN as $N ){
$QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
$NWD = $DATABASE->Query( $QS );
$NW = $NWD[0];
$IL[]="<td width=\"50px\"><img width=\"32\" src=\"/style/assets/".(($N['type']==101)?'NICs.png':'wifi-icon.png')."\"></td><td align=\"right\"><b>{$N['device']}:</b></td><td><b>{$NW['address']}</b></td>";
};
$NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
?>
{
xtype: 'tabpanel',
frame: false,
id: 'node_settings_content',
border: false,
activeTab: 0,
items: [{
xtype: 'panel',
title: 'General Info',
layout: 'hbox',
items:[{
xtype: 'panel',
flex: 1,
height: 303,
autoScroll: false,
html: '<table width="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr></table>'
},{
xtype: 'form',
id: '_ed_small',
flex: 1,
height: 303,
autoScroll: false,
//layout: 'vbox',
labelWidth: 120,
labelAlign: 'right',
items:[{
xtype: 'textfield',
fieldLabel: '<?=$Labels->GetLabel( 'SERV_NAME' );?>',
id: 'node_name',
value: '<?=$Node['name'];?>',
listeners:{
change: function(){
settingsChangeNotifier( 'node_name' );
Ext.getCmp('sasa_bo').enable();
}
}
},{
xtype: 'panel',
width: '100%',
html: '<div class="sideInfo_item" id="INFO_ON"><?=$Labels->GetLabel( 'SERV_BLD_TAG' ).': '.$NData['version_string'];?></div>'
},{
xtype: 'panel',
width: '100%',
html: '<div class="setEd_infoPanel" id="INFO_IPS"><?=$NIFO;?></div>'
},{
xtype: 'button',
id: 'sasa_bo',
width: '100%',
disabled: true,
text: 'Apply Changes',
handler: function(){
}
}]
}]
},{
xtype: 'panel',
title: 'Resources',
layout: 'hbox',
items:[{
xtype: 'panel',
flex: 1,
height: 303,
autoScroll: 'auto',
//layout: 'fit',
items:[<?php
$QS = "SELECT * FROM resources WHERE `node_id`={$Z}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
foreach( $Result as $R ){
switch( $R['type'] ){
case 1:
//Uart
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 6:
//USB DC
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="USBDC_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 31:
//Video Grabber
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="VIDEO_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('FRAMEGRAB_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 100:
//Loopback
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('LOOPBACK_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 101:
//Ethernet Interface
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('ETHERNET_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 102:
//WiFi Interface
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WIFI_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 103:
//Virtual IP Interface
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VIRTUALIP_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 104:
//VPN Interface
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VPN_TUN_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 105:
//WAN Interface
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WAN_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
//Media Encoder Sink
case 131: // Video Encoder Sink
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Video Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
case 132: // Audio Encoder Sink
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Audio Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
break;
default:
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
};
};
echo implode( ',', $SockDataParts );
};
?>]
},{
xtype: 'panel',
id: 'res_ed_small',
flex: 1,
height: 303,
layout: 'fit',
items:[{
html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
}]
}]
},{
xtype: 'panel',
title: 'Modules',
layout: 'hbox',
items:[{
xtype: 'panel',
flex: 1,
height: 303,
autoScroll: 'auto',
tbar:[{
text: 'Add Module'
}],
items:[<?php
$QS = "SELECT * FROM server_modules WHERE `server_id`={$Node['aux_id']}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
foreach( $Result as $R ){
$QS = "SELECT * FROM server_module_types WHERE id={$R['type']}";
$MOMO = $DATABASE->Query( $QS, false );
$MOD = $MOMO[0];
switch( $R['type'] ){
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
$ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enabled']==0)?'N':'O').'" onclick="editModule('.$R['id'].');">'.$Labels->GetLabel($MOD['name']).'</a>\'}';
break;
default:
$ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}';
};
};
echo implode( ',', $ModPart );
};
?>]
},{
xtype: 'panel',
id: 'mod_ed_small',
flex: 1,
height: 303,
layout: 'fit',
items:[{
html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
}]
}]
},{
xtype: 'panel',
title: 'Network',
items:[]
}],
listeners:{
afterrender: function(){
settingsAreChanged = false;
}
},
updateSettings: function(){
alert('Update Settings');
}
}
<?php
break;
};
};
} else {
echo "{}";
};
} else {
echo "{}";
};
} else {
echo "{}";
};
?>