Don't show a 'records' button anymore. Open the zone by clicking it. Closes #2

This commit is contained in:
Mark Schouten 2016-08-05 10:05:09 +02:00
parent 749478c36a
commit 5b4bcc34cc

228
index.php
View file

@ -453,130 +453,34 @@ $(document).ready(function () {
], ],
}, },
sorting: false, sorting: false,
openChildAsAccordion: true, selecting: true,
actions: { selectOnRowClick: true,
listAction: 'zones.php?action=list', selectionChanged: function (data) {
<?php if (is_adminuser() or $allowzoneadd === TRUE) { ?> var $selectedRows = $('#MasterZones').jtable('selectedRows');
createAction: 'zones.php?action=create', $selectedRows.each(function () {
deleteAction: 'zones.php?action=delete', var zone = $(this).data('record');
<?php } ?>
<?php if (is_adminuser()) { ?>
updateAction: 'zones.php?action=update'
<?php } ?>
},
fields: {
id: {
key: true,
type: 'hidden'
},
name: {
title: 'Domain',
width: '8%',
display: displayContent('name'),
edit: false,
inputClass: 'domain',
listClass: 'domain'
},
dnssec: {
title: 'DNSSEC',
width: '3%',
create: false,
edit: false,
display: displayDnssecIcon,
listClass: 'dnssec'
},
<?php if (is_adminuser()) { ?>
account: {
title: 'Account',
width: '8%',
display: displayContent('account'),
options: function(data) {
return 'users.php?action=listoptions&e='+$epoch;
},
defaultValue: 'admin',
inputClass: 'account',
listClass: 'account'
},
<?php } ?>
kind: {
title: 'Type',
width: '20%',
display: displayContent('kind'),
options: {'Native': 'Native', 'Master': 'Master'},
defaultValue: '<?php echo $defaults['defaulttype']; ?>',
edit: false,
inputClass: 'kind',
listClass: 'kind'
},
template: {
title: 'Template',
options: <?php echo json_encode(user_template_names()); ?>,
list: false,
create: true,
edit: false,
inputClass: 'template'
},
nameserver: {
title: 'Nameservers',
create: true,
list: false,
edit: false,
input: function(data) {
var $template = data.form.find('#Edit-template');
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>');
$template.change(function() {
$.get('zones.php?action=getformnameservers&template='+$template.val(), function(getdata) {
if (getdata != "") {
$("#nameservers").html(getdata);
} else {
$("#nameservers").html(ns_form);
}
});
});
return $elem;
},
inputClass: 'nameserver nameserver1'
},
serial: {
title: 'Serial',
width: '10%',
display: displayContent('serial'),
create: false,
edit: false,
inputClass: 'serial',
listClass: 'serial'
},
records: {
width: '5%',
title: 'Records',
edit: false,
create: false,
display: function (zone) {
var $img = $('<img class="list" src="img/list.png" title="Records" />');
$img.click(function () {
$('#MasterZones').jtable('openChildTable', $('#MasterZones').jtable('openChildTable',
$img.closest('tr'), { $(this).closest('tr'), {
title: 'Records in ' + zone.record.name, title: 'Records in ' + zone.name,
messages: { messages: {
addNewRecord: 'Add to ' + zone.record.name, addNewRecord: 'Add to ' + zone.name,
noDataAvailable: 'No records for ' + zone.record.name noDataAvailable: 'No records for ' + zone.name
}, },
paging: true, paging: true,
sorting: true, sorting: true,
pageSize: 20, pageSize: 20,
openChildAsAccordion: true, openChildAsAccordion: true,
actions: { actions: {
listAction: 'zones.php?action=listrecords&zoneid=' + zone.record.id, listAction: 'zones.php?action=listrecords&zoneid=' + zone.id,
createAction: 'zones.php?action=createrecord&zoneid=' + zone.record.id, createAction: 'zones.php?action=createrecord&zoneid=' + zone.id,
deleteAction: 'zones.php?action=deleterecord&zoneid=' + zone.record.id, deleteAction: 'zones.php?action=deleterecord&zoneid=' + zone.id,
updateAction: 'zones.php?action=editrecord&zoneid=' + zone.record.id updateAction: 'zones.php?action=editrecord&zoneid=' + zone.id
}, },
fields: { fields: {
domid: { domid: {
create: true, create: true,
type: 'hidden', type: 'hidden',
defaultValue: zone.record.id defaultValue: zone.id
}, },
id: { id: {
key: true, key: true,
@ -588,14 +492,14 @@ $(document).ready(function () {
domain: { domain: {
create: true, create: true,
type: 'hidden', type: 'hidden',
defaultValue: zone.record.name defaultValue: zone.name
}, },
name: { name: {
title: 'Label', title: 'Label',
width: '7%', width: '7%',
sorting: true, sorting: true,
create: true, create: true,
display: displayContent('name', zone.record.name), display: displayContent('name', zone.name),
inputClass: 'name', inputClass: 'name',
listClass: 'name' listClass: 'name'
}, },
@ -603,7 +507,7 @@ $(document).ready(function () {
title: 'Type', title: 'Type',
width: '2%', width: '2%',
options: function() { options: function() {
zonename = new String(zone.record.name); zonename = new String(zone.name);
if (zonename.match(/(\.in-addr|\.ip6)\.arpa/)) { if (zonename.match(/(\.in-addr|\.ip6)\.arpa/)) {
return { return {
'PTR': 'PTR', 'PTR': 'PTR',
@ -699,10 +603,102 @@ $(document).ready(function () {
} }
}, function (data) { }, function (data) {
data.childTable.jtable('load'); data.childTable.jtable('load');
})
}); });
return $img; });
},
openChildAsAccordion: true,
actions: {
listAction: 'zones.php?action=list',
<?php if (is_adminuser() or $allowzoneadd === TRUE) { ?>
createAction: 'zones.php?action=create',
deleteAction: 'zones.php?action=delete',
<?php } ?>
<?php if (is_adminuser()) { ?>
updateAction: 'zones.php?action=update'
<?php } ?>
},
fields: {
id: {
key: true,
type: 'hidden'
},
name: {
title: 'Domain',
width: '8%',
display: displayContent('name'),
edit: false,
inputClass: 'domain',
listClass: 'domain'
},
dnssec: {
title: 'DNSSEC',
width: '3%',
create: false,
edit: false,
display: displayDnssecIcon,
listClass: 'dnssec'
},
<?php if (is_adminuser()) { ?>
account: {
title: 'Account',
width: '8%',
display: displayContent('account'),
options: function(data) {
return 'users.php?action=listoptions&e='+$epoch;
},
defaultValue: 'admin',
inputClass: 'account',
listClass: 'account'
},
<?php } ?>
kind: {
title: 'Type',
width: '20%',
display: displayContent('kind'),
options: {'Native': 'Native', 'Master': 'Master'},
defaultValue: '<?php echo $defaults['defaulttype']; ?>',
edit: false,
inputClass: 'kind',
listClass: 'kind'
},
template: {
title: 'Template',
options: <?php echo json_encode(user_template_names()); ?>,
list: false,
create: true,
edit: false,
inputClass: 'template'
},
nameserver: {
title: 'Nameservers',
create: true,
list: false,
edit: false,
input: function(data) {
var $template = data.form.find('#Edit-template');
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>');
$template.change(function() {
$.get('zones.php?action=getformnameservers&template='+$template.val(), function(getdata) {
if (getdata != "") {
$("#nameservers").html(getdata);
} else {
$("#nameservers").html(ns_form);
} }
});
});
return $elem;
},
inputClass: 'nameserver nameserver1'
},
serial: {
title: 'Serial',
width: '10%',
display: displayContent('serial'),
create: false,
edit: false,
inputClass: 'serial',
listClass: 'serial'
}, },
exportzone: { exportzone: {
title: '', title: '',