]> git.0d.be Git - panikdb.git/blobdiff - panikdb/templates/emissions/episode_detail.html
limit possibility to stream to first diffusion
[panikdb.git] / panikdb / templates / emissions / episode_detail.html
index 48a6aa1a295a94cc41f406cdbce0d91d2aaac9eb..cdd48cae02a102f22d24da9967155de312c9606d 100644 (file)
@@ -18,7 +18,7 @@
   {% 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 %}
+{% elif not soundfiles and 0 %}
   {% if episode.effective_start %}
     <a class="button" id="stop-recording" href="stop">Arrêter l'enregistrement</a>
   {% else %}
@@ -41,6 +41,7 @@
 </div>
 {% endif %}
 
+<div class="bo-block">
 {% if episode.text %}
 <div class="text">
 {{ episode.text|safe }}
@@ -55,33 +56,44 @@ Tags :
 {% endfor %}
 </p>
 {% endif %}
+</div>
 
 
+<div class="bo-block">
 <h3>Diffusions</h3>
 
-{% now "Y-m-d H:i" as now %}
+{% now "Y-m-d H:i" as s_now %}
 
 <ul>
 {% for diffusion in diffusions %}
 <li>{{ diffusion.datetime }}
-{% 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 soundfiles|integral and perms.nonstop.add_track and diffusion.datetime|date:"Y-m-d H:i" > now %}
-  {% if has_soma %}
-  {% if not diffusion|is_already_in_soma %}
-  <a href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer dans soma]</a>
+
+{% if has_soma and diffusion|is_already_in_soma %}
+  {% if soundfiles|integral %}(diffusion programmée dans soma)
   {% else %}
-  (diffusion déjà programmée dans soma)
-  <!-- diffusion/{{ diffusion.id }}/remove -->
+    (stream programmé dans soma)
+    {% if can_manage and perms.nonstop.add_streameddiffusion and diffusion.end_datetime|date:"Y-m-d H:i" > s_now %}
+    <a href="{% url 'nonstop-del-streamed-diffusion' pk=diffusion.id %}">[supprimer stream dans soma]</a>
+    {% endif %}
   {% endif %}
+  {# removal limited to staff as this will not remove from soma #}
+  {% if user.is_staff %}<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>{% endif %}
+{% elif can_manage %}
+  {% if has_soma and diffusion.datetime|date:"Y-m-d H:i" > s_now %}
+    {% if soundfiles|integral and perms.nonstop.add_track %}
+    <a rel="popup" href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer dans soma]</a>
+    {% elif forloop.first and not soundfiles|integral and perms.nonstop.add_streameddiffusion %}
+    <a rel="popup" href="{% url 'nonstop-add-streamed-diffusion' pk=diffusion.id %}">[programmer stream dans soma]</a>
+    {% endif %}
   {% endif %}
+  <a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
 {% endif %}
 </li>
 {% endfor %}
 </ul>
+</div>
 
-
+<div class="bo-block">
 <h3>Sons</h3>
 
 <table id="soundfiles">
@@ -126,6 +138,7 @@ Tags :
 {% endfor %}
 </tbody>
 </table>
+</div>
 
 {% endblock %}
 
@@ -143,6 +156,19 @@ $(function() {
     }
   });
 
+  $(document).on('gadjo:dialog-loaded', function(e, form) {
+    var $select = $('select#id_jingle');
+    var audio = null;
+    $select.css('width', '80%').css('margin-right', '1em').after('<button id="play-jingle">⏵</button>');
+    $('#play-jingle').on('click', function() {
+      var val = $select.val();
+      if (audio) { audio.pause(); }
+      audio = new Audio('/nonstop/api/jingle/' + val + '/');
+      audio.play();
+      return false;
+    });
+  });
+
 });
 </script>
 {% endblock %}