<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:t="http://www.participatorypolitics.org/"
      xmlns:i18n="http://www.participatoryculture.org/i18n"
      eventCookie="@@@eventCookie@@@" dtvPlatform="@@@dtvPlatform@@@">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <t:include filename="dynamic.js" />

</head>
<body>
<!-- DOWNLOADS ******************************************************** -->
<div t:updateForView="allDownloadingItems">
<div t:hideIf="allDownloadingItems.len() == 0">
<div class="main-channelbar downloading-channelbar" onclick="return eventURL('action:toggleDownloadsView');">
  <div class="triangle" t:hideIf="showDownloads"/>
  <div class="triangle down" t:hideIf="not showDownloads"/>
  <a class="download-bar-action" href="#"
          onclick="eventURLAndStop('action:cancelDownloads', event);">Cancel All</a>
  <a class="download-bar-action" href="#"
          t:hideIf="allItemsPaused(allDownloadingItems)"
          onclick="eventURLAndStop('action:pauseDownloads', event);">Pause All</a>
  <a class="download-bar-action" href="#"
          t:hideIf="allItemsDownloading(allDownloadingItems)"
          onclick="eventURLAndStop('action:resumeDownloads', event);">Resume All</a>
  <span t:hideIf="allDownloadingItems.len()==1"  i18n:translate="">
      <span t:replace="allDownloadingItems.len()" i18n:name="count"/> Downloading</span>
   <span t:hideIf="allDownloadingItems.len()!=1" i18n:translate="">1 Downloading</span>
</div>
</div>
</div>

    <div class="downloading-sort" t:updateForView="downloadingItems">
        <div t:hideIf="downloadingItems.len() == 0">
            <t:executeTemplate filename="sort-bar" 
                itemSort="itemSortDownloading"
                section="'downloading'" />
        </div>
    </div>
    <div t:repeatForView="downloadingItems" t:repeatTemplate="download-item" t:containerDiv="true" />

<!-- / DOWNLOADS -->

<!-- NEW ITEMS -->

<div class="available-channelbar-wrap">
    <a class="main-channelbar available-channelbar" href="#" onclick="return eventURL('action:toggleNewItemsView');" t:updateForView="matchingItems">
      <div class="triangle" t:hideIf="showNewItems"/>
      <div class="triangle down" t:hideIf="not showNewItems"/>

      <div t:showIf="searchTerm is None">
        <div t:hideIf="isFolder" i18n:translate="">
              <span i18n:name="len" t:replace="notDeleted.len()" /> 
              Items on this Channel
        </div>
        <div t:showIf="isFolder" i18n:translate="">
              <span i18n:name="len" t:replace="notDeleted.len()" /> 
              Items on this Channel
        </div>
      </div>
      <div t:showIf="searchTerm is not None">
        <div t:showIf="notDeleted.len() == matchingItems.len()" i18n:translate="">
                All <span i18n:name="len" t:replace="matchingItems.len()" /> 
                Match This Search
        </div>
        <div t:hideIf="notDeleted.len() == matchingItems.len()" i18n:translate="">
                <span i18n:name="len" t:replace="matchingItems.len()" /> 
                Match This Search
        </div>
      </div>
    </a>

    <div id="main-titlebar-auto">
        <div t:updateForView="thisFeedView">
            <div t:hideIf="isFolder or feed.getURL().startswith('dtv:directoryfeed')">
                <div class="auto-download">
                    <span id="auto-label" i18n:translate="">AUTO DOWNLOAD</span>
                    <div class="select-box-left" onclick="showSelectBoxMenu('auto-download-menu');">
                    <div class="select-box-right">
                    <div class="select-box-mid" t:hideIf="feed is None">
                        <span t:replace="feed.getAutoDownloadMode()" />
                    </div>
                    </div>
                    </div>
                    
                    <br clear="all" />
                    <ul id="auto-download-menu" class="select-box-menu" t:hideIf="feed is None">
                        <li onclick="return eventURL('action:setAutoDownloadMode?mode=all&amp;feed=@@@feed.getID()@@@');" ><a href="#"><strong>ALL</strong> - Get all videos</a></li>
                        <li onclick="return eventURL('action:setAutoDownloadMode?mode=new&amp;feed=@@@feed.getID()@@@');" ><a href="#"><strong>NEW</strong> - Get only new videos</a></li>
                        <li onclick="return eventURL('action:setAutoDownloadMode?mode=off&amp;feed=@@@feed.getID()@@@');" ><a href="#"><strong>OFF</strong> - Don't auto-download videos</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<div t:updateForView="matchingItems">
    <div class="available-sort" t:showIf="showNewItems">
        <t:executeTemplate filename="sort-bar" 
            itemSort="itemSort"
            section="'main'" />
    </div>
</div>

<div t:repeatForView="newItems" t:repeatTemplate="download-item" t:containerDiv="true" />

<!-- The infamous "N more videos" oval -->
<div t:updateForView="matchingItems">  
  <div t:hideIf="allItemsMode or not showNewItems or newItems.len() == matchingItems.len()">
      <a href="#" onclick="return eventURL('action:toggleAllItemsMode');" class="main-notification">
          <span t:hideIf="isFolder" i18n:translate=""><span i18n:name="count" t:replace="matchingItems.len() - newItems.len()" /> more on this channel &gt;&gt;</span>
          <span t:showIf="isFolder" i18n:translate=""><span i18n:name="count" t:replace="matchingItems.len()"/> items in this channel folder &gt;&gt;</span>
        </a>
        <a href="#" onclick="return eventURL('action:toggleAllItemsMode');" class="main-notification-right">&nbsp;</a>
     <br clear="left" />
  </div>
</div>

<!-- / NEW ITEMS -->

<!-- WATCHABLE ******************************************************** -->
<div t:hideIf="not isFolder and feed.getURL().startswith('dtv:directoryfeed')" t:updateHideOnView="thisFeedView">
    <div t:updateForView="allWatchableItems">
        <a class="main-channelbar downloaded-channelbar" href="#" onclick="return eventURL('action:toggleWatchableView')" t:hideIf="len(allWatchableItems) == 0 or (not isFolder and feed.getURL().startswith('dtv:directoryfeed'))" >
            <div class="triangle" t:hideIf="showWatchableItems"/>
            <div class="triangle down" t:hideIf="not showWatchableItems"/>
            <span  i18n:translate=""><span i18n:name="len" t:replace="allWatchableItems.len()" /> Downloaded</span>
        </a>
    </div>
    
    <div t:updateForView="watchableItems">
        <div t:hideIf="len(watchableItems) == 0">
            <t:executeTemplate filename="sort-bar" 
                itemSort="itemSortWatchable"
                section="'watchable'" />
        </div>
    </div>
    <div t:repeatForView="watchableItems" t:repeatTemplate="download-item" t:containerDiv="true" />
</div>

<!-- / WATCHABLE -->
</body>
</html>
