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

display name rework

- extract service name instead of organization name
- compute display name in code, rather than template
- display entityID first, as mandatory, and name as optional
parent 8bba1701
Branches
Tags
No related merge requests found
...@@ -81,6 +81,16 @@ sub parse { ...@@ -81,6 +81,16 @@ sub parse {
push @{ $data->{domain} }, $scope->textContent(); push @{ $data->{domain} }, $scope->textContent();
} }
my @uiinfo = $child->getElementsByLocalName('UIInfo');
if (@uiinfo) {
my $uiinfo = $uiinfo[0];
my @names = $uiinfo->getChildrenByLocalName('DisplayName');
my %names =
map { $_->getAttribute('xml:lang') => $_->textContent() }
@names;
$data->{name} = $names{en} ? $names{en} : $names[0];
}
} elsif ($child->localname() eq 'SPSSODescriptor') { } elsif ($child->localname() eq 'SPSSODescriptor') {
# skip immediatly if requested type differs # skip immediatly if requested type differs
next ENTITY if $args{type} && $args{type} ne 'sp'; next ENTITY if $args{type} && $args{type} ne 'sp';
...@@ -121,6 +131,16 @@ sub parse { ...@@ -121,6 +131,16 @@ sub parse {
}; };
} }
my @uiinfo = $child->getElementsByLocalName('UIInfo');
if (@uiinfo) {
my $uiinfo = $uiinfo[0];
my @names = $uiinfo->getChildrenByLocalName('DisplayName');
my %names =
map { $_->getAttribute('xml:lang') => $_->textContent() }
@names;
$data->{name} = $names{en} ? $names{en} : $names[0];
}
} elsif ($child->localname() eq 'Extensions') { } elsif ($child->localname() eq 'Extensions') {
foreach my $registrationinfo ( foreach my $registrationinfo (
...@@ -141,6 +161,7 @@ sub parse { ...@@ -141,6 +161,7 @@ sub parse {
$policy->textContent(); $policy->textContent();
} }
} }
} elsif ($child->localname() eq 'ContactPerson') { } elsif ($child->localname() eq 'ContactPerson') {
my $details; my $details;
$details->{type} = $child->getAttribute('contactType'); $details->{type} = $child->getAttribute('contactType');
...@@ -154,13 +175,6 @@ sub parse { ...@@ -154,13 +175,6 @@ sub parse {
} }
push @{ $data->{contacts} }, $details; push @{ $data->{contacts} }, $details;
} }
} elsif ($child->localname() eq 'Organization') {
$data->{name} = _get_default_value(
$child, 'OrganizationName'
);
$data->{display_name} = _get_default_value(
$child, 'OrganizationDisplayName'
);
} }
## Getting X.509 certificates ## Getting X.509 certificates
...@@ -175,6 +189,10 @@ sub parse { ...@@ -175,6 +189,10 @@ sub parse {
# and no identifiable type was found # and no identifiable type was found
next ENTITY if $args{type} && !$data->{type}; next ENTITY if $args{type} && !$data->{type};
$data->{display_name} = $data->{name} ?
sprintf("%s (%s)", $data->{entityid}, $data->{name}) :
sprintf("%s", $data->{entityid});
push @array, $data; push @array, $data;
} }
...@@ -198,17 +216,6 @@ sub _boolean2integer { ...@@ -198,17 +216,6 @@ sub _boolean2integer {
undef; undef;
} }
sub _get_default_value {
my ($node, $child_name) = @_;
my %names;
$names{ $_->getAttribute('xml:lang') } = $_->textContent()
foreach $node->getChildrenByLocalName($child_name);
return $names{en} ? $names{en} : (values %names)[0];
}
1; 1;
__END__ __END__
......
...@@ -110,7 +110,7 @@ $(function() { ...@@ -110,7 +110,7 @@ $(function() {
<select id="entityid" name="entityid" class="required"> <select id="entityid" name="entityid" class="required">
<option value=""></option> <option value=""></option>
[% FOREACH entity IN metadata.sort('display_name') %] [% FOREACH entity IN metadata.sort('display_name') %]
<option value="[% entity.entityid %]">[% IF entity.display_name %][% entity.display_name %] [%+ END %]([% entity.entityid %])</option> <option value="[% entity.entityid %]">[% entity.display_name %]</option>
[% END %] [% END %]
</select> </select>
<p>[% lh.maketext("Only Service Providers included in eduGAIN metadata are included in the list.") %]</p> <p>[% lh.maketext("Only Service Providers included in eduGAIN metadata are included in the list.") %]</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment