forked from ScoDoc/ScoDoc
Bug fix: accès aux fichiers justificatifs
This commit is contained in:
parent
a4fbc2b80e
commit
99b182e1c7
@ -24,7 +24,6 @@ from app.models import (
|
|||||||
Justificatif,
|
Justificatif,
|
||||||
Departement,
|
Departement,
|
||||||
FormSemestre,
|
FormSemestre,
|
||||||
FormSemestreInscription,
|
|
||||||
)
|
)
|
||||||
from app.models.assiduites import (
|
from app.models.assiduites import (
|
||||||
compute_assiduites_justified,
|
compute_assiduites_justified,
|
||||||
@ -647,15 +646,16 @@ def justif_import(justif_id: int = None):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"])
|
@bp.route("/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"])
|
||||||
@api_web_bp.route("/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"])
|
@api_web_bp.route(
|
||||||
|
"/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"]
|
||||||
|
)
|
||||||
@scodoc
|
@scodoc
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required(Permission.AbsChange)
|
@permission_required(Permission.AbsJustifView)
|
||||||
def justif_export(justif_id: int = None, filename: str = None):
|
def justif_export(justif_id: int | None = None, filename: str | None = None):
|
||||||
"""
|
"""
|
||||||
Retourne un fichier d'une archive d'un justificatif
|
Retourne un fichier d'une archive d'un justificatif
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# On récupère le justificatif concerné
|
# On récupère le justificatif concerné
|
||||||
query: Query = Justificatif.query.filter_by(id=justif_id)
|
query: Query = Justificatif.query.filter_by(id=justif_id)
|
||||||
if g.scodoc_dept:
|
if g.scodoc_dept:
|
||||||
|
@ -13,11 +13,17 @@
|
|||||||
{% else%}
|
{% else%}
|
||||||
{% include "assiduites/widgets/tableau_actions/details.j2" %}
|
{% include "assiduites/widgets/tableau_actions/details.j2" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br>
|
|
||||||
<hr>
|
|
||||||
<br>
|
|
||||||
<a href="" id="lien-retour">Retour</a>
|
|
||||||
|
|
||||||
|
{% if not current_user.has_permission(sco.Permission.AbsJustifView)%}
|
||||||
|
<div class="help fontred" style="margin-top: 16px;">
|
||||||
|
Vous n'avez pas la permission d'ouvrir les fichiers justificatifs
|
||||||
|
déposés par d'autres personnes.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div style="margin-top: 32px;">
|
||||||
|
<a href="" id="lien-retour">retour</a>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
document.getElementById("lien-retour").href = document.referrer;
|
document.getElementById("lien-retour").href = document.referrer;
|
||||||
|
@ -90,10 +90,14 @@
|
|||||||
<div>Total : {{objet.justification.fichiers.total}} </div>
|
<div>Total : {{objet.justification.fichiers.total}} </div>
|
||||||
<ul>
|
<ul>
|
||||||
{% for filename in objet.justification.fichiers.filenames %}
|
{% for filename in objet.justification.fichiers.filenames %}
|
||||||
<li><a
|
<li>
|
||||||
href="{{url_for('api.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}">{{filename}}</a>
|
<a
|
||||||
|
href="{{url_for('apiweb.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}">{{filename}}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if not objet.justification.fichiers.filenames %}
|
||||||
|
<li class="fontred">fichiers non visibles</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text">Aucun</span>
|
<span class="text">Aucun</span>
|
||||||
|
@ -53,7 +53,7 @@ Actuellement noté{{etud.e}} en <b>{{objet_name|lower()}}</b> du {{objet.date_de
|
|||||||
<li data-id="{{filename}}">
|
<li data-id="{{filename}}">
|
||||||
<a data-file="{{filename}}">❌</a>
|
<a data-file="{{filename}}">❌</a>
|
||||||
<a data-link=""
|
<a data-link=""
|
||||||
href="{{url_for('api.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}"><span
|
href="{{url_for('apiweb.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}"><span
|
||||||
data-file="{{filename}}">{{filename}}</span></a>
|
data-file="{{filename}}">{{filename}}</span></a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.6.66"
|
SCOVERSION = "9.6.67"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user