Bugzilla – Attachment 10420 Details for
Bug 7943
Untranslatable strings in OPAC's authority search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[3.8.x] Bug 7943: Authority search results are untranslatable
38x-Bug-7943-Authority-search-results-are-untransl.patch (text/plain), 37.13 KB, created by
Jared Camins-Esakov
on 2012-06-22 02:52:16 UTC
(
hide
)
Description:
[3.8.x] Bug 7943: Authority search results are untranslatable
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-06-22 02:52:16 UTC
Size:
37.13 KB
patch
obsolete
>From 068b1513e15323d9c5df18e658fd79d9f2793a07 Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Wed, 30 May 2012 15:20:40 -0400 >Subject: [PATCH] [3.8.x] Bug 7943: Authority search results are untranslatable >Content-Type: text/plain; charset="UTF-8" > >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. > >Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> >Rebased for 3.8.x on 21 June 2012. >--- > C4/Auth.pm | 5 +- > C4/AuthoritiesMarc.pm | 335 ++++++++++---------- > authorities/ysearch.pl | 10 +- > cataloguing/addbiblio.pl | 1 - > .../intranet-tmpl/prog/en/css/staff-global.css | 9 + > .../en/includes/authorities-search-results.inc | 59 ++++ > .../modules/authorities/searchresultlist-auth.tt | 3 +- > .../en/modules/authorities/searchresultlist.tt | 3 +- > .../value_builder/unimarc_field_210c.tt | 3 +- > koha-tmpl/opac-tmpl/prog/en/css/opac.css | 9 + > .../en/includes/authorities-search-results.inc | 59 ++++ > ...uthoritiesdetail.tt => opac-auth-MARCdetail.tt} | 6 +- > .../en/modules/opac-authoritiessearchresultlist.tt | 8 +- > opac/opac-authoritiesdetail.pl | 29 +- > 14 files changed, 340 insertions(+), 199 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc > create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc > rename koha-tmpl/opac-tmpl/prog/en/modules/{opac-authoritiesdetail.tt => opac-auth-MARCdetail.tt} (92%) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 97ff3d4..fdbb010 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -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" ) { >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 7fed6d3..61d9591 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -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 /> <i>used for/see from:</i> ".$field->as_string(); >- } #See Also >- foreach my $field ($record->field('5..')) { >- $altheading.= "<br /> <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 >diff --git a/authorities/ysearch.pl b/authorities/ysearch.pl >index 56ef8e2..561ae4e 100755 >--- a/authorities/ysearch.pl >+++ b/authorities/ysearch.pl >@@ -62,10 +62,14 @@ if ( $auth_status ne "ok" ) { > my $startfrom = 0; > > my ( $results, $total ) = SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value, $startfrom * $resultsperpage, $resultsperpage, $authtypecode, $orderby ); >- foreach (@$results) { >- my ($value) = $_->{'summary'}; >+ foreach my $result (@$results) { >+ my $value = ''; >+ my $authorized = $result->{'summary'}->{authorized}; >+ foreach my $heading (@$authorized) { >+ $value .= $heading . ' '; >+ } > # Removes new lines > $value =~ s/<br \/>/ /g; > $value =~ s/\n//g; >- print nsb_clean($value) . "\n"; >+ print nsb_clean($value) . "\n"; > } >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index d5778a4..643fc53 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -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; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >index 0fc678c..1587a0f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >@@ -2236,3 +2236,12 @@ div#acqui_order_supplierlist > div.supplier > span.action { > div#acqui_order_supplierlist > div.supplier > div.baskets { > margin-top: 0.5em; > } >+ >+ >+.authref { >+ text-indent: 2em; >+} >+ >+.authref .label { >+ font-style: italic; >+} >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 >new file mode 100644 >index 0000000..92314b1 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc >@@ -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 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >index 7fd5607..2881710 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >@@ -1,3 +1,4 @@ >+[% PROCESS 'authorities-search-results.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › 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 %] >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 1131871..038959f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >@@ -1,3 +1,4 @@ >+[% PROCESS 'authorities-search-results.inc' %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Authorities › 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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt >index 5306146..043e700 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt >@@ -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 ) %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >index bdb2dc9..4400647 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css >+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css >@@ -2371,6 +2371,15 @@ span.sep { > text-shadow: 1px 1px 0 #FFF; > } > >+.authref { >+ text-indent: 2em; >+} >+ >+.authref .label { >+ font-style: italic; >+} >+ >+ > /* ## BABELTHEQUE ## */ > /* Uncomment if babeltheque configuration no contains these lines */ > /* >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 >new file mode 100644 >index 0000000..92314b1 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc >@@ -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 %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiesdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-MARCdetail.tt >similarity index 92% >rename from koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiesdetail.tt >rename to koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-MARCdetail.tt >index 287f6d1..8e87d71 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiesdetail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-MARCdetail.tt >@@ -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> >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 5fdfb27..a27480a 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt >@@ -1,3 +1,4 @@ >+[% PROCESS 'authorities-search-results.inc' %] > [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › [% 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&op=do_search&q=an=[% resul.authid %]">[% resul.used %] biblios</a> >diff --git a/opac/opac-authoritiesdetail.pl b/opac/opac-authoritiesdetail.pl >index 6610dfd..41b994f 100755 >--- a/opac/opac-authoritiesdetail.pl >+++ b/opac/opac-authoritiesdetail.pl >@@ -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; > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7943
:
9111
|
10261
|
10291
|
10292
|
10293
| 10420 |
10421