<?php
// Copyright 1999-2021. Plesk International GmbH. All rights reserved.
?>
<div id="<?php echo $this->element->getId() ?>">
    <?php echo $this->element->getElement('maxProcesses')->render($this); ?>
    <?php echo $this->element->getElement('idleTimeout')->render($this); ?>
    <?php if ($this->element->getElement('idleTimeoutAction')): ?>
        <?php echo $this->element->getElement('idleTimeoutAction')->render($this); ?>
    <?php endif; ?>
    <?php echo $this->element->getElement('cpuLimit')->render($this); ?>
    <?php echo $this->element->getElement('cpuLimitAction')->render($this); ?>
    <?php echo $this->element->getElement('cpuLimitInterval')->render($this); ?>
    <?php echo $this->element->getElement('recyclingByTime')->render($this); ?>
    <?php echo $this->element->getElement('recyclingByRequests')->render($this); ?>
    <?php echo $this->element->getElement('recyclingByVirtualMemory')->render($this); ?>
    <?php echo $this->element->getElement('recyclingByPrivateMemory')->render($this); ?>
</div>

<script type="text/javascript">
//<![CDATA[
(function () {
    var cpuLimitUnlimited = document.getElementById('<?php echo $this->element->getElement('cpuLimit')->getId() ?>-unlimited');
    var cpuLimitAction = document.getElementById('<?php echo $this->element->getElement('cpuLimitAction')->getId() ?>');
    var cpuLimitInterval = document.getElementById('<?php echo $this->element->getElement('cpuLimitInterval')->getId() ?>');

    var cpuLimitsDependsOn = function () {
        if (cpuLimitUnlimited.checked) {
            cpuLimitAction.disabled = true;
            cpuLimitInterval.disabled = true;
        } else {
            cpuLimitAction.disabled = false;
            if ('<?php echo Db_Table_Row_IisAppPool::CPU_LIMIT_ACTION_KILL_W3WP ?>' === cpuLimitAction.value
                || '<?php echo Db_Table_Row_IisAppPool::CPU_LIMIT_ACTION_NO_ACTION ?>' === cpuLimitAction.value
            ) {
                cpuLimitInterval.disabled = false;
            } else {
                cpuLimitInterval.disabled = true;
            }
        }
    };
    cpuLimitUnlimited.addEventListener('click', cpuLimitsDependsOn);
    cpuLimitAction.addEventListener('change', cpuLimitsDependsOn);
    cpuLimitsDependsOn();
})();
//]]>
</script>
