{*<!--

+---------------------------------------------------------------------------+
| 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'>
            <li>
                <a href='affiliate-edit.php' class='inlineIcon iconWebsiteAdd'>{t str=AddNewAffiliate}&nbsp;/&nbsp;App</a>
            </li>
            <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=ConfirmDeleteAffiliates}{literal}")) {
							window.location = 'affiliate-delete.php?{/literal}{rv_add_session_token}{literal}&affiliateid=' + ids.join(',');
						}
					}
                });

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

        {if !empty($topPager->links)}
        <ul class='tableFilters alignRight'>
            <li>
              <div class="pager">
                <span class="controls">{$topPager->links}</span>
              </div>
            </li>
        </ul>
        {/if}


        <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=website-index.php}
                </th>
                <th class='{ox_column_class item=type order=up default=1}'>
                    {ox_column_title item=type order=up default=1 str=Type url=website-index.php}
                </th>
                <th class='{ox_column_class item=updated order=up default=0}'>
                    {ox_column_title item=updated order=up default=0 str=Updated url=website-index.php}
                </th>
                {if $showAdDirect}
                <th>
                    {t str=AdvertiserSignup}
                </th>
                {/if}
                <th class='last alignRight'>&nbsp;

                </th>
                 <th class='last alignRight'>&nbsp;
                    
                </th>
            </tr>
        </thead>



{if !$affiliates|@count}
        <tbody>
            <tr class='odd'>
                <td colspan='{if $showAdDirect}4{else}3{/if}'>&nbsp;</td>
            </tr>
            <tr class='even'>
                <td></td>
                <td colspan='{if $showAdDirect}4{else}3{/if}' class="hasPanel">
                    <div class='tableMessage'>
                        <div class='panel'>
                            {t str=NoAffiliates}

                            <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>
                <td></td>
                <td></td>
            </tr>
            <tr class='odd'>
                <td colspan='{if $showAdDirect}4{else}3{/if}'>&nbsp;</td>
            </tr>
        </tbody>

{else}
        <tbody>
    {cycle name=bgcolor values="even,odd" assign=bgColor reset=1}
    {foreach key=key item=affiliate from=$from}
        {cycle name=bgcolor assign=bgColor}
            <tr class='{$bgColor}'>
              <td class='toggleSelection'>
                  <input type='checkbox' value='{$key}' />
                </td>
                <td>
                    <a href='affiliate-edit.php?affiliateid={$key}' class='inlineIcon iconWebsite'>{$affiliate.name|escape:html}</a>
                    {ox_entity_id type="Website" id=$key}
                </td>
                <td>
                    {$affiliate.afftype}
                </td>
                <td>
                    {ox_column_updated updated=$affiliate.updated}
                </td>
                {if $showAdDirect}
                <td>
                    {$affiliate.adv_signup|default:'&nbsp;'}
                </td>
                {/if}
                <td class='alignRight'>
                    <ul class='rowActions'>
                        <li>
                            <a href='zone-edit.php?affiliateid={$key}' class='inlineIcon iconZoneAdd'>{t str=AddNewZone}</a>
                        </li>
                        <li>
                          <a href='affiliate-zones.php?affiliateid={$key}' class='inlineIcon iconZones'>{t str=Zones}</a>
                        </li>
                        <li>
                            <a href='affiliate-channels.php?affiliateid={$key}' class='inlineIcon iconTargetingChannels'>{t str=Channels}</a>
                        </li>
                         {if $affiliate.afftype == "Android" || $affiliate.afftype == "IOS"}
                         <li>
                            <a href='app_ads.php?affiliateid={$key}' class='inlineIcon iconTargetingChannels'>Download app-ads.txt</a>
                        </li>
                        {else}
                        <li>
                            <a href='ads_txt.php?affiliateid={$key}' class='inlineIcon iconTargetingChannels'>Download ads.txt</a>
                        </li>
                        {/if}
                        
                    </ul>
                </td>
                 <td>
                     {if $affiliate.afftype == "Android"}
                     <a href='zone-sdk.php?affiliateid={$key}&app=1' class='inlineIcon iconZoneInvocation'>Download Android SDK</a>
                     {elseif $affiliate.afftype == "IOS"}
                     <a href='zone-sdk.php?affiliateid={$key}&app=2' class='inlineIcon iconZoneInvocation'>Download IOS SDK</a>
                     {/if}
                </td>
                
            </tr>
    {/foreach}
       </tbody>
{/if}
{if !empty($pager->links)}
    <tbody class="tableFooter">
        <tr>
        <td  colspan="3">
              <div class="pager">
                <span class="summary">{$pager->summary}</span>
                <span class="controls">{$pager->links}</span>
              </div>
        </td>
        </tr>
    </tbody>
{/if}

    </table>
</div>
