<p>
<a class="button" href="edit/">Modifier</a>
{% if perms.emissions.add_diffusion %}
-<a class="button" id="add-diffusion-link" href="#">Ajouter une diffusion</a>
+<a class="button" href="add-diffusion" rel="popup">Ajouter une diffusion</a>
{% endif %}
-<a class="button" id="add-soundfile-link" href="#">Ajouter un son</a>
+<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 %}
+{% 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/">Supprimer</a>
+<a class="button actually-not-that-friendly" href="delete/" rel="popup">Supprimer</a>
</p>
{% endif %}
</div>
{% endif %}
+<div class="bo-block">
{% if episode.text %}
<div class="text">
{{ episode.text|safe }}
{% 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 %}
-<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
-{% endif %}
-{% if soundfiles and perms.nonstop.add_track and diffusion.datetime|date:"Y-m-d H:i" > now and 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 %}
+ (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-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-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>
-<form id="add-diffusion-form" action="add-diffusion" method="POST" style="display: none;">
-{% csrf_token %}
-{{ add_diffusion_form.as_p }}
-<button>Ajouter cet horaire</button>
-<button class="cancel">Annuler</button>
-</form>
-
-
-
+<div class="bo-block">
<h3>Sons</h3>
<table id="soundfiles">
<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 %}
{% if soundfile.format %}
{% endfor %}
</tbody>
</table>
-
-<form id="add-soundfile-form" action="add-soundfile" method="POST" style="display: none;">
-{% csrf_token %}
-{{ add_soundfile_form.as_p }}
-<button>Ajouter ce son</button>
-<button class="cancel">Annuler</button>
-</form>
+</div>
{% endblock %}
{% 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() {
}
});
- $('button.cancel').click(function() {
- $(this).parent().dialog('close');
- return false;
+ $(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 %}