<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
?>
<script type="text/javascript">
//<![CDATA[
Plesk.require('app/log-browser/browser', function ({ createLogsProblemPanel, LogBrowser }) {
    new Jsw.Panel({
        cls: 'list-box',
        renderTo: 'main',
        items: [
            Jsw.createElement('div',
                createLogsProblemPanel(<?php echo json_encode($this->checksResult) ?>),
            ),

            new LogBrowser({
                data: <?php echo json_encode($this->list->fetchData(), JSON_HEX_TAG) ?>,
                dataUrl: '<?php echo $this->baseUrl("/log-file/browser-data/id/{$this->domId}") ?>',
                logFile: <?php echo json_encode($this->list->getLogFile()) ?>,
                isCustomLog: <?php echo $this->list->isCustomLog() ? 'true' : 'false' ?>,
                sources: <?php echo ($logs = $this->list->getAvailableLogs()) ? json_encode($logs, JSON_FORCE_OBJECT) : '{}'; ?>,
                sourcesSelected: <?php echo json_encode($this->list->getLogs()) ?>,
                webspaceId: <?php echo $this->webspaceId ?>,
                domainRootDir: '<?php echo $this->domRootDir ?>',
                domainHomeDir: '<?php echo $this->domHome ?>',
                serverDateTime: '<?php echo $this->serverDateTime ?>',
                isColumnAvailable: {
                    'type': <?php echo $this->list->isColumnAvailable('type') ? 'true' : 'false' ?>,
                    'ip': <?php echo $this->list->isColumnAvailable('ip') ? 'true' : 'false' ?>,
                    'code': <?php echo $this->list->isColumnAvailable('code') ? 'true' : 'false' ?>,
                    'referer': <?php echo $this->list->isColumnAvailable('referer') ? 'true' : 'false' ?>,
                    'agent': <?php echo $this->list->isColumnAvailable('agent') ? 'true' : 'false' ?>,
                    'size': <?php echo $this->list->isColumnAvailable('size') ? 'true' : 'false' ?>
                },
                urls: {
                    iconUnknown: '<?php echo $this->skinUrl('/icons/16/plesk/log-browser-unknown.png'); ?>',
                    iconRobot: '<?php echo $this->skinUrl('/icons/16/plesk/log-browser-robot.png'); ?>',
                    iconClient: '<?php echo $this->skinUrl('/icons/16/plesk/log-browser-client.png'); ?>',
                    iconReferer: '<?php echo $this->skinUrl('/icons/16/plesk/log-browser-refer.png'); ?>',
                    manageLogs: '<?php echo $this->baseUrl("/log-file/list/id/{$this->domId}") ?>',
                    addCustomLog: '<?php echo $this->baseUrl("/log-file/add-custom-log/id/{$this->domId}") ?>',
                    unlinkCustomLog: '<?php echo $this->baseUrl("/log-file/unlink-custom-log/id/{$this->domId}") ?>',
                    codeEditor: '<?php echo $this->baseUrl('/file-manager/code-editor') ?>',
                    returnUrl: '<?php echo $this->baseUrl('/log-file/browser/id/' . $this->domId); ?>',
                    logRotation: '<?php echo $this->logRotation ? $this->baseUrl("/log-file/settings/id/{$this->domId}") : '' ?>',
                    websitesDiagnostic: '<?php echo $this->websitesDiagnostic ? '/cp/websites-diagnostic' : '' ?>',
                }
            })
        ]
    });
});
//]]>
</script>
