Preparations for TLD create

This commit is contained in:
Pinga 2023-12-09 23:07:19 +02:00
parent f564d3b800
commit 73af9ed9c4
5 changed files with 256 additions and 5 deletions

View file

@ -40,4 +40,15 @@ class SystemController extends Controller
return view($response,'admin/system/manageTlds.twig');
}
public function createTld(Request $request, Response $response)
{
if ($_SESSION["auth_roles"] != 0) {
return $response->withHeader('Location', '/dashboard')->withStatus(302);
}
$db = $this->container->get('db');
return view($response,'admin/system/createTld.twig');
}
}

View file

@ -0,0 +1,240 @@
{% extends "layouts/app.twig" %}
{% block title %}{{ __('Create TLD') }}{% endblock %}
{% block content %}
<div class="page-wrapper">
<!-- Page header -->
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<!-- Page pre-title -->
<div class="page-pretitle">
{{ __('Overview') }}
</div>
<h2 class="page-title">
{{ __('Create TLD') }}
</h2>
</div>
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<div class="col-12">
<form action="/registrar/create" method="post" autocomplete="off">
{{ csrf.field | raw }}
<!-- Registrar Details Card -->
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title">New TLD Registration</h5>
</div>
<div class="card-body">
<form>
<!-- TLD Field -->
<div class="mb-3">
<label for="tldName" class="form-label">TLD Extension</label>
<input type="text" class="form-control" id="tldExtension" placeholder="Enter TLD">
<small class="form-text text-muted">Enter the desired top-level domain (TLD) name, like '.test' or '.example'.</small>
</div>
<!-- DNSSEC Toggle Switch (Disabled) -->
<div class="mb-3">
<label class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="dnssecToggle" disabled>
<span class="form-check-label">DNSSEC</span>
</label>
<small class="form-text text-muted">DNSSEC is currently activated manually. This option is for display purposes only.</small>
</div>
<!-- TLD Type Selector (ccTLD or gTLD) -->
<div class="mb-3">
<label for="tldTypeSelector" class="form-label">TLD Type</label>
<select class="form-select" id="tldTypeSelector">
<option value="ccTLD">ccTLD</option>
<option value="gTLD">gTLD</option>
</select>
<small class="form-text text-muted">Select the type of TLD: ccTLD (Country Code Top-Level Domain) or gTLD (Generic Top-Level Domain).</small>
</div>
<!-- Supported Script Dropdown -->
<div class="mb-3">
<label for="scriptDropdown" class="form-label">Supported Script</label>
<select class="form-select" id="scriptDropdown">
<option selected>ASCII</option>
<option value="cyrillic">Cyrillic</option>
<option value="japanese">Japanese</option>
<option value="korean">Korean</option>
</select>
<small class="form-text text-muted">Choose the script type that the TLD will support. Options include ASCII, Cyrillic, Japanese, and Korean.</small>
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<h5 class="card-title">TLD Pricing</h5>
</div>
<div class="card-body">
<!-- Pricing Table -->
<div class="table-responsive">
<table class="table table-vcenter card-table">
<thead>
<tr>
<th>Command / Duration</th>
<th>Setup Fee</th>
<th>1 Year</th>
<th>2 Years</th>
<th>3 Year</th>
<th>4 Years</th>
<th>5 Year</th>
<th>6 Years</th>
<th>7 Year</th>
<th>8 Years</th>
<th>9 Years</th>
<th>10 Years</th>
</tr>
</thead>
<tbody>
<!-- Create Command Row -->
<tr>
<td>Create</td>
<td><input type="number" class="form-control" name="createm0" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm12" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm24" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm36" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm48" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm60" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm72" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm84" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm96" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm108" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="createm120" placeholder="0.00"></td>
</tr>
<!-- Renew Command Row -->
<tr>
<td>Renew</td>
<td><input type="number" class="form-control" name="renewm0" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm12" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm24" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm36" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm48" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm60" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm72" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm84" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm96" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm108" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="renewm120" placeholder="0.00"></td>
</tr>
<!-- Transfer Command Row -->
<tr>
<td>Transfer</td>
<td><input type="number" class="form-control" name="transferm0" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm12" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm24" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm36" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm48" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm60" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm72" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm84" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm96" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm108" placeholder="0.00"></td>
<td><input type="number" class="form-control" name="transferm120" placeholder="0.00"></td>
</tr>
</tbody>
</table>
</div>
<!-- Restore Price Input -->
<div class="mb-3 mt-3">
<label for="restorePrice" class="form-label">Restore Price</label>
<input type="number" class="form-control" id="restorePrice" placeholder="Enter Restore Price">
<small class="form-text text-muted">Enter the price for restoring a TLD.</small>
</div>
</div>
<div class="card-footer">
<div class="row align-items-center">
<div class="col-auto">
<button type="submit" class="btn btn-primary">Create Registrar</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<footer class="footer footer-transparent d-print-none">
<div class="container-xl">
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item">
Copyright &copy; 2023
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
</li>
</ul>
</div>
</div>
</div>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ipForm = document.getElementById('ipWhitelistForm');
const maxFields = 5;
ipForm.addEventListener('click', function(e) {
const target = e.target;
// Handle Add IP Button Click
if (target.classList.contains('add-ip')) {
const totalFields = ipForm.querySelectorAll('input[name="ipAddress[]"]').length;
if (totalFields < maxFields) {
const newField = target.parentElement.cloneNode(true);
newField.querySelector('input').value = '';
newField.querySelector('.add-ip').classList.replace('btn-primary', 'btn-danger');
newField.querySelector('.add-ip').textContent = '-';
newField.querySelector('.add-ip').classList.replace('add-ip', 'remove-ip');
ipForm.querySelector('#ipAddressFields').appendChild(newField);
}
}
// Handle Remove IP Button Click
if (target.classList.contains('remove-ip')) {
target.parentElement.remove();
}
});
const copyCheckbox = document.getElementById('copyOwnerData');
// Function to copy data to another tab
function copyDataToTab(tabId) {
const ownerInputs = document.querySelectorAll('#owner input:not([type="checkbox"]), #owner select');
const targetFields = document.querySelectorAll(`${tabId} input:not([type='checkbox']), ${tabId} select`);
ownerInputs.forEach((input, index) => {
if (targetFields[index] && input.tagName === targetFields[index].tagName) {
targetFields[index].value = input.value;
}
});
}
copyCheckbox.addEventListener('change', function() {
if (this.checked) {
copyDataToTab('#billing');
copyDataToTab('#abuse');
} else {
// Clear fields when unchecked, if desired
['#billing', '#abuse'].forEach(tabId => {
const fields = document.querySelectorAll(`${tabId} input:not([type='checkbox']), ${tabId} select`);
fields.forEach(field => {
field.value = '';
});
});
}
});
});
</script>
{% endblock %}

View file

@ -25,11 +25,11 @@
{{ __('Manage Reserved Names') }}
</a>
</span>
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
<a href="{{route('createTld')}}" class="btn btn-primary d-none d-sm-inline-block">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
{{ __('Create New TLD') }}
</a>
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create New TLD') }}">
<a href="{{route('createTld')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create New TLD') }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</a>
</div>

View file

@ -25,11 +25,11 @@
{{ __('Manage Reserved Names') }}
</a>
</span>
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
<a href="{{route('createTld')}}" class="btn btn-primary d-none d-sm-inline-block">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
{{ __('Create New TLD') }}
</a>
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create New TLD') }}">
<a href="{{route('createTld')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create New TLD') }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</a>
</div>

View file

@ -189,7 +189,7 @@
</a>
</div>
</li>
<li {{ is_current_url('epphistory') or is_current_url('poll') or is_current_url('log') or is_current_url('registry') or is_current_url('reports') or is_current_url('manageTlds') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
<li {{ is_current_url('epphistory') or is_current_url('poll') or is_current_url('log') or is_current_url('registry') or is_current_url('reports') or is_current_url('manageTlds') or is_current_url('createTld') ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
<span class="nav-link-icon d-md-none d-lg-inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"></path> <path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"></path></svg>
</span>