<?php
// Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.
?>
<?php if ($this->overuse): ?>
<?php echo $this->element->getSubForm('overusePolicy')->render($this); ?>
<hr/>
<?php endif; ?>

<div class="two-cols-block clearfix">
    <div class="first-col">
      <div class="column-box">
        <div id="limitGroups-main" class="form-box form-box-50x50">
            <div id="limitGroups-main-content-area">
              <table cellspacing="0" width="100%" class="form-table form-limits"><tbody>
<?php if ($this->isReseller) : ?>
                <?php echo $this->element->getElement('max_cl')->render($this); ?>

<tr class="form-row">
  <td class="" colspan="3">
    <div class="title">
      <div class="title-area"></div>
    </div>
  </td>
</tr>

<?php endif; ?>
                <?php echo $this->element->getElement('disk_space')->render($this); ?>
<?php if ($this->softLimits): ?>
                <?php echo $this->element->getElement('disk_space_soft')->render($this); ?>
<?php endif; ?>
                <?php echo $this->element->getElement('max_traffic')->render($this); ?>
<?php if ($this->softLimits): ?>
                <?php echo $this->element->getElement('max_traffic_soft')->render($this); ?>
<?php endif; ?>

<tr class="form-row">
  <td class="" colspan="3">
    <div class="title">
      <div class="title-area"></div>
    </div>
  </td>
</tr>


<?php if ($this->element->getElement('max_site_builder')): ?>
    <?php echo $this->element->getElement('max_site_builder')->render($this); ?>
    <?php if (!$this->isReseller && $this->isUpsellAllowed) : ?>
                <?php echo $this->element->getElement('upsell_site_builder')->render($this); ?>
    <?php endif; ?>
<?php endif; ?>
<?php if ($this->isReseller) : ?>
                <?php echo $this->element->getElement('max_dom')->render($this); ?>
<?php else: ?>
                <?php echo $this->element->getElement('max_site')->render($this); ?>
<?php endif; ?>
                <?php echo $this->element->getElement('max_unity_mobile_sites')->render($this); ?>
                <?php echo $this->element->getElement('max_subdom')->render($this); ?>
                <?php echo $this->element->getElement('max_dom_aliases')->render($this); ?>

<tr class="form-row">
  <td class="" colspan="3">
    <div class="title">
      <div class="title-area"></div>
    </div>
  </td>
</tr>

<?php if ($this->element->getElement('max_box')): ?>
    <?php echo $this->element->getElement('max_box')->render($this); ?>
<?php endif; ?>
<?php if ($this->element->getElement('mbox_quota')): ?>
    <?php echo $this->element->getElement('mbox_quota')->render($this); ?>
<?php endif; ?>
<?php if ($this->hgModeWindows && $this->element->getElement('total_mboxes_quota')) : ?>
    <?php echo $this->element->getElement('total_mboxes_quota')->render($this); ?>
<?php endif; ?>
<?php if ($this->element->getElement('max_maillists')): ?>
    <?php echo $this->element->getElement('max_maillists')->render($this); ?>
<?php endif; ?>

<?php if ($this->element->getElement('max_box') || $this->element->getElement('mbox_quota') || $this->element->getElement('max_maillists')): ?>
<tr class="form-row">
  <td class="" colspan="3">
    <div class="title">
      <div class="title-area"></div>
    </div>
  </td>
</tr>
<?php endif; ?>

<?php echo $this->element->getElement('max_subftp_users')->render($this); ?>
<?php echo $this->element->getElement('max_db')->render($this); ?>
<?php if ($this->hgModeWindows): ?>
    <?php echo $this->element->getElement('mysql_dbase_space')->render($this); ?>
    <?php echo $this->element->getElement('max_mssql_db')->render($this); ?>
    <?php echo $this->element->getElement('mssql_dbase_space')->render($this); ?>
    <?php if ($this->element->getElement('mssql_dbase_filesize')): ?>
        <?php echo $this->element->getElement('mssql_dbase_filesize')->render($this); ?>
    <?php endif; ?>
    <?php if ($this->element->getElement('mssql_dbase_log_filesize')): ?>
        <?php echo $this->element->getElement('mssql_dbase_log_filesize')->render($this); ?>
    <?php endif; ?>
<?php endif; ?>

<?php if (!$this->isReseller && $this->element->getElement('expiration')) : ?>
                <?php echo $this->element->getElement('expiration')->render($this); ?>
<?php endif; ?>
              </tbody></table>
            </div>
        </div>
      </div>
    </div>

    <div class="second-col">
      <div class="column-box">
        <div id="limitGroups-additional" class="form-box form-box-50x50 b-collapsible">
            <div id="limitGroups-additional-content-area">
              <table cellspacing="0" width="100%" class="form-table form-limits"><tbody>
                <?php echo $this->element->getElement('max_webapps')->render($this); ?>
                <?php echo $this->element->getElement('max_wu')->render($this); ?>
                <?php if ($this->hgModeWindows): ?>
                    <?php echo $this->element->getElement('max_fpse_users')->render($this); ?>
                    <?php echo $this->element->getElement('max_shared_ssl_links')->render($this); ?>
                    <?php echo $this->element->getElement('max_odbc')->render($this); ?>
                    <?php echo $this->element->getElement('max_cf_dsn')->render($this); ?>
                    <?php if ($this->isReseller && $this->element->getElement('max_iis_app_pools')) : ?>
                        <?php echo $this->element->getElement('max_iis_app_pools')->render($this); ?>
                    <?php endif; ?>
                <?php endif; ?>
                <?php foreach ($this->serviceLimitIds as $limitId) {
                    echo $this->element->getElement($limitId)->render($this);
                }?>
              </tbody></table>
            </div>
        </div>
      </div>
    </div>
</div>

<script type='text/javascript'>
//<![CDATA[
Jsw.onReady(function() {
    new Jsw.Hint({
        renderTo: 'limitGroups-main-content-area',
        renderMode: 'top',
        hint: <?php echo $this->jsEscape($this->mainGroupTitle); ?>
    });
    new Jsw.Panel({
        applyTo: 'limitGroups-main',
        cls: 'form-box form-box-50x50'
    });
    new Jsw.Panel({
        title: <?php echo $this->jsEscape($this->additionalGroupTitle) ?>,
		hideContentTitle: <?php echo $this->jsEscape($this->additionalGroupTitleHidden) ?>,
        applyTo: 'limitGroups-additional',
        hidden: true
    });
});
//]]>
</script>

<?php if ($this->overuse): ?>
<script type="text/javascript">
//<![CDATA[
Jsw.namespace('AdminPanel.ServicePlan.Resources');

AdminPanel.ServicePlan.Resources.Tab = {
    updateControlsState: function() {
        if ($('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-true').checked) {
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseSoftAllowed')->getId(); ?>').disable();
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseAlwaysAllowed')->getId(); ?>').disable();
            $('<?php echo $this->element->getElement('disk_space_soft')->getId(); ?>-row').show();
            $('<?php echo $this->element->getElement('max_traffic_soft')->getId(); ?>-row').show();
        }
        if ($('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-soft').checked) {
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseSoftAllowed')->getId(); ?>').enable();
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseAlwaysAllowed')->getId(); ?>').disable();
            $('<?php echo $this->element->getElement('disk_space_soft')->getId(); ?>-row').show();
            $('<?php echo $this->element->getElement('max_traffic_soft')->getId(); ?>-row').show();
        }
        if ($('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-false').checked) {
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseSoftAllowed')->getId(); ?>').disable();
            $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('notifyOveruseAlwaysAllowed')->getId(); ?>').enable();
            $('<?php echo $this->element->getElement('disk_space_soft')->getId(); ?>-row').hide();
            $('<?php echo $this->element->getElement('max_traffic_soft')->getId(); ?>-row').hide();
        }
    }
}

Jsw.onReady(function() {
    $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-true').
        observe('click', AdminPanel.ServicePlan.Resources.Tab.updateControlsState);
    $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-soft').
        observe('click', AdminPanel.ServicePlan.Resources.Tab.updateControlsState);
    $('<?php echo $this->element->getSubForm('overusePolicy')->getElement('overuse')->getId(); ?>-false').
        observe('click', AdminPanel.ServicePlan.Resources.Tab.updateControlsState);

    AdminPanel.ServicePlan.Resources.Tab.updateControlsState();
});
//]]>
</script>
<?php endif; ?>
