2014-09-03 16:56:42 +02:00

117 lines
6.9 KiB
HTML

{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block content %}
<div class="row">
<h3>{{ host.get_fqdn }}</h3>
<div class="col-md-4">
<h3>{% trans "Edit Host" %}</h3>
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">{% trans "Update" %}</button>
</form>
<h3>{% trans "Delete Host" %}</h3>
<p class="text-danger">
{% trans "Deleting a host is not undoable. If you need it back, you'll have to add it again and configure a new update secret." %}
</p>
<form method="get" action="{% url 'delete_host' host.pk %}">
<button type="submit" class="btn btn-primary btn-danger">{% trans "Delete Host" %}</button>
</form>
</div>
<div class="col-md-4">
<h3>{% trans "Show Configuration" %}</h3>
<p>
{% blocktrans %}We'll generate a ready-to-use configuration for your router / update
client, filled out with all values (including a new secret).{% endblocktrans %}
</p>
<p class="text-warning">
{% blocktrans %}We'll create a new secret - if you had one before, it will become invalid.
You have to use the new secret in your router / update client configuration.{% endblocktrans %}
</p>
<form action="{% url 'generate_secret_view' host.pk %}" method="get">
<button type="submit" class="btn btn-primary btn-warning">{% trans "Show Configuration" %}</button>
</form>
<h3>{% trans "Update other Services" %}</h3>
<p>{% trans "We can send updates to other services when we receive an update from you." %}</p>
<form action="{% url 'updater_hostconfig_overview' host.pk %}" method="get">
<button type="submit" class="btn btn-primary">{% trans "Configure Updaters" %}</button>
</form>
</div>
<div class="col-md-4">
<h3>{% trans "Update Nameserver Records" %}</h3>
<p>{% blocktrans %}Usually you configure your router to follow the dyndns2 protocol.
But if you know what you are doing, and you want to update manually, you can do it here.{% endblocktrans %}
<br>
{% trans "We populated the input fields for the new addresses with your currently detected remote addresses." %}
</p>
<div class="form-group">
<label for="current_ipv4">{% trans "Current IPv4 address from master nameserver" %}</label>
<input class="form-control" type="text" id="current_ipv4" name="current_ipv4" value="{{ host.get_ipv4 }}" disabled>
<label for="myipv4">{% trans "Set new IPv4 address" %}</label>
<input class="form-control" type="text" id="myipv4" name="myipv4" placeholder="{% trans "give new ipv4 address" %}" value="{{ request.session.ipv4 }}" required autofocus>
</div>
<button type="button" class="btn btn-primary" onclick="update_host_v4('{{ host.get_fqdn }}')">{% trans "Update" %}</button> <span id="update_result_v4"></span>
<button type="button" class="btn" onclick="delete_host_v4('{{ host.get_fqdn }}')">{% trans "Delete" %}</button> <span id="delete_result_v4"></span>
<p></p>
<div class="form-group">
<label for="current_ipv6">{% trans "Current IPv6 address from master nameserver" %}</label>
<input class="form-control" type="text" id="current_ipv6" name="current_ipv6" value="{{ host.get_ipv6 }}" disabled>
<label for="myipv6">{% trans "Set new IPv6 address" %}</label>
<input class="form-control" type="text" id="myipv6" name="myipv6" placeholder="{% trans "give new ipv6 address" %}" value="{{ request.session.ipv6 }}" required>
</div>
<button type="button" class="btn btn-primary" onclick="update_host_v6('{{ host.get_fqdn }}')">{% trans "Update" %}</button> <span id="update_result_v6"></span>
<button type="button" class="btn" onclick="delete_host_v6('{{ host.get_fqdn }}')">{% trans "Delete" %}</button> <span id="delete_result_v6"></span>
<script>
update_host_v4 = function(host) {
$('#update_result_v4').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv4').val(), hostname: host } )
.done(function( data ) {
$('#update_result_v4').text(data);
}).fail(function( data ) {
$('#update_result_v4').text('error');
});
};
update_host_v6 = function(host) {
$('#update_result_v6').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv6').val(), hostname: host } )
.done(function( data ) {
$('#update_result_v6').text(data);
}).fail(function( data ) {
$('#update_result_v6').text('error');
});
};
delete_host_v4 = function(host) {
$('#delete_result_v4').text('deleting...');
$.get( "{% url 'nic_delete_authorized' %}", { myip: '0.0.0.0', hostname: host } )
.done(function( data ) {
$('#delete_result_v4').text(data);
}).fail(function( data ) {
$('#delete_result_v4').text('error');
});
};
delete_host_v6 = function(host) {
$('#delete_result_v6').text('deleting...');
$.get( "{% url 'nic_delete_authorized' %}", { myip: '::', hostname: host } )
.done(function( data ) {
$('#delete_result_v6').text(data);
}).fail(function( data ) {
$('#delete_result_v6').text('error');
});
};
</script>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>{% trans "Result Messages" %}</h3>
<form>
<label for="client_result_msg">{% trans "Client Result Message" %}</label>
<input class="form-control" type="text" maxlength="255" id="client_result_msg" value="{{ host.client_result_msg }}" disabled>
<label for="server_result_msg">{% trans "Server Result Message" %}</label>
<input class="form-control" type="text" maxlength="255" id="server_result_msg" value="{{ host.server_result_msg }}" disabled>
</form>
</div>
</div>
{% endblock %}