fix typos, missing imports
[mygpo.git] / mygpo / web / templates / episode.html
blob3393cbb6638efddb58fc0cd38048e50bd03db258
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load humanize %}
4 {% load episodes %}
5 {% load devices %}
6 {% load podcasts %}
7 {% load mygpoutil %}
8 {% load time %}
9 {% load youtube %}
10 {% load flickr %}
12 {% load menu %}
13 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
14 {% block sectionmenu %}
15 {% if episode.podcast.title %}
16 {{ "/podcast/"|section_menu:episode.podcast.title }}
17 {% else %}
18 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
19 {% endif %}
20 {% endblock %}
22 {% block head %}
23 <script type="text/javascript" src="/media/js/jquery-1.4.2.min.js"></script>
24 <script type="text/javascript" src="/media/js/jquery.watermark.min.js"></script>
25 {% if episode.url|is_youtube_video %}
26 <script type="text/javascript" src="/media/js/swfobject.js"></script>
27 <script type="text/javascript" src="/media/js/json2.js"></script>
28 <script type="text/javascript" src="/media/js/youtube-handler.js"></script>
29 {% endif %}
30 {% endblock head %}
32 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ episode.podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
34 {% block content %}
35 {% if episode.podcast.logo_url %}
36 <div id="podcastlogo"><a href="{% url podcast episode.podcast.id %}">{{ episode.podcast|podcast_logo_big }}</a></div>
37 {% endif %}
38 <h1>{{ episode.title|default:"Unnamed Episode"|striptags }}</h1>
39 <small class="description">
40 {% trans "from" %} <a href="{% url podcast episode.podcast.id %}">{{ episode.podcast }}</a>{% if episode.timestamp %}, {% trans "released" %} {{episode.timestamp}}{% endif %},
41 {% trans "links" %}:
42 <a href="{{episode.url}}">{% trans "download" %}</a>{% if episode.link and episode.link != episode.url %}, <a href="{{episode.link}}">{% trans "website" %}</a>
43 {% endif %},
44 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
45 </small>
46 <hr style="clear: none;"/>
48 {% if episode.url|is_youtube_video %}
49 <div id="ytapiplayer">
50 You need Flash player 8+ and JavaScript enabled to view this video.
51 </div>
52 {% endif %}
54 {% if episode.description %}
55 <p>{{ episode.description|remove_html_tags|linebreaksbr }}</p>
56 {% endif %}
58 {% if episode.url|is_flickr_photo %}
59 {{ episode|embed_flickr_photo }}
60 {% endif %}
62 {% if episode|is_image %}
63 <img src="{{ episode.url }}" />
64 {% endif %}
66 {% if user.is_authenticated %}
68 {% if is_favorite %}
69 <div>
70 <a href="{% url episode-fav episode.id %}">
71 <img src="/media/fav.png" style="vertical-align: middle;" /> {% trans "Favorite" %}
72 </a>
73 </div>
74 {% else %}
75 <div>
76 <a href="{% url episode-fav episode.id %}">
77 <img src="/media/fav-add.png" style="vertical-align: middle;" /> {% trans "Add as Favorite" %}
78 </a>
79 </div>
80 {% endif %}
82 {% if played_parts %}
83 <h3>Already played</h3>
84 {{ played_parts|played_visualization:duration }}
85 {% endif %}
88 <hr/>
89 <h2>{% trans "Chapters" %}</h2>
91 <div class="info">
92 {% if not subscription_meta %}
93 {% url subscribe podcast_id as subscribe-url %}
94 {% blocktrans with episode.podcast.id as podcast_id %}You aren't subscribed to this podcast. Therefor your chapters are also visible to other users. If you do no want that, <a href="{{ subscribe-url }}">subscribe to the podcast</a> and mark your subscription as private.{% endblocktrans %}
95 {% else %}
96 {% if subscription_meta.public %}
97 {% url podcast podast_id as podcast-url %}
98 {%blocktrans with episode.podcast.id as podcast_id %}Your own chapters are shown in bold. If you don't want them to appear to other users, go to the <a href="{{ podcast-url }}">podcast page</a> and mark your subscription as private.{% endblocktrans %}
99 {% else %}
100 {% url podcast podast_id as podcast-url %}
101 {% blocktrans with episode.podcast.id as podcast_id %}The following list contains your chapters in bold and those of other users. However, yours are not shown to others, because you've marked your subscription as prive on the <a href="{{ podcast-url }}">podcast page</a>. You can change that there, if you want.{% endblocktrans %}
102 {% endif %}
103 {% endif %}
104 </div>
106 <table class="list">
107 <tr>
108 <th></th>
109 <th>{% trans "Ad?" %}</th>
110 <th>{% trans "Label" %}</th>
111 <th></td>
112 </tr>
114 {% for chapter in chapters %}
115 <tr {% if chapter.user == user %}class="own-chapter"{% endif %} >
116 <td>{{ chapter.start|sec_to_time|time:"H:i:s" }}{% if chapter.start != chapter.end %} - {{ chapter.end|sec_to_time|time:"H:i:s" }}{% endif %}</td>
117 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
118 <td>{{ chapter.label }}</strong>
119 <td>
120 {% if chapter.user == user %}
121 <a href="{% url remove-chapter episode.id chapter.id %}">
122 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
123 </a>
124 {% endif %}
125 </td>
126 </tr>
127 {% endfor %}
128 <tr>
129 <form action="{% url add-chapter episode.id %}" method="POST">
130 {% csrf_token %}
131 <td>
132 <input type="text" name="start" id="start" class="time" /> -
133 <input type="text" name="end" id="end" class="time" />
134 </td>
135 <td>
136 <input type="checkbox" name="advertisement" />
137 </td>
138 <td>
139 <input type="text" name="label" />
140 </td>
141 <td>
142 <input type="submit" value="{% trans "Add" %}" />
143 </td>
144 </form>
145 </tr>
146 </table>
147 {% endif %}
149 {% if history %}
150 <h2>{% trans "History" %}</h2>
151 <table class="list">
152 <tr>
153 <th>{% trans "Time" %}</th>
154 <th>{% trans "Action" %}</th>
155 <th>{% trans "Device" %}</th>
156 <th></th>
157 </tr>
159 {% for s in history %}
160 <tr>
161 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
162 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
163 <td>
164 {% if s.device %}
165 <a href="{% url device s.device.id %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
166 {% endif %}
167 </td>
168 <td>{% if s.started %}{{s.started_time|date:"H:m:s" }} - {% endif %}
169 {% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
170 </td>
171 </tr>
172 {% endfor %}
173 </table>
174 {% endif %}
176 {% if not episode.title %}
177 <div class="info"><strong>{% trans "Why Unnamed Episode?" %}</strong> {% trans "Because we display names after we have fetched the information form the feed -- and this may take some time. Until this is completed, the podcast will simply be called this way." %}</div>
178 {% endif %}
180 {% endblock %}
183 {% block javascript %}
184 <script type="text/javascript">
185 $("#start").watermark("h:mm:ss", {className: 'watermark'});
186 $("#end").watermark("h:mm:ss", {className: 'watermark'});
188 {% if episode.url|is_youtube_video %}
189 {{ episode|embed_youtube_video:user }}
190 {% endif %}
192 </script>
193 {% endblock javascript %}