mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Merge branch 'bfbones-master'
This commit is contained in:
commit
319828033d
4 changed files with 41 additions and 52 deletions
|
@ -50,9 +50,9 @@ $templates[] = array(
|
||||||
$defaults['soa_edit'] = 'INCEPTION-INCREMENT';
|
$defaults['soa_edit'] = 'INCEPTION-INCREMENT';
|
||||||
$defaults['soa_edit_api'] = 'INCEPTION-INCREMENT';
|
$defaults['soa_edit_api'] = 'INCEPTION-INCREMENT';
|
||||||
$defaults['defaulttype'] = 'Master'; # Choose between 'Native' or 'Master'
|
$defaults['defaulttype'] = 'Master'; # Choose between 'Native' or 'Master'
|
||||||
$defaults['primaryns'] = 'unconfigured.primaryns'; # The value of the first NS-record
|
$defaults['ns'][0] = 'unconfigured.primaryns'; # The value of the first NS-record
|
||||||
$defaults['secondaryns'] = 'unconfigured.secondaryns'; # The value of the second NS-record
|
$defaults['ns'][1] = 'unconfigured.secondaryns'; # The value of the second NS-record
|
||||||
$defaults['ttl'] = 3600; # Default TTL for records
|
$defaults['ttl'] = 3600; # Default TTL for records
|
||||||
|
|
||||||
## UI Options
|
## UI Options
|
||||||
$menutype = 'horizontal'; # horizontal|vertical - use a horizontal or vertical menu
|
$menutype = 'horizontal'; # horizontal|vertical - use a horizontal or vertical menu
|
||||||
|
|
|
@ -31,6 +31,14 @@ if (!isset($authdb)) {
|
||||||
$blocklogin = TRUE;
|
$blocklogin = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($defaults['primaryns'])) {
|
||||||
|
$errormsg = "You should reconfigure your \$defaults['primaryns'] settings to use <code>\$defaults['ns'][0]</code>. We converted if for you now.";
|
||||||
|
$defaults['ns'][] = $defaults['primaryns'];
|
||||||
|
if (isset($defaults['secondaryns'])) {
|
||||||
|
$defaults['ns'][] = $defaults['secondaryns'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* No need to change stuf below */
|
/* No need to change stuf below */
|
||||||
|
|
||||||
if (function_exists('curl_init') === FALSE) {
|
if (function_exists('curl_init') === FALSE) {
|
||||||
|
|
58
index.php
58
index.php
|
@ -453,23 +453,21 @@ $(document).ready(function () {
|
||||||
edit: false,
|
edit: false,
|
||||||
inputClass: 'template'
|
inputClass: 'template'
|
||||||
},
|
},
|
||||||
nameserver1: {
|
nameserver: {
|
||||||
title: 'Pri. Nameserver',
|
title: 'Nameservers',
|
||||||
create: true,
|
create: true,
|
||||||
list: false,
|
list: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
input: function(data) {
|
input: function(data) {
|
||||||
var $template = data.form.find('#Edit-template');
|
var $template = data.form.find('#Edit-template');
|
||||||
var $elem = $('<input type="text" name="nameserver1" />');
|
var ns_form = '<?php foreach($defaults['ns'] as $ns) echo '<input type="text" name="nameserver[]" value="'.$ns.'" /><br />'; ?>';
|
||||||
$elem.val(<?php echo "'".$defaults['primaryns']."'"; ?>);
|
var $elem = $('<div id="nameservers">' + ns_form + '</div>');
|
||||||
$template.change(function() {
|
$template.change(function() {
|
||||||
$.get('zones.php?action=gettemplatenameservers&template='+$template.val()+'&prisec=pri', function(getdata) {
|
$.get('zones.php?action=getformnameservers&template='+$template.val(), function(getdata) {
|
||||||
if (getdata != "") {
|
if (getdata != "") {
|
||||||
$elem.val(getdata);
|
$("#nameservers").html(getdata);
|
||||||
$elem.attr('readonly', true);
|
|
||||||
} else {
|
} else {
|
||||||
$elem.val(<?php echo "'".$defaults['primaryns']."'"; ?>);
|
$("#nameservers").html(ns_form);
|
||||||
$elem.attr('readonly', false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -477,30 +475,6 @@ $(document).ready(function () {
|
||||||
},
|
},
|
||||||
inputClass: 'nameserver nameserver1'
|
inputClass: 'nameserver nameserver1'
|
||||||
},
|
},
|
||||||
nameserver2: {
|
|
||||||
title: 'Sec. Nameserver',
|
|
||||||
create: true,
|
|
||||||
list: false,
|
|
||||||
edit: false,
|
|
||||||
input: function(data) {
|
|
||||||
var $template = data.form.find('#Edit-template');
|
|
||||||
var $elem = $('<input type="text" name="nameserver2" />');
|
|
||||||
$elem.val(<?php echo "'".$defaults['secondaryns']."'"; ?>);
|
|
||||||
$template.change(function() {
|
|
||||||
$.get('zones.php?action=gettemplatenameservers&template='+$template.val()+'&prisec=sec', function(getdata) {
|
|
||||||
if (getdata != "") {
|
|
||||||
$elem.val(getdata);
|
|
||||||
$elem.attr('readonly', true);
|
|
||||||
} else {
|
|
||||||
$elem.val(<?php echo "'".$defaults['secondaryns']."'"; ?>);
|
|
||||||
$elem.attr('readonly', false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return $elem;
|
|
||||||
},
|
|
||||||
inputClass: 'nameserver nameserver2'
|
|
||||||
},
|
|
||||||
serial: {
|
serial: {
|
||||||
title: 'Serial',
|
title: 'Serial',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
|
@ -679,22 +653,18 @@ $(document).ready(function () {
|
||||||
defaultValue: 1,
|
defaultValue: 1,
|
||||||
inputClass: 'overwrite_namerserver'
|
inputClass: 'overwrite_namerserver'
|
||||||
},
|
},
|
||||||
nameserver1: {
|
nameserver: {
|
||||||
title: 'Pri. Nameserver',
|
title: 'Nameservers',
|
||||||
create: true,
|
create: true,
|
||||||
list: false,
|
list: false,
|
||||||
edit: false,
|
edit: false,
|
||||||
defaultValue: '<?php echo $defaults['primaryns']; ?>',
|
input: function(data) {
|
||||||
|
var ns_form = '<?php foreach($defaults['ns'] as $ns) echo '<input type="text" name="nameserver[]" value="'.$ns.'" /><br />'; ?>';
|
||||||
|
var $elem = $('<div id="nameservers">' + ns_form + '</div>');
|
||||||
|
return $elem;
|
||||||
|
},
|
||||||
inputClass: 'nameserver nameserver1'
|
inputClass: 'nameserver nameserver1'
|
||||||
},
|
},
|
||||||
nameserver2: {
|
|
||||||
title: 'Sec. Nameserver',
|
|
||||||
create: true,
|
|
||||||
list: false,
|
|
||||||
edit: false,
|
|
||||||
defaultValue: '<?php echo $defaults['secondaryns']; ?>',
|
|
||||||
inputClass: 'nameserver nameserver2'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
recordAdded: function() {
|
recordAdded: function() {
|
||||||
$("#MasterZones").jtable('load');
|
$("#MasterZones").jtable('load');
|
||||||
|
|
21
zones.php
21
zones.php
|
@ -452,11 +452,10 @@ case "create":
|
||||||
);
|
);
|
||||||
|
|
||||||
$nameservers = array();
|
$nameservers = array();
|
||||||
if (isset($_POST['nameserver1']) && $_POST['nameserver1'] != null) {
|
foreach($_POST['nameserver'] as $ns) {
|
||||||
array_push($nameservers, $_POST['nameserver1']);
|
if (isset($ns) && !empty($ns)) {
|
||||||
}
|
array_push($nameservers, $ns);
|
||||||
if (isset($_POST['nameserver2']) && $_POST['nameserver2'] != null) {
|
}
|
||||||
array_push($nameservers, $_POST['nameserver2']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($zonekind != "Slave") {
|
if ($zonekind != "Slave") {
|
||||||
|
@ -655,6 +654,18 @@ case "gettemplatenameservers":
|
||||||
echo "";
|
echo "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "getformnameservers":
|
||||||
|
$inputs = array();
|
||||||
|
foreach (user_template_list() as $template) {
|
||||||
|
if ($template['name'] !== $_GET['template']) continue;
|
||||||
|
foreach ($template['records'] as $record) {
|
||||||
|
if ($record['type'] == "NS" and array_search($record['content'], $inputs) === false) {
|
||||||
|
array_push($inputs, $record['content']);
|
||||||
|
echo '<input type="text" name="nameserver[]" value="'.$record['content'].'" readonly /><br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
jtable_respond(null, 'error', 'No such action');
|
jtable_respond(null, 'error', 'No such action');
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue