mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-20 20:13:40 +03:00
Moved things around in index.php so that the selection for records doesn't stop the permissions list from working.
This commit is contained in:
parent
f978e784d5
commit
4eb40af5b7
1 changed files with 207 additions and 196 deletions
215
index.php
215
index.php
|
@ -513,12 +513,111 @@ $(document).ready(function () {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
sorting: false,
|
sorting: false,
|
||||||
selecting: true,
|
openChildAsAccordion: true,
|
||||||
selectOnRowClick: true,
|
actions: {
|
||||||
selectionChanged: function (data) {
|
listAction: 'zones.php?action=list',
|
||||||
var $selectedRows = $('#MasterZones').jtable('selectedRows');
|
<?php if (is_adminuser() or $allowzoneadd === TRUE) { ?>
|
||||||
$selectedRows.each(function () {
|
createAction: 'zones.php?action=create',
|
||||||
var zone = $(this).data('record');
|
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'
|
||||||
|
},
|
||||||
|
records: {
|
||||||
|
title: 'Records',
|
||||||
|
width: '10%',
|
||||||
|
paging: true,
|
||||||
|
pageSize: 20,
|
||||||
|
create: false,
|
||||||
|
edit: false,
|
||||||
|
display: function(data) {
|
||||||
|
var $img = $('<img class="list" src="img/list.png" title="Records" />');
|
||||||
|
$img.click(function () {
|
||||||
|
var zone = data.record;
|
||||||
$('#MasterZones').jtable('openChildTable',
|
$('#MasterZones').jtable('openChildTable',
|
||||||
$(this).closest('tr'), {
|
$(this).closest('tr'), {
|
||||||
title: 'Records in ' + zone.name,
|
title: 'Records in ' + zone.name,
|
||||||
|
@ -704,101 +803,10 @@ $(document).ready(function () {
|
||||||
opentableTitle=opentable.find('.jtable-title-text').text();
|
opentableTitle=opentable.find('.jtable-title-text').text();
|
||||||
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'
|
|
||||||
},
|
},
|
||||||
permissions: {
|
permissions: {
|
||||||
title: 'Permissions',
|
title: 'Permissions',
|
||||||
|
@ -815,6 +823,7 @@ $(document).ready(function () {
|
||||||
actions: {
|
actions: {
|
||||||
listAction: 'permissions.php?action=list&zoneid=' + data.record.id,
|
listAction: 'permissions.php?action=list&zoneid=' + data.record.id,
|
||||||
createAction: 'permissions.php?action=add&zoneid=' + data.record.id,
|
createAction: 'permissions.php?action=add&zoneid=' + data.record.id,
|
||||||
|
updateAction: 'permissions.php?action=update&zoneid=' + data.record.id,
|
||||||
deleteAction: 'permissions.php?action=remove&zoneid=' + data.record.id
|
deleteAction: 'permissions.php?action=remove&zoneid=' + data.record.id
|
||||||
},
|
},
|
||||||
fields: {
|
fields: {
|
||||||
|
@ -835,7 +844,9 @@ $(document).ready(function () {
|
||||||
value: {
|
value: {
|
||||||
title: 'Name',
|
title: 'Name',
|
||||||
inputClass: "usergrouplist",
|
inputClass: "usergrouplist",
|
||||||
display: displayContent('value')
|
display: displayContent('value'),
|
||||||
|
create: true,
|
||||||
|
edit: false
|
||||||
},
|
},
|
||||||
permissions: {
|
permissions: {
|
||||||
title: 'Permissions',
|
title: 'Permissions',
|
||||||
|
@ -853,12 +864,12 @@ $(document).ready(function () {
|
||||||
},
|
},
|
||||||
formCreated: function(event, dat) {
|
formCreated: function(event, dat) {
|
||||||
$( ".usergrouplist" ).autocomplete({
|
$( ".usergrouplist" ).autocomplete({
|
||||||
source: "users.php?action=autocomplete&zoneid=" + data.record.id + "&type=" + $( ".permissionstype" ).val()
|
source: "permissions.php?action=autocomplete&type=" + $( ".permissionstype" ).val()
|
||||||
});
|
});
|
||||||
$( ".permissionstype" ).change(function() {
|
$( ".permissionstype" ).change(function() {
|
||||||
$( ".usergrouplist" ).val("");
|
$( ".usergrouplist" ).val("");
|
||||||
$( ".usergrouplist" ).autocomplete({
|
$( ".usergrouplist" ).autocomplete({
|
||||||
source: "users.php?action=autocomplete&type=" + $( ".permissionstype" ).val()
|
source: "permissions.php?action=autocomplete&type=" + $( ".permissionstype" ).val()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue