home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / Miro_Downloader.exe / compiled_templates / channel.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-11-12  |  43.9 KB  |  787 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. from template import Handle, fillAttr, quoteAndFillAttr, fillStaticTemplate
  5. from StringIO import StringIO
  6. from xhtmltools import urlencode
  7. from templatehelper import quoteattr, escape
  8. from string import Template
  9. import app
  10. import views
  11. import sorts
  12. import indexes
  13. import filters
  14. import resources
  15. import gtcache
  16. _ = gtcache.gettext
  17.  
  18. def fillTemplate(domHandler, dtvPlatform, eventCookie, bodyTagExtra, *args, **kargs):
  19.     global allItems, notDeleted, matchingItems, newItems, watchableItems, itemSort, itemSortWatchable, itemSortDownloading
  20.     
  21.     def _setFeed(kargs):
  22.         global allItemsMode, showDownloads, showNewItems, showWatchableItems, feed
  23.         allItemsMode = False
  24.         showDownloads = False
  25.         showNewItems = True
  26.         showWatchableItems = True
  27.         feed = views.feeds.getObjectByID(int(kargs['id']))
  28.         filters.switchNewItemsChannel(feed)
  29.         sorts.switchUnwatchedFirstChannel(feed)
  30.  
  31.     
  32.     def _updateView():
  33.         global showNewItems, allItemsMode
  34.         if not len(watchableItems) == 0:
  35.             if not len(newItems) > 0 or feed.getAutoDownloadMode() == 'off':
  36.                 pass
  37.         showNewItems = feed.getURL().startswith('dtv:directoryfeed')
  38.         if len(newItems) == 0 or not showNewItems:
  39.             allItemsMode = True
  40.             matchingItems.recomputeFilter(newItems)
  41.         
  42.         feed.updateIcons()
  43.  
  44.     
  45.     def reInit(*args, **kargs):
  46.         global itemSort, itemSortDownloading, itemSortWatchable
  47.         if feed.idExists():
  48.             feed.markAsViewed()
  49.         
  50.         _setFeed(kargs)
  51.         itemSort = feed.itemSort
  52.         itemSortDownloading = feed.itemSortDownloading
  53.         itemSortWatchable = feed.itemSortWatchable
  54.         newItems.sortFunc = feed.itemSort.sort
  55.         downloadingItems.sortFunc = feed.itemSortDownloading.sort
  56.         watchableItems.sortFunc = feed.itemSortWatchable.sort
  57.         allItems.changeIndexValue(indexes.itemsByFeed, int(kargs['id']))
  58.         views.feeds.recomputeFilter(thisFeedView)
  59.         _updateView()
  60.  
  61.     
  62.     def showDownloadsFilter(x):
  63.         return showDownloads
  64.  
  65.     
  66.     def showWatchableFilter(x):
  67.         return showWatchableItems
  68.  
  69.     
  70.     def showNewFilter(x):
  71.         isNew = filters.newItems(x)
  72.         if not showNewItems and allItemsMode:
  73.             pass
  74.         return isNew
  75.  
  76.     
  77.     def updateSearchString(newSearch):
  78.         if len(newSearch) == 0:
  79.             feed.setInlineSearchTerm(None)
  80.         else:
  81.             feed.setInlineSearchTerm(newSearch)
  82.         allItems.recomputeFilters()
  83.  
  84.     
  85.     def toggleDownloadsView(handle):
  86.         global showDownloads
  87.         showDownloads = not showDownloads
  88.         allDownloadingItems.recomputeFilter(downloadingItems)
  89.         handle.forceUpdate()
  90.  
  91.     
  92.     def toggleWatchableView(handle):
  93.         global showWatchableItems
  94.         showWatchableItems = not showWatchableItems
  95.         allWatchableItems.recomputeFilter(watchableItems)
  96.         handle.forceUpdate()
  97.  
  98.     
  99.     def toggleNewItemsView(handle):
  100.         global showNewItems
  101.         showNewItems = not showNewItems
  102.         matchingItems.recomputeFilter(newItems)
  103.         handle.forceUpdate()
  104.  
  105.     
  106.     def toggleAllItemsMode(handle):
  107.         global allItemsMode
  108.         allItemsMode = not allItemsMode
  109.         matchingItems.recomputeFilter(newItems)
  110.         handle.forceUpdate()
  111.  
  112.     
  113.     def setSortBy(by, which, handle):
  114.         if which == 'main':
  115.             feed.itemSort.setSortBy(by)
  116.             matchingItems.recomputeSort(newItems)
  117.         elif which == 'downloading':
  118.             feed.itemSortDownloading.setSortBy(by)
  119.             allDownloadingItems.recomputeSort(downloadingItems)
  120.         else:
  121.             feed.itemSortWatchable.setSortBy(by)
  122.             allWatchableItems.recomputeSort(watchableItems)
  123.         handle.forceUpdate()
  124.  
  125.     _setFeed(kargs)
  126.     allItems = views.items.filterWithIndex(indexes.itemsByFeed, feed.getID())
  127.     notDeleted = allItems.filter(filters.notDeleted)
  128.     matchingItems = notDeleted.filter((lambda x: filters.matchingItems(x, feed.inlineSearchTerm)))
  129.     newItems = matchingItems.filter(showNewFilter, sortFunc = feed.itemSort.sort, resort = True)
  130.     allDownloadingItems = matchingItems.filter(filters.downloadingOrPausedItems)
  131.     downloadingItems = allDownloadingItems.filter(showDownloadsFilter, sortFunc = feed.itemSortDownloading.sort, resort = True)
  132.     allWatchableItems = matchingItems.filter(filters.watchableItems)
  133.     watchableItems = allWatchableItems.filter(showWatchableFilter, sortFunc = feed.itemSortWatchable.sort, resort = True)
  134.     thisFeedView = views.feeds.filter((lambda x: x is feed))
  135.     itemSort = feed.itemSort
  136.     itemSortWatchable = feed.itemSortWatchable
  137.     itemSortDownloading = feed.itemSortDownloading
  138.     
  139.     def allItemsHaveState(view, state):
  140.         for item in view:
  141.             if item.getState() != state:
  142.                 return False
  143.                 continue
  144.         
  145.         return True
  146.  
  147.     
  148.     def allItemsPaused(view):
  149.         return allItemsHaveState(view, 'paused')
  150.  
  151.     
  152.     def allItemsDownloading(view):
  153.         return allItemsHaveState(view, 'downloading')
  154.  
  155.     _updateView()
  156.     isFolder = False
  157.     
  158.     def _execOnUnload():
  159.         matchingItems.unlink()
  160.         thisFeedView.unlink()
  161.         notDeleted.unlink()
  162.         allItems.unlink()
  163.         if feed.idExists():
  164.             feed.markAsViewed()
  165.         
  166.  
  167.     localvars = locals()
  168.     localvars.update(globals())
  169.     handle = Handle(domHandler, localvars, onUnlink = _execOnUnload)
  170.     
  171.     def up_0_handle(viewName, view, tid):
  172.         out = StringIO()
  173.         out.write(u'<div id="')
  174.         out.write(quoteattr(tid))
  175.         out.write(u'">\n    ')
  176.         out.write(u'\n\n<form action="javascript:eventURL(\'template:channel?id=')
  177.         out.write(quoteattr(urlencode(feed.getID())))
  178.         out.write(u'\')" method="GET" name="settings">\n\t<input type="hidden" name="feed" value="')
  179.         out.write(quoteattr(urlencode(feed.getID())))
  180.         out.write(u'"></input>\n\t\n\t<div id="settings-inner">\n            <div id="channel-url">\n                <div class="selectable">')
  181.         out.write(escape(feed.getURL()))
  182.         out.write(u'</div>\n                <div><a href="#" class="remove-channel" onclick="return eventURL(\'action:removeFeed?id=')
  183.         out.write(quoteattr(urlencode(feed.getID())))
  184.         out.write(u'\');"><span>')
  185.         out.write(_(u'remove channel'))
  186.         out.write(u'</span></a></div>\n            </div>\n\t<h2>')
  187.         tmplcomp06199063 = { }
  188.         tmplcomp24115903 = StringIO()
  189.         tmplcomp24115903.write(u'<span>')
  190.         tmplcomp24115903.write(escape(feed.getTitle()))
  191.         tmplcomp24115903.write(u'</span>')
  192.         tmplcomp24115903.seek(0)
  193.         tmplcomp06199063['title'] = tmplcomp24115903.read()
  194.         out.write(Template(_(u'Settings for ${title}')).substitute(tmplcomp06199063))
  195.         out.write(u'</h2> \n\t\t\t\t\n\t\t<div id="actual-settings">\n\t\t\n\t\t<span>')
  196.         out.write(_(u'Videos expire after'))
  197.         out.write(u'</span>\n\t\t<select onChange="javascript:setExpiration();" name="expireAfter">\n\t\t\t')
  198.         if not feed.getExpirationType() != 'system':
  199.             out.write(u'<option selected="1" value="system"><span>')
  200.             out.write(_(u'Default'))
  201.             out.write(u'</span> \n(<span>')
  202.             out.write(escape(feed.getFormattedDefaultExpiration()))
  203.             out.write(u'</span>)</option>')
  204.         
  205.         out.write(u'\n\t\t\t')
  206.         if not feed.getExpirationType() == 'system':
  207.             out.write(u'<option value="system"><span>')
  208.             out.write(_(u'default'))
  209.             out.write(u'</span> (<span>')
  210.             out.write(escape(feed.getFormattedDefaultExpiration()))
  211.             out.write(u'</span>)</option>')
  212.         
  213.         out.write(u'\n\t\t\t')
  214.         if not feed.getExpirationTime() != 3:
  215.             out.write(u'<option selected="1" value="3">3 hours</option>')
  216.         
  217.         out.write(u'\n\t\t\t')
  218.         if not feed.getExpirationTime() == 3:
  219.             out.write(u'<option value="3">3 hours</option>')
  220.         
  221.         out.write(u'\n\t\t\t')
  222.         if not feed.getExpirationTime() != 24:
  223.             out.write(u'<option selected="1" value="24">1 day</option>')
  224.         
  225.         out.write(u'\n\t\t\t')
  226.         if not feed.getExpirationTime() == 24:
  227.             out.write(u'<option value="24">1 day</option>')
  228.         
  229.         out.write(u'\n\t\t\t')
  230.         if not feed.getExpirationTime() != 72:
  231.             out.write(u'<option selected="1" value="72">3 days</option>')
  232.         
  233.         out.write(u'\n\t\t\t')
  234.         if not feed.getExpirationTime() == 72:
  235.             out.write(u'<option value="72">3 days</option>')
  236.         
  237.         out.write(u'\n\t\t\t')
  238.         if not feed.getExpirationTime() != 144:
  239.             out.write(u'<option selected="1" value="144">6 days</option>')
  240.         
  241.         out.write(u'\n\t\t\t')
  242.         if not feed.getExpirationTime() == 144:
  243.             out.write(u'<option value="144">6 days</option>')
  244.         
  245.         out.write(u'\n\t\t\t')
  246.         if not feed.getExpirationTime() != 240:
  247.             out.write(u'<option selected="1" value="240">10 days</option>')
  248.         
  249.         out.write(u'\n\t\t\t')
  250.         if not feed.getExpirationTime() == 240:
  251.             out.write(u'<option value="240">10 days</option>')
  252.         
  253.         out.write(u'\n\t\t\t')
  254.         if not feed.getExpirationTime() != 720:
  255.             out.write(u'<option selected="1" value="720">1 month</option>')
  256.         
  257.         out.write(u'\n\t\t\t')
  258.         if not feed.getExpirationTime() == 720:
  259.             out.write(u'<option value="720">1 month</option>')
  260.         
  261.         out.write(u'\n\t\t\t')
  262.         if not feed.getExpirationType() != 'never':
  263.             out.write(u'<option selected="1" value="never">Never</option>')
  264.         
  265.         out.write(u'\n\t\t\t')
  266.         if not feed.getExpirationType() == 'never':
  267.             out.write(u'<option value="never">Never</option>')
  268.         
  269.         out.write(u'\n\t\t</select>\n<br></br><br></br>\n\t\t')
  270.         if not feed.getMaxNew() == 'unlimited':
  271.             out.write(u'<input checked="checked" type="checkbox" name="maxOutDownloads" onClick="javascript:setMaxNew();"></input>')
  272.         
  273.         out.write(u'\n\t\t')
  274.         if not feed.getMaxNew() != 'unlimited':
  275.             out.write(u'<input type="checkbox" name="maxOutDownloads" onClick="javascript:setMaxNew();"></input>')
  276.         
  277.         out.write(u'\n\t\t<span>')
  278.         tmplcomp34681314 = { }
  279.         tmplcomp81810997 = StringIO()
  280.         if not feed.getMaxNew() == 'unlimited':
  281.             tmplcomp81810997.write(u'<input onBlur="javascript:setMaxNew();" name="maxNew" value="')
  282.             tmplcomp81810997.write(quoteattr(urlencode(feed.getMaxNew())))
  283.             tmplcomp81810997.write(u'" type="text" size="3"></input>')
  284.         
  285.         tmplcomp81810997.seek(0)
  286.         tmplcomp34681314['maxnew2'] = tmplcomp81810997.read()
  287.         tmplcomp07103808 = StringIO()
  288.         if not feed.getMaxNew() != 'unlimited':
  289.             tmplcomp07103808.write(u'<input onBlur="javascript:setMaxNew();" name="maxNew" value="3" disabled="1" type="text" size="3"></input>')
  290.         
  291.         tmplcomp07103808.seek(0)
  292.         tmplcomp34681314['maxnew'] = tmplcomp07103808.read()
  293.         out.write(Template(_(u"Don't Auto Download when more than ${maxnew} ${maxnew2} videos are waiting unwatched.")).substitute(tmplcomp34681314))
  294.         out.write(u'</span><div class="settings-small">')
  295.         out.write(_(u'Prevents this channel from using unlimited disk space.'))
  296.         out.write(u'</div>\n\n\t    <div class="gray-button-wrap settings-button">\n\t\t    <div id="feed-settings-close-button" onclick="return hideSettings()" class="gray-button-bg">\n                <div class="gray-button-left"></div>\n                <div class="gray-button-right"></div>\n                <div class="gray-button-content" i18:translate="">Done</div>\n            </div>\n\t</div>\n \t</div>         \n</div>\n\n\n</form>\n\n')
  297.         out.write(u'\n  </div>')
  298.         out.seek(0)
  299.         return out
  300.  
  301.     handle.addUpdate('tmplcomp32808340', 'nextSibling', thisFeedView, up_0_handle, u'thisFeedView')
  302.     
  303.     def up_1_handle(viewName, view, tid):
  304.         out = StringIO()
  305.         out.write(u'<div id="')
  306.         out.write(quoteattr(tid))
  307.         out.write(u'">\n            <div>\n                <img src="')
  308.         out.write(quoteattr(feed.getThumbnail()))
  309.         out.write(u'" alt="" id="main-icon"></img>\n\t    </div>\n            ')
  310.         if not feed.getURL().startswith('dtv:directoryfeed'):
  311.             out.write(u'<div class="main-titlebar-right">\n                <ul>\n                    ')
  312.             if not feed.getLink() == '':
  313.                 out.write(u'<li>\n                        <a href="')
  314.                 out.write(quoteattr(feed.getLink()))
  315.                 out.write(u'" class="round-button-left black">\n                        <div class="round-button-right black">\n                        <div class="round-button-content black">\n                        <span>')
  316.                 out.write(_(u'VISIT WEBSITE'))
  317.                 out.write(u'</span>\n                        </div>\n                        </div>\n                        </a>\n                    </li>')
  318.             
  319.             out.write(u'\n                    <li>\n                        <a href="#" class="round-button-left black" onclick="return recommendChannel(\'')
  320.             out.write(quoteattr(urlencode(feed.getTitle())))
  321.             out.write(u"', '")
  322.             out.write(quoteattr(urlencode(feed.getURL())))
  323.             out.write(u'\');">\n                        <div class="round-button-right black">\n                        <div class="round-button-content black">\n                        <span>')
  324.             out.write(_(u'SEND TO FRIEND'))
  325.             out.write(u'</span>\n                        </div>\n                        </div>\n                        </a>\n                    </li>\n                    <li>\n                        <a href="#" class="round-button-left black" onclick="return showSettings();">\n                        <div class="round-button-right black">\n                        <div class="round-button-content black">\n                        <span>')
  326.             out.write(_(u'SETTINGS'))
  327.             out.write(u'</span>\n                        </div>\n                        </div>\n                        </a>\n                    </li>\n                </ul>\n\t    </div>')
  328.         
  329.         out.write(u'\n        </div>')
  330.         out.seek(0)
  331.         return out
  332.  
  333.     handle.addUpdate('tmplcomp60523466', 'nextSibling', thisFeedView, up_1_handle, u'thisFeedView')
  334.     
  335.     def up_2_handle(viewName, view, tid):
  336.         out = StringIO()
  337.         out.write(u'<div id="')
  338.         out.write(quoteattr(tid))
  339.         out.write(u'">\n            <h1 id="main-title">')
  340.         out.write(escape(feed.getTitle()))
  341.         out.write(u'</h1>\n            <div id="auto-download">\n                ')
  342.         if not feed.getURL().startswith('dtv:directoryfeed'):
  343.             out.write(u'<div>\n                    <div class="auto-download">\n                        <span id="auto-label">')
  344.             out.write(_(u'AUTO DOWNLOAD'))
  345.             out.write(u'</span>\n                        <div class="select-box-left" onclick="showSelectBoxMenu(\'auto-download-menu\');">\n                        <div class="select-box-right">\n                        ')
  346.             if feed is not None:
  347.                 out.write(u'<div class="select-box-mid">\n                            <span>')
  348.                 out.write(escape(feed.getAutoDownloadMode()))
  349.                 out.write(u'</span>\n                        </div>')
  350.             
  351.             out.write(u'\n                        </div>\n                        </div>\n                        \n                        <br clear="all"></br>\n                        ')
  352.             if feed is not None:
  353.                 out.write(u'<ul id="auto-download-menu" class="select-box-menu">\n                            <li onclick="return eventURL(\'action:setAutoDownloadMode?mode=all&feed=')
  354.                 out.write(quoteattr(urlencode(feed.getID())))
  355.                 out.write(u'\');"><a href="#"><strong>ALL</strong> - Get all videos</a></li>\n                            <li onclick="return eventURL(\'action:setAutoDownloadMode?mode=new&feed=')
  356.                 out.write(quoteattr(urlencode(feed.getID())))
  357.                 out.write(u'\');"><a href="#"><strong>NEW</strong> - Get only new videos</a></li>\n                            <li onclick="return eventURL(\'action:setAutoDownloadMode?mode=off&feed=')
  358.                 out.write(quoteattr(urlencode(feed.getID())))
  359.                 out.write(u'\');"><a href="#"><strong>OFF</strong> - Don\'t auto-download videos</a></li>\n                        </ul>')
  360.             
  361.             out.write(u'\n                    </div>\n                </div>')
  362.         
  363.         out.write(u'\n            </div>\n            ')
  364.         if not 'feed' in localvars and feed.getURL() == 'dtv:search':
  365.             out.write(u'<div id="search-box-container">\n                ')
  366.             if not feed.inlineSearchTerm is not None:
  367.                 out.write(u'<div>\n                    <input value="')
  368.                 out.write(quoteattr(_('Find')))
  369.                 out.write(u'" onfocus="onSearchFocus(this)" type="search" id="search-box" onblur="endEditSearch()"></input>\n                </div>')
  370.             
  371.             out.write(u'\n                ')
  372.             if not feed.inlineSearchTerm is None:
  373.                 out.write(u'<div>\n                    <input onblur="endEditSearch()" searching="1" value="')
  374.                 out.write(quoteattr(feed.inlineSearchTerm))
  375.                 out.write(u'" onfocus="onSearchFocus(this)" type="search" id="search-box"></input>\n                </div>')
  376.             
  377.             out.write(u'\n            </div>')
  378.         
  379.         out.write(u'\n            </div>')
  380.         out.seek(0)
  381.         return out
  382.  
  383.     handle.addUpdate('tmplcomp77257750', 'nextSibling', thisFeedView, up_2_handle, u'thisFeedView')
  384.     
  385.     def up_3_handle(viewName, view, tid):
  386.         out = StringIO()
  387.         out.write(u'<div id="')
  388.         out.write(quoteattr(tid))
  389.         out.write(u'">\n            ')
  390.         if not feed.inlineSearchTerm is None or feed.getURL().startswith('dtv:directoryfeed'):
  391.             out.write(u'<div>\n                <div class="white-button-left save-search-channel">\n                <div class="white-button-right">\n                <div class="white-button-middle">\n                    <a href="#" onclick="return eventURL(\'action:addChannelSearchFeed?id=')
  392.             out.write(quoteattr(urlencode(feed.getID())))
  393.             out.write(u'\');">Save Search</a>\n                </div>\n                </div>\n                </div>\n            </div>')
  394.         
  395.         out.write(u'\n            </div>')
  396.         out.seek(0)
  397.         return out
  398.  
  399.     handle.addUpdate('tmplcomp64913735', 'nextSibling', matchingItems, up_3_handle, u'matchingItems')
  400.     localvars = locals()
  401.     localvars.update(globals())
  402.     handle_0 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  403.     handle.addSubHandle(handle_0)
  404.     localvars = locals()
  405.     localvars.update(globals())
  406.     handle_1 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  407.     
  408.     def up_0_handle_1(viewName, view, tid):
  409.         out = StringIO()
  410.         out.write(u'<div id="')
  411.         out.write(quoteattr(tid))
  412.         out.write(u'">\n')
  413.         if not allDownloadingItems.len() == 0:
  414.             out.write(u'<div>\n<div class="main-channelbar downloading-channelbar" onclick="return eventURL(\'action:toggleDownloadsView\');">\n  ')
  415.             if not showDownloads:
  416.                 out.write(u'<div class="triangle"></div>')
  417.             
  418.             out.write(u'\n  ')
  419.             if not not showDownloads:
  420.                 out.write(u'<div class="triangle down"></div>')
  421.             
  422.             out.write(u'\n  <a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:cancelDownloads\', event);">Cancel All</a>\n  ')
  423.             if not allItemsPaused(allDownloadingItems):
  424.                 out.write(u'<a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:pauseDownloads\', event);">Pause All</a>')
  425.             
  426.             out.write(u'\n  ')
  427.             if not allItemsDownloading(allDownloadingItems):
  428.                 out.write(u'<a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:resumeDownloads\', event);">Resume All</a>')
  429.             
  430.             out.write(u'\n  ')
  431.             if not allDownloadingItems.len() == 1:
  432.                 out.write(u'<span>\n      <span>')
  433.                 out.write(escape(allDownloadingItems.len()))
  434.                 out.write(u'</span> Downloading</span>')
  435.             
  436.             out.write(u'\n   ')
  437.             if not allDownloadingItems.len() != 1:
  438.                 out.write(u'<span>1 Downloading</span>')
  439.             
  440.             out.write(u'\n</div>\n</div>')
  441.         
  442.         out.write(u'\n</div>')
  443.         out.seek(0)
  444.         return out
  445.  
  446.     handle_1.addUpdate('tmplcomp37636645', 'nextSibling', allDownloadingItems, up_0_handle_1, u'allDownloadingItems')
  447.     
  448.     def up_1_handle_1(viewName, view, tid):
  449.         out = StringIO()
  450.         out.write(u'<div class="downloading-sort" id="')
  451.         out.write(quoteattr(tid))
  452.         out.write(u'">\n        ')
  453.         if not downloadingItems.len() == 0:
  454.             out.write(u'<div>\n            ')
  455.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'downloading', itemSort = itemSortDownloading))
  456.             out.write(u'\n        </div>')
  457.         
  458.         out.write(u'\n    </div>')
  459.         out.seek(0)
  460.         return out
  461.  
  462.     handle_1.addUpdate('tmplcomp45286698', 'nextSibling', downloadingItems, up_1_handle_1, u'downloadingItems')
  463.     
  464.     def up_2_handle_1(viewName, view, tid):
  465.         out = StringIO()
  466.         out.write(u'<a href="#" class="main-channelbar available-channelbar" onclick="return eventURL(\'action:toggleNewItemsView\');" id="')
  467.         out.write(quoteattr(tid))
  468.         out.write(u'">\n        ')
  469.         if not showNewItems:
  470.             out.write(u'<div class="triangle"></div>')
  471.         
  472.         out.write(u'\n        ')
  473.         if not not showNewItems:
  474.             out.write(u'<div class="triangle down"></div>')
  475.         
  476.         out.write(u'\n\n        ')
  477.         if not not (not isFolder):
  478.             out.write(u'<div>\n            ')
  479.             if not feed.inlineSearchTerm is not None:
  480.                 out.write(u'<div>\n                <span>')
  481.                 out.write(escape(notDeleted.len()))
  482.                 out.write(u'</span> \n                Items in this Channel\n            </div>')
  483.             
  484.             out.write(u'\n            ')
  485.             if not feed.inlineSearchTerm is None:
  486.                 out.write(u'<div>\n                ')
  487.                 if not not (notDeleted.len() == matchingItems.len()):
  488.                     out.write(u'<div>\n                    All <span>')
  489.                     out.write(escape(matchingItems.len()))
  490.                     out.write(u'</span> \n                    Match This Search\n                </div>')
  491.                 
  492.                 out.write(u'\n                ')
  493.                 if not notDeleted.len() == matchingItems.len():
  494.                     out.write(u'<div>\n                    <span>')
  495.                     out.write(escape(matchingItems.len()))
  496.                     out.write(u'</span> \n                    Match This Search\n                </div>')
  497.                 
  498.                 out.write(u'\n            </div>')
  499.             
  500.             out.write(u'\n        </div>')
  501.         
  502.         out.write(u'\n\n        ')
  503.         if not not isFolder:
  504.             out.write(u'<div>\n            <span>')
  505.             out.write(escape(notDeleted.len()))
  506.             out.write(u'</span> \n            Items in this Channel Folder\n        </div>')
  507.         
  508.         out.write(u'\n    </a>')
  509.         out.seek(0)
  510.         return out
  511.  
  512.     handle_1.addUpdate('tmplcomp60446172', 'nextSibling', matchingItems, up_2_handle_1, u'matchingItems')
  513.     
  514.     def up_3_handle_1(viewName, view, tid):
  515.         out = StringIO()
  516.         out.write(u'<div id="')
  517.         out.write(quoteattr(tid))
  518.         out.write(u'">\n    ')
  519.         if not not showNewItems:
  520.             out.write(u'<div class="available-sort">\n        ')
  521.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'main', itemSort = itemSort))
  522.             out.write(u'\n    </div>')
  523.         
  524.         out.write(u'\n</div>')
  525.         out.seek(0)
  526.         return out
  527.  
  528.     handle_1.addUpdate('tmplcomp11022004', 'nextSibling', matchingItems, up_3_handle_1, u'matchingItems')
  529.     
  530.     def up_4_handle_1(viewName, view, tid):
  531.         out = StringIO()
  532.         out.write(u'<div id="')
  533.         out.write(quoteattr(tid))
  534.         out.write(u'">  \n  ')
  535.         if not allItemsMode and not showNewItems or newItems.len() == matchingItems.len():
  536.             out.write(u'<div>\n      <a href="#" class="main-notification" onclick="return eventURL(\'action:toggleAllItemsMode\');">\n          ')
  537.             if not isFolder:
  538.                 out.write(u'<span><span>')
  539.                 out.write(escape(matchingItems.len() - newItems.len()))
  540.                 out.write(u'</span> more on this channel >></span>')
  541.             
  542.             out.write(u'\n          ')
  543.             if not not isFolder:
  544.                 out.write(u'<span><span>')
  545.                 out.write(escape(matchingItems.len()))
  546.                 out.write(u'</span> items in this channel folder >></span>')
  547.             
  548.             out.write(u'\n        </a>\n        <a href="#" class="main-notification-right" onclick="return eventURL(\'action:toggleAllItemsMode\');"> </a>\n     <br clear="left"></br>\n  </div>')
  549.         
  550.         out.write(u'\n</div>')
  551.         out.seek(0)
  552.         return out
  553.  
  554.     handle_1.addUpdate('tmplcomp54166034', 'nextSibling', matchingItems, up_4_handle_1, u'matchingItems')
  555.     
  556.     def up_5_handle_1(viewName, view, tid):
  557.         out = StringIO()
  558.         out.write(u'<div id="')
  559.         out.write(quoteattr(tid))
  560.         out.write(u'">\n        ')
  561.         if not len(allWatchableItems) == 0 and not isFolder and feed.getURL().startswith('dtv:directoryfeed'):
  562.             out.write(u'<a href="#" class="main-channelbar downloaded-channelbar" onclick="return eventURL(\'action:toggleWatchableView\')">\n            ')
  563.             if not showWatchableItems:
  564.                 out.write(u'<div class="triangle"></div>')
  565.             
  566.             out.write(u'\n            ')
  567.             if not not showWatchableItems:
  568.                 out.write(u'<div class="triangle down"></div>')
  569.             
  570.             out.write(u'\n            <span>')
  571.             tmplcomp01194628 = { }
  572.             tmplcomp98649693 = StringIO()
  573.             tmplcomp98649693.write(u'<span>')
  574.             tmplcomp98649693.write(escape(allWatchableItems.len()))
  575.             tmplcomp98649693.write(u'</span>')
  576.             tmplcomp98649693.seek(0)
  577.             tmplcomp01194628['len'] = tmplcomp98649693.read()
  578.             out.write(Template(_(u'${len} Downloaded')).substitute(tmplcomp01194628))
  579.             out.write(u'</span>\n        </a>')
  580.         
  581.         out.write(u'\n    </div>')
  582.         out.seek(0)
  583.         return out
  584.  
  585.     handle_1.addUpdate('tmplcomp46742417', 'nextSibling', allWatchableItems, up_5_handle_1, u'allWatchableItems')
  586.     
  587.     def up_6_handle_1(viewName, view, tid):
  588.         out = StringIO()
  589.         out.write(u'<div id="')
  590.         out.write(quoteattr(tid))
  591.         out.write(u'">\n        ')
  592.         if not len(watchableItems) == 0:
  593.             out.write(u'<div>\n            ')
  594.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'watchable', itemSort = itemSortWatchable))
  595.             out.write(u'\n        </div>')
  596.         
  597.         out.write(u'\n    </div>')
  598.         out.seek(0)
  599.         return out
  600.  
  601.     handle_1.addUpdate('tmplcomp31872732', 'nextSibling', watchableItems, up_6_handle_1, u'watchableItems')
  602.     
  603.     def rep_7_handle_1(this, viewName, view, tid):
  604.         out = StringIO()
  605.         out.write(u'\n<div dragsourcetype="')
  606.         out.write(quoteattr(this.getDragType()))
  607.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  608.         out.write(quoteattr(this.getID()))
  609.         out.write(u'" dragicon="video-tnail-')
  610.         out.write(quoteattr(viewName + str(this.getID())))
  611.         out.write(u'" selectID="')
  612.         out.write(quoteattr(this.getID()))
  613.         out.write(u'" class="main-video draggable ')
  614.         out.write(quoteattr(this.getSelectedState(view)))
  615.         out.write(u' ')
  616.         out.write(quoteattr(this.getMoreInfoState()))
  617.         out.write(u'" dragsourcedata="itemlist-')
  618.         out.write(quoteattr(this.getID()))
  619.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  620.         out.write(quoteattr(urlencode(viewName)))
  621.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  622.         if not viewName == 'playlistView' or 'downloadeditem':
  623.             pass
  624.         out.write(quoteattr(''))
  625.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  626.         out.write(quoteattr(urlencode(viewName)))
  627.         out.write(u"', ")
  628.         out.write(quoteattr(urlencode(this.getID())))
  629.         out.write(u');" id="')
  630.         out.write(quoteattr(tid))
  631.         out.write(u'">\n    <div>')
  632.         out.write(this.getItemXML(viewName))
  633.         out.write(u'</div>\n</div>\n')
  634.         out.seek(0)
  635.         return out
  636.  
  637.     handle_1.addView('tmplcomp48244590', 'containerDiv', downloadingItems, rep_7_handle_1, u'downloadingItems')
  638.     
  639.     def rep_8_handle_1(this, viewName, view, tid):
  640.         out = StringIO()
  641.         out.write(u'\n<div dragsourcetype="')
  642.         out.write(quoteattr(this.getDragType()))
  643.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  644.         out.write(quoteattr(this.getID()))
  645.         out.write(u'" dragicon="video-tnail-')
  646.         out.write(quoteattr(viewName + str(this.getID())))
  647.         out.write(u'" selectID="')
  648.         out.write(quoteattr(this.getID()))
  649.         out.write(u'" class="main-video draggable ')
  650.         out.write(quoteattr(this.getSelectedState(view)))
  651.         out.write(u' ')
  652.         out.write(quoteattr(this.getMoreInfoState()))
  653.         out.write(u'" dragsourcedata="itemlist-')
  654.         out.write(quoteattr(this.getID()))
  655.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  656.         out.write(quoteattr(urlencode(viewName)))
  657.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  658.         if not viewName == 'playlistView' or 'downloadeditem':
  659.             pass
  660.         out.write(quoteattr(''))
  661.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  662.         out.write(quoteattr(urlencode(viewName)))
  663.         out.write(u"', ")
  664.         out.write(quoteattr(urlencode(this.getID())))
  665.         out.write(u');" id="')
  666.         out.write(quoteattr(tid))
  667.         out.write(u'">\n    <div>')
  668.         out.write(this.getItemXML(viewName))
  669.         out.write(u'</div>\n</div>\n')
  670.         out.seek(0)
  671.         return out
  672.  
  673.     handle_1.addView('tmplcomp61348099', 'containerDiv', newItems, rep_8_handle_1, u'newItems')
  674.     
  675.     def rep_9_handle_1(this, viewName, view, tid):
  676.         out = StringIO()
  677.         out.write(u'\n<div dragsourcetype="')
  678.         out.write(quoteattr(this.getDragType()))
  679.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  680.         out.write(quoteattr(this.getID()))
  681.         out.write(u'" dragicon="video-tnail-')
  682.         out.write(quoteattr(viewName + str(this.getID())))
  683.         out.write(u'" selectID="')
  684.         out.write(quoteattr(this.getID()))
  685.         out.write(u'" class="main-video draggable ')
  686.         out.write(quoteattr(this.getSelectedState(view)))
  687.         out.write(u' ')
  688.         out.write(quoteattr(this.getMoreInfoState()))
  689.         out.write(u'" dragsourcedata="itemlist-')
  690.         out.write(quoteattr(this.getID()))
  691.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  692.         out.write(quoteattr(urlencode(viewName)))
  693.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  694.         if not viewName == 'playlistView' or 'downloadeditem':
  695.             pass
  696.         out.write(quoteattr(''))
  697.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  698.         out.write(quoteattr(urlencode(viewName)))
  699.         out.write(u"', ")
  700.         out.write(quoteattr(urlencode(this.getID())))
  701.         out.write(u');" id="')
  702.         out.write(quoteattr(tid))
  703.         out.write(u'">\n    <div>')
  704.         out.write(this.getItemXML(viewName))
  705.         out.write(u'</div>\n</div>\n')
  706.         out.seek(0)
  707.         return out
  708.  
  709.     handle_1.addView('tmplcomp96811263', 'containerDiv', watchableItems, rep_9_handle_1, u'watchableItems')
  710.     localvars = locals()
  711.     localvars.update(globals())
  712.     handle_1_0 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  713.     handle_1.addSubHandle(handle_1_0)
  714.     localvars = locals()
  715.     localvars.update(globals())
  716.     handle_1_1 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  717.     handle_1.addSubHandle(handle_1_1)
  718.     localvars = locals()
  719.     localvars.update(globals())
  720.     handle_1_2 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  721.     handle_1.addSubHandle(handle_1_2)
  722.     handle.addSubHandle(handle_1)
  723.     out = StringIO()
  724.     out.write(u'<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
  725.     out.write(u'<html dtvPlatform="')
  726.     out.write(quoteattr(urlencode(dtvPlatform)))
  727.     out.write(u'" eventCookie="')
  728.     out.write(quoteattr(urlencode(eventCookie)))
  729.     out.write(u'" xmlns="http://www.w3.org/1999/xhtml">\n\n<head>\n    <base href="')
  730.     out.write(quoteattr(feed.getBaseHref()))
  731.     out.write(u'"></base>\n    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"></meta>\n    <title>Miro Channel View</title>\n\n    <link href="')
  732.     out.write(quoteattr(resources.url(u'css/main.css')))
  733.     out.write(u'" type="text/css" rel="stylesheet"></link>\n    <script type="text/javascript">\n<!-- // Protect from our XML parser, which doesn\'t know to protect <script>\n\n///////////////////////////////////////////////////////////////////////////////\n//// For use on your page                                                  ////\n///////////////////////////////////////////////////////////////////////////////\n\nfunction getDTVPlatform() {\n    var elt = document.getElementsByTagName("html")[0];\n    return elt.getAttribute(\'dtvPlatform\');\n}\n\nfunction loadURL(url) {\n    try {\n        document.location.href = url;\n    } catch (e) {\n        // This may happen if the backend decides to handle the url load\n        // itself.\n    }\n}\n\n// For calling from page Javascript: Cause a URL to be loaded. The\n// assumption is that the application will notice, abort the load, and\n// take some action based on the URL.\nfunction eventURL(url) {\n    if (typeof(window.frontend) == \'undefined\') {\n\t// Generic strategy: trigger a load, and hope the application\n\t// catches it and cancels it without creating a race\n\t// condition.\n        loadURL(url)\n    } else {\n\t// OS X WebKit (KHTML) strategy: pass in an Objective C object\n\t// through the window object and call a method on it.\n\twindow.frontend.eventURL(url);\n    }\n\n    return false;\n}\n\n// Calls eventURL, then calls event.stopPropagation() and\n// event.preventDefault() so that the event chain is stopped.\nfunction eventURLAndStop(url, event) {\n  eventURL(url);\n  event.stopPropagation();\n  event.preventDefault();\n}\n\nfunction recommendItem(title, url) {\n    loadURL(\'http://www.videobomb.com/index/democracyemail?url=\' + \n            url + \'&title=\' + title);\n    return false;\n}\n\nfunction recommendChannel(title, url) {\n    // See also app.py if changing this URL\n    loadURL(\'http://www.videobomb.com/democracy_channel/email_friend\' +\n        \'?url=\' + url + \'&title=\' + title);\n    return false;\n}\n\n// Start the video player. The playlist will be the items in the view\n// named by viewName. If firstItemId is the id of an item in the view,\n// playback will start on that item; otherwise playback will start on\n// the first item.\nfunction playViewNamed(viewName, firstItemId) {\n    url = \'action:playViewNamed?\';\n    url = url + \'viewName=\' + URLencode(viewName);\n    url = url + \'&firstItemId=\' + URLencode(firstItemId);\n    eventURL(url);\n    return false;\n}\n\n// You can make \'incremental search\' text boxes on your page that\n// effectively tie the text box to the \'parameter\' argument of setViewFilter,\n// with the other argumens fixed. To do this, add these two attributes to\n// the text box:\n//   onfocus="startEditSearch(this)"\n//   onblur="endEditFilter()"\n// replacing the arguments in parentheses with the desired strings.\n//\n// You\'ll also need to provide a updateSearchString function at the\n// top of your template to perform the actual update\n\nvar editSearchField = null;\nvar editSearchOldValue = \'\';\nvar editSearchTimer = null;\nvar editSearchCallback = null;\n\nfunction onSearchFocus(obj){\n  if (obj.getAttribute(\'searching\') != \'1\') {\n\tobj.value="";\n\tobj.searching = \'1\';\n  }\n  startEditSearch(obj, null);\n}\n\nfunction startEditSearch(obj, callback) {\n  editSearchOldValue = obj.value;\n\n  editSearchField = obj;\n  editSearchCallback = callback;\n  editSearchTimerTick();\n}\n\nfunction editSearchUpdate() {\n    value = editSearchField.value;\n    if (editSearchOldValue != value) {\n\turl = \'action:setSearchString?searchString=\' + URLencode(value);\n\teventURL(url);\n\teditSearchOldValue = value;\n\tif(editSearchCallback) editSearchCallback();\n    }\n}\n\nfunction editSearchTimerTick() {\n    editSearchUpdate();\n    editSearchTimer = setTimeout(editSearchTimerTick, 50);\n}\n\nfunction endEditSearch() {\n  clearTimeout(editSearchTimer);\n  editSearchUpdate();\n}\n\n// Internal use: \'URL encode\' the given string.\nfunction URLencode(str) {\n    return encodeURIComponent(str)\n}\n\nfunction URLdecode(str) {\n  return decodeURIComponent(str)\n}\n\nvar currentSelectBoxMenu = null;\nfunction showSelectBoxMenu(id) {\n    document.getElementById(id).style.display = \'block\';\n    currentSelectBoxMenu = id;\n    document.addEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\nfunction hideSelectBoxMenu(event) {\n    document.getElementById(currentSelectBoxMenu).style.display = \'\';\n    currentSelectBoxMenu = null;\n    document.removeEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\n///////////////////////////////////////////////////////////////////////////////\n//// For calling by host templating code                                   ////\n///////////////////////////////////////////////////////////////////////////////\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it disappear.\nfunction hideItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'none\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it visible if it was previously hidden.\nfunction showItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Replace the item with the\n// given id with the element described by the proided XML.\nfunction changeItem(id, newXML) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.replaceChild(frag, elt);\n}\n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element immediately before the item\n// with the given id, such that the newly inserted item has the same\n// parent.\nfunction addItemBefore(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.insertBefore(frag, elt);\n}    \n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element as the final child of the\n// item with the given id.\nfunction addItemAtEnd(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.insertBefore(frag, null);\n}    \n\n// For calling by host templating code: Remove the item with the given\n// id.\nfunction removeItem(id) {\n    elt = document.getElementById(id);\n    elt.parentNode.removeChild(elt);\n}    \n\n// Internal use: Sometime if all you do is change the style on a node,\n// Safari doesn\'t update the view until your mouse is next over the\n// window. Force the issue by making a drastic change in the vicinity\n// of the given element and then reversing it.\nfunction forceRedisplay(elt) {\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.extractContents();\n    r.insertNode(frag);\n}\n\nfunction handleContextMenuSelect(event) {\n  if(event.button == 2) {\n    var area = event.currentTarget.getAttribute("selectArea");\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var url = \'action:handleContextMenuSelect?id=\' + id + \'&area=\' + area +\n              \'&viewName=\' + viewName;\n    eventURL(url);\n  }\n  return true;\n}\n\nfunction handleSelect(event) {\n   if(event.target.tagName && event.target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n    }\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var area = event.currentTarget.getAttribute("selectArea");\n    var shiftKey = \'0\';\n    var ctrlKey = \'0\';\n    if(event.shiftKey) shiftKey = \'1\';\n    if(event.ctrlKey || event.metaKey) ctrlKey = \'1\';\n    eventURL(\'action:handleSelect?area=\' + area + \'&viewName=\' + viewName + \n\t\'&id=\' + id + \'&shiftDown=\' + shiftKey + \'&ctrlDown=\' + ctrlKey);\n    return true;\n}\n\nfunction handleDblClick(event, viewName, id) {\n   var target = event.target;\n   while (target != undefined && target.ondblclick === null && target.tagName.toUpperCase() != \'A\') {\n       target = target.parentNode;\n   }\n\n   if(target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n   } else {\n       return eventURL(\'action:playViewNamed?viewName=\' + viewName + \n           \'&firstItemId=\' + id);\n   }\n}\n\nfunction getKeyFromEvent(evt) {\n  var key = 0;\n  if (window.event)  {\n    key = evt.keyCode;\n  } else if (evt.which) {\n  \tkey = evt.which;\n  }\n\n  return key;\n}\n\nfunction sendKeyToSearchBox(event) {\n  if(event.altKey || event.ctrlKey || event.metaKey ||\n      (event.target.tagName && event.target.tagName.toUpperCase() == \'INPUT\'))\n      return true;\n  var key = getKeyFromEvent(event);\n  if ((key == 33) || (key == 34) || (key == 35) || (key == 36) || \n      (key == 37) || (key == 38) || (key == 39) || (key == 40))\n      return true;\n  var searchBox = document.getElementById("search-box");\n  searchBox.focus();\n  return true;\n}\n\nfunction playNewVideos(event, id) {\n  eventURL(\'action:playNewVideos?id=\' + id);\n  event.stopPropagation(); // don\'t want handleSelect to deal with this event\n  return false;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n\n-->\n</script>\n\n    <script type="text/javascript">\n    <!-- // Protect from our XML parser, which doesn\'t know to protect <script>\n\n    var settingsMode = \'closed\';\n\n    function showSettings()\n    {\n        if(settingsMode == \'open\') return hideSettings();\n        var feedSettings = document.getElementById("feed-settings");\n        feedSettings.style.display = "block";\n        settingsMode = \'open\';\n        return false;\n    }\n\n    function hideSettings()\n    {\n        var feedSettings = document.getElementById("feed-settings");\n        feedSettings.style.display = "none";\n        settingsMode = \'closed\';\n        return false;\n    }\n\n    function setExpiration()\n    {\n        var url = "action:setExpiration";\n        var idx = document.forms[\'settings\'][\'expireAfter\'].selectedIndex;\n        var value = document.forms[\'settings\'][\'expireAfter\'].options[idx].value;\n\n        url += \'?feed=\' + document.forms[\'settings\'][\'feed\'].value;\n        if (value == \'system\' || value == \'never\')\n        {\n            url += "&type=" + value + "&time=0";\n        }\n        else\n        {\n            url += "&type=feed&time=" + value;\n        }\n\n        eventURL(url);\n    }\n\n    function setMaxNew()\n    {\n        var url = "action:setMaxNew";\n\n        url += \'?feed=\' + document.forms[\'settings\'][\'feed\'].value;\n        if (document.forms[\'settings\'][\'maxOutDownloads\'].checked)\n        {\n            var maxNew = document.forms[\'settings\'][\'maxNew\'];\n            maxNew.disabled = false;\n            if(maxNew.value == \'\') maxNew.value = \'0\';\n            if(!(parseInt(maxNew.value) >= 0)) {\n               eventURL(\'action:invalidMaxNew?value=\' + escape(maxNew.value));\n               maxNew.value = \'0\';\n            }\n            url += \'&maxNew=\' + maxNew.value;\n        }\n        else\n        {\n            document.forms[\'settings\'][\'maxNew\'].disabled = true;\n            url += \'&maxNew=-1\';\n        }\n\n        eventURL(url);\n    }\n\n    -->\n</script>\n\n    <script src="')
  734.     out.write(quoteattr(resources.url(u'templates/osxdnd.js')))
  735.     out.write(u'" type="text/javascript"></script>\n    \n    \n\n</head>\n\n<body onkeydown="sendKeyToSearchBox(event);"')
  736.     out.write(u' ' + bodyTagExtra)
  737.     out.write(u'>\n<div id="feed-settings">\n  ')
  738.     out.write(u'<span id="tmplcomp32808340"/>\n</div>\n    \n\n\n<div id="main-titlebar">\n        ')
  739.     out.write(u'<span id="tmplcomp60523466"/>\n\n        <div class="main-titlebar-left">\n            ')
  740.     out.write(u'<span id="tmplcomp77257750"/>\n            ')
  741.     out.write(u'<span id="tmplcomp64913735"/>\n        </div>\n</div>\n\n\n\n<div id="main-container">\n    <div t:showIf=')
  742.     out.write(quoteAndFillAttr(u'feed.isScraped() and feed.isUpdating()', locals()))
  743.     out.write(u' class=')
  744.     out.write(quoteAndFillAttr(u'main-container-scraping', locals()))
  745.     out.write(u' id="tmplcomp40028358"')
  746.     
  747.     _hideFunc = lambda : if feed.isScraped():
  748. passnot feed.isUpdating()
  749.     _dynHide = _hideFunc()
  750.     if _dynHide:
  751.         out.write(u' style="display:none">')
  752.     else:
  753.         out.write(u'>')
  754.     handle.addUpdateHideOnView('tmplcomp40028358', thisFeedView, _hideFunc, _dynHide)
  755.     out.write(u'\n    <div class="scraping-indicator">\n      <img src="')
  756.     out.write(quoteattr(resources.url(u'images/scraping-indicator-left.gif')))
  757.     out.write(u'" align="left"></img>\n      <img src="')
  758.     out.write(quoteattr(resources.url(u'images/scraping-indicator-right.gif')))
  759.     out.write(u'" align="right"></img>\n      <div class="scraping-content">')
  760.     out.write(_(u'Looking for videos at this URL'))
  761.     out.write(u'</div>\n    </div>\n    </div>\n    <div class="hide-channel-title">\n        ')
  762.     out.write(u'\n\n')
  763.     out.write(u'<span id="tmplcomp37636645"/>\n\n    ')
  764.     out.write(u'<span id="tmplcomp45286698"/>\n    <div id="tmplcomp48244590">')
  765.     out.write(u'</div>\n\n\n\n\n\n<div class="available-channelbar-wrap">\n    ')
  766.     out.write(u'<span id="tmplcomp60446172"/>\n</div>\n\n')
  767.     out.write(u'<span id="tmplcomp11022004"/>\n\n<div id="tmplcomp61348099">')
  768.     out.write(u'</div>\n\n\n')
  769.     out.write(u'<span id="tmplcomp54166034"/>\n\n\n\n\n<div id="tmplcomp09684708"')
  770.     
  771.     _hideFunc = lambda : if not isFolder:
  772. passfeed.getURL().startswith('dtv:directoryfeed')
  773.     _dynHide = _hideFunc()
  774.     if _dynHide:
  775.         out.write(u' style="display:none">')
  776.     else:
  777.         out.write(u'>')
  778.     handle.addUpdateHideOnView('tmplcomp09684708', thisFeedView, _hideFunc, _dynHide)
  779.     out.write(u'\n    ')
  780.     out.write(u'<span id="tmplcomp46742417"/>\n    \n    ')
  781.     out.write(u'<span id="tmplcomp31872732"/>\n    <div id="tmplcomp96811263">')
  782.     out.write(u'</div>\n</div>\n\n\n')
  783.     out.write(u'\n    </div>\n</div>\n\n\n</body>\n</html>')
  784.     out.seek(0)
  785.     return (out, handle)
  786.  
  787.