From 6359ab028a2ce5f62eb4cb882ba0fbda39d382ff 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 --- C4/Biblio.pm | 12 +++++- koha-tmpl/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 5500b30..fbcce2b 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1706,10 +1706,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 @@ -1745,7 +1747,10 @@ sub GetMarcSubjects { } } - push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop }; + push @marcsubjects, { + MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop, + authoritylink => $authoritylink, + }; } return \@marcsubjects; @@ -1831,7 +1836,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 be300b1..e7f392b 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 %] -- 1.7.2.5