UI improvements

This commit is contained in:
Pinga 2025-04-03 14:30:31 +03:00
parent 4e3e788952
commit 08d30c57e9
3 changed files with 88 additions and 60 deletions

View file

@ -728,18 +728,6 @@ class SystemController extends Controller
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
} }
if (isset($data['dnssec_enable'], $data['bind9_enable'])) {
if ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] === 'on') {
$dnssec_both = 1;
} elseif ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] !== 'on') {
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
} elseif ($data['dnssec_enable'] !== 'on' && $data['bind9_enable'] === 'on') {
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
}
}
try { try {
$db->beginTransaction(); $db->beginTransaction();
@ -821,18 +809,6 @@ class SystemController extends Controller
] ]
); );
if (isset($dnssec_both) && $dnssec_both === 1) {
$db->update(
'domain_tld',
[
'secure' => 1
],
[
'id' => $tld_id
]
);
}
// Loop through category indices from 1 to 10 // Loop through category indices from 1 to 10
for ($i = 1; $i <= 10; $i++) { for ($i = 1; $i <= 10; $i++) {
$categoryNameKey = 'categoryName' . $i; $categoryNameKey = 'categoryName' . $i;
@ -1984,4 +1960,50 @@ class SystemController extends Controller
} }
public function manageDnssec(Request $request, Response $response)
{
if ($_SESSION["auth_roles"] != 0) {
return $response->withHeader('Location', '/dashboard')->withStatus(302);
}
$db = $this->container->get('db');
if (!empty($_SESSION['u_tld_id'])) {
$tld_id = $_SESSION['u_tld_id'][0];
} else {
$this->container->get('flash')->addMessage('error', 'No TLD specified for DNSSEC');
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
}
if (!empty($_SESSION['u_tld_extension'])) {
$tld_extension = $_SESSION['u_tld_extension'][0];
} else {
$this->container->get('flash')->addMessage('error', 'No TLD specified for DNSSEC');
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
}
try {
$db->update(
'domain_tld',
[
'secure' => 1
],
[
'id' => $tld_id
]
);
unset($_SESSION['u_tld_id']);
unset($_SESSION['u_tld_extension']);
$this->container->get('flash')->addMessage('success', 'DNSSEC for ' . $tld_extension . ' has been successfully activated');
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
} catch (Exception $e) {
$db->rollBack();
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
}
}
} }

View file

@ -3,6 +3,7 @@
{% block title %}{{ __('Manage TLD') }} {{ tld.tld }}{% endblock %} {% block title %}{{ __('Manage TLD') }} {{ tld.tld }}{% endblock %}
{% block content %} {% block content %}
<link href="/assets/css/sweetalert2.min.css" rel="stylesheet">
<div class="page-wrapper"> <div class="page-wrapper">
<!-- Page header --> <!-- Page header -->
<div class="page-header d-print-none"> <div class="page-header d-print-none">
@ -17,18 +18,6 @@
{{ __('Manage TLD') }} {{ tld_u }} {{ __('Manage TLD') }} {{ tld_u }}
</h2> </h2>
</div> </div>
<!-- Page title actions -->
<div class="col-auto ms-auto d-print-none">
<div class="btn-list">
<a href="/registry/idnexport/{{ tld.tld }}" class="btn btn-outline-info d-none d-sm-inline-block">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3" /></svg>
{{ __('Export IDN Table') }}
</a>
<a href="/registry/idnexport/{{ tld.tld }}" class="btn btn-outline-info d-sm-none btn-icon" aria-label="{{ __('Export IDN Table') }}" title="{{ __('Export IDN Table') }}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3" /></svg>
</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -41,7 +30,12 @@
{{ csrf.field | raw }} {{ csrf.field | raw }}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('General Details') }}</h5> <h3 class="card-title">{{ __('General Details') }}</h3>
<div class="card-actions">
<a href="/registry/idnexport/{{ tld.tld }}" target="_blank" class="btn btn-outline-orange"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4" /><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3" /></svg>
{{ __('Export IDN Table') }}
</a>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="datagrid"> <div class="datagrid">
@ -71,24 +65,6 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="datagrid-item">
<div class="datagrid-title">{{ __('Enable DNSSEC') }}</div>
<div class="datagrid-content">
<label class="form-check">
<input class="form-check-input" type="checkbox" name="dnssec_enable" {% if secureTld == 1 %} checked disabled {% endif %}>
<span class="form-check-label">{{ __('Enable') }}</span>
</label>
</div>
</div>
<div class="datagrid-item">
<div class="datagrid-title">{{ __('DNSSEC Mode') }}</div>
<div class="datagrid-content">
<label class="form-check">
<input class="form-check-input" type="checkbox" name="bind9_enable" {% if secureTld == 1 %} checked disabled {% endif %}>
<span class="form-check-label">{{ __('BIND9') }}</span>
</label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -96,9 +72,9 @@
{% if dnssecData is defined and dnssecData.keys is defined and dnssecData.keys|length > 0 %} {% if dnssecData is defined and dnssecData.keys is defined and dnssecData.keys|length > 0 %}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('DNSSEC Details') }} <h3 class="card-title">{{ __('DNSSEC Details') }}
<span class="card-subtitle">{{ __('Last Updated') }}: {{ dnssecData.timestamp }}</span> <span class="card-subtitle">{{ __('Last Updated') }}: {{ dnssecData.timestamp }}</span>
</h5> </h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
@ -160,7 +136,15 @@
{% elseif dnssecData.error is defined %} {% elseif dnssecData.error is defined %}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('DNSSEC Details') }}</h5> <h3 class="card-title">{{ __('DNSSEC Details') }}</h3>
{% if secureTld != 1 %}
<div class="card-actions">
<a href="/registry/dnssec" class="btn btn-outline-indigo btn-3" id="enableDnssecLink">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12.462 20.87c-.153 .047 -.307 .09 -.462 .13a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 .11 6.37" /><path d="M16 19h6" /><path d="M19 16v6" /></svg>
{{ __('Enable DNSSEC') }}
</a>
</div>
{% endif %}
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
@ -171,7 +155,7 @@
{% else %} {% else %}
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('DNSSEC Details') }}</h5> <h3 class="card-title">{{ __('DNSSEC Details') }}</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
@ -185,7 +169,7 @@
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header">
<h5 class="card-title">{{ __('Pricing') }}</h5> <h3 class="card-title">{{ __('Pricing') }}</h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="table-responsive"> <div class="table-responsive">
@ -324,6 +308,27 @@
</div> </div>
{% include 'partials/footer.twig' %} {% include 'partials/footer.twig' %}
</div> </div>
<script src="/assets/js/sweetalert2.min.js" defer></script>
<script>
document.getElementById('enableDnssecLink').addEventListener('click', function (e) {
e.preventDefault(); // Prevent default link behavior
Swal.fire({
title: 'Are you sure?',
text: 'Please ensure DNSSEC has been properly configured for this TLD prior to proceeding, as outlined in section 2.1.3b. of the manual.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, continue',
cancelButtonText: 'Cancel',
confirmButtonColor: '#4263eb',
cancelButtonColor: '#9ba9be'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = e.target.closest('a').href;
}
});
});
</script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const createm12Input = document.querySelector('input[name="createm12"]'); const createm12Input = document.querySelector('input[name="createm12"]');

View file

@ -150,6 +150,7 @@ $app->group('', function ($route) {
$route->get('/registry/phases/{tld}', SystemController::class . ':viewPhases')->setName('viewPhases'); $route->get('/registry/phases/{tld}', SystemController::class . ':viewPhases')->setName('viewPhases');
$route->post('/registry/phases', SystemController::class . ':managePhases')->setName('managePhases'); $route->post('/registry/phases', SystemController::class . ':managePhases')->setName('managePhases');
$route->get('/registry/idnexport/{script}', SystemController::class .':idnexport')->setName('idnexport'); $route->get('/registry/idnexport/{script}', SystemController::class .':idnexport')->setName('idnexport');
$route->map(['GET', 'POST'], '/registry/dnssec', SystemController::class . ':manageDnssec')->setName('manageDnssec');
$route->get('/support', SupportController::class .':view')->setName('ticketview'); $route->get('/support', SupportController::class .':view')->setName('ticketview');
$route->map(['GET', 'POST'], '/support/new', SupportController::class .':newticket')->setName('newticket'); $route->map(['GET', 'POST'], '/support/new', SupportController::class .':newticket')->setName('newticket');