<?php
// Copyright 1999-2012. Parallels IP Holdings GmbH. All Rights Reserved.
?>
<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function() {

	var sectionGeneralFields = (function() {
        var sectionGeneralFields = [];

        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralSubscriber'); ?>,
            <?php if ($this->generalInfo['subscriberOverviewUrl']): ?>
            value: '<a href="' + Jsw.baseUrl
                + <?php echo $this->jsEscape($this->generalInfo['subscriberOverviewUrl']); ?>
                + '">' + <?php echo $this->jsEscape($this->generalInfo['subscriber']->getPname()); ?> + '</a>'
            <?php else: ?>
            value:  <?php echo $this->jsEscape($this->generalInfo['subscriber']->getPname()); ?>
            <?php endif; ?>
                <?php if ($this->generalInfo['subscriber']->getCname()) : ?>
                + ', ' + <?php echo $this->jsEscape($this->generalInfo['subscriber']->getCname()); ?>
                <?php endif; ?>
        });
        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralSetupDate'); ?>,
            value: <?php echo $this->jsEscape($this->generalInfo['setupDate']); ?>
        });
        <?php if (isset($this->generalInfo['expirationDate'])): ?>
        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralExpirationDate'); ?>,
            value: <?php echo $this->generalInfo['expirationDate'] ?
                $this->jsEscape($this->generalInfo['expirationDate']) : $this->jsHtml('&mdash;'); ?>
        });
        <?php endif ?>
        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralSatatus'); ?>,
            value: <?php echo $this->jsHtml($this->statusState($this->generalInfo['isStatusActive'])); ?>
        });
        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralPlan'); ?>,
            value: <?php echo ($this->generalInfo['subscription']
                ? $this->jsHtml('<a href="' . $this->baseUrl($this->generalInfo['planUrl']) . '">' . $this->escape($this->generalInfo['planName']) . '</a>'
                    . $this->subscriptionState($this->generalInfo['subscription'], 'subscription-status-description-tooltip'))
                : $this->jsLmsg('fieldGeneralPlanCustom')); ?>
        });
        sectionGeneralFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldGeneralAddons'); ?>,
            value: <?php echo(count($this->generalInfo['addons']) ? $this->jsHtml(implode($this->generalInfo['addons'], '<br/>')) : "'&mdash;'") ?>
        });

        return sectionGeneralFields;
    }());

	var sectionHostingFields = (function() {
        var sectionHostingFields = [];

        <?php if ($this->hosting): ?>
        <?php if ($this->hostingInfo['ipV4Address']): ?>
        sectionHostingFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->hostingInfo['ipV6Address'] ? $this->jsLmsg('fieldHostingIPV4Address') : $this->jsLmsg('fieldHostingIPAddress'); ?>,
            value: '<?php echo $this->hostingInfo['ipV4Address']; ?> ('
                + <?php echo $this->jsLmsg($this->hostingInfo['isIpV4Shared'] ? 'fieldHostingIPAddressShared' : 'fieldHostingIPAddressExclusive'); ?>
                + ')'
        });
        <?php endif; ?>
        <?php if ($this->hostingInfo['ipV6Address']): ?>
            sectionHostingFields.push({
                componentType: 'Jsw.form.DisplayField',
                fieldLabel: <?php echo $this->jsLmsg('fieldHostingIPV6Address'); ?>,
                value: '<?php echo $this->hostingInfo['ipV6Address']; ?> ('
                    + <?php echo $this->jsLmsg($this->hostingInfo['isIpV6Shared'] ? 'fieldHostingIPAddressShared' : 'fieldHostingIPAddressExclusive'); ?>
                    + ')'
            });
        <?php endif; ?>
        sectionHostingFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: <?php echo $this->jsLmsg('fieldHostingSysUser'); ?>,
            value: <?php echo $this->jsEscape($this->hostingInfo['sysUser']); ?>
        });
        <?php else: ?>
        sectionHostingFields.push({
            componentType: 'Jsw.Hint',
            hint: <?php echo $this->jsLmsg('fieldHostingNoHostingHint'); ?>
        });
        <?php endif; ?>
        <?php if (!$this->layout()->isClassicMode): ?>
        sectionHostingFields.push({
            componentType: 'Jsw.form.DisplayField',
            fieldLabel: AdminPanel.Subscription.getControlPanelLoginHTML(
                <?php echo $this->id; ?>,
                'admin' != <?php echo $this->jsEscape($this->generalInfo['subscriberType']) ?>,
                <?php echo $this->jsLmsg('fieldHostingSubscriberLoginAs'); ?>,
                'admin' == <?php echo $this->jsEscape($this->generalInfo['subscriberType']) ?> ?
                    <?php echo $this->jsLmsg('hintAdminLogin'); ?> : <?php echo $this->jsLmsg('hintLogin'); ?>,
                'admin' == <?php echo $this->jsEscape($this->generalInfo['subscriberType']) ?> ?
                    '/subscription/overview/id/<?php echo $this->id ?>' : null
            )
        });
        <?php endif ?>

        return sectionHostingFields;
    }());

    var getToolsPanel = function() {
        var billingUpgrade = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonBillingPackageUpgrade',
                        cls: addcls,
                        addCls: 'sb-billing-package-upgrade',
                        title: <?php echo $this->jsLmsg('buttonBillingPackageUpgrade'); ?>,
                        description: <?php echo $this->jsLmsg('buttonBillingPackageUpgradeHint'); ?>,
                        href: '<?php echo $this->goToBillingUrls["upgrade"]; ?>',
                        target: <?php echo $this->jsEscape($this->billingTargetWindow) ?>
                    }
        };
        var billingDowngrade = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonBillingPackageDowngrade',
                        cls: addcls,
                        addCls: 'sb-billing-package-downgrade',
                        title: <?php echo $this->jsLmsg('buttonBillingPackageDowngrade'); ?>,
                        description: <?php echo $this->jsLmsg('buttonBillingPackageDowngradeHint'); ?>,
                        href: '<?php echo $this->goToBillingUrls["downgrade"]; ?>',
                        target: <?php echo $this->jsEscape($this->billingTargetWindow) ?>
                    }
        };
        var billingAddons = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonBillingPackageAddons',
                        cls: addcls,
                        addCls: 'sb-billing-package-addons',
                        title: <?php echo $this->jsLmsg('buttonBillingPackageAddons'); ?>,
                        description: <?php echo $this->jsLmsg('buttonBillingPackageAddonsHint'); ?>,
                        href: '<?php echo $this->goToBillingUrls["addons"]; ?>',
                        target: <?php echo $this->jsEscape($this->billingTargetWindow) ?>
                    }
        };
        var separator = function() {
            return {
              componentType: 'Jsw.bar.Separator'
            }
        };
        var hseparator = function() {
            return {
              componentType: 'Jsw.bar.HorizontalSeparator'
            }
        };
        var billingPackageOverview = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonBillingPackageOverview',
                        cls: addcls,
                        addCls: 'sb-billing-info',
                        title: <?php echo $this->jsLmsg('buttonBillingPackageOverview'); ?>,
                        description: <?php echo $this->jsLmsg('buttonBillingPackageOverviewHint'); ?>,
                        href: '<?php echo $this->goToBillingUrls["overview"]; ?>',
                        target: <?php echo $this->jsEscape($this->billingTargetWindow) ?>
                    }
        };
        var switchToAnotherPlan = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonSwitchToAnotherPlan',
                        cls: addcls,
                        addCls: 'sb-switch-to-another-plan',
                        title: <?php echo $this->jsLmsg('buttonSwitchToAnotherPlan'); ?>,
                        description: <?php echo $this->jsLmsg('buttonSwitchToAnotherPlanHint'); ?>,
                        href: '/subscription/change-current/id/<?php echo $this->id; ?>'
                    }
        };
        var manuallyEditParameters = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonManuallyEditParameters',
                        title: <?php echo $this->jsLmsg('buttonManuallyEditParameters');?>,
                        description: <?php echo $this->jsLmsg('buttonManuallyEditParametersHint'); ?>,
                        cls: addcls,
                        addCls: 'sb-manually-edit-parameters',
                        href: '/subscription/edit/id/<?php echo $this->id; ?>/?redirect=/subscription/overview/id/<?php echo $this->id; ?>'
                    }
        };
        <?php if($this->changeLimitsPermission && $this->generalInfo['subscription']): ?>
        var unlockAndSync = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonUnlockAndSync',
                        title: <?php echo $this->jsLmsg($this->generalInfo['subscription']->isLocked() ? 'buttonUnlockAndSync' : 'buttonSync');?>,
                        description: <?php echo $this->jsLmsg($this->generalInfo['subscription']->isLocked() ? 'buttonUnlockAndSyncHint' : 'buttonSyncHint'); ?>,
                        cls: addcls,
                        addCls: 'sb-unlock-and-sync',
                        handler: function() {
                            Jsw.redirectPost('/subscription/synchronize/id/<?php echo $this->id; ?>');
                        }
                    }
        };
        <?php endif; ?>
        var editHostingSettings = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonEditHostingSettings',
                        cls: addcls,
                        addCls: 'sb-edit-hosting-settings',
                        title: <?php echo $this->jsLmsg('buttonEditHostingSettings'); ?>,
                        description: <?php echo $this->jsLmsg('buttonEditHostingSettingsHint'); ?>,
                        href: '/subscription/edit-hosting/id/<?php echo $this->id; ?>'
                    }
        };
        <?php if ($this->hasLegacyResources): ?>
        var legacyResourcesToolsAction = function(params) {
            Jsw.messageBox.show({
                'type': Jsw.messageBox.TYPE_YESNO,
                'subtype': 'toggle',
                'text': params.title,
                'description': params.description,
                'onYesClick': function() {
                    Jsw.redirectPost(params.url, {
                        redirect: '/subscription/overview/id/<?php echo $this->id; ?>',
                        ids: [<?php echo $this->id; ?>]
                    });
                },
                'needAttention': true,
                'needAttentionText': params.attention,
                'needAttentionBlockSubmit': true,
                'buttonTitles': {
                    'yes': <?php echo $this->jsLmsg('components.buttons.yes') ?>,
                    'no': <?php echo $this->jsLmsg('components.buttons.no') ?>
                }
            });
        };
        var legacyResourcesTools = function() {
            return {
                componentType: 'Jsw.list.AdditionalActions',
                title: <?php echo $this->jsLmsg('bunchSolutions'); ?>,
                operations: [
                     {
                         componentType: 'Jsw.SmallButton',
                         id: 'toCustomerApplyButton',
                         title: <?php echo $this->jsLmsg('toCustomerApplyButton');?>,
                         description: <?php echo $this->jsLmsg('toCustomerApplyHint') ?>,
                         addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-customer',
                         cls: 'sb-btn',
                         handler: function(){
                             legacyResourcesToolsAction({
                                 url: '/business-model-upgrade/manual-subscription-solution/solution/toCustomer/',
                                 title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                                 attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toCustomerApplyHint'); ?>
                             });
                         }
                     }, {
                         componentType: 'Jsw.SmallButton',
                         id: 'toSubscriptionWithUsersApplyButton',
                         title: <?php echo $this->jsLmsg('toSubscriptionWithUsersApplyButton');?>,
                         description: <?php echo $this->jsLmsg('toSubscriptionWithUsersApplyHint') ?>,
                         addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-subscription-with-users',
                         cls: 'sb-btn',
                         handler: function(){
                             legacyResourcesToolsAction({
                                 url: '/business-model-upgrade/manual-subscription-solution/solution/toSubscriptionWithUsers/',
                                 title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                                 attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toSubscriptionWithUsersApplyHint'); ?>
                             });
                         }
                     }, {
                         componentType: 'Jsw.SmallButton',
                         id: 'toSubscriptionWithoutUsersApplyButton',
                         title: <?php echo $this->jsLmsg('toSubscriptionWithoutUsersApplyButton');?>,
                         description: <?php echo $this->jsLmsg('toSubscriptionWithoutUsersApplyHint') ?>,
                         addCls: 'sb-business-model-upgrade-solution sb-business-model-upgrade-solution-subscription-to-subscription-without-users',
                         cls: 'sb-btn',
                         handler: function(){
                             legacyResourcesToolsAction({
                                 url: '/business-model-upgrade/manual-subscription-solution/solution/toSubscriptionWithoutUsers/',
                                 title: <?php echo $this->jsLmsg('applyConfirmation'); ?>,
                                 attention: <?php echo $this->jsLmsg('admin.components.lists.businessmodelupgrade.subscriptions.toSubscriptionWithoutUsersApplyHint'); ?>
                             });
                         }
                     }
                ]
            }
        };
        <?php endif; ?>

        var toggle = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonToggle',
                        title: <?php echo $this->jsEscape($this->buttonToggleTitle);?>,
                        description: <?php echo $this->jsEscape($this->buttonToggleHint); ?>,
                        cls: addcls,
                        addCls: <?php echo $this->jsEscape($this->buttonToggleCls); ?>,
                        handler: function() {
                            <?php if ($this->isBillingAvailable): ?>
                            Jsw.messageBox.show({
                                    'type': Jsw.messageBox.TYPE_YESNO,
                                    'subtype': 'toggle',
                                    'text': <?php echo $this->jsEscape($this->confirmationToggleTitle) ?>,
                                    'description': <?php echo $this->jsEscape($this->confirmationToggleDescription) ?>,
                                    'onYesClick': function() {
                                                      Jsw.redirectPost('/subscription/toggle/id/<?php echo $this->id; ?>');
                                                  },
                                    'buttonTitles': {
                                            'yes': <?php echo $this->jsLmsg('components.buttons.yes') ?>,
                                            'no': <?php echo $this->jsLmsg('components.buttons.no') ?>
                                    }
                            });
                            <?php else: ?>
                        	Jsw.redirectPost('/subscription/toggle/id/<?php echo $this->id; ?>');
                            <?php endif; ?>
                        }
                    }
        };
        var changeOwner = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonChangeOwner',
                        title: <?php echo $this->jsLmsg('buttonChangeOwner');?>,
                        description: <?php echo $this->jsLmsg('buttonChangeOwnerHint'); ?>,
                        cls: addcls,
                        addCls: 'sb-assign-new-owner',
                        handler: function() {
                            <?php if ($this->isBillingAvailable): ?>
                            Jsw.messageBox.show({
                                    'type': Jsw.messageBox.TYPE_YESNO,
                                    'subtype': 'toggle',
                                    'text': <?php echo $this->jsLmsg('admin.components.billing.buttonChangeOwnerTitle') ?>,
                                    'description': <?php echo $this->jsLmsg('admin.components.billing.warningChangeOwner') ?>,
                                    'onYesClick': function() {
                                                      Jsw.redirectPost('/plesk/client@any/domain@multi/chowner?overview=true&del[0]=<?php echo $this->id; ?>');
                                                  },
                                    'buttonTitles': {
                                            'yes': <?php echo $this->jsLmsg('components.buttons.yes') ?>,
                                            'no': <?php echo $this->jsLmsg('components.buttons.no') ?>
                                    }
                            });
                            <?php else: ?>
                            Jsw.redirectPost('/plesk/client@any/domain@multi/chowner?overview=true&del[0]=<?php echo $this->id; ?>');
                            <?php endif; ?>
                        }
                    }
        };
        var remove = function(addcls) {
            return {
                        componentType: 'Jsw.SmallButton',
                        id: 'buttonRemove',
                        cls: addcls,
                        addCls: 'sb-remove-selected',
                        title: <?php echo $this->jsLmsg('buttonRemove'); ?>,
                        description: <?php echo $this->jsLmsg('buttonRemoveHint'); ?>,
                        handler: function() {
                            Jsw.messageBox.show({
                                'type': Jsw.messageBox.TYPE_YESNO,
                                'subtype': 'delete',
                                'text': <?php echo $this->jsLmsg('confirmOnDelete')?>,
                                'buttonTitles': {
                                    yes: <?php echo $this->jsLmsg('components.buttons.yes')?>,
                                    no: <?php echo $this->jsLmsg('components.buttons.no')?>,
                                    wait: <?php echo $this->jsLmsg('components.buttons.wait')?>
                                },
                                <?php if ($this->isBillingAvailable): ?>
                                'needAttention': true,
                                'needAttentionText': <?php echo $this->jsLmsg('admin.components.billing.warningRemoveSubscription'); ?>,
                                'needAttentionBlockSubmit': true,
                                <?php endif; ?>
                                'onYesClick': function() {
                                	Jsw.redirectPost('/subscription/delete-current/id/<?php echo $this->id; ?>');
                                },

                                isAjax: <?php echo $this->isHomonymSearchEnabled ? 'true' : 'false' ?>,
                                requestUrl: '/subscription/search-homonym-data/',
                                requestParams: {ids: '<?php echo $this->id; ?>'},
                                loadingTitle: <?php echo $this->jsLmsg('components.homonyms.loading'); ?>
                            });
                        }
                    }
        };
        <?php if($this->isServiceModelAvailable): ?>
        var serviceInstances = function(addcls) {
            return {
                componentType: 'Jsw.SmallButton',
                id: 'buttonServiceInstances',
                cls: addcls,
                addCls: 'sb-service-instances',
                title: <?php echo $this->jsLmsg('buttonServiceInstances'); ?>,
                description: <?php echo $this->jsLmsg('buttonServiceInstancesHint'); ?>,
                href: '/service-instance/list/package/<?php echo $this->servicePackageId; ?>'
            }
        };
        <?php endif; ?>
        var tools = [
                <?php if($this->isBillingAvailable): ?>
                  billingPackageOverview("s-btn"), billingUpgrade("s-btn"), billingDowngrade("s-btn"), billingAddons("s-btn"), separator(),
                  <?php if ($this->changeLimitsPermission && $this->generalInfo['subscription']
                            && ($this->generalInfo['subscription']->isLocked()
                            || !$this->generalInfo['subscription']->isSynchronized())): ?>
                        unlockAndSync("s-btn"), separator(),
                  <?php endif; ?>
                  <?php if ($this->hasLegacyResources): ?> legacyResourcesTools(), separator(), <?php endif; ?>
                  toggle("s-btn"), separator(),
                  <?php if ($this->createDomainPermission): ?> remove("s-btn"), separator(), <?php endif; ?>
                  { componentType: 'Jsw.list.AdditionalActions',
                    title: <?php echo $this->jsLmsg('buttonMoreActions'); ?>,
                    operations: [
                       <?php if ($this->hosting): ?>editHostingSettings("sb-btn"), hseparator(), <?php endif;?>
                       <?php if ($this->changeLimitsPermission && $this->vendorHasPlans): ?>switchToAnotherPlan("sb-btn"), <?php endif; ?>
                       manuallyEditParameters("sb-btn"), hseparator(),
                       changeOwner("sb-btn")
                    ]
                  }
                <?php else: ?>
                  <?php if ($this->changeLimitsPermission && $this->vendorHasPlans): ?>switchToAnotherPlan("s-btn"), separator(), <?php endif; ?>
                  manuallyEditParameters("s-btn"), separator(),
                  <?php if ($this->changeLimitsPermission && $this->generalInfo['subscription']
                            && ($this->generalInfo['subscription']->isLocked()
                            || !$this->generalInfo['subscription']->isSynchronized())): ?>
                        unlockAndSync("s-btn"), separator(),
                  <?php endif; ?>
                  <?php if ($this->hosting): ?>editHostingSettings("s-btn"), separator(), <?php endif;?>
                  <?php if ($this->hasLegacyResources): ?> legacyResourcesTools(), separator(), <?php endif; ?>
                  toggle("s-btn"), changeOwner("s-btn")
                  <?php if ($this->createDomainPermission): ?> , separator(), remove("s-btn") <?php endif; ?>
                <?php endif; ?>
                <?php if($this->isServiceModelAvailable): ?>
                , separator(), serviceInstances("s-btn")
                <?php endif; ?>
        ];

        return tools;
    }

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

            new Jsw.SmallTools({
                operations: getToolsPanel()
            }),

            new Jsw.layout.TwoColumns({
                items: [{
                    componentType: 'Jsw.Panel',
                    'title': <?php echo $this->jsLmsg('generalSectionTitle') ?>,
                    cls: 'form-box',
                    items: sectionGeneralFields
                }, new Jsw.Container({
                    items: [<?php if($this->isBillingAvailable): ?> {
                    componentType: 'Jsw.Panel',
                    'title': <?php echo $this->jsLmsg('billingSectionTitle') ?>,
                    cls: 'form-box',
                    items: [
                        <?php if ($this->billingData->isAvailable()): ?>
                        {
                            componentType: 'Jsw.form.DisplayField',
                            fieldLabel: <?php echo $this->jsLmsg('billingPrice'); ?>,
                            value: <?php echo $this->jsHtml($this->billingCurrency($this->billingData->price)); ?>
                        },
                        {
                            componentType: 'Jsw.form.DisplayField',
                            fieldLabel: <?php echo $this->jsLmsg('billingCycle'); ?>,
                            value: <?php echo $this->jsHtml($this->billingData->cycle); ?>
                        },
                        {
                            componentType: 'Jsw.form.DisplayField',
                            fieldLabel: <?php echo $this->jsLmsg('billingDateRenewal'); ?>,
                            value: <?php echo $this->jsHtml($this->billingData->dateRenewal); ?>
                        }
                        <?php else: ?>
                        {
                            componentType: 'Jsw.Hint',
                            hint: <?php echo $this->jsLmsg('noBilllingDataAvailable'); ?>
                        }
                        <?php endif; ?>
                    ]
                }, <?php endif; ?> {
                    componentType: 'Jsw.Panel',
                    'title': <?php echo $this->jsLmsg('hostingSectionTitle') ?>,
                    cls: 'form-box',
                    items: sectionHostingFields
                }]})]
            }),

            new Jsw.Panel({
                title: <?php echo $this->jsLmsg('servicesSectionTitle'); ?>,
                cls: 'form-box',
                items: [
                    new Jsw.Panel({
                        title: '',
                        cls: 'list-box list-groups-box',
                        html: <?php echo $this->jsHtml($this->partial('partials/domains.phtml',
                                                                      array(
                                                                           'domainsInfo' => $this->domainsInfo,
                                                                           'limits' => $this->domainResourceLimits,
                                                                      ))); ?>
                    })
                ]
            }),

            new Jsw.bar.Tabs({
                type: 'dynamic',
                cls: 'tabs',
                items: [
                    <?php echo $this->partial('partials/subscription-resources-overview.phtml', array(
                        'overusePolicy' => $this->overusePolicy,
                        'overusePolicyNotify' => $this->overusePolicyNotify,
                        'mainResourceLimits' => $this->mainResourceLimits,
                        'additionalResourceLimits' => $this->additionalResourceLimits)); ?>
                    , <?php echo $this->partial('partials/permissions-overview.phtml', array('mainPermissions' => $this->mainPermissions, 'additionalPermissions' => $this->additionalPermissions)); ?>
                    <?php if ($this->planItems): ?>
                    , <?php echo $this->partial('partials/extras-overview.phtml', array('planItems' => $this->planItems)); ?>
                    <?php endif; ?>
                ]
            })
        ]
    });
    <?php if ($this->subscriptionStatusDescription):?>
        Jsw.Tooltip.init(
            $('subscription-status-description-tooltip'),
            {text: <?php echo $this->jsEscape($this->subscriptionStatusDescription);?>}
        );
    <?php endif?>
    <?php if ($this->webserverConfigurationDomainHint):?>
    $$('span.webspace-configuration-failed-tooltip').each(function(hintElement) {
        new Jsw.Tooltip.init(
            hintElement,
            {text: <?php echo $this->jsEscape($this->webserverConfigurationDomainHint); ?>}
        );
    });
    <?php endif?>
});
//]]>
</script>
