Bug 7943: Authority search results are untranslatable

The HTML for authority search results was previously generated in
C4::AuthoritiesMarc::BuildSummary, which meant that it couldn't be
translated. This patch moves the HTML generation into the templates
by introducing a new authorities-search-results.inc include file for
both the OPAC and the Intranet which contains a Template::Toolkit BLOCK
for rendering the authority results. Fixes the authority autocomplete
by removing the untranslatable strings, and returning only data from
the database.

To test:
1. Apply patch.
2. Test authority searching in the authority module in the staff client
3. Test authority searching in the authority control plugin in the
   cataloguing module (and the plugin for UNIMARC field 210$c, if you
   can figure out how)
4. Test authority searching in the OPAC

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with MARC21 data.

1) Applies cleanly on current HEAD.

2) Authority search in staff

Patch works wonderfully, only some small notes found while testing that have
not been changed by this patch:

ENH note: Search terms show up nowhere. So if I want to change the sorting, I have to
repeat typing in my search term. Even if the form does not keep the term, it
should be visible somewhere on the screen what I searched for.

ENH note: The pagination on top and at the bottom of the result list are formatted
differently. Maybe some missing CSS?

ENH note: Also the authority type is not shown at all in the result list.

3) Cataloguing and authority plugins

The autocomplete function works nicely.

ENH note: There is only one small enhancement
I could imagine. If I start my search from 100 it will limit the search to
'persons' but the autocomplete will also suggest other authorities. It would
be a bit cleaner, if the autocomplete could limit by the appropriate authority
type too. Very nice feature.

Plugins overall work nicely. Created links include the authority numbers and work
correctly.

4) Authority search in OPAC

Works nicely. Display is consistent, but translatability greatly improved.

ENH note: In staff we use 'Details' in OPAC we use 'View full heading' - I wonder
if maybe 'details' would be better understandable for users?

Note: Code reveals a system preference 'AuthDisplayHierarchy' that is
not available in the system preference editor. I talked to Jared and he
will work on this feature later on. For now it's no regression, as the
preference has never been visible.
This commit is contained in:
Jared Camins-Esakov 2012-05-30 15:20:40 -04:00 committed by Paul Poulain
parent 622967b323
commit 3aaaf2f2e4
14 changed files with 341 additions and 203 deletions

View File

@ -315,7 +315,7 @@ sub get_template_and_user {
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'),
GoogleJackets => C4::Context->preference("GoogleJackets"),
OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"),
OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"),
KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"),
LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
@ -328,7 +328,8 @@ sub get_template_and_user {
XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
using_https => $in->{'query'}->https() ? 1 : 0,
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
marcflavour => C4::Context->preference("marcflavour"),
);
if ( $in->{'type'} eq "intranet" ) {

View File

@ -46,12 +46,12 @@ BEGIN {
&DelAuthority
&GetAuthority
&GetAuthorityXML
&CountUsage
&CountUsageChildren
&SearchAuthorities
&BuildSummary
&BuildSummary
&BuildUnimarcHierarchies
&BuildUnimarcHierarchy
@ -926,9 +926,9 @@ sub FindDuplicateAuthority {
=head2 BuildSummary
$text= &BuildSummary( $record, $authid, $authtypecode)
$summary= &BuildSummary( $record, $authid, $authtypecode)
return HTML encoded Summary
Returns a hashref with a summary of the specified record.
Comment : authtypecode can be infered from both record and authid.
Moreover, authid can also be inferred from $record.
@ -936,171 +936,176 @@ Would it be interesting to delete those things.
=cut
sub BuildSummary{
## give this a Marc record to return summary
my ($record,$authid,$authtypecode)=@_;
my $dbh=C4::Context->dbh;
my $summary;
# handle $authtypecode is NULL or eq ""
if ($authtypecode) {
my $authref = GetAuthType($authtypecode);
$summary = $authref->{summary};
}
# FIXME: should use I18N.pm
my %language;
$language{'fre'}="Français";
$language{'eng'}="Anglais";
$language{'ger'}="Allemand";
$language{'ita'}="Italien";
$language{'spa'}="Espagnol";
my %thesaurus;
$thesaurus{'1'}="Peuples";
$thesaurus{'2'}="Anthroponymes";
$thesaurus{'3'}="Oeuvres";
$thesaurus{'4'}="Chronologie";
$thesaurus{'5'}="Lieux";
$thesaurus{'6'}="Sujets";
#thesaurus a remplir
my @fields = $record->fields();
my $reported_tag;
# if the library has a summary defined, use it. Otherwise, build a standard one
# FIXME - it appears that the summary field in the authority frameworks
# can work as a display template. However, this doesn't
# suit the MARC21 version, so for now the "templating"
# feature will be enabled only for UNIMARC for backwards
# compatibility.
if ($summary and C4::Context->preference('marcflavour') eq 'UNIMARC') {
my @fields = $record->fields();
# $reported_tag = '$9'.$result[$counter];
my @stringssummary;
foreach my $field (@fields) {
my $tag = $field->tag();
my $tagvalue = $field->as_string();
my $localsummary= $summary;
$localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
if ($tag<10) {
if ($tag eq '001') {
$reported_tag.='$3'.$field->data();
}
} else {
my @subf = $field->subfields;
for my $i (0..$#subf) {
my $subfieldcode = $subf[$i][0];
my $subfieldvalue = $subf[$i][1];
my $tagsubf = $tag.$subfieldcode;
$localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
}
}
push @stringssummary, $localsummary if ($localsummary ne $summary);
sub BuildSummary {
## give this a Marc record to return summary
my ($record,$authid,$authtypecode)=@_;
my $dbh=C4::Context->dbh;
my %summary;
# handle $authtypecode is NULL or eq ""
if ($authtypecode) {
my $authref = GetAuthType($authtypecode);
$summary{authtypecode} = $authref->{authtypecode};
$summary{type} = $authref->{authtypetext};
$summary{summary} = $authref->{summary};
}
my $resultstring;
$resultstring = join(" -- ",@stringssummary);
$resultstring =~ s/\[(.*?)\]//g;
$resultstring =~ s/\n/<br\/>/g;
$summary = $resultstring;
} else {
my $heading = '';
my $altheading = '';
my $seealso = '';
my $broaderterms = '';
my $narrowerterms = '';
my $see = '';
my $seeheading = '';
my $notes = '';
my $marc21subfields = 'abcdfghjklmnopqrstuvxyz';
my %marc21controlrefs = ( 'a' => 'earlier',
'b' => 'later',
'd' => 'acronym',
'f' => 'musical',
'g' => 'broader',
'h' => 'narrower',
'i' => 'subfi',
't' => 'parent'
);
my %thesaurus;
$thesaurus{'1'}="Peuples";
$thesaurus{'2'}="Anthroponymes";
$thesaurus{'3'}="Oeuvres";
$thesaurus{'4'}="Chronologie";
$thesaurus{'5'}="Lieux";
$thesaurus{'6'}="Sujets";
#thesaurus a remplir
my @fields = $record->fields();
if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
# construct UNIMARC summary, that is quite different from MARC21 one
# accepted form
foreach my $field ($record->field('2..')) {
$heading.= $field->as_string('abcdefghijlmnopqrstuvwxyz');
}
# rejected form(s)
foreach my $field ($record->field('3..')) {
$notes.= '<span class="note">'.$field->subfield('a')."</span>\n";
}
foreach my $field ($record->field('4..')) {
if ($field->subfield('2')) {
my $thesaurus = "thes. : ".$thesaurus{"$field->subfield('2')"}." : ";
$see.= '<span class="UF">'.$thesaurus.$field->as_string('abcdefghijlmnopqrstuvwxyz')."</span> -- \n";
my $reported_tag;
# if the library has a summary defined, use it. Otherwise, build a standard one
# FIXME - it appears that the summary field in the authority frameworks
# can work as a display template. However, this doesn't
# suit the MARC21 version, so for now the "templating"
# feature will be enabled only for UNIMARC for backwards
# compatibility.
if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') {
my @fields = $record->fields();
# $reported_tag = '$9'.$result[$counter];
my @stringssummary;
foreach my $field (@fields) {
my $tag = $field->tag();
my $tagvalue = $field->as_string();
my $localsummary= $summary{summary};
$localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
if ($tag<10) {
if ($tag eq '001') {
$reported_tag.='$3'.$field->data();
}
} else {
my @subf = $field->subfields;
for my $i (0..$#subf) {
my $subfieldcode = $subf[$i][0];
my $subfieldvalue = $subf[$i][1];
my $tagsubf = $tag.$subfieldcode;
$localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
}
}
push @stringssummary, $localsummary if ($localsummary ne $summary{summary});
}
}
# see :
foreach my $field ($record->field('5..')) {
if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) {
$broaderterms.= '<span class="BT"> '.$field->as_string('abcdefgjxyz')."</span> -- \n";
} elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
$narrowerterms.= '<span class="NT">'.$field->as_string('abcdefgjxyz')."</span> -- \n";
} elsif ($field->subfield('a')) {
$seealso.= '<span class="RT">'.$field->as_string('abcdefgxyz')."</a></span> -- \n";
my $resultstring;
$resultstring = join(" -- ",@stringssummary);
$resultstring =~ s/\[(.*?)\]//g;
$resultstring =~ s/\n/<br>/g;
$summary{summary} = $resultstring;
} else {
my @authorized;
my @notes;
my @seefrom;
my @seealso;
my @otherscript;
my @fields = $record->fields();
if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
# construct UNIMARC summary, that is quite different from MARC21 one
# accepted form
foreach my $field ($record->field('2..')) {
push @authorized, $field->as_string('abcdefghijlmnopqrstuvwxyz');
}
# rejected form(s)
foreach my $field ($record->field('3..')) {
push @notes, $field->subfield('a');
}
foreach my $field ($record->field('4..')) {
my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : '';
push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom' };
}
# 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' };
} elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){
push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower' };
} elsif ($field->subfield('a')) {
push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso' };
}
}
# // form
foreach my $field ($record->field('7..')) {
my $lang = substr($field->subfield('8'),3,3);
push @otherscript, { lang => $lang, term => $field->subfield('a') };
}
} else {
# construct MARC21 summary
# FIXME - looping over 1XX is questionable
# since MARC21 authority should have only one 1XX
foreach my $field ($record->field('1..')) {
my $tag = $field->tag();
next if "152" eq $tag;
# FIXME - 152 is not a good tag to use
# in MARC21 -- purely local tags really ought to be
# 9XX
if ($tag eq '100') {
push @authorized, $field->as_string('abcdefghjklmnopqrstvxyz68');
} elsif ($tag eq '110') {
push @authorized, $field->as_string('abcdefghklmnoprstvxyz68');
} elsif ($tag eq '111') {
push @authorized, $field->as_string('acdefghklnpqstvxyz68');
} elsif ($tag eq '130') {
push @authorized, $field->as_string('adfghklmnoprstvxyz68');
} elsif ($tag eq '148') {
push @authorized, $field->as_string('abvxyz68');
} elsif ($tag eq '150') {
push @authorized, $field->as_string('abvxyz68');
} elsif ($tag eq '151') {
push @authorized, $field->as_string('avxyz68');
} elsif ($tag eq '155') {
push @authorized, $field->as_string('abvxyz68');
} elsif ($tag eq '180') {
push @authorized, $field->as_string('vxyz68');
} elsif ($tag eq '181') {
push @authorized, $field->as_string('vxyz68');
} elsif ($tag eq '182') {
push @authorized, $field->as_string('vxyz68');
} elsif ($tag eq '185') {
push @authorized, $field->as_string('vxyz68');
} else {
push @authorized, $field->as_string();
}
} #See From
foreach my $field ($record->field('4..')) {
my $type = 'seefrom';
$type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
if ($type eq 'subfi') {
push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
} else {
push @seefrom, { heading => $field->as_string($marc21subfields), type => $type };
}
} #See Also
foreach my $field ($record->field('5..')) {
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') };
} else {
push @seealso, { heading => $field->as_string($marc21subfields), type => $type };
}
}
foreach my $field ($record->field('6..')) {
push @notes, $field->as_string();
}
}
}
# // form
foreach my $field ($record->field('7..')) {
my $lang = substr($field->subfield('8'),3,3);
$seeheading.= '<span class="langue"> En '.$language{$lang}.' : </span><span class="OT"> '.$field->subfield('a')."</span><br />\n";
}
$broaderterms =~s/-- \n$//;
$narrowerterms =~s/-- \n$//;
$seealso =~s/-- \n$//;
$see =~s/-- \n$//;
$summary = $heading."<br />".($notes?"$notes <br />":"");
$summary.= '<p><div class="label">TG : '.$broaderterms.'</div></p>' if ($broaderterms);
$summary.= '<p><div class="label">TS : '.$narrowerterms.'</div></p>' if ($narrowerterms);
$summary.= '<p><div class="label">TA : '.$seealso.'</div></p>' if ($seealso);
$summary.= '<p><div class="label">EP : '.$see.'</div></p>' if ($see);
$summary.= '<p><div class="label">'.$seeheading.'</div></p>' if ($seeheading);
} else {
# construct MARC21 summary
# FIXME - looping over 1XX is questionable
# since MARC21 authority should have only one 1XX
foreach my $field ($record->field('1..')) {
next if "152" eq $field->tag(); # FIXME - 152 is not a good tag to use
# in MARC21 -- purely local tags really ought to be
# 9XX
if ($record->field('100')) {
$heading.= $field->as_string('abcdefghjklmnopqrstvxyz68');
} elsif ($record->field('110')) {
$heading.= $field->as_string('abcdefghklmnoprstvxyz68');
} elsif ($record->field('111')) {
$heading.= $field->as_string('acdefghklnpqstvxyz68');
} elsif ($record->field('130')) {
$heading.= $field->as_string('adfghklmnoprstvxyz68');
} elsif ($record->field('148')) {
$heading.= $field->as_string('abvxyz68');
} elsif ($record->field('150')) {
$heading.= $field->as_string('abvxyz68');
#$heading.= $field->as_formatted();
my $tag=$field->tag();
$heading=~s /^$tag//g;
$heading =~s /\_/\$/g;
} elsif ($record->field('151')) {
$heading.= $field->as_string('avxyz68');
} elsif ($record->field('155')) {
$heading.= $field->as_string('abvxyz68');
} elsif ($record->field('180')) {
$heading.= $field->as_string('vxyz68');
} elsif ($record->field('181')) {
$heading.= $field->as_string('vxyz68');
} elsif ($record->field('182')) {
$heading.= $field->as_string('vxyz68');
} elsif ($record->field('185')) {
$heading.= $field->as_string('vxyz68');
} else {
$heading.= $field->as_string();
}
} #See From
foreach my $field ($record->field('4..')) {
$seeheading.= "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>used for/see from:</i> ".$field->as_string();
} #See Also
foreach my $field ($record->field('5..')) {
$altheading.= "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>see also:</i> ".$field->as_string();
}
$summary .= ": " if $summary;
$summary.=$heading.$seeheading.$altheading;
}
}
return $summary;
$summary{authorized} = \@authorized;
$summary{notes} = \@notes;
$summary{seefrom} = \@seefrom;
$summary{seealso} = \@seealso;
$summary{otherscript} = \@otherscript;
}
return \%summary;
}
=head2 BuildUnimarcHierarchies

View File

@ -66,14 +66,15 @@ if ( $auth_status ne "ok" ) {
print "[";
my $i = 0;
foreach (@$results) {
foreach my $result (@$results) {
if($i > 0){ print ","; }
my ($value) = $_->{'summary'};
# Removes new lines
$value =~ s/<br \/>/ /g;
$value =~ s/\n//g;
$value = "{\"summary\":\"" . $value . "\"" . "}";
my $value = '';
my $authorized = $result->{'summary'}->{authorized};
foreach my $heading (@$authorized) {
$value .= $heading . ' ';
}
$value = "{\"summary\":\"" . $value . "\"" . "}";
print nsb_clean($value) . "\n";
$i++;
}
print "]";
print "]";

View File

@ -984,7 +984,6 @@ $template->param(
frameworkcode => $frameworkcode,
itemtype => $frameworkcode,
borrowernumber => $loggedinuser,
marcflavour => C4::Context->preference("marcflavour"),
);
output_html_with_http_headers $input, $cookie, $template->output;

View File

@ -2364,3 +2364,12 @@ ul.ui-tabs-nav li {
#header_search .ui-corner-top {
border-radius: 0 0 4px 4px;
}
.authref {
text-indent: 2em;
}
.authref .label {
font-style: italic;
}

View File

@ -0,0 +1,59 @@
[% BLOCK showreference %]
[% IF marcflavour == 'UNIMARC' %]
[% SWITCH type %]
[% CASE 'broader' %]
<span class="BT">[% heading %]</span> --
[% CASE 'narrower' %]
<span class="NT">[% heading %]</span> --
[% CASE 'narrower' %]
<span class="NT">[% heading %]</span> --
[% CASE 'seefrom' %]
<span class="UF">[% heading %]</span> --
[% CASE 'seealso' %]
<span class="RT">[% heading %]</span> --
[% END %]
[% ELSE %]
[% IF ( label ) %]<span class="label">[% label %]</span>[% END %]
<span class="heading">[% heading %]</span>
[% UNLESS ( type=='seefrom' || type=='seealso' ) %]<span class="type">[% SWITCH type %]
[% CASE 'earlier' %](Earlier heading)
[% CASE 'later' %](Later heading)
[% CASE 'acronym' %](Acronym)
[% CASE 'musical' %](Musical composition)
[% CASE 'broader' %](Broader heading)
[% CASE 'narrower' %](Narrower heading)
[% CASE %]([% type %])
[% END %]</span>[% END %]
[% END %]
[% END %]
[% BLOCK authresult %]
[% IF ( summary.summary ) %][% summary.summary %]:[% END %]
[% UNLESS ( summary.summaryonly ) %]
[% FOREACH authorize IN summary.authorized %]
<span class="authorizedheading">[% authorize %]</span>
[% END %]
[% IF ( marcflavour == 'UNIMARC' ) %]
[% FOREACH note IN summary.notes %]
<span class="note">[% note %]</span>
[% END %]
[% FOREACH seefro IN summary.seefrom %]
[% PROCESS showreference heading=seefro.heading label="" type=seefro.type %]
[% END %]
[% ELSE %]
[% IF ( summary.seefrom ) %]
[% FOREACH seefro IN summary.seefrom %]
<div class="seefrom authref">
[% PROCESS showreference heading=seefro.heading label="used for/see from:" type=seefro.type %]
</div>
[% END %]
[% END %]
[% IF ( summary.seealso ) %]
[% FOREACH seeals IN summary.seealso %]
<div class="seealso authref">
[% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type %]
</div>
[% END %]
[% END %]
[% END %]
[% END %]
[% END %]

View File

@ -1,3 +1,4 @@
[% PROCESS 'authorities-search-results.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Cataloging authority plugin</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -67,7 +68,7 @@ function jumpfull(page)
</tr>
[% FOREACH resul IN result %]
<tr>
<td>[% resul.summary %]</td>
<td>[% PROCESS authresult summary=resul.summary %]</td>
<td>[% resul.used %] times</td>
<td>
[% IF resul.repets %]

View File

@ -1,3 +1,4 @@
[% PROCESS 'authorities-search-results.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Authorities &rsaquo; Authority search results</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -63,7 +64,7 @@ function searchauthority() {
[% ELSE %]
<tr>
[% END %]
<td>[% resul.summary %]</td>
<td>[% PROCESS authresult summary=resul.summary %]</td>
<td><a href="detail.pl?authid=[% resul.authid %]">Details</a></td>
[% UNLESS ( resul.isEDITORS ) %]
<td>

View File

@ -1,3 +1,4 @@
[% PROCESS 'authorities-search-results.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>UNIMARC field 210c builder</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -59,7 +60,7 @@
</tr>
[% FOREACH resul IN result %]
<tr>
<td>[% resul.summary %]</td>
<td>[% PROCESS authresult summary=resul.summary %]</td>
<td>[% resul.used %] times</td>
<td>
[% IF ( resul.to_report ) %]

View File

@ -2585,6 +2585,15 @@ ul.ui-tabs-nav li {
color: #222222;
}
.authref {
text-indent: 2em;
}
.authref .label {
font-style: italic;
}
/* ## BABELTHEQUE ## */
/* Uncomment if babeltheque configuration no contains these lines */
/*

View File

@ -0,0 +1,59 @@
[% BLOCK showreference %]
[% IF marcflavour == 'UNIMARC' %]
[% SWITCH type %]
[% CASE 'broader' %]
<span class="BT">[% heading %]</span> --
[% CASE 'narrower' %]
<span class="NT">[% heading %]</span> --
[% CASE 'narrower' %]
<span class="NT">[% heading %]</span> --
[% CASE 'seefrom' %]
<span class="UF">[% heading %]</span> --
[% CASE 'seealso' %]
<span class="RT">[% heading %]</span> --
[% END %]
[% ELSE %]
[% IF ( label ) %]<span class="label">[% label %]</span>[% END %]
<span class="heading">[% heading %]</span>
[% UNLESS ( type=='seefrom' || type=='seealso' ) %]<span class="type">[% SWITCH type %]
[% CASE 'earlier' %](Earlier heading)
[% CASE 'later' %](Later heading)
[% CASE 'acronym' %](Acronym)
[% CASE 'musical' %](Musical composition)
[% CASE 'broader' %](Broader heading)
[% CASE 'narrower' %](Narrower heading)
[% CASE %]([% type %])
[% END %]</span>[% END %]
[% END %]
[% END %]
[% BLOCK authresult %]
[% IF ( summary.summary ) %][% summary.summary %]:[% END %]
[% UNLESS ( summary.summaryonly ) %]
[% FOREACH authorize IN summary.authorized %]
<span class="authorizedheading">[% authorize %]</span>
[% END %]
[% IF ( marcflavour == 'UNIMARC' ) %]
[% FOREACH note IN summary.notes %]
<span class="note">[% note %]</span>
[% END %]
[% FOREACH seefro IN summary.seefrom %]
[% PROCESS showreference heading=seefro.heading label="" type=seefro.type %]
[% END %]
[% ELSE %]
[% IF ( summary.seefrom ) %]
[% FOREACH seefro IN summary.seefrom %]
<div class="seefrom authref">
[% PROCESS showreference heading=seefro.heading label="used for/see from:" type=seefro.type %]
</div>
[% END %]
[% END %]
[% IF ( summary.seealso ) %]
[% FOREACH seeals IN summary.seealso %]
<div class="seealso authref">
[% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type %]
</div>
[% END %]
[% END %]
[% END %]
[% END %]
[% END %]

View File

@ -66,8 +66,10 @@ function showChildren(mynumber) {
<p><b>[% Tag0X.tag %]</b></p>
<ul>
[% FOREACH subfiel IN Tag0X.subfield %]
<p><b>[% subfiel.marc_lib %]:</b> [% subfiel.marc_value %]</p>
[% END %]
<p><b>[% subfiel.marc_lib %]:</b>
[% IF subfiel.isurl %]<a href="[% subfiel.marc_value %]">[% subfiel.marc_value %]</a>
[% ELSE %][% subfiel.marc_value %][% END %]</p>
[% END %]
</ul>
[% END %]
</div>

View File

@ -1,3 +1,4 @@
[% PROCESS 'authorities-search-results.inc' %]
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF ( total ) %]Authority search result[% ELSE %]No results found[% END %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
@ -52,11 +53,8 @@
[% ELSE %]
<tr>
[% END %]
<td>[% resul.summary %]</td>
<td>
[% authtypetext %]
</td>
<td>[% PROCESS authresult summary=resul.summary %]</td>
<td>[% authtypetext %]</td>
[% UNLESS ( resul.isEDITORS ) %]
<td>
<a href="/cgi-bin/koha/opac-search.pl?type=opac&amp;op=do_search&amp;q=an=[% resul.authid %]">[% resul.used %] biblios</a>

View File

@ -52,9 +52,8 @@ my $query = new CGI;
my $dbh = C4::Context->dbh;
my $authid = $query->param('authid');
my $authtypecode = &GetAuthTypeCode( $authid );
my $tagslib = &GetTagsLabels( 1, $authtypecode );
my $display_hierarchy = C4::Context->preference("AuthDisplayHierarchy");
my $show_marc = $query->param('marc') || 1; # Currently only MARC view is available
# open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@ -67,8 +66,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
}
);
my $authid = $query->param('authid');
my $authtypecode = &GetAuthTypeCode( $authid );
my $tagslib = &GetTagsLabels( 0, $authtypecode );
my $record;
if (C4::Context->preference("AuthDisplayHierarchy")){
if ($display_hierarchy){
my $trees=BuildUnimarcHierarchies($authid);
my @trees = split /;/,$trees ;
push @trees,$trees unless (@trees);
@ -88,7 +92,7 @@ if (C4::Context->preference("AuthDisplayHierarchy")){
push @loophierarchies, { 'loopelement' =>\@loophierarchy};
}
$template->param(
'displayhierarchy' =>C4::Context->preference("AuthDisplayHierarchy"),
'displayhierarchy' => $display_hierarchy,
'loophierarchies' =>\@loophierarchies,
);
}
@ -145,15 +149,10 @@ foreach my $field (@fields) {
my %subfield_data;
$subfield_data{marc_lib} =
$tagslib->{ $field->tag() }->{ $subf[$i][0] }->{lib};
if ( $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{isurl} ) {
$subfield_data{marc_value} =
"<a href=\"$subf[$i][1]\">$subf[$i][1]</a>";
}
else {
$subfield_data{marc_value} = $subf[$i][1];
}
$subfield_data{marc_subfield} = $subf[$i][0];
$subfield_data{marc_tag} = $field->tag();
$subfield_data{isurl} = $tagslib->{ $field->tag() }->{ $subf[$i][0] }->{isurl};
$subfield_data{marc_value} = $subf[$i][1];
push( @subfields_data, \%subfield_data );
}
}
@ -186,12 +185,6 @@ $template->param(
biblio_fields => $biblio_fields,
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
authtypesloop => \@authtypesloop,
LibraryName => C4::Context->preference("LibraryName"),
OpacNav => C4::Context->preference("OpacNav"),
opaccredits => C4::Context->preference("opaccredits"),
opacsmallimage => C4::Context->preference("opacsmallimage"),
opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
);
output_html_with_http_headers $query, $cookie, $template->output;