<?php
// Copyright 1999-2012. Parallels IP Holdings GmbH. All Rights Reserved.
?>
<?php echo $this->partial('partials/tabs.phtml', array('tabs' => $this->tabs, 'renderTo' => 'main')); ?>

<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function() {

    new Jsw.Hint({
        renderTo: 'main',
        hint: <?php echo $this->jsLmsg('hint'); ?>
    });

    new Jsw.Panel({
        cls: 'list-box',
        renderTo: 'main',
        items: [
            new Jsw.List({
                id: 'java-application-list',
                searchOveral: 'name',
                searchFilters: <?php echo Zend_Json::encode($this->applicationsList->getSearchFilterConfig()); ?>,
                data: <?php echo Zend_Json::encode($this->applicationsList->fetchData()); ?>,
                dataUrl: '/java-application/list-data/id/<?php echo $this->domId ?>',
                disabledSelectHint: <?php echo $this->applicationsList->jsLmsg('disabledSelectHint'); ?>,
                columns: [
                    Jsw.list.COLUMN_SELECTION,
                    {
                        header: <?php echo $this->applicationsList->jsLmsg('status'); ?>,
                        headerCls: 'icon',
                        sortable: true,
                        dataIndex: 'status',
                        cls: 'min',
                        renderer: function(item) {
                            return item.status;
                        }
                    },
                    {
                        header: <?php echo $this->applicationsList->jsLmsg('path'); ?>,
                        sortable: true,
                        dataIndex: 'path',
                        renderer: function(item) {
                            return item.path;
                        }
                    },
                    {
                        header: <?php echo $this->applicationsList->jsLmsg('sessions');?>,
                        sortable: true,
                        dataIndex: 'sessions',
                        renderer: function(item) {
                            return item.sessions;
                        }
                    }
                ],
                operations: [
                <?php if ($this->allowCreateDatabase): ?>
                {
                    componentType: 'Jsw.SmallButton',
                    id: 'buttonInstallNewApplication',
                    title: <?php echo $this->jsLmsg('buttonInstallNewApplication');?>,
                    description: <?php echo $this->jsEscape($this->buttonInstallNewApplicationHint); ?>,
                    addCls: 'sb-install',
                    href: '/java-application/create/id/<?php echo $this->domId ?>'
                },
                <?php endif; ?>
                <?php if (!$this->tomcatStatus): ?>
                {
                    componentType: 'Jsw.SmallButton',
                    title: <?php echo $this->jsLmsg('buttonTurnOn');?>,
                    attrs: { 'data-method': 'post' },
                    description: <?php echo $this->jsEscape($this->buttonTurnOnHint); ?>,
                    addCls: 'sb-turn-on',
                    href: '/java-application/turn-on/id/<?php echo $this->domId ?>'
                },
                <?php endif; ?>
                <?php if ($this->tomcatStatus): ?>
                {
                    componentType: 'Jsw.SmallButton',
                    title: <?php echo $this->jsLmsg('buttonTurnOff');?>,
                    attrs: { 'data-method': 'post' },
                    description: <?php echo $this->jsEscape($this->buttonTurnOffHint); ?>,
                    addCls: 'sb-turn-off',
                    href: '/java-application/turn-off/id/<?php echo $this->domId ?>'
                },
                <?php endif; ?>
                {
                    componentType: 'Jsw.SmallButton',
                    title: <?php echo $this->jsLmsg('buttonRefresh');?>,
                    description: <?php echo $this->jsEscape($this->buttonRefreshHint); ?>,
                    addCls: 'sb-refresh',
                    href: '/java-application/list/id/<?php echo $this->domId ?>'
                },
                {
                    componentType: 'Jsw.bar.Separator'
                },
                {
                    componentType: 'Jsw.SmallButton',
                    id: 'buttonRemoveJavaApplication',
                    title: <?php echo $this->applicationsList->jsLmsg('remove');?>,
                    description: <?php echo $this->applicationsList->jsLmsg('hintRemove'); ?>,
                    addCls: 'sb-remove-selected',
                    handler: function(event) {
                        Jsw.getComponent('java-application-list').execGroupOperation({
                            url: '/java-application/delete/id/<?php echo $this->domId ?>',
                            subtype: 'delete',
                            mouseEvent: event,
                            locale: {
                                confirmOnGroupOperation: <?php echo $this->applicationsList->jsLmsg('confirmOnDelete'); ?>
                            }
                        });
                    }
                }]
            })
        ]
    });

});
//]]>
</script>
