]> git.0d.be Git - panikdb.git/blobdiff - panikdb/templates/emissions/episode_detail.html
allow staff to remove diffusions already in soma
[panikdb.git] / panikdb / templates / emissions / episode_detail.html
index 6ce86fd2b51b0a5c143daae8ac484ff1f8abe208..182119088d028bdec1ad28f7e2250c7b623788a4 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
-{% load soundfiles panikdbtags %}
+{% load soundfiles panikdbtags nonstop %}
 {% block appbar %}
 <h2>{{ episode.emission.title }} — {{ episode.title }}</h2>
 <span><a href="../">Retourner à l'émission</a></span>
@@ -9,10 +9,23 @@
 
 {% if can_manage %}
 <p>
-<a class="big-friendly-button" href="edit/">Modifier</a>
-<a class="big-friendly-button" id="add-diffusion-link" href="#">Ajouter une diffusion</a>
-<a class="big-friendly-button" id="add-soundfile-link" href="#">Ajouter un son</a>
-<a class="big-friendly-button actually-not-that-friendly" href="delete/">Supprimer</a>
+<a class="button" href="edit/">Modifier</a>
+{% if perms.emissions.add_diffusion %}
+<a class="button" href="add-diffusion" rel="popup">Ajouter une diffusion</a>
+{% endif %}
+<a class="button" href="add-soundfile" rel="popup">Ajouter un son</a>
+{% if episode.effective_start and episode.effective_end %}
+  {% if internal_ip %}
+  <a class="button" id="download-recording" download href="{{ episode.get_pige_download_url }}">Télécharger l'enregistrement</a>
+  {% endif %}
+{% elif not soundfiles and 0 %}
+  {% if episode.effective_start %}
+    <a class="button" id="stop-recording" href="stop">Arrêter l'enregistrement</a>
+  {% else %}
+    <a class="button" id="start-recording" href="start">Démarrer l'enregistrement</a>
+  {% endif %}
+{% endif %}
+<a class="button actually-not-that-friendly" href="delete/" rel="popup">Supprimer</a>
 </p>
 {% endif %}
 
@@ -28,6 +41,7 @@
 </div>
 {% endif %}
 
+<div class="bo-block">
 {% if episode.text %}
 <div class="text">
 {{ episode.text|safe }}
@@ -42,29 +56,44 @@ Tags :
 {% endfor %}
 </p>
 {% endif %}
+</div>
 
 
+<div class="bo-block">
 <h3>Diffusions</h3>
 
+{% now "Y-m-d H:i" as now %}
+
 <ul>
 {% for diffusion in diffusions %}
 <li>{{ diffusion.datetime }}
-{% if can_manage %}
+{% if can_manage and perms.emissions.delete_diffusion and not diffusion|is_already_in_soma %}
 <a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
 {% endif %}
+{% if diffusion.datetime|date:"Y-m-d H:i" > now and has_soma %}
+  {% if soundfiles|integral and perms.nonstop.add_track %}
+  {% if not diffusion|is_already_in_soma %}
+  <a href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer dans soma]</a>
+  {% else %}
+  (diffusion déjà programmée dans soma)
+  {% if user.is_staff %}<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>{% endif %}
+  {% endif %}
+  {% endif %}
+  {% if not soundfiles|integral and perms.nonstop.add_streameddiffusion %}
+    {% if not diffusion|is_already_in_soma %}
+    <a rel="popup" href="{% url 'nonstop-add-streamed-diffusion' pk=diffusion.id %}">[programmer stream dans soma]</a>
+    {% else %}
+    (stream déjà programmé dans soma)
+    {% if user.is_staff %}<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>{% endif %}
+    {% endif %}
+  {% endif %}
+{% endif %}
 </li>
 {% endfor %}
 </ul>
+</div>
 
-<form id="add-diffusion-form" action="add-diffusion" method="POST" style="display: none;">
-{% csrf_token %}
-{{ add_diffusion_form.as_p }}
-<input type="submit" value="Ajouter cet horaire"/>
-<button class="cancel">Annuler</button>
-</form>
-
-
-
+<div class="bo-block">
 <h3>Sons</h3>
 
 <table id="soundfiles">
@@ -72,9 +101,11 @@ Tags :
 <tr>
  <th>Fichier</th>
  <th>Titre</th>
+ <th>Durée</th>
  <th>Format</th>
  <th>Podcastable?</th>
  <th>Fragment?</th>
+ <th>Nb d'écoutes</th>
  {% if can_manage %}<th>Modifier</th>{% endif %}
  {% if can_manage %}<th>Supprimer</th>{% endif %}
  {% if perms.emissions.add_focus %}<th>Focus</th>{% endif %}
@@ -84,32 +115,30 @@ Tags :
 <tr>
 <td><a href="{{ soundfile.file.url }}">{{ soundfile|sound_filename }}</a></td>
 <td>{{ soundfile.title }}</td>
+<td>{{ soundfile.duration|as_duration }}</td>
 <td>{% if soundfile.format %}{{ soundfile.format }}{% else %}-{% endif %}</td>
 <td>{% if soundfile.podcastable %}oui{% else %}non{% endif %}</td>
 <td>{% if soundfile.fragment %}oui{% else %}non{% endif %}</td>
+<td>{{ soundfile|nb_visits }}</td>
 {% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/"
-               class="icon-edit" title="Modifier"></a></td>{% endif %}
+               class="icon-edit" rel="popup" title="Modifier"></a></td>{% endif %}
 {% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/remove"
-               class="icon-remove-sign" title="Retirer"></a></td>{% endif %}
+               class="icon-remove-sign" rel="popup" title="Retirer"></a></td>{% endif %}
 {% if perms.emissions.add_focus %}
 <td>
-{% if soundfile.has_focus %}
+{% if soundfile|has_focus %}
 ✓ <a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a>
 {% else %}
-<a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
+  {% if soundfile.format %}
+  <a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
+  {% endif %}
 {% endif %}
 </td>
 {% endif %}
 {% endfor %}
 </tbody>
 </table>
-
-<form id="add-soundfile-form" action="add-soundfile" method="POST" style="display: none;">
-{% csrf_token %}
-{{ add_soundfile_form.as_p }}
-<input type="submit" value="Ajouter ce son"/>
-<button class="cancel">Annuler</button>
-</form>
+</div>
 
 {% endblock %}
 
@@ -117,17 +146,6 @@ Tags :
 {% block page-end %}
 <script>
 $(function() {
-  $('#add-soundfile-link').click(
-    function() {
-      $('#id_title').parent().hide();
-      $('#add-soundfile-form').dialog({modal: true, title: 'Son', width: 'auto'});
-    });
-
-  $('#add-diffusion-link').click(
-    function() {
-      $('#add-diffusion-form').dialog({modal: true, title: 'Horaire', width: 'auto'});
-    });
-
   $('.image img').click(function() { $(this).toggleClass('large'); });
 
   $('#id_fragment').change(function() {
@@ -138,10 +156,6 @@ $(function() {
     }
   });
 
-  $('button.cancel').click(function() {
-    $(this).parent().dialog('close');
-    return false;
-  });
 });
 </script>
 {% endblock %}