{% extends "base.html" %}
{% block content %}
<center>
	<h3>Choose server</h3>
	<p>
		<form action="{{ action }}" method="get">
			<select autofocus required name="serv" id="{{ select_id }}">
				<option disabled>Choose server</option>
					{% for select in selects %}
						{% if select.2 == serv %}
							<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
						{% else %}
							<option value="{{ select.2 }}">{{ select.1 }}</option>
						{% endif %}
					{% endfor %}
			</select>
			<button type="submit" value="open" name="open" class="btn btn-default">Open</button>
		</form>
	</p>
	{% if note %}
		<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
	{% endif %}
	{% if open %}
		<center>
			<h3>Choose old version</h3>
			<form action="delver.py#conf" method="get">
				<label for="select_all" id="label_select_all"><b>Select all</b></label>
				<input type="checkbox" id="select_all"><br />
				{% for file in return_files %}
					<label for="{{file}}"> {{file}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
					<a href="/app/configver.py?serv={{serv}}&open=open&configver={{file}}&view=1" class="ui-button ui-widget ui-corner-all" target="_blanck" title="View this version of the config" style="margin-top: -6px;">View</a><br />
				{% endfor %}
				<input type="hidden" value="{{serv}}" name="serv">
				<input type="hidden" value="open" name="open">
				<input type="hidden" value="del" name="del">
				<p>
					<button type="submit" value="" name="" class="btn btn-default">Delete</button>
				</p>
			</form> 
		</center>
	{% endif %}
	{% if aftersave %}
		<div class="alert alert-info"><b>The following files were deleted:</b><br /> </div>
		{% if stderr %}
			<div class="alert alert-danger">
				Some errors:
				<br> 
				<br> 
					{{stderr}} 
			</div>
		{% else %}
			<div class="alert alert-success">
			{% for f in file %}
				{{f}}
			{% endfor %}
			</div>
		{% endif %}
	{% endif %}
	</center>
{% endblock %}