From b0ab204bfd4ba048097d0b29cb60ab6fe611da83 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 13 Aug 2012 15:34:51 -0400 Subject: [PATCH] Bug 8210: add links to authorities in normal mode headings Cherry-picked from BibLibre's work on bug 5888: opac-detail subject/author links improvements Added a link to opac-authoritiesdetail.pl when possible. Only affects 'Normal view'. Does not affect XSLT display. Signed-off-by: Jared Camins-Esakov Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- C4/Biblio.pm | 12 +++++-- .../opac-tmpl/prog/en/modules/opac-detail.tt | 36 +++++++++++++------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 533fcb67d4..ab4cc36030 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1704,10 +1704,12 @@ sub GetMarcSubjects { # if there is an authority link, build the links with an= subfield9 my $subfield9 = $field->subfield('9'); + my $authoritylink; if ($subfield9) { my $linkvalue = $subfield9; $linkvalue =~ s/(\(|\))//g; @link_loop = ( { limit => 'an', 'link' => $linkvalue } ); + $authoritylink = $linkvalue } # other subfields @@ -1743,7 +1745,10 @@ sub GetMarcSubjects { } } - push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop }; + push @marcsubjects, { + MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop, + authoritylink => $authoritylink, + }; } return \@marcsubjects; @@ -1829,7 +1834,10 @@ sub GetMarcAuthors { }; } } - push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop }; + push @marcauthors, { + MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop, + authoritylink => $subfield9, + }; } return \@marcauthors; } diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index a77e468b70..f740488d94 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -360,11 +360,17 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( MARCAUTHORS ) %] Additional authors: - [% FOREACH MARCAUTHOR IN MARCAUTHORS %] - [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %][% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %] - [% UNLESS ( loop.last ) %]| -[% END %] - [% END %] + [% FOREACH MARCAUTHOR IN MARCAUTHORS %] + [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %] + [% MARCAUTHOR_SUBFIELDS_LOO.separator %] + [% MARCAUTHOR_SUBFIELDS_LOO.value %] + [% END %] + [% IF (MARCAUTHOR.authoritylink) %] + + [% END %] + [% UNLESS ( loop.last ) %]|[% END %] + [% END %] [% END %] @@ -418,12 +424,20 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] [% IF ( MARCSUBJCTS ) %] - Subject(s): - [% FOREACH MARCSUBJCT IN MARCSUBJCTS %] - [% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] - [% MARCSUBJECT_SUBFIELDS_LOO.separator %][% MARCSUBJECT_SUBFIELDS_LOO.value %][% END %] - [% IF ( loop.last ) %][% ELSE %]|[% END %] - [% END %] + + Subject(s): + [% FOREACH MARCSUBJCT IN MARCSUBJCTS %] + [% subjectsloop = loop %] + [% FOREACH SUBFIELD IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] + [% SUBFIELD.separator %] + [% SUBFIELD.value %] + [% END %] + [% IF (MARCSUBJCT.authoritylink) %] + + [% END %] + [% UNLESS ( loop.last ) %] | [% END %] + [% END %] + [% ELSE %] [% IF ( subjects ) %]Subject(s): [% FOREACH subject IN subjects %][% subject.subject %] | [% END %][% END %] [% END %] -- 2.39.5