[Koha-patches] [PATCH] Bug 3462: Links in authorities should be hyperlinks
Jared Camins-Esakov
jcamins at cpbibliography.com
Fri Jun 22 04:46:55 CEST 2012
Make see also links in both the OPAC and authority module search results
into hyperlinks and not just textual strings.
To test:
1. Do a search for an authority that will bring up a heading with a
see also reference in the staff client and the OPAC.
2. Confirm that the see also references listed in the search results
are now hyperlinks, which work.
---
C4/AuthoritiesMarc.pm | 37 ++++++++++++++++---
.../en/includes/authorities-search-results.inc | 7 +++-
.../en/modules/authorities/searchresultlist.tt | 2 +-
.../en/includes/authorities-search-results.inc | 7 +++-
.../en/modules/opac-authoritiessearchresultlist.tt | 2 +-
5 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index c92c319..0f91656 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -948,7 +948,7 @@ sub BuildSummary {
$summary{type} = $authref->{authtypetext};
$summary{summary} = $authref->{summary};
}
- my $marc21subfields = 'abcdfghjklmnopqrstuvxyz';
+ my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
my %marc21controlrefs = ( 'a' => 'earlier',
'b' => 'later',
'd' => 'acronym',
@@ -1027,11 +1027,26 @@ sub BuildSummary {
# see :
foreach my $field ($record->field('5..')) {
if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
- push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader' };
+ push @seealso, {
+ heading => $field->as_string('abcdefgjxyz'),
+ type => 'broader',
+ search => $field->as_string('abcdefgjxyz'),
+ authid => $field->subfield('9')
+ };
} elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
- push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower' };
+ push @seealso, {
+ heading => $field->as_string('abcdefgjxyz'),
+ type => 'narrower',
+ search => $field->as_string('abcdefgjxyz'),
+ authid => $field->subfield('9')
+ };
} elsif ($field->subfield('a')) {
- push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso' };
+ push @seealso, {
+ heading => $field->as_string('abcdefgxyz'),
+ type => 'seealso',
+ search => $field->as_string('abcdefgjxyz'),
+ authid => $field->subfield('9')
+ };
}
}
# // form
@@ -1090,9 +1105,19 @@ sub BuildSummary {
my $type = 'seealso';
$type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
if ($type eq 'subfi') {
- push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
+ push @seealso, {
+ heading => $field->as_string($marc21subfields),
+ type => $field->subfield('i'),
+ search => $field->as_string($marc21subfields),
+ authid => $field->subfield('9')
+ };
} else {
- push @seealso, { heading => $field->as_string($marc21subfields), type => $type };
+ push @seealso, {
+ heading => $field->as_string($marc21subfields),
+ type => $type,
+ search => $field->as_string($marc21subfields),
+ authid => $field->subfield('9')
+ };
}
}
foreach my $field ($record->field('6..')) {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
index 92314b1..9dc37bd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
@@ -14,7 +14,10 @@
[% END %]
[% ELSE %]
[% IF ( label ) %]<span class="label">[% label %]</span>[% END %]
- <span class="heading">[% heading %]</span>
+ <span class="heading">
+ [% IF ( linkpath && search ) %]<a href="[% link %][% search %]">[% heading %]</a>
+ [% ELSE %][% heading %][% END %]
+ </span>
[% UNLESS ( type=='seefrom' || type=='seealso' ) %]<span class="type">[% SWITCH type %]
[% CASE 'earlier' %](Earlier heading)
[% CASE 'later' %](Later heading)
@@ -50,7 +53,7 @@
[% IF ( summary.seealso ) %]
[% FOREACH seeals IN summary.seealso %]
<div class="seealso authref">
- [% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type %]
+ [% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type linkpath=link search=seeals.search %]
</div>
[% END %]
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
index 038959f..362a33a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
@@ -64,7 +64,7 @@ function searchauthority() {
[% ELSE %]
<tr>
[% END %]
- <td>[% PROCESS authresult summary=resul.summary %]</td>
+ <td>[% PROCESS authresult summary=resul.summary link="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&marclist=any&operator=contains&orderby=HeadingAsc&value=" %]</td>
<td><a href="detail.pl?authid=[% resul.authid %]">Details</a></td>
[% UNLESS ( resul.isEDITORS ) %]
<td>
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc b/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc
index 92314b1..9dc37bd 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc
@@ -14,7 +14,10 @@
[% END %]
[% ELSE %]
[% IF ( label ) %]<span class="label">[% label %]</span>[% END %]
- <span class="heading">[% heading %]</span>
+ <span class="heading">
+ [% IF ( linkpath && search ) %]<a href="[% link %][% search %]">[% heading %]</a>
+ [% ELSE %][% heading %][% END %]
+ </span>
[% UNLESS ( type=='seefrom' || type=='seealso' ) %]<span class="type">[% SWITCH type %]
[% CASE 'earlier' %](Earlier heading)
[% CASE 'later' %](Later heading)
@@ -50,7 +53,7 @@
[% IF ( summary.seealso ) %]
[% FOREACH seeals IN summary.seealso %]
<div class="seealso authref">
- [% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type %]
+ [% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type linkpath=link search=seeals.search %]
</div>
[% END %]
[% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
index a27480a..6e0b2fa 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
@@ -53,7 +53,7 @@
[% ELSE %]
<tr>
[% END %]
- <td>[% PROCESS authresult summary=resul.summary %]</td>
+ <td>[% PROCESS authresult summary=resul.summary link="/cgi-bin/koha/opac-authorities-home.pl?op=do_search&type=opac&operator=contains&marclist=any&and_ora=and&orderby=HeadingAsc&value=" %]</td>
<td>[% authtypetext %]</td>
[% UNLESS ( resul.isEDITORS ) %]
<td>
--
1.7.2.5
More information about the Koha-patches
mailing list