<table class="table">
	<tr>
		<th><a href="?p=dashboard&clear_cache" onclick="return confirm('Are you sure?');">Clear cache</a></th>
	</tr>
</table>
<form action="?p=dashboard&maintenance" method="post">
	<table class="table">
		<tr>
			<th colspan="2">Maintenance
			</th>
		</tr>
		<tr>
			<td>Site status:</td>
			<td>
				<select name="status">
					<option value="0"{% if not is_closed %} selected{% endif %}>Open</option>
					<option value="1"{% if is_closed %} selected{% endif %}>Closed</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>Message: (only if closed)</td>
			<td>
				<textarea name="message" maxlength="255" cols="40" rows="5">{{ closed_message }}</textarea>
			<td>
		</tr>
		<tr>
			<td colspan="2">
				<input type="submit" class="button" value="Update"/>
			</td>
	</table>
</form>
<br/>
<div>
	{% if status.online %}
	<p class="success" style="width: 150px; text-align: center;">Status: Online<br/>
		{{ status.uptimeReadable }}, {{ status.players }}/{{ status.playersMax }}<br/>
		{{ status.lua.ip }} : {{ status.lua.loginPort }}
		<br/><br/><u><a id="more-button" href="#"></a></u>

		<span id="status-more">
		<br/>
		<b>Server</b>:<br/> {{ status.server }} {{ status.serverVersion }}<br/>
		<b>Version</b>: {{ status.clientVersion }}<br/><br/>

		<b>Monsters</b>: {{ status.monsters }}<br/>
		<b>Map</b>: {{ status.mapName }}, <b>author</b>: {{ status.mapAuthor }}, <b>size</b>: {{ status.mapWidth }} x {{ status.mapHeight }}<br/>
		<b>MOTD</b>:<br/> {{ status.motd }}<br/><br/>

		<b>Last updated</b>: {{ status.lastCheck|date("H:i:s") }}
		</span>
	</p>
	{% else %}
	<p class="error" style="width: 120px; text-align: center;">Status: Offline</p>
	{% endif %}
</div>
{% if status.online %}
<script type="text/javascript">
    $(document).ready(function() {
        $("#status-more").hide();
        $("#more-button").text("More");
    });

    $("#more-button").click(function() {
        if($("#status-more").is(":hidden")) {
            $("#more-button").text("Hide");
            $("#status-more").show();
        }
        else {
            $("#more-button").text("More");
            $("#status-more").hide();
        }

        return false;
    });
</script>
{% endif %}