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
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,16 @@ sub parse {
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') {
# skip immediatly if requested type differs
next ENTITY if $args{type} && $args{type} ne 'sp';
......@@ -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') {
foreach my $registrationinfo (
......@@ -141,6 +161,7 @@ sub parse {
$policy->textContent();
}
}
} elsif ($child->localname() eq 'ContactPerson') {
my $details;
$details->{type} = $child->getAttribute('contactType');
......@@ -154,13 +175,6 @@ sub parse {
}
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
......@@ -175,6 +189,10 @@ sub parse {
# and no identifiable type was found
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;
}
......@@ -198,17 +216,6 @@ sub _boolean2integer {
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;
__END__
......
......@@ -110,7 +110,7 @@ $(function() {
<select id="entityid" name="entityid" class="required">
<option value=""></option>
[% 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 %]
</select>
<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.
Finish editing this message first!
Please register or to comment