From 6cb1ca764b90d2fc0e84e26cda42f6d183a417d0 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 Content-Type: text/plain; charset="UTF-8" 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 --- C4/Biblio.pm | 12 +++++- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 40 ++++++++++++++------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index c479502..308fda1 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1707,6 +1707,7 @@ sub GetMarcSubjects { # if there is an authority link, build the link with an= subfield9 my $found9 = 0; + my $authoritylink; for my $subject_subfield (@subfields) { # don't load unimarc subfields 3,4,5 @@ -1724,6 +1725,7 @@ sub GetMarcSubjects { } if ( $code eq 9 ) { $found9 = 1; + $authoritylink = $linkvalue; @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } ); } if ( not $found9 ) { @@ -1740,7 +1742,10 @@ sub GetMarcSubjects { $counter++; } - push @marcsubjects, { MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop }; + push @marcsubjects, { + MARCSUBJECT_SUBFIELDS_LOOP => \@subfields_loop, + authoritylink => $authoritylink, + }; } return \@marcsubjects; @@ -1823,7 +1828,10 @@ sub GetMarcAuthors { unless ( $authors_subfield->[0] eq '9' || $authors_subfield->[0] eq '0'); $count_auth++; } - 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 54ed48e..71ba359 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -336,12 +336,20 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( MARCAUTHORS ) %] - 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 %] + + Authors: + [% FOREACH MARCAUTHOR IN MARCAUTHORS %] + [% authorsloop = loop %] + [% FOREACH SUBFIELD IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %] + [% SUBFIELD.value %] + [% UNLESS (loop.last) %][% SUBFIELD.separator %][% END %] + [% END %] + [% IF (MARCAUTHOR.authoritylink) %] + + [% END %] + [% UNLESS ( loop.last ) %]|[% END %] + [% END %] [% END %] @@ -395,12 +403,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