{*<!--

+---------------------------------------------------------------------------+
| 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='advertiser-edit.php' class='inlineIcon iconAdvertiserAdd'>{t str=AddClient}</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=ConfirmDeleteClients}{literal}")) {
                            window.location = 'advertiser-delete.php?{/literal}{rv_add_session_token}{literal}&clientid=' + ids.join(',');
                        }
                    }
                });

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

        <ul class='tableFilters alignRight'>
            <li>
                <div class='label'>
                    Show
                </div>

                <div class='dropDown'>
                    <span><span>{if $hideinactive}Active advertisers{else}All advertisers{/if}</span></span>

                    <div class='panel'>
                        <div>
                            <ul>
                                <li><a href='advertiser-index.php?hideinactive=0'>All advertisers</a></li>
                                <li><a href='advertiser-index.php?hideinactive=1'>Active advertisers</a></li>
                            </ul>
                        </div>
                    </div>

                    <div class='mask'></div>
                </div>
            </li>
            {if !empty($topPager->links)}
            <li>
              <div class="pager">
                <span class="controls">{$topPager->links}</span>
              </div>
            </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=advertiser-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=advertiser-index.php}
                </th>
                <th class='last alignRight'>&nbsp;

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

{if !$from|@count}
        <tbody>
            <tr class='odd'>
                <td colspan='3'>&nbsp;</td>
            </tr>
            <tr class='even'>
                <td colspan='3' class="hasPanel">
                    <div class='tableMessage'>
                        <div class='panel'>

                        {if $hideinactive}
                            {$aCount.advertisers_hidden} {t str=InactiveAdvertisersHidden}
                        {else}
                            {t str=NoClients}
                        {/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='3'>&nbsp;</td>
            </tr>
        </tbody>

{else}
        <tbody>
    {cycle name=bgcolor values="even,odd" assign=bgColor reset=1}
    {foreach key=clientId item=client from=$from}
        {cycle name=bgcolor assign=bgColor}
            <tr class='{$bgColor} {if $client.type == $MARKET_TYPE}systemAdvertiser{/if}'>
                <td class='toggleSelection'>
                  {if $client.type != $MARKET_TYPE}
                    <input type='checkbox' value='{$clientId}' />
                  {/if}
                </td>
                <td>
                  {if $client.type == $MARKET_TYPE} {* no link, just name, and don't display system ids *}
                    <span class='inlineIcon iconAdvertiserSystem'>{$client.clientname|escape:html}</span>
                  {else}
                    <a href='advertiser-edit.php?clientid={$clientId}' class='inlineIcon iconAdvertiser'>{$client.clientname|escape:html}</a>
                    {ox_entity_id type="Advertiser" id=$clientId}
                  {/if}
                </td>
                <td>
                    {ox_column_updated updated=$client.updated}
                </td>
                <td class='alignRight horizontalActions'>
                    <ul class='rowActions'>
                        <li>
                            <a href='campaign-edit.php?clientid={$clientId}' class='inlineIcon {if $client.type == $MARKET_TYPE}iconCampaignSystemAdd{else}iconCampaignAdd{/if}'>{t str=AddCampaign}</a>
                        </li>
                        <li>
                            <a href='advertiser-campaigns.php?clientid={$clientId}' class='inlineIcon {if $client.type == $MARKET_TYPE}iconCampaignsSystem{else}iconCampaigns{/if}'>{t str=Campaigns}</a>
                        </li>
                    </ul>
                </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>