<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
</head>
<?

  @zones = $EQW->ListBootedZones();
#  @zones = (
#   { type => "dynamic", short_name => "arena", long_name => "Arena", port => 8001 },
#   { type => "static", short_name => "freportw", long_name => "West Freeport", port => 8002 },
#   { type => "static", short_name => "freportn", long_name => "North Freeport", port => 8003 }
#  );

?>

<body>
<h2 align="center">Zone List</h2>
<hr/>
<div align="center">
<a href="action.html?action=rebootall">Reboot All Zones</a> -
<a href="action.html?action=killall">Kill All Zones</a>
</div>
<hr/>
<?
print "You have ".($#zones+1)." zones running.";
?>
<hr/>
<table width="100%"  border="1" cellspacing="2" cellpadding="3" class="zonelist">
  <tr>
    <th scope="col">Zone Name </th>
    <th scope="col">Port</th>
    <th scope="col">Players</th>
    <th scope="col">Log File </th>
    <th scope="col">Actions</th>
  </tr>
<?
  for my $zonekey (sort @zones) {
		my $zone = $EQW->GetZoneDetails($zonekey);
		if(!$zone) {
			$zone->{long_name} = "ERROR: no zone";
		} elsif($zone->{error}) {
			$zone->{long_name} = "ERROR: $zone->{error}";
		}

		print "<tr>\n";
		if($zone->{type} eq "dynamic") {
			if($zone->{zone_id} == 0) {
				print "\t<td><b>$zone->{launched_name}:</b> <a href='zone.html?zone=$zone->{short_name}'>Idle</a></td>";
			} else {
				print "\t<td><b>$zone->{launched_name}:</b> <a href='zone.html?zone=$zone->{short_name}'>$zone->{long_name}</a> ($zone->{short_name})</td>";
			}
		} else {
			print "<td><a href='zone.html?zone=$zone->{short_name}'>$zone->{long_name}</a> ($zone->{short_name})</td>";
		}
		print "<td>$zone->{port}</td>";
		print "<td><a href='players.html?zone=$zone->{short_name}'>Players</a></td>";
		print "<td><a href='log.html?zone=$zone->{short_name}'>View Log</a></td>";
		print "<td>";
		print "<a href='action.html?zone=$zone->{short_name}&action=restart'>Restart</a> - ";
		print "<a href='action.html?zone=$zone->{short_name}&action=kill'>Kill</a>";
		print "</td>\n";
		print "</tr>\n";
  }
?>
</table>




</body>
</html>
