mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-28 22:15:40 +00:00
8ea00b9484
- Use Flask blueprint - Split model and views into smaller parts - Bug fixes - API adjustment
285 lines
12 KiB
HTML
285 lines
12 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}<title>Domain Management - {{ SITE_NAME }}</title>{% endblock %}
|
|
|
|
{% block dashboard_stat %}
|
|
{% if status %}
|
|
{% if status.get('status') == 'ok' %}
|
|
<div class="alert alert-success">
|
|
<strong>Success!</strong> {{ status.get('msg') }}
|
|
</div>
|
|
{% elif status.get('status') == 'error' %}
|
|
<div class="alert alert-danger">
|
|
{% if status.get('msg') != None %}
|
|
<strong>Error!</strong> {{ status.get('msg') }}
|
|
{% else %}
|
|
<strong>Error!</strong> An undefined error occurred.
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
<section class="content-header">
|
|
<h1>
|
|
Manage domain <small>{{ domain.name }}</small>
|
|
</h1>
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ url_for('dashboard.dashboard') }}"><i class="fa fa-dashboard"></i> Home</a></li>
|
|
<li class="active">Domain Management</li>
|
|
</ol>
|
|
</section>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<form method="post" action="{{ url_for('domain.setting', domain_name=domain.name) }}">
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Domain Access Control</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<div class="row">
|
|
<div class="col-xs-2">
|
|
<p>Users on the right have access to manage the records in
|
|
the {{ domain.name }} domain.</p>
|
|
<p>Click on users to move from between columns.</p>
|
|
<p>
|
|
Users in <font style="color: red;">red</font> are Administrators
|
|
and already have access to <b>ALL</b> domains.
|
|
</p>
|
|
</div>
|
|
<div class="form-group col-xs-2">
|
|
<select multiple="multiple" class="form-control" id="domain_multi_user"
|
|
name="domain_multi_user[]">
|
|
{% for user in users %}
|
|
<option {% if user.id in
|
|
domain_user_ids %}selected{% endif %} value="{{ user.username }}"
|
|
{% if user.role.name== 'Administrator' %}style="color: red" {% endif %}>{{
|
|
user.username}}</option> {% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="box-body">
|
|
<div class="col-xs-offset-2">
|
|
<div class="form-group">
|
|
<button type="submit" class="btn btn-flat btn-primary"><i class="fa fa-check"></i>
|
|
Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Account</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<div class="col-xs-12">
|
|
<div class="form-group">
|
|
<form method="post"
|
|
action="{{ url_for('domain.change_account', domain_name=domain.name) }}">
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
<select name="accountid" class="form-control" style="width:15em;">
|
|
<option value="0">- No Account -</option>
|
|
{% for account in accounts %}
|
|
<option value="{{ account.id }}"
|
|
{% if domain_account.id == account.id %}selected{% endif %}>{{ account.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select><br />
|
|
<button type="submit" class="btn btn-flat btn-primary" id="change_soa_edit_api">
|
|
<i class="fa fa-check"></i> Change account for {{ domain.name }}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Auto PTR creation</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<p><input type="checkbox" id="{{ domain.name }}" class="auto_ptr_toggle"
|
|
{% for setting in domain.settings %}{% if setting.setting=='auto_ptr' and setting.value=='True' %}checked{% endif %}{% endfor %}
|
|
{% if SETTING.get('auto_ptr') %}disabled="True" {% endif %}>
|
|
Allow automatic reverse pointer creation on record updates?{% if
|
|
SETTING.get('auto_ptr') %}</br><code>Auto-ptr is enabled globally on the PDA
|
|
system!</code>{% endif %}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">DynDNS 2 Settings</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<p><input type="checkbox" id="{{ domain.name }}" class="dyndns_on_demand_toggle"
|
|
{% for setting in domain.settings %}{% if setting.setting=='create_via_dyndns' and setting.value=='True' %}checked{% endif %}{% endfor %}>
|
|
Allow on-demand creation of records via DynDNS updates?</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Change SOA-EDIT-API</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<p>The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made
|
|
to the domain.</p>
|
|
<ul>
|
|
<li>
|
|
DEFAULT - Generate a soa serial of YYYYMMDD01. If the current serial is lower than the
|
|
generated serial, use the generated serial. If the current serial is higher or equal to the
|
|
generated serial, increase the current serial by 1.
|
|
</li>
|
|
<li>
|
|
INCREASE - Increase the current serial by 1.
|
|
</li>
|
|
<li>
|
|
EPOCH - Change the serial to the number of seconds since the EPOCH, aka unixtime.
|
|
</li>
|
|
<li>
|
|
OFF - Disable automatic updates of the SOA serial.
|
|
</li>
|
|
</ul>
|
|
<b>New SOA-EDIT-API Setting:</b>
|
|
<form method="post" action="{{ url_for('domain.change_soa_edit_api', domain_name=domain.name) }}">
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
<select name="soa_edit_api" class="form-control" style="width:15em;">
|
|
<option selected value="0">- Unchanged -</option>
|
|
<option>DEFAULT</option>
|
|
<option>INCREASE</option>
|
|
<option>EPOCH</option>
|
|
<option>OFF</option>
|
|
</select><br />
|
|
<button type="submit" class="btn btn-flat btn-primary" id="change_soa_edit_api">
|
|
<i class="fa fa-check"></i> Change SOA-EDIT-API setting for {{ domain.name }}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<h3 class="box-title">Domain Deletion</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<p>This function is used to remove a domain from PowerDNS-Admin <b>AND</b> PowerDNS. All records and
|
|
user privileges associated with this domain will also be removed. This change cannot be
|
|
reverted.</p>
|
|
<button type="button" class="btn btn-flat btn-danger pull-left delete_domain"
|
|
id="{{ domain.name }}">
|
|
<i class="fa fa-trash"></i> DELETE DOMAIN {{ domain.name }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|
|
{% block extrascripts %}
|
|
<script>
|
|
//initialize pretty checkboxes
|
|
$('.dyndns_on_demand_toggle').iCheck({
|
|
checkboxClass: 'icheckbox_square-blue',
|
|
increaseArea: '20%' // optional
|
|
});
|
|
$('.auto_ptr_toggle').iCheck({
|
|
checkboxClass: 'icheckbox_square-blue',
|
|
increaseArea: '20%' // optional
|
|
});
|
|
|
|
$("#domain_multi_user").multiSelect();
|
|
|
|
//handle checkbox toggling
|
|
$('.dyndns_on_demand_toggle').on('ifToggled', function (event) {
|
|
var is_checked = $(this).prop('checked');
|
|
var domain = $(this).prop('id');
|
|
postdata = {
|
|
'action': 'set_setting',
|
|
'data': {
|
|
'setting': 'create_via_dyndns',
|
|
'value': is_checked
|
|
},
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
};
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/domain/' + domain + '/manage-setting', true);
|
|
});
|
|
$('.auto_ptr_toggle').on('ifToggled', function (event) {
|
|
var is_checked = $(this).prop('checked');
|
|
var domain = $(this).prop('id');
|
|
postdata = {
|
|
'action': 'set_setting',
|
|
'data': {
|
|
'setting': 'auto_ptr',
|
|
'value': is_checked
|
|
},
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
};
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/domain/' + domain + '/manage-setting', true);
|
|
});
|
|
|
|
// handle deletion of domain
|
|
$(document.body).on('click', '.delete_domain', function () {
|
|
var modal = $("#modal_delete_domain");
|
|
var domain = $(this).prop('id');
|
|
var info = "Are you sure you want to delete " + domain + "?";
|
|
modal.find('.modal-body p').text(info);
|
|
modal.find('#button_delete_confirm').click(function () {
|
|
$.post($SCRIPT_ROOT + '/domain/setting/' + domain + '/delete', {
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
}, function () {
|
|
window.location.href = '{{ url_for('dashboard.dashboard') }}';
|
|
});
|
|
modal.modal('hide');
|
|
})
|
|
modal.modal('show');
|
|
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
{% block modals %}
|
|
<div class="modal fade modal-warning" id="modal_delete_domain">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
<h4 class="modal-title">Confirmation</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p></p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-flat btn-default pull-left" data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-flat btn-danger" id="button_delete_confirm">
|
|
Delete</button>
|
|
</div>
|
|
</div>
|
|
<!-- /.modal-content -->
|
|
</div>
|
|
<!-- /.modal-dialog -->
|
|
</div>
|
|
{% endblock %}
|