<?php
include_once 'config.php';
include_once 'inc/index_post.php';
$machines=getAllMachines();
$js="";
$out="";
?>
<html>
<head>
<script type="text/javascript" src="js/site.js"></script>
<link rel="stylesheet" href="css/site.css" type="text/css" />
</head>
<body>
<form method='post' action='./'>
<table class="main" align="center" rules="rows" >
<?php if($is_admin): ?>
<tr>
<td colspan='7'>
<? include 'addmachine.php' ?>
</td>
</tr>
<? endif ?>
<tr>
<td class='thead'>Machine</td>
<td class='thead'>Protocol</td>
<td class='thead'>Port</td>
<td class='thead'>Status</td>
<td class='thead'>Action</td>
<td class='thead'>Connect</td>
<?php if($is_admin): ?>
<td class='thead'>Delete</td>
<?php endif ?>
</tr>
<? foreach($machines as $mid=>$machine): ?>
<?php $services=getAllServices($mid)?>
<tr style="border-bottom:solid thin black">
<td rowspan="<?php echo count($services); ?>" style="text-align:left;font-weight:bold;font-size:small">
<?php include 'inc/machine_table.php';?>
</td>
<?php if(count($services)>0): ?>
<?php foreach ($services as $service): ?>
<? $id=$service->id; ?>
<? $js .= "var xmlhttp$id=GetXmlHttpObject()\n"; ?>
<? $js .= "var xmlhttp_a$id=GetXmlHttpObject()\n"; ?>
<? $js .= "checkService($id,false)\n"; ?>
<td class='display-proto'><?php echo $service->protocol; ?></td>
<td class='display'><?php echo $service->port; ?></td>
<td class='status' id='<?php echo $id."-status";?>'><img src='img/processing.gif' width='100' height='30'></img></td>
<td class='status' id='<?php echo $id."-action";?>'></td>
<td class='status' style='text-align:left'>
<?php if($service->protocol=='http'): ?>
<a href="http://<?php echo $machine->host.":".$service->port;?>" target="_blank"><img src='img/text_html.png' width='30' height='30' /></a>
</td>
<?php endif ?>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php endforeach ?>
<?php if($is_admin): ?>
<tr>
<td colspan='5'><input type='submit' value='Update' /></td>
</tr>
<?php endif ?>
</table>
</form>
<script type="text/javascript">
<?php echo $js;?>
</script>
</body>
</html>