Skip to content
Snippets Groups Projects
Commit b8b20d50 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

honour federations ordering defined in configuration

parent 574fb1aa
Branches
Tags
No related merge requests found
...@@ -257,7 +257,7 @@ sub req_select_sp { ...@@ -257,7 +257,7 @@ sub req_select_sp {
my @federations = split(/, */, $self->{configuration}->{federations}->{list}); my @federations = split(/, */, $self->{configuration}->{federations}->{list});
my %groups; my @groups;
my @self_entities; my @self_entities;
foreach my $federation (@federations) { foreach my $federation (@federations) {
if ($self->{configuration}->{$federation}->{metadata}) { if ($self->{configuration}->{$federation}->{metadata}) {
...@@ -275,7 +275,8 @@ sub req_select_sp { ...@@ -275,7 +275,8 @@ sub req_select_sp {
) if $EVAL_ERROR; ) if $EVAL_ERROR;
my $entities = $metadata->parse(type => 'sp'); my $entities = $metadata->parse(type => 'sp');
$groups{$federation} = { push @groups, {
id => $federation,
label => $self->{configuration}->{$federation}->{label}, label => $self->{configuration}->{$federation}->{label},
entities => [ entities => [
map { { map { {
...@@ -310,7 +311,8 @@ sub req_select_sp { ...@@ -310,7 +311,8 @@ sub req_select_sp {
} }
} }
} elsif ($self->{configuration}->{$federation}->{link}) { } elsif ($self->{configuration}->{$federation}->{link}) {
$groups{$federation} = { push @groups, {
id => $federation,
label => $self->{configuration}->{$federation}->{label}, label => $self->{configuration}->{$federation}->{label},
link => $self->{configuration}->{$federation}->{link}, link => $self->{configuration}->{$federation}->{link},
}; };
...@@ -318,7 +320,8 @@ sub req_select_sp { ...@@ -318,7 +320,8 @@ sub req_select_sp {
} }
if (@self_entities) { if (@self_entities) {
$groups{_self} = { unshift @groups, {
id => '_self',
label => $self->{lh}->maketext("My organization"), label => $self->{lh}->maketext("My organization"),
entities => \@self_entities, entities => \@self_entities,
}; };
...@@ -328,7 +331,7 @@ sub req_select_sp { ...@@ -328,7 +331,7 @@ sub req_select_sp {
template => 'select_sp.tt2.html', template => 'select_sp.tt2.html',
data => { data => {
action => 'select_sp', action => 'select_sp',
groups => \%groups, groups => \@groups,
} }
); );
} }
......
...@@ -15,15 +15,20 @@ ...@@ -15,15 +15,20 @@
[% lh.maketext("You must be an administrator of that service to continue afterwards.") %] [% lh.maketext("You must be an administrator of that service to continue afterwards.") %]
</p> </p>
[% FOREACH group IN groups.keys.sort() %] [% FOREACH group IN groups() %]
<fieldset> <fieldset>
<legend>[% groups.$group.label %]</legend> [% IF group.entities %]
<select id="[% group %]" name="[% group %]"> <legend>[% group.label %]</legend>
<select id="[% group.id %]" name="[% group.id %]">
<option value=""></option> <option value=""></option>
[% FOREACH entity IN groups.$group.entities.sort('name') %] [% FOREACH entity IN group.entities.sort('name') %]
<option value="[% entity.id %]" data-federation="[% entity.federation %]">[% entity.name %]</option> <option value="[% entity.id %]" data-federation="[% entity.federation %]">[% entity.name %]</option>
[% END %] [% END %]
</select> </select>
[% END %]
[% IF group.link %]
<a class="button" href="[% group.link %]">[% group.label %]</a>
[% END %]
</fieldset> </fieldset>
[% END %] [% END %]
<input type="hidden" id="federation" name="federation"/> <input type="hidden" id="federation" name="federation"/>
......
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
[% lh.maketext("You must be an administrator of that service to continue afterwards.") %] [% lh.maketext("You must be an administrator of that service to continue afterwards.") %]
</p> </p>
[% FOREACH group IN groups.keys.sort() %] [% FOREACH group IN groups %]
<fieldset> <fieldset>
[% IF groups.$group.entities %] [% IF group.entities %]
<legend>[% groups.$group.label %]</legend> <legend>[% group.label %]</legend>
<select id="[% group %]" name="[% group %]"> <select id="[% group.id %]" name="[% group.id %]">
<option value=""></option> <option value=""></option>
[% FOREACH entity IN groups.$group.entities.sort('name') %] [% FOREACH entity IN group.entities.sort('name') %]
<option value="[% entity.id %]" data-federation="[% entity.federation %]">[% entity.name %]</option> <option value="[% entity.id %]" data-federation="[% entity.federation %]">[% entity.name %]</option>
[% END %] [% END %]
</select> </select>
[% END %] [% END %]
[% IF groups.$group.link %] [% IF group.link %]
<a class="button" href="[% groups.$group.link %]">[% groups.$group.label %]</a> <a class="button" href="[% group.link %]">[% group.label %]</a>
[% END %] [% END %]
</fieldset> </fieldset>
[% END %] [% END %]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment