Maurice Meyer 8 years ago
parent
commit
fdaa16ea1b
1 changed files with 9 additions and 5 deletions
  1. 9 5
      js/edit-master.js

+ 9 - 5
js/edit-master.js

@@ -304,11 +304,6 @@ function addRecord() {
             $('#table-records>tbody>tr').last().find('span.glyphicon-trash').click(trashClicked);
             $('#table-records>tbody>tr').last().find('span.glyphicon-share').click(remoteClicked);
             requestSerial();
-            $('#addName').val("");
-            $('#addType').val("A").change();
-            $('#addContent').val("");
-            $('#addPrio').val("");
-            $('#addTtl').val("");
         },
         "json"
     );
@@ -344,11 +339,20 @@ function requestDomainName() {
             $('#domain-name').text(data.name);
             $('#add-domain-name').text("." + data.name);
             domainName = data.name;
+            setDefaultRecordType();
             $('#addButton').unbind().click(addRecord);
         },
         "json"
     );
 }
+function setDefaultRecordType() {
+    var reverseZone = false;
+    if(domainName.endsWith('.in-addr.arpa')) reverseZone = true;
+    if(domainName.endsWith('.ip6.arpa')) reverseZone = true;
+    if(reverseZone) {
+        $('#addType').val('PTR').change();
+    }
+}
 function enableFilter(enable) {
     if(enable) {
         $('#searchName').prop("disabled", false);