{% extends base %}{% load cache i18n shorturl hosts thumbnail staticfiles %}
{% comment %}
Copyright © 2012 Robert Weidlich. All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE LICENSOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
{% endcomment %}
{% block title %} &middot; {{ show.name }}{% endblock %}
{% block breadcrumb %}{{ block.super }} » <a href="{% url 'shows' %}">{% trans "Shows" %}</a>{% if show %} » {{ show.name }}{% endif %}{% endblock %}
{% block head_css %}
	{{ block.super }}
	<link rel="stylesheet" href="{% static "css/player-xenim.css" %}" />
{% endblock %}
{% block head_js %}
	{{ block.super }}
	<script src="{% static "js/mediaelement-and-player.min.js" %}"></script>
	<script>
	$('audio').mediaelementplayer({
		features: ['playpause'],
		stretching: "fill",
		setDimensions: false,
		success: function (mediaElement, domObject) {
			mediaElement.addEventListener('pause', function (e) {
				mediaElement.load();
			}, false);
	        }
	});
	</script>
{% endblock %}
{% block head %}
{% if show %}
<link href="{% host_url "show-feed" show_name=show.slug on "feeds" %}" type="application/atom+xml" rel="alternate" title="ATOM Feed" />
{% endif %}
{% endblock %}
{% block feed_label %}{% trans "Subscribe" %}{% endblock %}
{% block feed_footer %}
<li><a href="{% host_url "show-feed" show_name=show.slug on "feeds" %}" class="icon-rss-squared"><span class="show-for-medium">{% trans "atom" %}</span></a></li>
{% endblock %}
{% block collapsed_shows %}un{% endblock %}
{% block navi_shows %}
<ul>
{% for s in shows %}
        <li{% ifequal s show %} class="active"{% endifequal %}>
		<a class="{% ifequal s show %}un{% endifequal %}collapsed" href="{% url 'show' show_name=s.slug %}">{{ s.name }}</a>
	{% ifequal s show %}
                <ul>
		{% if is_paginated and page_obj.has_previous %}
			<li><a href="?page={{ page_obj.previous_page_number }}">...</a></li>
		{% endif %}
		{% for episode in object_list %}
			<li><a href="{% url 'episode' show_name=episode.show.slug episode_id=episode.slug %}">
				{{ episode.slug|upper }}
			</a></li>
		{% endfor %}
		{% if is_paginated and page_obj.has_next %}
			<li><a href="?page={{ page_obj.next_page_number }}">...</a></li>
		{% endif %}
                </ul>
	{% endifequal %}
        </li>
{% endfor %}
</ul>
{% endblock %}
{% block content %}
{% block list_head %}
{% if show %}
{% cache 900 episode_list_head show.slug %}
<div class="showheader">
{% if show.icon %}<img src="{{ show.icon|thumbnail_url:'listing' }}" class="showicon" alt="{{ show.name }} logo" />{% endif %}
<h1><a href="{% url 'show' show_name=show.slug %}">{{ show.name }}</a></h1>
<small>{{ show.description }} (<a href="{{ show.url }}">{% trans "Homepage" %}</a>)</small>
<p>{{ show.abstract }}</p>
</div>
{% endcache %}
{% endif %}
{% endblock %}
{% if object_list %}
{% for episode in object_list %}
	{% ifchanged %}
		<h2>
		{% ifequal episode.status "RUNNING" %}
			{% if show_name %}<a href="{% url 'live_show' show_name=show.slug %}">{% endif %}
				{% trans "Running Episodes" %}
			{% if show_name %}</a>{% endif %}
		{% endifequal %}
		{% ifequal episode.status "ARCHIVED" %}
			{% trans "Archived Episodes" %}
		{% endifequal %}
		{% ifequal episode.status "UPCOMING" %}
			{% if show_name %}<a href="{% url 'upcoming_show' show_name=show.slug %}">{% endif %}
				{% trans "Upcoming Episodes" %}
			{% if show_name %}</a>{% endif %}
		{% endifequal %}
		</h2>
	{% endifchanged %}
	{% include "radioportal/episodes/episode_list_entry.html" %}
{% endfor %}
{% else %}
{% block no_episodes %}<h2>{% trans "No episodes available." %}</h2>{% endblock %}
{% endif %}
{% if is_paginated %}
<div>
<ul class="pagination text-center">
	{% if page_obj.has_previous %}
	{% ifnotequal page_obj.previous_page_number 1 %}
	<li><a href="?page=1">{% trans "First" %}</a></li>
	{% endifnotequal %}
	<li class="pagination-previous"><a href="?page={{ page_obj.previous_page_number }}">{% trans "Previous" %}</a></li>
	{% endif %}
	<li class="">{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ paginator.num_pages }}</li>
	{% if page_obj.has_next %}
	<li class="pagination-next"><a href="?page={{ page_obj.next_page_number }}">{% trans "Next" %}</a></li>
	{% ifnotequal page_obj.next_page_number paginator.num_pages %}
	<li><a href="?page=last">{% trans "Last" %}</a></li>
	{% endifnotequal %}
	{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
