<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
?>
<?php if ($this->hostingControl): ?>
<div class="form-box">
    <?php echo $this->element->getElement('hostingEnabled')->render($this); ?>
</div>
<?php endif; ?>

<div id="hostingParameters">

    <div class="two-cols-block clearfix">
        <div class="first-col">
            <div class="column-box">

                <div class="form-box">
                    <div class="title"><h3><span><?php echo $this->sectionCoreHosting; ?></span></h3></div>
                    <?php if ($this->element->getSubForm('unpaidWebsiteStatusSubForm')) : ?>
                        <?php echo $this->element->getSubForm('unpaidWebsiteStatusSubForm')->render($this); ?>
                    <?php endif; ?>
                    <?php echo $this->element->getElement('quota')->render($this); ?>
                    <?php echo $this->element->getElement('ssl')->render($this); ?>
                    <?php echo $this->element->getElement('sslRedirect')->render($this); ?>
                    <?php echo $this->element->getDisplayGroup('webstatGroup')->render($this); ?>
                    <?php echo $this->element->getElement('errdocs')->render($this); ?>
                    <?php if (!$this->isWindows && $this->element->getDisplayGroup('shellGroup')) : ?>
                        <?php echo $this->element->getDisplayGroup('shellGroup')->render($this); ?>
                    <?php endif; ?>
                </div>

                <div class="form-box">
                    <div class="title"><h3><span><?php echo $this->sectionScripting; ?></span></h3></div>
                    <?php if ($this->isWindows) : ?>
                        <?php echo $this->element->getElement('aspDotNet')->render($this); ?>
                        <?php echo $this->element->getElement('aspDotNetVersion')->render($this); ?>
                        <?php echo $this->masterCheckbox(
                            $this->element->getElement('aspDotNet')->getId(),
                            array($this->element->getElement('aspDotNetVersion')->getId()),
                            true,
                            false);
                        ?>
                    <?php endif; ?>

                    <?php echo $this->element->getElement('cgi')->render($this); ?>


                    <?php if ($this->element->getElement('perl')): ?>
                        <?php echo $this->element->getElement('perl')->render($this); ?>
                    <?php endif; ?>

                    <?php if ($this->element->getElement('python')): ?>
                        <?php echo $this->element->getElement('python')->render($this); ?>
                    <?php endif; ?>

                    <?php if (!$this->isWindows) : ?>
                        <?php echo $this->element->getElement('fastcgi')->render($this); ?>
                    <?php else: ?>
                        <?php echo $this->element->getElement('asp')->render($this); ?>
                    <?php endif; ?>

                    <?php echo $this->element->getElement('ssi')->render($this); ?>
                    <?php echo $this->element->getElement('wu_script')->render($this); ?>
                </div>

                <div class="form-box">
                    <?php if ($this->defaultServerElements): ?>
                        <div class="title"><h3><span><?php echo $this->defaultDatabaseServer; ?></span></h3></div>
                        <?php foreach ($this->defaultServerElements as $defaultServerElement) : ?>
                            <?php echo $this->element->getElement($defaultServerElement)->render($this); ?>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </div>

            </div>
        </div>

        <div class="second-col">
            <div class="column-box">
                <div class="form-box">
                    <?php if ($this->isWindows) : ?>
                        <div class="title"><h3><span><?php echo $this->sectionAdvanced; ?></span></h3></div>
                        <?php echo $this->element->getElement('write_modify')->render($this); ?>
                        <?php echo $this->element->getElement('webdeploy')->render($this); ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>

</div>

<?php if ($this->hostingControl): ?>

<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function () {
    var updateControlsState = function () {
        if (document.getElementById('<?php echo $this->element->getElement('hostingEnabled')->getId() ?>').checked) {
            document.getElementById('hostingParameters').style.display = '';
        } else {
            document.getElementById('hostingParameters').style.display = 'none';
        }
        updatePhpSettingsControlsState();
    };

    var updatePhpSettingsControlsState = function () {
        var phpElement = document.getElementById('tabs-phpSettingsTab-phpSettings-php');
        if (!phpElement) {
            return;
        }

        if (document.getElementById('<?php echo $this->element->getElement('hostingEnabled')->getId() ?>').checked
            && phpElement.checked
        ) {
            document.getElementById('tab-phpSettingsTab').querySelectorAll('input, select, textarea').forEach(function (element) {
                element.disabled = false;
                if (element.updateControlsState) {
                    element.updateControlsState();
                }
            });
        } else {
            document.getElementById('tab-phpSettingsTab').querySelectorAll('input, select, textarea').forEach(function (element) {
                element.disabled = true;
            });
            if (document.getElementById('<?php echo $this->element->getElement('hostingEnabled')->getId() ?>').checked) {
                phpElement.disabled = false;
            }
        }
    };

    document.getElementById('<?php echo $this->element->getElement('hostingEnabled')->getId() ?>').addEventListener('click', updateControlsState);
    updateControlsState();
});
//]]>
</script>
<?php endif; ?>
