From 3f935fe643fd8d4f807803c99dbd25d048acb143 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Wed, 24 Feb 2021 15:42:40 +0100
Subject: add V2 views and template tags for new homepage


diff --git a/program/templates/v2/boxes/broadcastformat.html b/program/templates/v2/boxes/broadcastformat.html
new file mode 100644
index 0000000..8118cdb
--- /dev/null
+++ b/program/templates/v2/boxes/broadcastformat.html
@@ -0,0 +1,11 @@
+{% if broadcastformat_list %}
+    <dl id="broadcastformat" class="portlet">
+        <dt class="portletHeader"><span>Legende</span></dt>
+        {% for bf in broadcastformat_list %}
+            <dd class="portletItem bcformat bf-{{ bf.slug }}">
+                <a title="Sendungen mit dem Sendungsformat {{ bf.format }} anzeigen."
+                   href="?broadcastformat={{ bf.slug }}">{{ bf.format }}</a>
+            </dd>
+        {% endfor %}
+    </dl>
+{% endif %}
diff --git a/program/templates/v2/boxes/current.html b/program/templates/v2/boxes/current.html
new file mode 100644
index 0000000..0ac5179
--- /dev/null
+++ b/program/templates/v2/boxes/current.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<html>
+<head>
+    <meta charset="utf-8"/>
+    <title>Current program box</title>
+</head>
+<body>
+{% if previous_timeslot or current_timeslot or next_timeslot or after_next_timeslot %}
+    <dl id="program-current-box" class="portlet program-box">
+        <dt class="portletHeader">Programm derzeit</dt>
+        <dd class="portletItem">
+            <table>
+                <tr class="previous">
+                    <td class="start">{{ previous_timeslot.start|date:"H:i" }}</td>
+                    <td class="format bf-{{ previous_timeslot.show.broadcastformat.slug }}"
+                        title="{{ previous_timeslot.show.broadcastformat.format }}">&nbsp;</td>
+                    <td class="show">
+                        <h3>
+                            <a href="{% url "timeslot-detail" previous_timeslot.id %}">{{ previous_timeslot.show.name }}</a>
+                        </h3>
+                    </td>
+                    <td class="show"></td>
+                </tr>
+                <tr class="current">
+                    <td class="start">{{ current_timeslot.start|date:"H:i" }}</td>
+                    <td class="format bf-{{ current_timeslot.show.broadcastformat.slug }}"
+                        title="{{ current_timeslot.show.broadcastformat.format }}">&#x25B6;</td>
+                    <td class="show">
+                        <h3>
+                            <a href="{% url "timeslot-detail" current_timeslot.id %}">{{ current_timeslot.show.name }}</a>
+                        </h3>
+                        {% if current_timeslot.note %}
+                            <p>{{ current_timeslot.note.title }}</p>
+                        {% else %}
+                            <p>{{ current_timeslot.show.short_description }}</p>
+                        {% endif %}
+                    </td>
+                </tr>
+                <tr class="next">
+                    <td class="start">{{ next_timeslot.start|date:"H:i" }}</td>
+                    <td class="format bf-{{ next_timeslot.show.broadcastformat.slug }}"
+                        title="{{ next_timeslot.show.broadcastformat.format }}">&nbsp;</td>
+                    <td class="show">
+                        <h3><a href="{% url "timeslot-detail" next_timeslot.id %}">{{ next_timeslot.show.name }}</a>
+                        </h3>
+                    </td>
+                    <td class="show"></td>
+                </tr>
+                <tr class="after_next">
+                    <td class="start">{{ after_next_timeslot.start|date:"H:i" }}</td>
+                    <td class="format bf-{{ after_next_timeslot.show.broadcastformat.slug }}"
+                        title="{{ after_next_timeslot.show.broadcastformat.format }}">&nbsp;</td>
+                    <td class="show">
+                        <h3>
+                            <a href="{% url "timeslot-detail" after_next_timeslot.id %}">{{ after_next_timeslot.show.name }}</a>
+                        </h3>
+                    </td>
+                    <td class="show"></td>
+                </tr>
+            </table>
+        </dd>
+    </dl>
+{% endif %}
+</body>
+</html>
diff --git a/program/templates/v2/boxes/language.html b/program/templates/v2/boxes/language.html
new file mode 100644
index 0000000..050c342
--- /dev/null
+++ b/program/templates/v2/boxes/language.html
@@ -0,0 +1,15 @@
+{% if language_list %}
+    <dl id="filterbox_language" class="portlet filterbox">
+        <dt class="portletHeader"><span>Sprache<span></dt>
+        <dd class="portletItem">
+            <ul>
+                {% for language in language_list %}
+                    <li>
+                        <a title="Sendungen auf {{ language.name }} anzeigen."
+                           href="?language={{ language.slug }}">{{ language.name }}/{{ language.native_name }}</a>
+                    </li>
+                {% endfor %}
+            </ul>
+        </dd>
+    </dl>
+{% endif %}
diff --git a/program/templates/v2/boxes/musicfocus.html b/program/templates/v2/boxes/musicfocus.html
new file mode 100644
index 0000000..021185b
--- /dev/null
+++ b/program/templates/v2/boxes/musicfocus.html
@@ -0,0 +1,15 @@
+{% if musicfocus_list %}
+    <dl id="filterbox_musicfocus" class="portlet filterbox">
+        <dt class="portletHeader"><span>Musiktendenz<span></dt>
+        <dd class="portletItem">
+            <ul>
+                {% for mf in musicfocus_list %}
+                    <li>
+                        <a title="Sendungen mit der Musiktendenz {{ mf.focus }} anzeigen."
+                           class="abbrev mf-{{ mf.abbrev }}" href="?musicfocus={{ mf.slug }}">{{ mf.focus }}</a>
+                    </li>
+                {% endfor %}
+            </ul>
+        </dd>
+    </dl>
+{% endif %}
diff --git a/program/templates/v2/boxes/recommendation.html b/program/templates/v2/boxes/recommendation.html
new file mode 100644
index 0000000..3f4429e
--- /dev/null
+++ b/program/templates/v2/boxes/recommendation.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+<head>
+    <meta charset="utf-8"/>
+    <title>Recomendations box</title>
+</head>
+<body>
+{% if recommendation_list %}
+    <dl id="recommendations" class="portlet program-box">
+        <dt class="portletHeader">Programmhinweise</dt>
+        <dd class="portletItem">
+            <table>
+                {% for recommendation in recommendation_list %}
+                    <tr>
+                        <td class="start">&nbsp;</td>
+                        <td class="format bf-{{ recommendation.show.broadcastformat.slug }}"
+                            title="{{ recommendation.show.broadcastformat.format }}">&nbsp;</td>
+                        <td class="show">
+                            {{ recommendation.start|date:"d.m. H:i" }} - {{ recommendation.end|date:"H:i" }}<br/>
+                            <h3>
+                                <a href="{% url "timeslot-detail" recommendation.id %}">{{ recommendation.show.name }}</a>
+                            </h3>
+                            <p class="note-title">
+                                {% if recommendation.note %}
+                                    {{ recommendation.note.title }}<br/>
+                                {% else %}
+                                    {{ recommendation.show.broadcastformat.format }}<br/>
+                                {% endif %}
+                                <a href="{% url "timeslot-detail" recommendation.id %}">[weiter]</a>
+                            </p>
+                        </td>
+                    </tr>
+                {% endfor %}
+            </table>
+        </dd>
+    </dl>
+{% endif %}
+</body>
+</html>
diff --git a/program/templates/v2/boxes/showinformation.html b/program/templates/v2/boxes/showinformation.html
new file mode 100644
index 0000000..dbbe60d
--- /dev/null
+++ b/program/templates/v2/boxes/showinformation.html
@@ -0,0 +1,16 @@
+{% if showinformation_list %}
+    <dl id="filterbox_showinformation" class="portlet filterbox">
+        <dt class="portletHeader"><span>Sendungsinfo<span></dt>
+        <dd class="portletItem">
+            <ul>
+                {% for si in showinformation_list %}
+                    <li>
+                        <a title="Sendungen mit der Information {{ si.information }} anzeigen."
+                           class="abbrev si-{{ si.abbrev }}"
+                           href="?showinformation={{ si.slug }}">{{ si.information }}</a>
+                    </li>
+                {% endfor %}
+            </ul>
+        </dd>
+    </dl>
+{% endif %}
diff --git a/program/templates/v2/boxes/showtopic.html b/program/templates/v2/boxes/showtopic.html
new file mode 100644
index 0000000..93e873a
--- /dev/null
+++ b/program/templates/v2/boxes/showtopic.html
@@ -0,0 +1,16 @@
+{% if showtopic_list %}
+    <dl id="filterbox_showtopic" class="portlet filterbox">
+        <dt class="portletHeader"><span>Thema / Schwerpunkt<span></dt>
+        <dd class="portletItem">
+            <ul>
+                {% for showtopic in showtopic_list %}
+                    <li>
+                        <a title="Sendungen mit dem Schwerpunkt {{ showtopic.topic }} anzeigen."
+                           class="abbrev st-{{ showtopic.abbrev }}"
+                           href="?showtopic={{ showtopic.slug }}">{{ showtopic.topic }}</a>
+                    </li>
+                {% endfor %}
+            </ul>
+        </dd>
+    </dl>
+{% endif %}
diff --git a/program/templates/v2/day_schedule.html b/program/templates/v2/day_schedule.html
new file mode 100644
index 0000000..7bab98e
--- /dev/null
+++ b/program/templates/v2/day_schedule.html
@@ -0,0 +1,101 @@
+<html>
+<head>
+    <title>Tagesansicht {{ day|date:"l, d.m.Y" }} &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+{% load content_boxes %}
+<div id="filter-format">
+    {% broadcastformatV2 %}
+</div>
+
+<div id="filter-topic">
+  <dl id="filter-header" class="portlet">
+    <dt class="portletHeader"><span>Filter</span></dt>
+  </dl>
+{% musicfocusV2 %}
+{% showinformationV2 %}
+{% showtopicV2 %}
+{% languageV2 %}
+</div>
+
+<div id="content-main" class="day-schedule">
+    <h2>Tagesansicht</h2>
+    <h1 id="date">{{ day|date:"l, d.m.Y" }}</h1>
+
+    <div id="timeslots">
+        {% for timeslot in timeslots %}
+            {% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %}
+                <div class="timeslot bf-{{ default_show.broadcastformat.slug }}">
+                    <div class="show-start">{{ timeslot.get_previous_by_start.end|date:"H:i" }}</div>
+                    <div class="show-abbrevs">
+                        {% for si in default_show.showinformation.all %}
+                            <span title="{{ si.information }}"
+                                  class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+                        {% endfor %}
+                        {% for st in default_show.showtopic.all %}
+                            <span title="{{ st.topic }}" class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+                        {% endfor %}
+                        {% for mf in default_show.musicfocus.all %}
+                            <span title="{{ mf.focus }}" class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+                        {% endfor %}
+                    </div>
+                    <div class="show-detail">
+                        <h3 class="show-title">{{ default_show.name }}</h3>
+                        <p class="show-description">{{ default_show.short_description }}</p>
+                    </div>
+                </div>
+            {% endif %}
+            <div class="timeslot bf-{{ timeslot.show.broadcastformat.slug }}">
+                <div class="show-start">{{ timeslot.start|date:"H:i" }}</div>
+                <div class="show-abbrevs">
+                    {% for si in timeslot.show.showinformation.all %}
+                        <span title="{{ si.information }}"
+                              class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for st in timeslot.show.showtopic.all %}
+                        <span title="{{ st.topic }}"
+                              class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for mf in timeslot.show.musicfocus.all %}
+                        <span title="{{ mf.focus }}"
+                              class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+                    {% endfor %}
+                </div>
+                <div class="show-detail">
+                    <h3 class="show-title"><a
+                            href="{% url "timeslot-detail" timeslot.id %}">{{ timeslot.show.name }}</a></h3>
+                    {% if timeslot.note %}
+                        <p class="note-title"><strong>Heute:</strong> {{ timeslot.note.title }}</p>
+                    {% else %}
+                        <p class="show-description">{{ timeslot.show.short_description }}</p>
+                    {% endif %}
+                </div>
+            </div>
+            {% if timeslot.end != timeslot.get_next_by_start.start %}
+                <div class="timeslot bf-{{ default_show.broadcastformat.slug }}">
+                    <div class="show-start">{{ timeslot.end|date:"H:i" }}</div>
+                    <div class="show-abbrevs">
+                        {% for si in default_show.showinformation.all %}
+                            <span title="{{ si.information }}"
+                                  class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+                        {% endfor %}
+                        {% for st in default_show.showtopic.all %}
+                            <span title="{{ st.topic }}" class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+                        {% endfor %}
+                        {% for mf in default_show.musicfocus.all %}
+                            <span title="{{ mf.focus }}" class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+                        {% endfor %}
+                    </div>
+                    <div class="show-detail">
+                        <h3 class="show-title">{{ default_show.name }}</h3>
+                        <p class="show-description">{{ default_show.short_description }}</p>
+                    </div>
+                </div>
+            {% endif %}
+        {% endfor %}
+    </div>
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/host_detail.html b/program/templates/v2/host_detail.html
new file mode 100644
index 0000000..e7aad16
--- /dev/null
+++ b/program/templates/v2/host_detail.html
@@ -0,0 +1,27 @@
+<html>
+<head>
+    <title>Host: {{ host.name }} &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+<div id="content-main" class="host-detail">
+    <div id="name">{{ host.name }}</div>
+
+    <div id="shows">
+        <div id="shows-title">Sendungen</div>
+        {% for show in host.active_shows %}
+            <div class="show {{ show.broadcastformat.slug }}"><a href="{% url "show-detail" show.slug %}"> {{ show.name }}</a></div>
+        {% endfor %}
+    </div>
+
+    {% if host.email %}
+        <div id="email">E-Mail Adresse: <a href="{{ host.email }}">{{ host.email }}</a></div>
+    {% endif %}
+
+    {% if host.website %}
+        <div id="website">Website: <a href="{{ host.website }}">{{ host.website }}</a></div>
+    {% endif %}
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/host_list.html b/program/templates/v2/host_list.html
new file mode 100644
index 0000000..ada9bf1
--- /dev/null
+++ b/program/templates/v2/host_list.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+    <title>Sendungsmacherinnen &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+<div id="content-main">
+    <h1>Sendungsmachende A-Z</h1>
+    <div class="host-list">
+        {% for host in host_list %}
+            <div class="host">
+                <a href="{% url "host-detail" host.id %}">{{ host.name }}</a>
+            </div>
+        {% endfor %}
+    </div>
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/recommendation_list.html b/program/templates/v2/recommendation_list.html
new file mode 100644
index 0000000..3fcc5d1
--- /dev/null
+++ b/program/templates/v2/recommendation_list.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+    <title>Tipps &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+<div id="content-main" class="recommendations">
+    <h1>Programmhinweise</h1>
+    <div id="shows">
+        {% for recommendation in recommendation_list %}
+            <div class="show recommendation  bf-{{ recommendation.show.broadcastformat.slug }}">
+                <div class="show-abbrevs">
+                    {% for si in recommendation.show.showinformation.all %}
+                        <span title="{{ si.information }}"
+                              class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for st in recommendation.show.showtopic.all %}
+                        <span title="{{ st.topic }}"
+                              class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for mf in recommendation.show.musicfocus.all %}
+                        <span title="{{ mf.focus }}"
+                              class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+                    {% endfor %}
+                </div>
+                <div class="show-detail">
+                    <h4>
+                        <a href="{% url "show-detail" recommendation.show.slug %}">{{ recommendation.show.name }}</a><br/>
+                        vom {{ recommendation.start|date:"d.m. H:i" }}-{{ recommendation.end|date:"H:i" }}</h4>
+                    {% if recommendation.note %}
+                        <h3 class="show-title">
+                          <a href="{% url "timeslot-detail" recommendation.id %}">{{ recommendation.note.title }}</a>
+                        </h3>
+                        <div class="note-content">{{ recommendation.note.content|safe }}</div>
+                    {% else %}
+                        <h3 class="show-title"><a
+                                href="{% url "timeslot-detail" recommendation.id %}">{{ recommendation.show.broadcastformat.format }}</a>
+                        </h3>
+                    {% endif %}
+                </div>
+            </div>
+        {% endfor %}
+    </div>
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/show_detail.html b/program/templates/v2/show_detail.html
new file mode 100644
index 0000000..2e45549
--- /dev/null
+++ b/program/templates/v2/show_detail.html
@@ -0,0 +1,88 @@
+<html>
+<head>
+    <title>Sendung: {{ show.name }} &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+<div id="calendar"></div>
+
+<div id="content-main" class="show-detail">
+
+    <div class="show-detail-header bf-{{ show.broadcastformat.slug }}">
+        <div class="show-details">
+            <h1 id="name">{{ show.name }}</h1>
+            {% if show.id != 1 %}
+                <p id="programslots">
+                    {% for slot in show.active_programslots %}
+                        <span class="programslot">{{ slot }}</span><br/>
+                    {% endfor %}
+                </p>
+            {% endif %}
+        </div>
+
+        <div class="show-categorization">
+            <p id="broadcastformat">{{ show.broadcastformat.format }}</p>
+            {% for si in show.showinformation.all %}
+                <span title="{{ si.information }}" class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+            {% endfor %}
+            {% for st in show.showtopic.all %}
+                <span title="{{ st.topic }}" class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+            {% endfor %}
+            {% for mf in show.musicfocus.all %}
+                <span title="{{ mf.focus }}" class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+            {% endfor %}
+        </div>
+
+    </div>
+
+    <div id="short-description" class="documentDescription">{{ show.short_description }}</div>
+
+    {% if show.description %}
+        <div id="description">{{ show.description|safe }}</div>
+    {% endif %}
+
+    {% if show.image and show.image_enabled %}
+        <div id="image" style="float: right;"><img src="/program/static/{{ show.image }}" width="200" alt="image"></div>
+    {% endif %}
+
+    <p>
+        {% for host in show.hosts.all %}
+            <a href="{% url "host-detail" host.id %}">{{ host }}</a><br/>
+        {% endfor %}
+        {% if show.email %}
+            <strong>Email:</strong> <a href="mailto:{{ show.email }}">{{ show.email }}</a><br/>
+        {% endif %}
+        {% if show.website %}
+            <strong>Website:</strong> <a href="{{ show.website }}">{{ show.website }}</a><br/>
+        {% endif %}
+    </p>
+
+    {% if show.notes.all %}
+        <br/>
+        <h2>Sendungstipps</h2>
+        <ul class="recommendations-list">
+            {% for note in show.notes.all reversed %}
+                <li>
+                    <a href="{% url "timeslot-detail" note.timeslot.id %}"
+                       title="{{ note.title }}">{{ note.start|date:"d. M Y" }}:</a>
+                    <div class="title">{{ note.title }}</div>
+                </li>
+            {% endfor %}
+            {% if show.predecessor and show.predecessor.notes.all %}
+                {% if show.name != show.predecessor.name %}
+                    <h3>Davor als <a href="{% url "show-detail" show.predecessor.slug %}">{{ show.predecessor.name }}</a></h3>
+                {%  endif %}
+                {% for note in show.predecessor.notes.all reversed %}
+                    <li>
+                        <a href="{%  url "timeslot-detail" note.timeslot.id %}"
+                           title="{{ note.title }}">{{ note.start|date:"d. M Y" }}:</a>
+                        <div class="title">{{ note.title }}</div>
+                    </li>
+                {% endfor %}
+            {% endif %}
+        </ul>
+    {% endif %}
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/show_list.html b/program/templates/v2/show_list.html
new file mode 100644
index 0000000..1115a41
--- /dev/null
+++ b/program/templates/v2/show_list.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+    <title>Sendungen &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+{% load content_boxes %}
+<div id="filter-format">
+    {% broadcastformatV2 %}
+</div>
+<div id="filter-topic">
+    <dl id="filter-header" class="portlet">
+        <dt class="portletHeader"><span>Filter</span></dt>
+    </dl>
+    {% musicfocusV2 %}
+    {% showinformationV2 %}
+    {% showtopicV2 %}
+    {% languageV2 %}
+</div>
+
+<div id="content-main" class="show-list">
+    <h1>Sendungen A-Z</h1>
+
+    <div id="shows">
+        {% for show in show_list %}
+            <div class="show bf-{{ show.broadcastformat.slug }}">
+                <div class="show-abbrevs">
+                    {% for si in show.showinformation.all %}
+                        <span title="{{ si.information }}"
+                              class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for st in show.showtopic.all %}
+                        <span title="{{ st.topic }}"
+                              class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+                    {% endfor %}
+                    {% for mf in show.musicfocus.all %}
+                        <span title="{{ mf.focus }}"
+                              class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+                    {% endfor %}
+                </div>
+                <div class="show-detail">
+                    <h3 class="show-title"><a href="{% url "show-detail" show.slug %}">{{ show.name }}</a></h3>
+                    <ul class="show-programslots">
+                        {% for programslot in show.active_program_slots %}
+                            <li class="show-programslot">{{ programslot }}</li>
+                        {% endfor %}
+                    </ul>
+                    <p class="show-description">{{ show.short_description }}</p>
+                </div>
+            </div>
+        {% endfor %}
+    </div>
+
+</div>
+
+</body>
+</html>
diff --git a/program/templates/v2/timeslot_detail.html b/program/templates/v2/timeslot_detail.html
new file mode 100644
index 0000000..88749a2
--- /dev/null
+++ b/program/templates/v2/timeslot_detail.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+    <title>Sendung: {{ timeslot.show.name }} &mdash; Radio Helsinki - Freies Radio Graz</title>
+</head>
+<body>
+
+<div id="content-main" class="timeslot-detail">
+
+    <div class="show-detail-header bf-{{ timeslot.show.broadcastformat.slug }}">
+        <h1 id="name">
+            <a href="{% url "show-detail" timeslot.show.slug %}">{{ timeslot.show.name }}</a>
+        </h1>
+        {% if timeslot.note %}
+            <h2>{{ timeslot.note.title }}</h2>
+        {% endif %}
+        <strong>Sendung am {{ timeslot.start|date:"d.m.Y H:i" }} bis {{ timeslot.end|date:"H:i" }}</strong>
+
+        <div class="show-abbrevs">
+            {% for si in timeslot.show.showinformation.all %}
+                <span title="{{ si.information }}" class="abbrev si-{{ si.abbrev }}"><span>{{ si.abbrev }}</span></span>
+            {% endfor %}
+            {% for st in timeslot.show.showtopic.all %}
+                <span title="{{ st.topic }}" class="abbrev st-{{ st.abbrev }}"><span>{{ st.abbrev }}</span></span>
+            {% endfor %}
+            {% for mf in timeslot.show.musicfocus.all %}
+                <span title="{{ mf.focus }}" class="abbrev mf-{{ mf.abbrev }}"><span>{{ mf.abbrev }}</span></span>
+            {% endfor %}
+        </div>
+
+        <p id="broadcastformat">{{ timeslot.show.broadcastformat.format }}</p>
+    </div>
+
+    {% if timeslot.note %}
+        <p class="timeslot-note">{{ timeslot.note.content|safe }}</p>
+    {% endif %}
+
+    <div id="short-description" class="documentDescription">{{ timeslot.show.short_description }}</div>
+
+    {% if timeslot.show.description %}
+        <div id="description">{{ timeslot.show.description|safe }}</div>
+    {% endif %}
+
+    <p>
+        {% for host in timeslot.show.hosts.all %}
+            <a href="{% url "host-detail" host.id %}">{{ host }}</a><br/>
+        {% endfor %}
+        {% if timeslot.show.email %}
+            <strong>Email:</strong> <a href="mailto:{{ timeslot.show.email }}">{{ timeslot.show.email }}</a><br/>
+        {% endif %}
+        {% if timeslot.show.website %}
+            <strong>Website:</strong> <a href="{{ timeslot.show.website }}">{{ timeslot.show.website }}</a><br/>
+        {% endif %}
+    </p>
+</div>
+
+</body>
+</html>
diff --git a/program/templatetags/content_boxes.py b/program/templatetags/content_boxes.py
index ece466b..f979ca2 100644
--- a/program/templatetags/content_boxes.py
+++ b/program/templatetags/content_boxes.py
@@ -5,6 +5,8 @@ from program.models import BroadcastFormat, MusicFocus, ShowInformation, ShowTop
 register = template.Library()
 
 
+# Legacy Tags for Homepage until 2021
+
 @register.inclusion_tag('boxes/broadcastformat.html')
 def broadcastformat():
     return {'broadcastformat_list': BroadcastFormat.objects.filter(enabled=True)}
@@ -28,3 +30,30 @@ def showtopic():
 @register.inclusion_tag('boxes/language.html')
 def language():
     return {'language_list': Language.objects.all()}
+
+
+# V2 Tags added for new Homepage 2021
+
+@register.inclusion_tag('v2/boxes/broadcastformat.html')
+def broadcastformatV2():
+    return {'broadcastformat_list': BroadcastFormat.objects.filter(enabled=True)}
+
+
+@register.inclusion_tag('v2/boxes/musicfocus.html')
+def musicfocusV2():
+    return {'musicfocus_list': MusicFocus.objects.all()}
+
+
+@register.inclusion_tag('v2/boxes/showinformation.html')
+def showinformationV2():
+    return {'showinformation_list': ShowInformation.objects.all()}
+
+
+@register.inclusion_tag('v2/boxes/showtopic.html')
+def showtopicV2():
+    return {'showtopic_list': ShowTopic.objects.all()}
+
+
+@register.inclusion_tag('v2/boxes/language.html')
+def languageV2():
+    return {'language_list': Language.objects.all()}
diff --git a/program/urls.py b/program/urls.py
index a3badf3..cb389e2 100644
--- a/program/urls.py
+++ b/program/urls.py
@@ -21,7 +21,18 @@ urlpatterns = patterns('',
                        url(r'^shows/?$', views.ShowListView.as_view()),
                        url(r'^shows/(?P<slug>[\w-]+)/?$', views.ShowDetailView.as_view(), name='show-detail'),
                        url(r'^(?P<pk>\d+)/?$', views.TimeSlotDetailView.as_view(), name='timeslot-detail'),
-                       url(r'^styles.css$', views.StylesView.as_view())
+                       url(r'^styles.css$', views.StylesView.as_view()),
+                       # V2 Patterns for new Homepage 2021
+                       url(r'^v2/today/?$', views.DayScheduleViewV2.as_view()),
+                       url(r'^v2/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/?$', views.DayScheduleViewV2.as_view()),
+                       url(r'^v2/current_box/?$', cache_page(60)(views.CurrentShowBoxViewV2.as_view())),
+                       url(r'^v2/hosts/?$', views.HostListViewV2.as_view()),
+                       url(r'^v2/hosts/(?P<pk>\d+)/?$', views.HostDetailViewV2.as_view(), name='host-detail'),
+                       url(r'^v2/tips/?$', views.RecommendationsListViewV2.as_view()),
+                       url(r'^v2/tips_box/?$', views.RecommendationsBoxViewV2.as_view()),
+                       url(r'^v2/shows/?$', views.ShowListViewV2.as_view()),
+                       url(r'^v2/shows/(?P<slug>[\w-]+)/?$', views.ShowDetailViewV2.as_view(), name='show-detail'),
+                       url(r'^v2/(?P<pk>\d+)/?$', views.TimeSlotDetailViewV2.as_view(), name='timeslot-detail'),
                        )
 if settings.DEBUG:
     urlpatterns += \
diff --git a/program/views.py b/program/views.py
index 256ad5d..ab7bd82 100644
--- a/program/views.py
+++ b/program/views.py
@@ -13,6 +13,8 @@ from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, Sho
 from program.utils import tofirstdayinisoweek, get_cached_shows
 
 
+# Legacy Views for Homepage until 2021
+
 class HostListView(ListView):
     context_object_name = 'host_list'
     queryset = Host.objects.filter(Q(is_always_visible=True) | Q(shows__programslots__until__gt=datetime.now)).distinct()
@@ -195,6 +197,134 @@ class StylesView(TemplateView):
         return context
 
 
+# V2 Views added for new Homepage 2021
+
+class HostListViewV2(ListView):
+    context_object_name = 'host_list'
+    queryset = Host.objects.filter(Q(is_always_visible=True) | Q(shows__programslots__until__gt=datetime.now)).distinct()
+    template_name = 'v2/host_list.html'
+
+
+class HostDetailViewV2(DetailView):
+    context_object_name = 'host'
+    queryset = Host.objects.all()
+    template_name = 'v2/host_detail.html'
+
+
+class ShowListViewV2(ListView):
+    context_object_name = 'show_list'
+    template_name = 'v2/show_list.html'
+
+    def get_queryset(self):
+        queryset = Show.objects.filter(programslots__until__gt=date.today()).exclude(id=1).distinct()
+        if 'broadcastformat' in self.request.GET:
+            broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat'])
+            queryset = queryset.filter(broadcastformat=broadcastformat)
+        elif 'musicfocus' in self.request.GET:
+            musicfocus = get_object_or_404(MusicFocus, slug=self.request.GET['musicfocus'])
+            queryset = queryset.filter(musicfocus=musicfocus)
+        elif 'showinformation' in self.request.GET:
+            showinformation = get_object_or_404(ShowInformation, slug=self.request.GET['showinformation'])
+            queryset = queryset.filter(showinformation=showinformation)
+        elif 'showtopic' in self.request.GET:
+            showtopic = get_object_or_404(ShowTopic, slug=self.request.GET['showtopic'])
+            queryset = queryset.filter(showtopic=showtopic)
+        elif 'language' in self.request.GET:
+            language = get_object_or_404(Language, slug=self.request.GET['language'])
+            queryset = queryset.filter(language=language)
+
+        return queryset
+
+
+class ShowDetailViewV2(DetailView):
+    queryset = Show.objects.all().exclude(id=1)
+    template_name = 'v2/show_detail.html'
+
+
+class TimeSlotDetailViewV2(DetailView):
+    queryset = TimeSlot.objects.all()
+    template_name = 'v2/timeslot_detail.html'
+
+
+class RecommendationsListViewV2(ListView):
+    context_object_name = 'recommendation_list'
+    template_name = 'v2/recommendation_list.html'
+
+    now = datetime.now()
+    end = now + timedelta(weeks=1)
+
+    queryset = TimeSlot.objects.filter(Q(note__isnull=False, note__status=1,
+                                         start__range=(now, end)) |
+                                       Q(show__broadcastformat__slug='sondersendung',
+                                         start__range=(now, end))).order_by('start')[:20]
+
+
+class RecommendationsBoxViewV2(RecommendationsListView):
+    template_name = 'v2/boxes/recommendation.html'
+
+
+class DayScheduleViewV2(TemplateView):
+    template_name = 'v2/day_schedule.html'
+
+    def get_context_data(self, **kwargs):
+        year = self.kwargs.get('year', None)
+        month = self.kwargs.get('month', None)
+        day = self.kwargs.get('day', None)
+
+        if year is None and month is None and day is None:
+            today = datetime.combine(date.today(), time(6, 0))
+        else:
+            today = datetime.strptime('%s__%s__%s__06__00' % (year, month, day), '%Y__%m__%d__%H__%M')
+
+        tomorrow = today + timedelta(days=1)
+
+        context = super(DayScheduleViewV2, self).get_context_data(**kwargs)
+        context['day'] = today
+        context['recommendations'] = Note.objects.filter(status=1, timeslot__start__range=(today, tomorrow))
+        context['default_show'] = Show.objects.get(pk=1)
+
+        timeslots = TimeSlot.objects.get_day_timeslots(today)
+
+        if 'broadcastformat' in self.request.GET:
+            broadcastformat = get_object_or_404(BroadcastFormat, slug=self.request.GET['broadcastformat'])
+            context['timeslots'] = timeslots.filter(show__broadcastformat=broadcastformat)
+        elif 'musicfocus' in self.request.GET:
+            musicfocus = get_object_or_404(MusicFocus, slug=self.request.GET['musicfocus'])
+            context['timeslots'] = timeslots.filter(show__musicfocus=musicfocus)
+        elif 'showinformation' in self.request.GET:
+            showinformation = get_object_or_404(ShowInformation, slug=self.request.GET['showinformation'])
+            context['timeslots'] = timeslots.filter(show__showinformation=showinformation)
+        elif 'showtopic' in self.request.GET:
+            showtopic = get_object_or_404(ShowTopic, slug=self.request.GET['showtopic'])
+            context['showtopic'] = timeslots.filter(show__showtopic=showtopic)
+        elif 'language' in self.request.GET:
+            language = get_object_or_404(Language, slug=self.request.GET['language'])
+            context['showtopic'] = timeslots.filter(show__language=language)
+        else:
+            context['timeslots'] = timeslots
+        return context
+
+
+class CurrentShowBoxViewV2(TemplateView):
+    context_object_name = 'recommendation_list'
+    template_name = 'v2/boxes/current.html'
+
+    def get_context_data(self, **kwargs):
+        current_timeslot = TimeSlot.objects.get_or_create_current()
+        previous_timeslot = current_timeslot.get_previous_by_start()
+        next_timeslot = current_timeslot.get_next_by_start()
+        after_next_timeslot = next_timeslot.get_next_by_start()
+
+        context = super(CurrentShowBoxViewV2, self).get_context_data(**kwargs)
+        context['current_timeslot'] = current_timeslot
+        context['previous_timeslot'] = previous_timeslot
+        context['next_timeslot'] = next_timeslot
+        context['after_next_timeslot'] = after_next_timeslot
+        return context
+
+
+# Exports
+
 def json_day_schedule(request, year=None, month=None, day=None):
     if year is None and month is None and day is None:
         today = datetime.combine(date.today(), time(0, 0))
-- 
cgit v0.10.2