diff --git a/DnsServerCore/www/js/zone.js b/DnsServerCore/www/js/zone.js
index 4dcaf89f..1e3ab1f1 100644
--- a/DnsServerCore/www/js/zone.js
+++ b/DnsServerCore/www/js/zone.js
@@ -61,6 +61,26 @@ $(function () {
}
});
+ $("input[type=radio][name=rdZoneTransfer]").change(function () {
+ var zoneTransfer = $('input[name=rdZoneTransfer]:checked').val();
+ if (zoneTransfer === "AllowOnlySpecifiedNameServers") {
+ $("#txtZoneTransferNameServers").prop("disabled", false);
+ }
+ else {
+ $("#txtZoneTransferNameServers").prop("disabled", true);
+ }
+ });
+
+ $("input[type=radio][name=rdZoneNotify]").change(function () {
+ var zoneTransfer = $('input[name=rdZoneNotify]:checked').val();
+ if (zoneTransfer === "SpecifiedNameServers") {
+ $("#txtZoneNotifyNameServers").prop("disabled", false);
+ }
+ else {
+ $("#txtZoneNotifyNameServers").prop("disabled", true);
+ }
+ });
+
$("#chkAddEditRecordDataPtr").click(function () {
var addPtrRecord = $("#chkAddEditRecordDataPtr").prop('checked');
$("#chkAddEditRecordDataCreatePtrZone").prop('disabled', !addPtrRecord);
@@ -158,14 +178,28 @@ function refreshZones(checkDisplay) {
var isReadOnlyZone = zones[i].internal;
+ var disableOptions;
+
+ switch (zones[i].type) {
+ case "Primary":
+ case "Secondary":
+ disableOptions = zones[i].internal;
+ break;
+
+ default:
+ disableOptions = true;
+ break;
+ }
+
tableHtmlRows += "
| " + htmlEncode(name) + " | ";
tableHtmlRows += "" + type + " | ";
tableHtmlRows += "" + status + " | ";
tableHtmlRows += "" + expiry + " | ";
- tableHtmlRows += "";
+ tableHtmlRows += " | ";
tableHtmlRows += "";
tableHtmlRows += "";
- tableHtmlRows += " |
";
+ tableHtmlRows += "";
+ tableHtmlRows += "";
}
$("#tableZonesBody").html(tableHtmlRows);
@@ -287,6 +321,144 @@ function deleteZone(objBtn, domain, editZone) {
});
}
+function showZoneOptions(domain) {
+ var divZoneOptionsAlert = $("#divZoneOptionsAlert");
+ var divZoneOptionsLoader = $("#divZoneOptionsLoader");
+ var divZoneOptions = $("#divZoneOptions");
+
+ divZoneOptionsLoader.show();
+ divZoneOptions.hide();
+
+ $("#modalZoneOptions").modal("show");
+
+ HTTPRequest({
+ url: "/api/zone/options/get?token=" + token + "&domain=" + domain,
+ success: function (responseJSON) {
+ if (responseJSON.response.name === "")
+ responseJSON.response.name = ".";
+
+ $("#lblZoneOptionsZoneName").text(responseJSON.response.name);
+
+ $("#txtZoneTransferNameServers").prop("disabled", true);
+ $("#txtZoneNotifyNameServers").prop("disabled", true);
+
+ switch (responseJSON.response.zoneTransfer) {
+ case "Allow":
+ $("#rdZoneTransferAllow").prop("checked", true);
+ break;
+
+ case "AllowOnlyZoneNameServers":
+ $("#rdZoneTransferAllowOnlyZoneNameServers").prop("checked", true);
+ break;
+
+ case "AllowOnlySpecifiedNameServers":
+ $("#rdZoneTransferAllowOnlySpecifiedNameServers").prop("checked", true);
+ $("#txtZoneTransferNameServers").prop("disabled", false);
+ break;
+
+ case "Deny":
+ default:
+ $("#rdZoneTransferDeny").prop("checked", true);
+ break;
+ }
+
+ {
+ var value = "";
+
+ for (var i = 0; i < responseJSON.response.zoneTransferNameServers.length; i++)
+ value += responseJSON.response.zoneTransferNameServers[i] + "\r\n";
+
+ $("#txtZoneTransferNameServers").val(value);
+ }
+
+ switch (responseJSON.response.notify) {
+ case "ZoneNameServers":
+ $("#rdZoneNotifyZoneNameServers").prop("checked", true);
+ break;
+
+ case "SpecifiedNameServers":
+ $("#rdZoneNotifySpecifiedNameServers").prop("checked", true);
+ $("#txtZoneNotifyNameServers").prop("disabled", false);
+ break;
+
+ case "None":
+ default:
+ $("#rdZoneNotifyNone").prop("checked", true);
+ break;
+ }
+
+ {
+ var value = "";
+
+ for (var i = 0; i < responseJSON.response.notifyNameServers.length; i++)
+ value += responseJSON.response.notifyNameServers[i] + "\r\n";
+
+ $("#txtZoneNotifyNameServers").val(value);
+ }
+
+ divZoneOptionsLoader.hide();
+ divZoneOptions.show();
+ },
+ error: function () {
+ divZoneOptionsLoader.hide();
+ },
+ invalidToken: function () {
+ $("#modalZoneOptions").modal("hide");
+ showPageLogin();
+ },
+ objAlertPlaceholder: divZoneOptionsAlert,
+ objLoaderPlaceholder: divZoneOptionsLoader
+ });
+}
+
+function saveZoneOptions() {
+ var divZoneOptionsAlert = $("#divZoneOptionsAlert");
+ var divZoneOptionsLoader = $("#divZoneOptionsLoader");
+ var domain = $("#lblZoneOptionsZoneName").text();
+
+ var zoneTransfer = $("input[name=rdZoneTransfer]:checked").val();
+
+ var zoneTransferNameServers = cleanTextList($("#txtZoneTransferNameServers").val());
+
+ if ((zoneTransferNameServers.length === 0) || (zoneTransferNameServers === ","))
+ zoneTransferNameServers = false;
+ else
+ $("#txtZoneTransferNameServers").val(zoneTransferNameServers.replace(/,/g, "\n"));
+
+ var notify = $("input[name=rdZoneNotify]:checked").val();
+
+ var notifyNameServers = cleanTextList($("#txtZoneNotifyNameServers").val());
+
+ if ((notifyNameServers.length === 0) || (notifyNameServers === ","))
+ notifyNameServers = false;
+ else
+ $("#txtZoneNotifyNameServers").val(notifyNameServers.replace(/,/g, "\n"));
+
+ var btn = $("#btnSaveZoneOptions");
+ btn.button('loading');
+
+ HTTPRequest({
+ url: "/api/zone/options/set?token=" + token + "&domain=" + domain
+ + "&zoneTransfer=" + zoneTransfer + "&zoneTransferNameServers=" + encodeURIComponent(zoneTransferNameServers)
+ + "¬ify=" + notify + "¬ifyNameServers=" + encodeURIComponent(notifyNameServers),
+ success: function (responseJSON) {
+ btn.button('reset');
+ $("#modalZoneOptions").modal("hide");
+ },
+ error: function () {
+ btn.button('reset');
+ divZoneOptionsLoader.hide();
+ },
+ invalidToken: function () {
+ btn.button('reset');
+ $("#modalZoneOptions").modal("hide");
+ showPageLogin();
+ },
+ objAlertPlaceholder: divZoneOptionsAlert,
+ objLoaderPlaceholder: divZoneOptionsLoader
+ });
+}
+
function showAddZoneModal() {
$("#divAddZoneAlert").html("");
@@ -480,6 +652,17 @@ function showEditZone(domain) {
$("#btnEditZoneDeleteZone").show();
}
+ switch (type) {
+ case "Primary":
+ case "Secondary":
+ $("#btnZoneOptions").show();
+ break;
+
+ default:
+ $("#btnZoneOptions").hide();
+ break;
+ }
+
var records = responseJSON.response.records;
var tableHtmlRows = "";