Django-magic to prevent cross-site request forgery for POST requests
[mygpo.git] / mygpo / web / templates / episode.html
blob28236209b4fdd2f2fbe1bf00282564d63b8b45ed
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 %}
10 {% load menu %}
11 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
12 {% block sectionmenu %}{{ "/podcast/"|section_menu:episode.podcast.title }}{% endblock %}
14 {% block head %}
15 <script type="text/javascript" src="/media/js/jquery-1.4.2.min.js"></script>
16 <script type="text/javascript" src="/media/js/jquery.watermark.min.js"></script>
17 {% endblock head %}
19 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ episode.podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
21 {% block content %}
22 {% if episode.podcast.logo_url %}
23 <div id="podcastlogo">{{ episode.podcast|podcast_logo_big }}</div>
24 {% endif %}
25 <h1>{{ episode.title|default:"Unnamed Episode"|striptags }}</h1>
26 <small class="description">
27 {% trans "from" %} <a href="/podcast/{{ episode.podcast.id }}">{{ episode.podcast }}</a>{% if episode.timestamp %}, {% trans "released" %} {{episode.timestamp}}{% endif %},
28 {% trans "links" %}:
29 <a href="{{episode.url}}">{% trans "download" %}</a>{% if episode.link and episode.link != episode.url %}, <a href="{{episode.link}}">{% trans "website" %}</a>
30 {% endif %},
31 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
32 </small>
33 <hr style="clear: none;"/>
35 {% if episode.description %}
36 <p>{{ episode.description|remove_html_tags|linebreaksbr }}</p>
37 {% endif %}
39 {% if user.is_authenticated %}
40 <hr/>
41 <h2>{% trans "Chapters" %}</h2>
43 <div class="info">
44 {% if not subscription_meta %}
45 {% 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="/podcast/{{ podcast_id }}/subscribe">subscribe to the podcast</a> and mark your subscription as private.{% endblocktrans %}
46 {% else %}
47 {% if subscription_meta.public %}
48 {%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/{{ podcast_id }}">podcast page</a> and mark your subscription as private.{% endblocktrans %}
49 {% else %}
50 {% 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/{{ podcast_id }}">podcast page</a>. You can change that there, if you want.{% endblocktrans %}
51 {% endif %}
52 {% endif %}
53 </div>
55 <table class="list">
56 <tr>
57 <th></th>
58 <th>{% trans "Ad?" %}</th>
59 <th>{% trans "Label" %}</th>
60 <th></td>
61 </tr>
63 {% for chapter in chapters %}
64 <tr {% if chapter.user == user %}class="own-chapter"{% endif %} >
65 <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>
66 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
67 <td>{{ chapter.label }}</strong>
68 <td>
69 {% if chapter.user == user %}
70 <a href="/episode/{{ episode.id }}/remove-chapter/{{ chapter.id}}">
71 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
72 </a>
73 {% endif %}
74 </td>
75 </tr>
76 {% endfor %}
77 <tr>
78 <form action="/episode/{{ episode.id }}/add-chapter" method="POST">
79 {% csrf_token %}
80 <td>
81 <input type="text" name="start" id="start" class="time" /> -
82 <input type="text" name="end" id="end" class="time" />
83 </td>
84 <td>
85 <input type="checkbox" name="advertisement" />
86 </td>
87 <td>
88 <input type="text" name="label" />
89 </td>
90 <td>
91 <input type="submit" value="{% trans "Add" %}" />
92 </td>
93 </form>
94 </tr>
95 </table>
96 {% endif %}
98 {% if history %}
99 <h2>{% trans "History" %}</h2>
100 <table class="list">
101 <tr>
102 <th>{% trans "Time" %}</th>
103 <th>{% trans "Action" %}</th>
104 <th>{% trans "Device" %}</th>
105 <th></th>
106 </tr>
108 {% for s in history %}
109 <tr>
110 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
111 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
112 <td><a href="/device/{{ s.device.id }}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a></td>
113 <td>{% if s.playmark %}{{ s.playmark_time|date:"H:m:s" }}{% endif %}
114 </tr>
115 {% endfor %}
116 </table>
117 {% endif %}
119 {% if not episode.title %}
120 <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>
121 {% endif %}
123 {% endblock %}
126 {% block javascript %}
127 <script type="text/javascript">
128 $("#start").watermark("h:mm:ss", {className: 'watermark'});
129 $("#end").watermark("h:mm:ss", {className: 'watermark'});
130 </script>
131 {% endblock javascript %}