<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 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 rel="popup" 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)
- {% if user.is_staff %}<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>{% endif %}
- {% endif %}
+ (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 %}
- {% if not soundfiles|integral and perms.nonstop.add_streameddiffusion %}
- {% if not diffusion|is_already_in_soma %}
+ {# 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 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>
- {% 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 %}
+ <a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
{% endif %}
</li>
{% endfor %}