<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>

<script type="text/javascript">
//<![CDATA[
    new Jsw.Container({
        renderTo: 'main',
        items: [
            new Jsw.Hint({
                hint: <?php echo $this->jsLmsg('pageHint'); ?>
            }),

            new Jsw.SmallTools({
                operations: [
                    {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonAddJail',
                        title: <?php echo $this->jsLmsg('buttonEditJail') ?>,
                        description: <?php echo $this->jsLmsg('hintEditJail') ?>,
                        addCls: 'sb-change-subscription',
                        href: '/server-protection/edit-jail/id/' + <?php echo $this->jsHtml(rawurlencode($this->jail->getName())); ?>
                    <?php if ($this->jail->isEnabled()): ?>
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonDisableJails',
                        title: <?php echo $this->jsLmsg('buttonDisableJail');?>,
                        description: <?php echo $this->jsLmsg('hintDisableJail'); ?>,
                        addCls: 'sb-turn-off',
                        handler: function () {
                            Jsw.redirectPost(Jsw.prepareUrl('/server-protection/toggle-jail/id/' + <?php echo $this->jsHtml(rawurlencode($this->jail->getName())); ?>));
                        },
                    <?php elseif ($this->showActivateJailsButton): ?>
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonActivateJails',
                        title: <?php echo $this->jsLmsg('buttonActivateJail');?>,
                        description: <?php echo $this->jsLmsg('hintActivateJail'); ?>,
                        addCls: 'sb-activate',
                        handler: function () {
                            Jsw.redirectPost(Jsw.prepareUrl('/server-protection/toggle-jail/id/' + <?php echo $this->jsHtml(rawurlencode($this->jail->getName())); ?>));
                        },
                    <?php endif; ?>
                    <?php if ($this->showRemoveButton): ?>
                    }, {
                        componentType: 'Jsw.bar.Separator'
                    }, {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemoveJail',
                        title: <?php echo $this->jsLmsg('buttonRemoveJail') ?>,
                        description: <?php echo $this->jsLmsg('hintRemoveJail') ?>,
                        addCls: 'sb-remove-selected',
                        handler: function () {
                            Jsw.redirectPost(Jsw.prepareUrl('/server-protection/delete-jail/id/' + <?php echo $this->jsHtml(rawurlencode($this->jail->getName())); ?>));
                        },
                    }
                    <?php else: ?>
                    }
                    <?php endif; ?>
                ]
            }),

            {
                componentType: 'Jsw.Panel',
                cls: 'form-box',
                items: [
                    {
                        componentType: 'Jsw.form.DisplayField',
                        fieldLabel: <?php echo $this->jsLmsg('fieldSatatus'); ?>,
                        value: <?php echo $this->jsHtml($this->jail->isEnabled() ?
                            ('<img src="' . $this->skinUrl('/icons/16/plesk/on.png') . '" alt="' . $this->lmsg('enabled') . '" /> ' .
                                $this->lmsg('enabled')) :
                            ('<img src="' . $this->skinUrl('/icons/16/plesk/att.png') . '" alt="' . $this->lmsg('disabled') . '" /> ' .
                                $this->lmsg('disabled'))); ?>
                    }, {
                        componentType: 'Jsw.form.DisplayField',
                        fieldLabel: <?php echo $this->jsLmsg('fieldParameters'); ?>,
                        value: <?php echo $this->jsHtml('<pre class="code">' . $this->escape($this->jail->getText()) . '</pre>'); ?>
                    }
                ]
            }
        ]
    });
//]]>
</script>


<?php echo $this->partial('server-protection/_ban-list.phtml', [
    'bannedIpsList' => $this->bannedIpsList,
    'hint' => $this->jsLmsg('banListHint'),
    'dataUrl' => '/server-protection/ban-list-data/jail/' . $this->jail->getName(),
    'showJailColumn' => false,
]); ?>
