diff --git a/lib/Froxlor/Ajax/Ajax.php b/lib/Froxlor/Ajax/Ajax.php index 4fa57aee..073af4ab 100644 --- a/lib/Froxlor/Ajax/Ajax.php +++ b/lib/Froxlor/Ajax/Ajax.php @@ -83,6 +83,8 @@ class Ajax return $this->getConfigDetails(); case 'getConfigJsonExport': return $this->getConfigJsonExport(); + case 'loadLanguageString': + return $this->loadLanguageString(); default: return $this->errorResponse('Action not found!'); } @@ -344,4 +346,16 @@ class Ajax } return $this->errorResponse('Not allowed', 403); } + + /** + * loads a given language string by its identifier + */ + private function loadLanguageString() + { + $langid = isset($_POST['langid']) ? $_POST['langid'] : ""; + if (preg_match('/^([a-zA-Z\.]+)$/', $langid)) { + return $this->jsonResponse(lng($langid)); + } + return $this->errorResponse('Invalid identifier: ' . $langid, 406); + } } diff --git a/lib/formfields/formfield.dns_add.php b/lib/formfields/formfield.dns_add.php index 0528c199..b7c07da0 100644 --- a/lib/formfields/formfield.dns_add.php +++ b/lib/formfields/formfield.dns_add.php @@ -63,7 +63,8 @@ return [ 'dns_content' => [ 'label' => 'Content', 'type' => 'text', - 'value' => $content + 'value' => $content, + 'note' => lng('dnseditor.notes.A') ], 'dns_ttl' => [ 'label' => 'TTL', diff --git a/lng/en.lng.php b/lng/en.lng.php index fb38af24..9dee0886 100644 --- a/lng/en.lng.php +++ b/lng/en.lng.php @@ -897,6 +897,25 @@ return [ 'dnseditor' => [ 'edit' => 'edit DNS', 'records' => 'records', + 'notes' => [ + 'A' => '32-bit IPv4 address, used to map hostnames to an IP address of the host.', + 'AAAA' => '128-bit IPv6 address, used to map hostnames to an IP address of the host.', + 'CAA' => 'The CAA resource record allows a DNS domain name holder to specify one or more Certification Authorities (CAs) authorized to issue certificates for that domain.
Structure: flag tag[issue|issuewild|iodef|contactmail|contactphone] value
Example: 0 issue "ca.example.net"
0 iodef "mailto:security@example.com"
', + 'CNAME' => 'Alias of the domain name, the DNS lookup will continue by retrying the lookup with the new name. Only possible for subdomains!', + 'DNAME' => 'Creates an alias for an entire subtree of the domain name tree', + 'LOC' => 'Geographic location information for a domain name.
Structure: ( d1 [m1 [s1]] {"N"|"S"} d2 [m2 [s2]] {"E"|"W"} alt["m"] [siz["m"] [hp["m"] [vp["m"]]]] )
Description: d1: [0 .. 90] (degrees latitude) + d2: [0 .. 180] (degrees longitude) + m1, m2: [0 .. 59] (minutes latitude/longitude) + s1, s2: [0 .. 59.999] (seconds latitude/longitude) + alt: [-100000.00 .. 42849672.95] BY .01 (altitude in meters) + siz, hp, vp: [0 .. 90000000.00] (size/precision in meters)
Example: 52 22 23.000 N 4 53 32.000 E -2.00m 0.00m 10000m 10m', + 'MX' => 'Mail exchange record, maps a domain name to a mailserver for that domain.
Example: 10 mail.example.com
Note: For priority, use field above', + 'NS' => 'Delegates a DNS zone to use the given authoritative name servers.', + 'RP' => 'Responsible Person record
Structure: mailbox[replace @ with a dot] txt-record-name
Example: team.froxlor.org. froxlor.org.', + 'SRV' => 'Service location record, used for newer protocols instead of creating protocol-specific records such as MX.
Structure: priority weight port target
Example: 0 5 5060 sipserver.example.com.
Note: For priority, use field above', + 'SSHFP' => 'The SSHFP resource record is used to publish secure shell (SSH) key fingerprints in the DNS.
Structure: algorithm type fingerprint
Algorithms: 0: reserved, 1: RSA, 2: DSA, 3: ECDSA, 4: Ed25519, 6: Ed448
Types: 0: reserved, 1: SHA-1, 2: SHA-256
Example: 2 1 123456789abcdef67890123456789abcdef67890', + 'TXT' => 'Free definable, descriptive text.' + ] ], 'domain' => [ 'openbasedirpath' => 'OpenBasedir-path', diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig index eae300a0..5fa944d4 100644 --- a/templates/Froxlor/form/formfields.html.twig +++ b/templates/Froxlor/form/formfields.html.twig @@ -137,9 +137,6 @@ {% if field.type == 'hidden' and field.display is defined %} {% endif %} - {% if field.note is defined and field.note is not empty %} -
{{ field.note|raw }}
- {% endif %} {% if field.next_to is defined %} {% for nid, nfield in field.next_to %} {% if nfield.next_to_prefix is defined %} diff --git a/templates/Froxlor/src/js/components/dnseditor.js b/templates/Froxlor/src/js/components/dnseditor.js new file mode 100644 index 00000000..cd062f5e --- /dev/null +++ b/templates/Froxlor/src/js/components/dnseditor.js @@ -0,0 +1,19 @@ +$(function () { + + // Display helptext to content box according to dns-record type selected + $("select[name='dns_type']").on('change', function () { + var selVal = $(this).val(); + $.ajax({ + url: "lib/ajax.php?action=loadLanguageString", + type: "POST", + dataType: "json", + data: { langid: 'dnseditor.notes.' + selVal }, + success: function (data) { + $("#dns_content").next().html(data); + }, + error: function (request, status, error) { + console.log(request, status, error) + } + }); + }); +}); diff --git a/templates/Froxlor/src/js/main.js b/templates/Froxlor/src/js/main.js index ed895581..4afc92b1 100644 --- a/templates/Froxlor/src/js/main.js +++ b/templates/Froxlor/src/js/main.js @@ -22,3 +22,4 @@ require('./components/domains') require('./components/configfiles') require('./components/apikeys') require('./components/install') +require('./components/dnseditor')