<?php
// Copyright 1999-2024. Plesk International GmbH. All rights reserved.
?>
<?php
foreach ($this->element->getElements() as $element) {
    echo $element;
}
?>
<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function() {
    var enableFastCgiElement = document.getElementById('<?php echo $this->element->getElement($this->enableElementName)->getId();?>');
    function onEnableFastCgiChange() {
        <?php foreach($this->element->getElements() as $element): ?>
            <?php if ($element->getId() == $this->element->getElement($this->enableElementName)->getId()):?>
                <?php continue; ?>
            <?php endif; ?>

        var fastCgiSettingElement = document.getElementById('<?php echo $element->getId();?>');
        if ('off' === enableFastCgiElement.value) {
            fastCgiSettingElement.disabled = true;
        } else {
            fastCgiSettingElement.disabled = false;
        }
        <?php endforeach; ?>

    }

    if (enableFastCgiElement) {
        enableFastCgiElement.addEventListener('change', onEnableFastCgiChange);
        enableFastCgiElement.addEventListener('focus', onEnableFastCgiChange);
        var phpEnableElement = document.getElementById('php') ? document.getElementById('php') : document.getElementById('tabs-phpSettingsTab-phpSettings-php');
        if (phpEnableElement) {
            phpEnableElement.addEventListener('change', onEnableFastCgiChange);
        }
        onEnableFastCgiChange();
    }
});
//]]>
</script>
