$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)) {
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
TRUE
);
+INSERT INTO config.global_flag (name, label, enabled) VALUES (
+ 'opac.show_related_headings_in_browse',
+ oils_i18n_gettext(
+ 'opac.show_related_headings_in_browse',
+ 'Display related headings (see-also) in browse',
+ 'cgf',
+ 'label'
+ ),
+ TRUE
+);
+
INSERT INTO config.settings_group (name, label)
VALUES ('ebook_api', oils_i18n_gettext('ebook_api', 'Ebook API Integration', 'csg', 'label'));
--- /dev/null
+BEGIN;
+
+INSERT INTO config.global_flag (name, label, enabled) VALUES (
+ 'opac.show_related_headings_in_browse',
+ oils_i18n_gettext(
+ 'opac.show_related_headings_in_browse',
+ 'Display related headings (see-also) in browse',
+ 'cgf',
+ 'label'
+ ),
+ TRUE
+);
+
+COMMIT;
depart_list = ['blimit', 'bterm', 'bpivot'];
ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
+ 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;
%]
<h2 class="sr-only">[% l('Catalog Browse') %]</h2>
# 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 <ul> if we have at least one <li> (WCAG 2.0)
<ul class="browse-result-authority-headings">
[% END %]
- <li><span class="browse-result-authority-field-name">[% field.name %]</span>
+ <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
<a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
<span class="browse-result-authority-bib-links">([% h.target_count %])</span>
</li>
# that h.target_count is only
# defined when h.target is.
- IF h.target AND h.target_count AND result.list_sees.grep('^' _ h.target _ '$').size == 0 AND !h.main_entry;
+ IF h.target AND h.target_count AND result.list_sees.grep('^' _ h.target _ '$').size == 0 AND !h.main_entry AND ctx.get_cgf('opac.show_related_headings_in_browse').enabled == 't';
id = h.target; NEXT IF seenit.$id; seenit.$id = 1;
IF !auth_headings_ul_added;
# only add a <ul> if we have at least one <li> (WCAG 2.0)
auth_headings_ul_added = 1; %]
<ul class="browse-result-authority-headings">
[% END %]
- <li><span class="browse-result-authority-field-name">[% field.name %]</span>
+ <li><span class="browse-result-authority-field-name">[% heading_use_label(use=h.type) %]</span>
<a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
<span class="browse-result-authority-bib-links">([% h.target_count %])</span>
</li>