From: Galen Charlton Date: Fri, 18 Aug 2017 21:36:57 +0000 (+0000) Subject: better display of labels X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6dd4f64ef181f58567d70b6aa1226e4341ce035b;p=working%2FEvergreen.git better display of labels Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm index 1d49aa5dae..4440b1563a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm @@ -119,6 +119,21 @@ sub find_authority_headings_and_notes { $self->extract_public_general_notes($record, $row); + # extract headings from the main authority record along with their + # types + my $parsed_headings = $self->editor->json_query({ + from => [ "authority.extract_headings", $row->{marc} ] + }); + my %heading_type_map = (); + if ($parsed_headings) { + foreach my $h (@$parsed_headings) { + $heading_type_map{$h->{normalized_heading}} = + $h->{purpose} eq 'variant' ? 'variant' : + $h->{purpose} eq 'related' ? $h->{related_type} : + ''; + } + } + # By applying grep in this way, we get acsaf objects that *have* and # therefore *aren't* main entries, which is what we want. foreach my $acsaf (values(%$acsaf_table)) { @@ -130,6 +145,10 @@ sub find_authority_headings_and_notes { my $h = { main_entry => ( $acsaf->main_entry ? 0 : 1 ), heading => _get_authority_heading($field, \%sf_lookup), $acsaf->joiner }; + my $norm = search_normalize($h->{heading}); + if (exists $heading_type_map{$norm}) { + $h->{type} = $heading_type_map{$norm}; + } # XXX I was getting "target" from authority.authority_linking, but # that makes no sense: that table can only tell you that one # authority record as a whole points at another record. It does diff --git a/Open-ILS/src/templates/opac/browse.tt2 b/Open-ILS/src/templates/opac/browse.tt2 index 36f528b520..679ceac850 100644 --- a/Open-ILS/src/templates/opac/browse.tt2 +++ b/Open-ILS/src/templates/opac/browse.tt2 @@ -11,6 +11,20 @@ depart_list = ['blimit', 'bterm', 'bpivot']; ctx.metalinks.push(''); + MACRO heading_use_label BLOCK; + SWITCH use; + CASE 'variant'; + l('See'); + CASE 'broader'; + l('Broader term'); + CASE 'narrower'; + l('Broader term'); + CASE 'other'; + l('Related term'); + CASE; + l('See'); + END; + END; %]

[% l('Catalog Browse') %]

@@ -140,7 +154,7 @@ # that h.target_count is only # defined when h.target is. - IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0; + IF h.target AND h.target_count AND result.list_authorities.grep('^' _ h.target _ '$').size == 0 AND h.main_entry; id = h.target; NEXT IF seenit.$id; seenit.$id = 1; IF !auth_headings_ul_added; # only add a