{*<!--

+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+

-->*}


<div class='tableWrapper'>
    <div class='tableHeader'>
        <ul class='tableActions'>
            {if $canAdd}
            <li>
                {if $affiliateId != -1}
                <a href='zone-edit.php?affiliateid={$affiliateId}' class='inlineIcon iconZoneAdd'>{t str=AddNewZone}</a>
                {else}
                <span class='inlineIcon iconZoneAddDisabled'>{t str=AddNewZone}</span>
                {/if}
            </li>
            {/if}
            {if $canDelete}
            <li class='inactive activeIfSelected'>
                <a id='deleteSelection' href='#' class='inlineIcon iconDelete'>{t str=Delete}</a>

                {literal}
                <script type='text/javascript'>
                <!--

				$('#deleteSelection').click(function(event) {
					event.preventDefault();

					if (!$(this).parents('li').hasClass('inactive')) {
						var ids = [];
						$(this).parents('.tableWrapper').find('.toggleSelection input:checked').each(function() {
							ids.push(this.value);
						});

						if (!tablePreferences.warningBeforeDelete || confirm("{/literal}{t str=ConfirmDeleteZones}{literal}")) {
							window.location = 'zone-delete.php?affiliateid={/literal}{$affiliateId}&{rv_add_session_token}{literal}&zoneid=' + ids.join(',');
						}
					}
				});

				//-->
				</script>
                {/literal}
            </li>
            {/if}
        </ul>

        <div class='clear'></div>
        <div class='corner left'></div>
        <div class='corner right'></div>
    </div>

    <table cellspacing='0' summary=''>
        <thead>
            <tr>
              <th class='first toggleAll'>
                  <input type='checkbox' />
                </th>
                <th class='{ox_column_class item=name order=up default=1}'>
                    {ox_column_title item=name order=up default=1 str=Name url=affiliate-zones.php}
                </th>
                <th class='{ox_column_class item=size order=up default=0}'>
                    {ox_column_title item=size order=up default=0 str=Size url=affiliate-zones.php}
                </th>
                <th>
                  {t str=Description}
                </th>
                <th class='last alignRight'>&nbsp;

                </th>
            </tr>
        </thead>

{if !$from|@count}
        <tbody>
            <tr class='odd'>
                <td colspan='5'>&nbsp;</td>
            </tr>
            <tr class='even'>
                <td colspan='5' class="hasPanel">
                    <div class='tableMessage'>
                        <div class='panel'>
                            {if $affiliateId != -1}
                                {t str=NoZones}
                            {else}
                                {t str=NoZonesAddWebsite}
                            {/if}

                            <div class='corner top-left'></div>
                            <div class='corner top-right'></div>
                            <div class='corner bottom-left'></div>
                            <div class='corner bottom-right'></div>
                        </div>
                    </div>

                    &nbsp;
                </td>
            </tr>
            <tr class='odd'>
                <td colspan='5'>&nbsp;</td>
            </tr>
        </tbody>

{else}
        <tbody>
    {cycle name=bgcolor values="even,odd" assign=bgColor reset=1}
    {foreach key=zoneId item=zone from=$from}
        {cycle name=bgcolor assign=bgColor}
            <tr class='{$bgColor}'>
              <td class='toggleSelection'>
                  <input type='checkbox' value='{$zoneId}' />
                </td>
                <td>
                  {if $canEdit}
                      <a href='zone-edit.php?affiliateid={$affiliateId}&zoneid={$zoneId}' class='inlineIcon {ox_zone_icon delivery=$zone.delivery active=$zone.active warning=$zone.lowPriorityWarning}'>{$zone.zonename|escape:html}</a>
                    {else}
                      <span class='inlineIcon {ox_zone_icon delivery=$zone.delivery active=$zone.active warning=$zone.lowPriorityWarning}'>{$zone.zonename|escape:html}</span>
                    {/if}
                  {ox_entity_id type="Zone" id=$zoneId}
                </td>
                <td>
                    {ox_zone_size width=$zone.width height=$zone.height delivery=$zone.delivery}
                </td>
                <td>
                    {$zone.description|escape:html|default:'&nbsp;'}
                </td>
                <td class='alignRight'>
                    <ul class='rowActions'>
                        {if $canLink}
                        <li>
                            <a href='zone-include.php?affiliateid={$affiliateId}&zoneid={$zoneId}' class='inlineIcon iconZoneLinked'>{t str=IncludedBanners}</a>
                        </li>
                        {/if}
                        <li>
                            <a href='zone-probability.php?affiliateid={$affiliateId}&zoneid={$zoneId}' class='inlineIcon iconZoneProbability'>{t str=Probability}</a>
                        </li>
                        {if $canInvocation}
                        <li>
                            <a href='zone-invocation.php?affiliateid={$affiliateId}&zoneid={$zoneId}' class='inlineIcon iconZoneInvocation'>{t str=Invocationcode}</a>
                        </li>
                        {/if}
                    </ul>
                </td>
            </tr>
    {/foreach}
       </tbody>
{/if}
    </table>
</div>
