<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
?>
<?php echo $this->form ?>
<script type="text/javascript">
//<![CDATA[
    new Jsw.Panel({
        cls: 'list-box',
        renderTo: 'main',
        items: [
            new Jsw.List({
                id: 'log-file-list',
                data: <?php echo Zend_Json::encode($this->logFilesList->fetchData()); ?>,
                dataUrl: '/web-app-firewall/log-list-data',
                isDisabledItem: function(item) {
                    return item.readOnly;
                },
                columns: [
                    Jsw.list.COLUMN_SELECTION,
                    {
                        header: <?php echo $this->logFilesList->jsLmsg('modificationDate'); ?>,
                        sortable: true,
                        dataIndex: 'modificationDate',
                        cls: 't-r number'
                    },
                    {
                        header: <?php echo $this->logFilesList->jsLmsg('name'); ?>,
                        sortable: true,
                        dataIndex: 'name',
                        renderer: function (item) {
                            return '<span class="tooltipData">' + <?php echo $this->logFilesList->jsLmsg('viewHint');?> + '</span>' +
                                '<a href="#" onclick="window.open(\'' + Jsw.prepareUrl('/web-app-firewall/view-log/filename/' + Jsw.escapeHtml(item.name)) + '\', \'_blank\', \'toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=500,innerWidth=1000,innerHeight=500\'); return false;">' + Jsw.escapeHtml(item.name) + '</a>';
                        }
                    },
                    {
                        header: <?php echo $this->logFilesList->jsLmsg('fileSize'); ?>,
                        sortable: true,
                        dataIndex: 'fileSize',
                        cls: 't-r number'
                    },
                    {
                        header: '',
                        sortable: false,
                        cls: 'min',
                        renderer: function (item, isDisabled) {
                            var downloadTitle = <?php echo $this->logFilesList->jsLmsg('buttonDownloadHint') ?>;
                            return (
                                '<span>' +
                                    '<span class="tooltipData">' + downloadTitle + '</span>' +
                                    '<a href=' + Jsw.prepareUrl('/web-app-firewall/download-log/filename/' + encodeURIComponent(item.name)) +'>' +
                                        '<img src="<?php echo $this->skinUrl('/icons/16/plesk/download.png'); ?>" alt="' + downloadTitle + '" title="" />' +
                                    '</a>' +
                                '</span>'
                            );
                        }
                    }
                ],
                operations: [
                    {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemoveLogFiles',
                        title: <?php echo $this->logFilesList->jsLmsg('remove');?>,
                        description: <?php echo $this->logFilesList->jsLmsg('hintRemove'); ?>,
                        addCls: 'sb-remove-selected',
                        handler: function (event) {
                            Jsw.getComponent('log-file-list').execGroupOperation({
                                url: '/web-app-firewall/delete-log',
                                subtype: 'delete',
                                mouseEvent: event,
                                locale: {
                                    confirmOnGroupOperation: <?php echo $this->logFilesList->jsLmsg('confirmOnDelete'); ?>
                                }
                            });
                        }
                    }
                ]
            })
        ]
    });
//]]>
</script>

