diff --git a/modules/registrars/synergywholesaledomains/js/functions.js b/modules/registrars/synergywholesaledomains/js/functions.js index cecc145..49761b6 100644 --- a/modules/registrars/synergywholesaledomains/js/functions.js +++ b/modules/registrars/synergywholesaledomains/js/functions.js @@ -12,6 +12,24 @@ if ('undefined' !== typeof toastr) { toastr.options.fadeIn = 500; } +$(document).ready(function () { + $('#dnsrecords').delegate('select', 'change', function () { + var self = $(this); + var form = self.closest('form'); + var addressCol = form.find("div:eq(1)"); + + if (self.val() == 'SRV') { + addressCol.html('\ + \ + \ + \ + ') + } else { + addressCol.html('') + } + }); +}); + function Toast(type, css, msg) { toastr.options.positionClass = css; toastr[type](msg); @@ -198,7 +216,7 @@ function addRecord(domain_id, temprecord_id, formdata, recordType) { $('#form-' + data.record_id + ' input[name=address]').val(data.recordContent); $('#form-' + data.record_id + ' input[name=ttl]').val(data.recordTTL); - if ('undefined' !== typeof data.recordPrio && 'MX' === data.recordType) { + if ('undefined' !== typeof data.recordPrio && ('MX' === data.recordType || 'SRV' === data.recordType)) { $('#form-' + data.record_id + ' input[name=priority]').val(data.recordPrio); } else { $('#form-' + data.record_id + ' input[name=priority]').val('N/A'); @@ -270,7 +288,7 @@ function saveRecord(domain_id, record_id, formdata, recordType) { $('#form-' + data.record_id + ' input[name=hostname]').val(data.recordName); $('#form-' + data.record_id + ' input[name=address]').val(data.recordContent); $('#form-' + data.record_id + ' input[name=ttl]').val(data.recordTTL); - if (typeof data.recordPrio !== 'undefined' && data.recordType == 'MX') { + if (typeof data.recordPrio !== 'undefined' && (data.recordType == 'MX' || data.recordType == 'SRV')) { $('#form-' + data.record_id + ' input[name=priority]').val(data.recordPrio); } else { $('#form-' + data.record_id + ' input[name=priority]').val('N/A'); @@ -328,7 +346,7 @@ function populateDNSRow(record_id, domain, hostname, type, ttl, address, priorit `; } - let template = `
+ var template = `
@@ -350,6 +368,33 @@ function populateDNSRow(record_id, domain, hostname, type, ttl, address, priorit
`; + if ('SRV' == type) { + var srvContent = address.split(" "); + var template = `
+
+ +
+ +
+
+ + + +
+
+ +
+
+ +
+
+ +
+ ${controls} +
+
`; + } + $('#dnsrecords').append(template); } diff --git a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php index 31c8030..8e13968 100644 --- a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php +++ b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php @@ -1823,6 +1823,10 @@ function synergywholesaledomains_manageDNSURLForwarding(array $params) return synergywholesaledomains_ajaxResponse(['error' => 'Error adding DNS record: Cannot add NS on root domain.']); } + if ($_REQUEST['type'] == 'SRV') { + $_REQUEST['address'] = "{$_REQUEST['address1']} {$_REQUEST['address2']} {$_REQUEST['address3']}"; + } + $record = []; foreach (['type', 'address', 'priority', 'ttl'] as $key) { if (!empty($_REQUEST[$key])) {