{*<!--

+---------------------------------------------------------------------------+
| OpenX v2.8                                                                |
| =========                                                                 |
|                                                                           |
| Copyright (c) 2003-2009 OpenX Limited                                     |
| For contact details, see: http://www.openx.org/                           |
|                                                                           |
| This program is free software; you can redistribute it and/or modify      |
| it under the terms of the GNU General Public License as published by      |
| the Free Software Foundation; either version 2 of the License, or         |
| (at your option) any later version.                                       |
|                                                                           |
| This program is distributed in the hope that it will be useful,           |
| but WITHOUT ANY WARRANTY; without even the implied warranty of            |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
| GNU General Public License for more details.                              |
|                                                                           |
| You should have received a copy of the GNU General Public License         |
| along with this program; if not, write to the Free Software               |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |
+---------------------------------------------------------------------------+
$Id: campaign-index-list.html 62345 2010-09-14 21:16:38Z chris.nutting $

-->*}


<div class='tableWrapper'>
    <div class='tableHeader'>
        <ul class='tableActions'>
            {if $isManager}
            <li>
                {if $clientId != -1}
                <a href='campaign-edit.php?clientid={$clientId}' class='inlineIcon iconCampaignAdd'>{t str=AddCampaign}</a>
                {else}
                <span class='inlineIcon iconCampaignAddDisabled'>{t str=AddCampaign}</span>
                {/if}
            </li>
            {/if}
            {if $isAdvertiser == false}
            <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=ConfirmDeleteCampaigns}{literal}")) {
    						window.location = 'campaign-delete.php?clientid={/literal}{$clientId}{literal}&campaignid=' + 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 campaigns{else}All campaigns{/if}</span></span>

                    <div class='panel'>
                        <div>
                            <ul>
                                <li><a href='advertiser-campaigns.php?clientid={$clientId}&hideinactive=0'>All campaigns</a></li>
                                <li><a href='advertiser-campaigns.php?clientid={$clientId}&hideinactive=1'>Active campaigns</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 $isAdvertiser == false}
                <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=advertiser-campaigns.php}
                </th>
                <th class='{ox_column_class item=status order=up default=0}'>
                    {ox_column_title item=status order=up default=0 str=Status url=advertiser-campaigns.php}
                </th>
                <th>
                    Type
                </th>
                <th>&nbsp;

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

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

{if !$from|@count}
        <tbody>
            <tr class='odd'>
                <td colspan='6'>&nbsp;</td>
            </tr>
            <tr class='even'>
                <td colspan='6' class="hasPanel">
                    <div class='tableMessage'>
                        <div class='panel'>
                            {if $clientId != -1}
                            	{if $hideinactive}
                               		{$aCount.campaigns_hidden} {t str=InactiveCampaignsHidden}
                                {else}
	                                {t str=NoCampaigns}
                                {/if}
                            {else}
                                {t str=NoCampaignsAddAdvertiser}
                            {/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='6'>&nbsp;</td>
            </tr>
        </tbody>

{else}
        <tbody>
    {cycle name=bgcolor values="even,odd" assign=bgColor reset=1}
    {foreach key=campaignId item=campaign from=$from}
        {cycle name=bgcolor assign=bgColor}
            <tr class='{$bgColor}'>
                {if $isAdvertiser == false}
                <td class='toggleSelection'>
                    <input type='checkbox' value='{$campaignId}' />
                </td>
                {/if}
                <td>
                    {if $isAdvertiser}
                        <a href='campaign-banners.php?clientid={$clientId}&campaignid={$campaignId}' class='inlineIcon {ox_campaign_icon status=$campaign.status}'>{$campaign.campaignname|escape:html}</a>
                    {else}
                        {if $isAdvertiser && $canEdit == false}
                            <span class='inlineIcon {ox_campaign_icon status=$campaign.status}'>{$campaign.campaignname|escape:html}</span>
                        {else}
                            {if $campaign.system}
                                <a href='campaign-edit.php?clientid={$clientId}&campaignid={$campaignId}' class='inlineIcon iconCampaignSystem'>{$campaign.campaignname|escape:html}</a>
                            {else}
                                <a href='campaign-edit.php?clientid={$clientId}&campaignid={$campaignId}' class='inlineIcon {ox_campaign_icon status=$campaign.status}'>{$campaign.campaignname|escape:html}</a>
                            {/if}    
                        {/if}
                    {/if}
                    {ox_entity_id type="Campaign" id=$campaignId}
                </td>
                <td>
                    {ox_campaign_status clientid=$clientId campaignid=$campaignId status=$campaign.status}
                </td>
                <td>
                    {ox_campaign_type type=$campaign.type}
                </td>
                <td class='alignRight verticalActions'>
                  {if $campaign.system != true}
                    <ul class='rowActions'>
                    {if $isAdvertiser == false}
                        <li>
                            <a href='banner-edit.php?clientid={$clientId}&campaignid={$campaignId}' class='inlineIcon iconBannerAdd'>{t str=AddBanner}</a>
                        </li>
                        {/if}
                        <li>
                            <a href='campaign-banners.php?clientid={$clientId}&campaignid={$campaignId}' class='inlineIcon iconBanners'>{t str=Banners}</a>
                        </li>
                    </ul>
                  {/if}
                </td>
                <td class='hasPanel'>
                    <div class='panel'>
                        <table cellspacing='0' summary=''>
                            <tr>
                                <th>{t str=ImpressionsBooked}</th>
                                <td>{if $campaign.impressions >= 0}{$campaign.impressions}{else}{t str=Unlimited}{/if}</td>
                            </tr>
                            <tr>
                                <th>{t str=ClicksBooked}</th>
                                <td>{if $campaign.clicks >= 0}{$campaign.clicks}{else}{t str=Unlimited}{/if}</td>
                            </tr>
                            {if $showconversions}
                            <tr>
                                <th>{t str=ConversionsBooked}</th>
                                <td>{if $campaign.conversions >= 0}{$campaign.conversions}{else}{t str=Unlimited}{/if}</td>
                            </tr>
                            {/if}
                            <tr>
                                <th>{t str=ActivationDate}</th>
                                <td>{$campaign.activate}</td>
                            </tr>
                            <tr>
                                <th>{t str=ExpirationDate}</th>
                                <td>{$campaign.expire}</td>
                            </tr>
                            <tr>
                                <th>{t str=Priority}</th>
                                <td>{$campaign.priority}</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>
