Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
dcbf4f32
Commit
dcbf4f32
authored
10 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
sco_inscr_passage: refactoring
parent
28e794c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/scodoc/sco_inscr_passage.py
+126
-83
126 additions, 83 deletions
app/scodoc/sco_inscr_passage.py
with
126 additions
and
83 deletions
app/scodoc/sco_inscr_passage.py
+
126
−
83
View file @
dcbf4f32
...
...
@@ -625,25 +625,52 @@ def etuds_select_boxes(
for
src_cat
in
auth_etuds_by_cat
.
keys
():
infos
=
auth_etuds_by_cat
[
src_cat
][
"
infos
"
]
infos
[
"
comment
"
]
=
infos
.
get
(
"
comment
"
,
""
)
# commentaire dans sous-titre boite
help_txt
=
infos
.
get
(
"
help
"
,
""
)
etuds
=
auth_etuds_by_cat
[
src_cat
][
"
etuds
"
]
etuds
.
sort
(
key
=
itemgetter
(
"
nom
"
))
with_checkbox
=
(
not
read_only
)
and
auth_etuds_by_cat
[
src_cat
][
"
infos
"
].
get
(
"
with_checkbox
"
,
True
)
checkbox_name
=
auth_etuds_by_cat
[
src_cat
][
"
infos
"
].
get
(
"
checkbox_name
"
,
"
etuds
"
)
etud_key
=
auth_etuds_by_cat
[
src_cat
][
"
infos
"
].
get
(
"
etud_key
"
,
"
etudid
"
)
if
etuds
or
show_empty_boxes
:
infos
[
"
nbetuds
"
]
=
len
(
etuds
)
xls_url
=
(
scu
.
build_url_query
(
base_url
,
export_cat_xls
=
src_cat
)
if
base_url
and
etuds
else
""
)
H
.
append
(
"""
<div class=
"
pas_sembox
"
id=
"
%(id)s
"
>
<div class=
"
pas_sembox_title
"
><a href=
"
%(title_target)s
"
"""
%
infos
etuds_select_box
(
etuds
,
infos
,
with_checkbox
=
with_checkbox
,
sel_inscrits
=
sel_inscrits
,
xls_url
=
xls_url
,
inscrits_ailleurs
=
inscrits_ailleurs
,
)
)
H
.
append
(
"
</div>
"
)
return
"
\n
"
.
join
(
H
)
def
etuds_select_box
(
etuds
:
list
[
dict
],
infos
:
dict
,
with_checkbox
:
bool
=
True
,
sel_inscrits
:
bool
=
True
,
xls_url
:
str
=
""
,
inscrits_ailleurs
:
set
=
None
,
)
->
str
:
"""
HTML pour une
"
boite
"
avec une liste d
'
étudiants à sélectionner
"""
inscrits_ailleurs
=
inscrits_ailleurs
or
{}
box_id
=
infos
[
"
id
"
]
H
=
[]
H
.
append
(
f
"""
<div class=
"
pas_sembox
"
id=
"
{
box_id
}
"
>
<div class=
"
pas_sembox_title
"
><a href=
"
{
infos
[
'
title_target
'
]
}
"
"""
)
help_txt
=
infos
.
get
(
"
help
"
)
if
help_txt
:
# bubble
H
.
append
(
'
title=
"
%s
"'
%
help_txt
)
H
.
append
(
f
'
title=
"
{
help_txt
}
"'
)
H
.
append
(
"""
>%(title)s</a></div>
<div class=
"
pas_sembox_subtitle
"
>(%(nbetuds)d étudiants%(comment)s)
"""
...
...
@@ -651,45 +678,64 @@ def etuds_select_boxes(
)
if
with_checkbox
:
H
.
append
(
"""
(Select.
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select(
'
%(id)s
'
, true);
"
>tous</a>
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select(
'
%(id)s
'
, false );
"
>aucun</a>
"""
# "
%
infos
f
"""
(Select.
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select(
'
{
box_id
}
'
, true);
"
>tous</a>
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select(
'
{
box_id
}
'
, false );
"
>aucun</a>
"""
)
if
sel_inscrits
:
H
.
append
(
"""
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select_inscrits(
'
%(id)s
'
);
"
>inscrits</a>
"""
%
infos
f
"""
<a href=
"
#
"
class=
"
stdlink
"
onclick=
"
sem_select_inscrits(
'
{
box_id
}
'
);
"
>inscrits</a>
"""
)
if
with_checkbox
or
sel_inscrits
:
H
.
append
(
"
)
"
)
if
base_url
and
etuds
:
url
=
scu
.
build_url_query
(
base_url
,
export_cat_xls
=
src_cat
)
H
.
append
(
f
'
<a href=
"
{
url
}
"
>
{
scu
.
ICON_XLS
}
</a>
'
)
if
xls_url
:
H
.
append
(
f
'
<a href=
"
{
xls_url
}
"
>
{
scu
.
ICON_XLS
}
</a>
'
)
H
.
append
(
"
</div>
"
)
for
etud
in
etuds
:
if
etud
.
get
(
"
inscrit
"
,
False
):
c
=
"
deja-inscrit
"
checked
=
'
checked=
"
checked
"'
else
:
checked
=
""
if
etud
[
"
etudid
"
]
in
inscrits_ailleurs
:
c
=
"
inscrit-ailleurs
"
else
:
c
=
""
sco_etud
.
format_etud_ident
(
etud
)
is_inscrit
=
etud
.
get
(
"
inscrit
"
,
False
)
extra_class
=
(
"
deja-inscrit
"
if
is_inscrit
else
(
"
inscrit-ailleurs
"
if
etud
[
"
etudid
"
]
in
inscrits_ailleurs
else
""
)
)
H
.
append
(
_etud_row
(
etud
,
with_checkbox
=
with_checkbox
,
checkbox_name
=
infos
.
get
(
"
checkbox_name
"
,
"
etuds
"
),
etud_key
=
infos
.
get
(
"
etud_key
"
,
"
etudid
"
),
is_inscrit
=
is_inscrit
,
extra_class
=
extra_class
,
)
)
H
.
append
(
"
</div>
"
)
return
"
\n
"
.
join
(
H
)
def
_etud_row
(
etud
:
dict
,
with_checkbox
:
bool
=
True
,
checkbox_name
:
str
=
"
etuds
"
,
etud_key
:
str
=
""
,
is_inscrit
:
bool
=
False
,
extra_class
:
str
=
""
,
)
->
str
:
"""
HTML
'
row
'
for this etud
"""
H
=
[]
nomprenom
=
scu
.
format_nomprenom
(
etud
)
if
etud
[
"
etudid
"
]:
elink
=
f
"""
<a id=
"
{
etud
[
'
etudid
'
]
}
"
class=
"
discretelink etudinfo
{
c
}
"
elink
=
f
"""
<a id=
"
{
etud
[
'
etudid
'
]
}
"
class=
"
discretelink etudinfo
{
extra_class
}
"
href=
"
{
url_for
(
'
scolar.fiche_etud
'
,
scodoc_dept
=
g
.
scodoc_dept
,
etudid
=
etud
[
'
etudid
'
],
)
}
"
>
{
etud
[
'
nomprenom
'
]
}
</a>
}
"
>
{
nomprenom
}
</a>
"""
else
:
# ce n'est pas un etudiant ScoDoc
elink
=
etud
[
"
nomprenom
"
]
elink
=
nomprenom
if
etud
.
get
(
"
datefinalisationinscription
"
,
None
):
elink
+=
(
...
...
@@ -702,24 +748,21 @@ def etuds_select_boxes(
if
not
etud
.
get
(
"
paiementinscription
"
,
True
):
elink
+=
'
<span class=
"
paspaye
"
> (non paiement)</span>
'
H
.
append
(
"""
<div class=
"
pas_etud
%s
"
>
"""
%
c
)
H
.
append
(
f
"""
<div class=
"
pas_etud
{
extra_class
}
"
>
"""
)
if
"
etape
"
in
etud
:
etape_str
=
etud
[
"
etape
"
]
or
""
else
:
etape_str
=
""
H
.
append
(
"""
<span class=
"
sp_etape
"
>
%s</span>
"""
%
etape_str
)
H
.
append
(
f
"""
<span class=
"
sp_etape
"
>
{
etape_str
}
</span>
"""
)
if
with_checkbox
:
H
.
append
(
"""
<input type=
"
checkbox
"
name=
"
%s:list
"
value=
"
%s
"
%s>
""
"
%
(
checkbox_name
,
etud
[
etud_key
]
,
checked
)
f
"""
<input type=
"
checkbox
"
name=
"
{
checkbox_name
}
:list
"
value=
"
{
etud
[
etud_key
]
}
"
{
'
checked
=
"
checked
"'
if
is_inscrit
else
''
}
>
"""
)
H
.
append
(
elink
)
if
with_checkbox
:
H
.
append
(
"""
</input>
"""
)
H
.
append
(
"
</div>
"
)
H
.
append
(
"
</div>
"
)
H
.
append
(
"
</div>
"
)
return
"
\n
"
.
join
(
H
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment