FreedomBox/plinth/modules/dynamicdns/templates/dynamicdns_configure.html
Daniel Steglich 746b077557 fixed typo
2015-03-05 13:15:44 +01:00

145 lines
5.8 KiB
HTML

{% extends "base.html" %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% load bootstrap %}
{% block content %}
<form class="form" method="post">
{% csrf_token %}
{% include 'bootstrapform/field.html' with field=form.enabled %}
<div id='dynamicdns-post-enabled-form'>
<h3>Dynamic DNS type</h3>
<div id='dynamicdns-no-js'>
You have disabled Javascript. Dynamic form mode is disabled and
some helper functions may not work </br> (but the main functionality should work)
</br><hr>
</div>
<div id='div-dynamicdns-dropdown' style="display:none">
{% include 'bootstrapform/field.html' with field=form.service_type %}
</div>
<div id='div-dynamicdns-gnudip'>
{% include 'bootstrapform/field.html' with field=form.dynamicdns_server %}
</div>
<div id='div-dynamicdns-updateurl'>
{% include 'bootstrapform/field.html' with field=form.dynamicdns_update_url %}
{% include 'bootstrapform/field.html' with field=form.disable_SSL_cert_check %}
{% include 'bootstrapform/field.html' with field=form.use_http_basic_auth %}
</div>
<h3>Account Information</h3>
{% include 'bootstrapform/field.html' with field=form.dynamicdns_domain %}
{% include 'bootstrapform/field.html' with field=form.dynamicdns_user %}
{% include 'bootstrapform/field.html' with field=form.dynamicdns_secret %}
{% include 'bootstrapform/field.html' with field=form.showpw %}
<h3>IP check URL</h3>
{% include 'bootstrapform/field.html' with field=form.dynamicdns_ipurl %}
</div>
<input type="submit" class="btn btn-primary" value="Update setup"/>
</form>
{% endblock %}
{% block page_js %}
<script type="text/javascript">
var SELFHOST = 'https://carol.selfhost.de/update?username=<User>&password=<Pass>&myip=<Ip>'
var NOIP = 'http://dynupdate.no-ip.com/nic/update?hostname=<Domain>&myip=<Ip>'
window.onload = function() {mod_form()}
function show_pass()
{
if(document.getElementById('id_dynamicdns-showpw').checked){
document.getElementById('id_dynamicdns-dynamicdns_secret').type='text';}
else
document.getElementById('id_dynamicdns-dynamicdns_secret').type='password';
}
function dropdown()
{
var dropdown = document.getElementById('id_dynamicdns-service_type');
var service_type = dropdown.options[dropdown.selectedIndex].value;
document.getElementById('id_dynamicdns-use_http_basic_auth').checked = false;
document.getElementById('id_dynamicdns-disable_SSL_cert_check').checked = false;
if (service_type == 1){
document.getElementById('div-dynamicdns-updateurl').style.display = 'none';
document.getElementById('div-dynamicdns-gnudip').style.display = 'block';
document.getElementById('id_dynamicdns-dynamicdns_update_url').value='';
}
if (service_type == 2){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
document.getElementById('id_dynamicdns-dynamicdns_update_url').value = NOIP;
document.getElementById('id_dynamicdns-use_http_basic_auth').checked = true;
document.getElementById('id_dynamicdns-dynamicdns_server').value='';
}
if (service_type == 3){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
document.getElementById('id_dynamicdns-dynamicdns_update_url').value = SELFHOST;
document.getElementById('id_dynamicdns-dynamicdns_server').value='';
}
if (service_type == 4){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
document.getElementById('id_dynamicdns-dynamicdns_update_url').value='';
document.getElementById('id_dynamicdns-dynamicdns_server').value='';
}
}
function mod_form()
{
document.getElementById('dynamicdns-no-js').style.display = 'none';
document.getElementById('div-dynamicdns-dropdown').style.display = 'block';
if ( document.getElementById('id_dynamicdns-enabled').checked ) {
document.getElementById('dynamicdns-post-enabled-form').style.display = 'block';
var dropdown = document.getElementById('id_dynamicdns-service_type');
var service_type = dropdown.options[dropdown.selectedIndex].value;
if (service_type == 1){
document.getElementById('div-dynamicdns-updateurl').style.display = 'none';
document.getElementById('div-dynamicdns-gnudip').style.display = 'block';
}
if (service_type == 2){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
}
if (service_type == 3){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
}
if (service_type == 4){
document.getElementById('div-dynamicdns-gnudip').style.display = 'none';
document.getElementById('div-dynamicdns-updateurl').style.display = 'block';
}
}else{
document.getElementById('dynamicdns-post-enabled-form').style.display = 'none';
}
}
</script>
{% endblock %}