{*<!--

+---------------------------------------------------------------------------+
| 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 $clientId == -1 || $campaignId == -1}
                <span class='inlineIcon iconBannerAddDisabled'>{t str=AddBanner}</span>
                {else}
                <a href='banner-edit.php?clientid={$clientId}&amp;campaignid={$campaignId}' class='inlineIcon iconBannerAdd'>{t str=AddBanner}</a>
                {/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=ConfirmDeleteBanners}{literal}")) {
                            window.location = 'banner-delete.php?clientid={/literal}{$clientId}{literal}&campaignid={/literal}{$campaignId}&{rv_add_session_token}{literal}&bannerid=' + ids.join(',');
                        }
                    }
                });

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

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

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

                    <div class='panel'>
                        <div>
                            <ul>
                                <li><a href='campaign-banners.php?clientid={$clientId}&amp;campaignid={$campaignId}&amp;hideinactive=0'>All banners</a></li>
                                <li><a href='campaign-banners.php?clientid={$clientId}&amp;campaignid={$campaignId}&amp;hideinactive=1'>Active banners</a></li>
                            </ul>
                        </div>
                    </div>

                    <div class='mask'></div>
                </div>
            </li>
        </ul>

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

    <table cellspacing='0' summary=''>
        <thead>
            <tr>
                {if $canDelete}
                <th class='first toggleAll'>
                    <input type='checkbox' />
                </th>
                {/if}
                <th class='{ox_column_class item=name order=up default=1}'>
                    {ox_column_title item=name order=up default=1 str=Name url=campaign-banners.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=campaign-banners.php}
                </th>
                <th>
                    &nbsp;
                </th>
                <th>
                    &nbsp;
                </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 $clientId != -1}
                            {if $campaignId != -1}
                                {if $hideinactive}
                                    {$aCount.banners_hidden} {t str=InactiveBannersHidden}
                                {else}
                                    {t str=NoBanners}
                                {/if}
                            {else}
                                {t str=NoBannersAddCampaign values=$clientId}
                            {/if}
                        {else}
                            {t str=NoBannersAddAdvertiser}
                        {/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=bannerId item=banner from=$from}
        {cycle name=bgcolor assign=bgColor}
            <tr class='{$bgColor}'>
                {if $canDelete}
                <td class='toggleSelection'>
                    <input type='checkbox' value='{$bannerId}' />
                </td>
                {/if}
                <td>
                  {if $canEdit}
                      <a href='banner-edit.php?clientid={$clientId}&campaignid={$campaignId}&bannerid={$bannerId}' class='inlineIcon {ox_banner_icon type=$banner.type active=$banner.active}'>{$banner.description|escape:html}</a>
                    {else}
                      <span class='inlineIcon {ox_banner_icon type=$banner.type active=$banner.active}'>{$banner.description|escape:html}</span>
                    {/if}
                  {ox_entity_id type="Banner" id=$bannerId}
                </td>
                <td>
                    {ox_column_updated updated=$banner.updated}
                </td>
                <td>
                    {$banner.preview}
                </td>
                <td class='alignRight verticalActions'>
                    <ul class='rowActions'>
                      {if $canACL}
                        <li>
                            <a href='banner-acl.php?clientid={$clientId}&amp;campaignid={$campaignId}&amp;bannerid={$bannerId}' class='inlineIcon iconBannerApplyLimitations'>{t str=ACL}</a>
                        </li>
                        {/if}
                        {if !$banner.active && $canActivate}
                        <li>
                            <a href='banner-activate.php?{rv_add_session_token}&amp;clientid={$clientId}&amp;campaignid={$campaignId}&amp;bannerid={$bannerId}&amp;value=1' class='inlineIcon iconActivate'>{t str=Activate}</a>
                        </li>
                        {/if}
                        {if $banner.active && $canDeactivate}
                        <li>
                            <a href='banner-activate.php?{rv_add_session_token}&amp;clientid={$clientId}&amp;campaignid={$campaignId}&amp;bannerid={$bannerId}&amp;value=0' class='inlineIcon iconDeactivate'>{t str=Deactivate}</a>
                        </li>
                        {/if}
                    </ul>
                </td>
                <td class='hasPanel'>
                    <div class='panel'>
                        <table cellspacing='0' summary=''>
                            {if $banner.width > 0}
                            <tr>
                                <th>{t str=Size}</th>
                                <td>{ox_banner_size width=$banner.width height=$banner.height}</td>
                            </tr>
                            {/if}
                            <tr>
                                <th>{t str=Url}</th>
                                <td>
                                {if $banner.url_trimmed}
                                    <span title="{$banner.url|escape}">
                                        {$banner.url_trimmed|escape}
                                    </span>
                                {else}
                                    {$banner.url|escape}
                                {/if}
                                </td>
                            </tr>
                            <tr>
                                <th>{t str=Weight}</th>
                                <td>{$banner.weight}</td>
                            </tr>
                        </table>

                        <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>
                </td>
            </tr>
    {/foreach}
       </tbody>
{/if}
    </table>
</div>
