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

no need for localized names, extract a default one

parent 88c6d28a
No related branches found
No related tags found
No related merge requests found
......@@ -153,12 +153,12 @@ sub parse {
push @{ $data->{contacts} }, $details;
}
} elsif ($child->localname() eq 'Organization') {
foreach my $name ($child->getChildrenByLocalName('OrganizationName')) {
$data->{name}->{ $name->getAttribute('xml:lang') } = $name->textContent();
}
foreach my $name ($child->getChildrenByLocalName('OrganizationDisplayName')) {
$data->{display_name}->{ $name->getAttribute('xml:lang') } = $name->textContent();
}
$data->{name} = _get_default_value(
$child, 'OrganizationName'
);
$data->{display_name} = _get_default_value(
$child, 'OrganizationDisplayName'
);
}
## Getting X.509 certificates
......@@ -174,9 +174,6 @@ sub parse {
if ($data->{domain});
$data->{domain} = $domains;
# compute default display name for template sorting
$data->{default_display_name} = $data->{display_name}->{en};
push @array, $data;
}
......@@ -200,6 +197,17 @@ 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__
......
......@@ -111,8 +111,8 @@ Note that only Service Providers are in the list which are included in the eduGA
<select id="sp_entityid" name="sp_entityid" class="required">
<option value="">Select your Service Provider below</option>
[% FOREACH entity IN metadata.sort('default_display_name') %]
<option value="[% entity.entityid %]">[% IF entity.default_display_name %][% entity.default_display_name %] [% END %]([% entity.entityid %])</option>
[% FOREACH entity IN metadata.sort('display_name') %]
<option value="[% entity.entityid %]">[% IF entity.display_name %][% entity.display_name %] [% END %]([% entity.entityid %])</option>
[% END %]
</select>
<br/>
......
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