only let admin select php-configs that the customer is allowed to use to avoid unwanted php-config changes when customer edits domain, refs #514

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-09 13:57:23 +01:00
parent 4d3fa6eca5
commit 5612720342
4 changed files with 74 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ $header
{$title}
</h2>
</header>
<script type="text/javascript" src="templates/{$theme}/assets/js/domains.js"></script>
<section>

52
templates/Sparkle/assets/js/domains.js vendored Normal file
View File

@@ -0,0 +1,52 @@
$(document).ready(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
/**
* disable unusable php-configuration by customer settings
*/
$('#customerid').change(function() {
var cid = $(this).val();
var sid = getUrlParameter('s');
var page = getUrlParameter('page');
$.ajax({
url: "admin_domains.php?s="+sid+"&page="+page+"&action=jqGetCustomerPHPConfigs",
type: "POST",
data: {
customerid: cid
},
dataType: "json",
success: function(json) {
if (json.length > 0) {
$('#phpsettingid option').each(function() {
var pid = $(this).val();
$(this).attr("disabled", "disabled");
for (i in json) {
if (pid == json[i]) {
$(this).removeAttr("disabled");
}
}
});
}
},
error: function(a, b) {
console.log(a, b);
}
});
});
});