New lock/unlock svg icons

This commit is contained in:
Emmanuel Viennet 2025-01-10 21:00:45 +01:00
parent df22198880
commit d8511d0488
9 changed files with 125 additions and 85 deletions

View File

@ -100,9 +100,13 @@ def formsemestre_editwithmodules(formsemestre_id: int):
H = []
if not formsemestre.etat:
H.append(
f"""<p>{scu.icontag(
"lock_img", border="0", title="Semestre verrouillé")
}<b>Ce semestre est verrouillé.</b></p>"""
f"""<p>
<span style="margin-right: 8px;">
{
scu.icontag("lock_25", file_format="svg", border="0",
height="64px", title="Semestre verrouillé")
}
</span><b>Ce semestre est verrouillé.</b></p>"""
)
else:
r = do_formsemestre_createwithmodules(edit=True, formsemestre=formsemestre)

View File

@ -479,35 +479,6 @@ def formsemestre_status_menubar(formsemestre: FormSemestre | None) -> str:
)
# Element HTML decrivant un semestre (barre de menu et infos)
def formsemestre_page_title(formsemestre_id=None):
"""Element HTML decrivant un semestre (barre de menu et infos)
Cherche dans la requete si un semestre est défini
via (formsemestre_id ou moduleimpl ou evaluation ou group)
"""
formsemestre_id = (
formsemestre_id
if formsemestre_id is not None
else retreive_formsemestre_from_request()
)
#
if not formsemestre_id:
return ""
try:
formsemestre_id = int(formsemestre_id)
except ValueError:
log(f"formsemestre_id: invalid type {formsemestre_id:r}")
return ""
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
return render_template(
"formsemestre_page_title.j2",
formsemestre=formsemestre,
scu=scu,
sem_menu_bar=formsemestre_status_menubar(formsemestre),
)
# ---------
# ancienne fonction ScoDoc7 à supprimer lorsqu'on utilisera les modèles
# utilisé seulement par export Apogée

View File

@ -1549,11 +1549,17 @@ ICONSIZES = {} # name : (width, height) cache image sizes
def icontag(name, file_format="png", no_size=False, **attrs):
"""tag HTML pour un icone.
(dans les versions anterieures on utilisait Zope)
Les icones sont des fichiers PNG dans .../static/icons
Les icones sont des fichiers PNG ou SVG dans .../static/icons
Si la taille (width et height) n'est pas spécifiée, lit l'image
pour la mesurer (et cache le résultat).
Si no_size, n'indique pas width / height dans l'élément html généré.
Pour les images SVG, width ou height doivent être spécifiés.
"""
if (not no_size) and (("width" not in attrs) or ("height" not in attrs)):
if (
file_format != "svg"
and (not no_size)
and (("width" not in attrs) or ("height" not in attrs))
):
if name not in ICONSIZES:
img_file = os.path.join(
Config.SCODOC_DIR,

View File

@ -1742,8 +1742,8 @@ formsemestre_page_title .eye img {
formsemestre_page_title .lock img {
display: inline-block;
vertical-align: middle;
margin-bottom: 5px;
padding-right: 5px;
margin-left: 8px;
margin-right: 8px;
}
#formnotes .tf-explanation {

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 1054.286 1456.4419"
xml:space="preserve"
width="1054.286"
height="1456.4419"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs5"><clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath5"><rect
style="opacity:0.44;fill:#800000;stroke-width:0.847964"
id="rect6"
width="1072.9879"
height="1481.1898"
x="248.80879"
y="264.35934" /></clipPath><clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath6"><rect
style="opacity:0.44;fill:#800000;stroke-width:0.847964"
id="rect7"
width="1072.9879"
height="1481.1898"
x="248.80879"
y="264.35934" /></clipPath><clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath7"><rect
style="opacity:0.44;fill:#800000;stroke-width:0.847964"
id="rect8"
width="1072.9879"
height="1481.1898"
x="248.80879"
y="264.35934" /></clipPath></defs>
<path
style="fill:#cfd8dd"
d="m 533.44444,997.90814 v -342.348 c 0,-142.441 116.537,-260.838 258.978,-260.647 142.446,0.191 257.39976,116.13869 258.27496,258.625 l 1.8054,293.92884 c 0.1976,32.1664 66.6107,-190.12414 56.4386,-159.60784 l -46.6516,139.95495 c -10.1721,30.51629 104.8956,63.33866 104.8956,31.17166 V 653.53814 c 0,-50.614 -9.926,-99.746 -29.502,-146.029 -18.896,-44.675 -45.935,-84.785 -80.366,-119.217 -34.432,-34.431 -74.54196,-61.471 -119.21696,-80.366 -46.283,-19.577 -95.415,-29.503 -146.029,-29.503 -50.615,0 -99.746,9.926 -146.03,29.503 -44.675,18.896 -84.786,45.935 -119.217,80.366 -34.43,34.43 -61.469,74.541 -80.366,119.217 -19.576,46.283 -29.503,95.414 -29.503,146.029 v 344.371 h 116.489 z"
id="path1"
clip-path="url(#clipPath7)"
transform="translate(-256,-278.42314)" /><path
style="fill:#f7e07f"
d="M 1270.286,1734.865 H 296 c -22.091,0 -40,-17.909 -40,-40 v -725.47 c 0,-22.091 17.909,-40 40,-40 h 974.286 c 22.091,0 40,17.909 40,40 v 725.47 c 0,22.092 -17.909,40 -40,40 z"
id="path2"
clip-path="url(#clipPath6)"
transform="translate(-256,-278.42314)" /><g
id="g3"
style="fill:#800000"
clip-path="url(#clipPath5)"
transform="translate(-256,-278.42314)">
<path
style="fill:#800000"
d="m 832.62,1351.039 v 159.303 h -98.955 v -159.303 c -32.911,-17.655 -55.285,-52.398 -55.285,-92.36 0,-57.861 46.902,-104.762 104.762,-104.762 57.861,0 104.762,46.901 104.762,104.762 10e-4,39.962 -22.373,74.706 -55.284,92.36 z"
id="path3" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 1535.999 1421.73"
xml:space="preserve"
width="1535.999"
height="1421.73"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs5" />
<g
id="g5"
transform="translate(-256,-313.135)">
<path
style="fill:#cfd8dd"
d="M 1158.258,1032.62 V 690.272 c 0,-142.441 116.537,-260.838 258.978,-260.647 142.446,0.191 258.275,116.136 258.275,258.625 v 76.077 c 0,32.167 26.077,58.244 58.244,58.244 v 0 c 32.167,0 58.244,-26.077 58.244,-58.244 V 688.25 c 0,-50.614 -9.926,-99.746 -29.502,-146.029 -18.896,-44.675 -45.935,-84.785 -80.366,-119.217 -34.432,-34.431 -74.542,-61.471 -119.217,-80.366 -46.283,-19.577 -95.415,-29.503 -146.029,-29.503 -50.615,0 -99.746,9.926 -146.03,29.503 -44.675,18.896 -84.786,45.935 -119.217,80.366 -34.43,34.43 -61.469,74.541 -80.366,119.217 -19.576,46.283 -29.503,95.414 -29.503,146.029 v 344.371 h 116.489 z"
id="path1" />
<g
id="g4">
<path
style="fill:#f7e07f"
d="M 1270.286,1734.865 H 296 c -22.091,0 -40,-17.909 -40,-40 v -725.47 c 0,-22.091 17.909,-40 40,-40 h 974.286 c 22.091,0 40,17.909 40,40 v 725.47 c 0,22.092 -17.909,40 -40,40 z"
id="path2" />
<g
id="g3">
<path
style="fill:#ebcd6d"
d="m 832.62,1351.039 v 159.303 h -98.955 v -159.303 c -32.911,-17.655 -55.285,-52.398 -55.285,-92.36 0,-57.861 46.902,-104.762 104.762,-104.762 57.861,0 104.762,46.901 104.762,104.762 10e-4,39.962 -22.373,74.706 -55.284,92.36 z"
id="path3" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -24,10 +24,14 @@
<span class="nbinscrits"><a class="discretelink" href="{{url_for('scolar.groups_lists', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.formsemestre.id)}}">{{sco.formsemestre.inscriptions|length}} inscrits</a></span>
<span class="lock">
{% if not sco.formsemestre.etat %}<a href="{{url_for('notes.formsemestre_flip_lock', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.formsemestre.id)}}">{{scu.icontag("lock_img", border="0", title="Semestre
verrouillé")|safe}}</a>
{% endif %}
<a href="{{
url_for('notes.formsemestre_flip_lock', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.formsemestre.id)
}}">{{
(scu.icontag("lock_25_open", file_format="svg", border="0", height="20px", title="Semestre déverrouillé")
if sco.formsemestre.etat else scu.icontag("lock_25", file_format="svg", border="0", height="20px", title="Semestre verrouillé"))
|safe
}}</a>
</span>
<span class="eye">
{% if not scu.is_passerelle_disabled() %}

View File

@ -1,44 +0,0 @@
{# -*- mode: jinja-html -*- #}
{# Element HTML decrivant un semestre (barre de menu et infos) #}
{# was formsemestre_page_title #}
<div class="formsemestre_page_title noprint">
<div class="infos">
<span class="semtitle"><a class="stdlink" title="{{formsemestre.session_id()}}" href="{{url_for('notes.formsemestre_status',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id)}}">{{formsemestre.titre}}</a>
{%- if formsemestre.semestre_id != -1 -%}
<a title="{{formsemestre.etapes_apo_str()
}}">, {{
formsemestre.formation.get_cursus().SESSION_NAME}}
{{formsemestre.semestre_id}}</a>
{%- endif -%}
{%- if formsemestre.modalite %} en {{formsemestre.modalite}}
{%- endif %}</span><span class="dates"><a title="du {{formsemestre.date_debut.strftime('%d/%m/%Y')}}
au {{formsemestre.date_fin.strftime('%d/%m/%Y')}} ">{{formsemestre.mois_debut()}} -
{{formsemestre.mois_fin()}}</a></span><span class="resp"><a
title="{{formsemestre.responsables_str(abbrev_prenom=False)}}">{{formsemestre.responsables_str()}}</a></span><span
class="nbinscrits"><a class="discretelink" href="{{url_for('scolar.groups_lists',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id)
}}">{{formsemestre.etuds_inscriptions|length}} inscrits</a></span><span class="lock">
{%-if not formsemestre.etat -%}
<a href="{{ url_for( 'notes.formsemestre_flip_lock',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id )}}">{{
scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe
}}</a>
{%- endif -%}
</span>
{%-if not scu.is_passerelle_disabled()-%}
<span class="eye"><a href="{{
url_for('notes.formsemestre_change_publication_bul',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id )
}}">{%-
if formsemestre.bul_hide_xml -%}
{{scu.ICON_HIDDEN|safe}}
{%- else -%}
{{scu.ICON_PUBLISHED|safe}}
{%- endif -%}
</a></span>
{%- endif -%}
</div>
{{sem_menu_bar|safe}}
</div>

View File

@ -25,7 +25,8 @@
</button>
</form>
{% else %}
{{ scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe }}
{{ scu.icontag("lock_25", file_format="svg", border="0",
height="20px", title="Semestre verrouillé")|safe }}
{% endif %}
{% endif %}
</summary>