From 492dd7dc7f78ae29371f2d5a0e0eab224b406fb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Wed, 3 Oct 2012 17:55:50 +0200 Subject: [PATCH] Bug 8870 UNIMARC authorities search doesn't display information properly - Note field (3xx) are not displayed on search result page. We get 'HASH()' text. - Parallel/Other forms (7xx) are not displayed, with language name in front of heading, both on result and detail page. - Note are not displayed. - On result page, seealso form are displayed, but end with a superfluous '--' - Style the result page, with condensed block, and space between them. - Done both on OPAC/staff To be applied on 3.8.x after bug 8523. Signed-off-by: Jared Camins-Esakov Signed-off-by: Paul Poulain --- C4/AuthoritiesMarc.pm | 58 +++++++++---------- .../prog/en/css/staff-global.css | 10 ++++ .../includes/authorities-search-results.inc | 51 ++++++++++++---- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 10 +++- .../includes/authorities-search-results.inc | 42 ++++++++++---- .../prog/en/includes/opac-authorities.inc | 10 ++++ .../prog/en/modules/opac-auth-detail.tt | 14 +++-- .../opac-authoritiessearchresultlist.tt | 1 + 8 files changed, 135 insertions(+), 61 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 2671cd4195..dde1c0547d 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -959,6 +959,11 @@ sub BuildSummary { 'i' => 'subfi', 't' => 'parent' ); + my %unimarc_relation_from_code = ( + g => 'broader', + h => 'narrower', + a => 'seealso', + ); my %thesaurus; $thesaurus{'1'}="Peuples"; $thesaurus{'2'}="Anthroponymes"; @@ -1023,39 +1028,28 @@ sub BuildSummary { my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : ''; push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom', field => $field->tag() }; } -# see : - foreach my $field ($record->field('5..')) { - if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { - push @seealso, { - heading => $field->as_string('abcdefgjxyz'), - type => 'broader', - field => $field->tag(), - 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', - field => $field->tag(), - search => $field->as_string('abcdefgjxyz'), - authid => $field->subfield('9') - }; - } elsif ($field->subfield('a')) { - push @seealso, { - heading => $field->as_string('abcdefgxyz'), - type => 'seealso', - field => $field->tag(), - search => $field->as_string('abcdefgjxyz'), - authid => $field->subfield('9') - }; + + # see : + @seealso = map { + my $type = $unimarc_relation_from_code{$_->subfield('5') || 'a'}; + my $heading = $_->as_string('abcdefgjxyz'); + { + field => $_->tag, + type => $type, + heading => $heading, + search => $heading, + authid => $_->subfield('9'), } - } -# // form - foreach my $field ($record->field('7..')) { - my $lang = substr($field->subfield('8'),3,3); - push @otherscript, { lang => $lang, term => $field->subfield('a'), direction => 'ltr', field => $field->tag() }; - } + } $record->field('5..'); + + # Other forms + @otherscript = map { { + lang => $_->subfield('8') || '', + term => $_->subfield('a'), + direction => 'ltr', + field => $_->tag, + } } $record->field('7..'); + } else { # construct MARC21 summary # FIXME - looping over 1XX is questionable 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 3ce31d422a..7f8c9a1c40 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -2380,6 +2380,16 @@ ul.ui-tabs-nav li { #authfinderops { float: right; } +div.authorizedheading { + font-weight: bold; +} +.authres_notes, .authres_seealso, .authres_otherscript { + padding-top: 3px; +} +.authres_notes { + font-style: italic; +} + .contents { width: 75%; 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 58f5f2d22a..366c695296 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 @@ -2,15 +2,13 @@ [% IF marcflavour == 'UNIMARC' %] [% SWITCH type %] [% CASE 'broader' %] - [% heading | html %] -- + BT: [% heading | html %] [% CASE 'narrower' %] - [% heading | html %] -- - [% CASE 'narrower' %] - [% heading | html %] -- + NT: [% heading | html %] [% CASE 'seefrom' %] - [% heading | html %] -- + UF: [% heading | html %] [% CASE 'seealso' %] - [% heading | html %] -- + RT: [% heading | html %] [% END %] [% ELSE %] [% IF ( label ) %][% label | html %][% END %] @@ -33,16 +31,37 @@ [% BLOCK authresult %] [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %] [% UNLESS ( summary.summaryonly ) %] +
[% FOREACH authorize IN summary.authorized %] - [% authorize.heading | html %] + [% authorize.heading | html %] [% END %] +
[% IF ( marcflavour == 'UNIMARC' ) %] - [% FOREACH note IN summary.notes %] - [% note | html %] + [% IF summary.notes %] +
+ [% FOREACH note IN summary.notes %] + [% note.note | html %] + [% END %] +
+ [% END %] + [% IF summary.seealso %] +
+ [% FOREACH see IN summary.seealso %] + [% PROCESS showreference heading=see.heading label="" type=see.type search='' %] + [% IF ! loop.last %] ; [% END %] [% END %] - [% FOREACH seefro IN summary.seefrom %] - [% PROCESS showreference heading=seefro.heading label="" type=seefro.type search='' %] +
+ [% END %] + [% IF summary.otherscript %] +
+ [% FOREACH other IN summary.otherscript %] + [% PROCESS language lang=other.lang | trim %]: + [% other.term %] + [% IF ! loop.last %] ; [% END %] [% END %] +
+ [% END %] + [% ELSE %] [% IF ( summary.seefrom ) %] [% FOREACH seefro IN summary.seefrom %] @@ -61,3 +80,13 @@ [% END %] [% END %] [% END %] +[% BLOCK language %] + [% SWITCH lang %] + [% CASE ['en', 'eng'] %]English + [% CASE ['fr', 'fre'] %]French + [% CASE ['it', 'ita'] %]Italian + [% CASE ['de', 'ger', 'deu'] %]German + [% CASE ['es', 'spa'] %]Spanish + [% CASE %][% lang %] + [% END %] +[% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 4211029142..7ab95e0523 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2682,10 +2682,18 @@ ul.ui-tabs-nav li { .authstanzaheading { font-weight: bold; } - +div.authorizedheading { + font-weight: bold; +} .authstanza li { margin-left: 0.5em; } +.authres_notes, .authres_seealso, .authres_otherscript { + padding-top: 5px; +} +.authres_notes { + font-style: italic; +} #didyoumean { background-color: #EEE; 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 58f5f2d22a..6e6db3c3ea 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 @@ -2,15 +2,13 @@ [% IF marcflavour == 'UNIMARC' %] [% SWITCH type %] [% CASE 'broader' %] - [% heading | html %] -- + BT: [% heading | html %] [% CASE 'narrower' %] - [% heading | html %] -- - [% CASE 'narrower' %] - [% heading | html %] -- + NT: [% heading | html %] [% CASE 'seefrom' %] - [% heading | html %] -- + UF: [% heading | html %] [% CASE 'seealso' %] - [% heading | html %] -- + RT: [% heading | html %] [% END %] [% ELSE %] [% IF ( label ) %][% label | html %][% END %] @@ -33,15 +31,35 @@ [% BLOCK authresult %] [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %] [% UNLESS ( summary.summaryonly ) %] - [% FOREACH authorize IN summary.authorized %] +
+ [% FOREACH authorize IN summary.authorized %] [% authorize.heading | html %] - [% END %] + [% END %] +
[% IF ( marcflavour == 'UNIMARC' ) %] - [% FOREACH note IN summary.notes %] - [% note | html %] + [% IF summary.notes %] +
+ [% FOREACH note IN summary.notes %] + [% note.note | html %] + [% END %] +
+ [% END %] + [% IF summary.seealso %] +
+ [% FOREACH see IN summary.seealso %] + [% PROCESS showreference heading=see.heading label="" type=see.type search='' %] + [% IF ! loop.last %] ; [% END %] + [% END %] +
[% END %] - [% FOREACH seefro IN summary.seefrom %] - [% PROCESS showreference heading=seefro.heading label="" type=seefro.type search='' %] + [% IF summary.otherscript %] +
+ [% FOREACH other IN summary.otherscript %] + [% PROCESS language lang=other.lang | trim %]: + [% other.term %] + [% IF ! loop.last %] ; [% END %] + [% END %] +
[% END %] [% ELSE %] [% IF ( summary.seefrom ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-authorities.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-authorities.inc index 2e131bbddb..1a967887b4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-authorities.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-authorities.inc @@ -54,3 +54,13 @@ [% ELSE %][% heading %] [% END %] [% END %] +[% BLOCK language %] + [% SWITCH lang %] + [% CASE ['en', 'eng'] %]English + [% CASE ['fr', 'fre'] %]French + [% CASE ['it', 'ita'] %]Italian + [% CASE ['de', 'ger', 'deu'] %]German + [% CASE ['es', 'spa'] %]Spanish + [% CASE %][% lang %] + [% END %] +[% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt index cb195b1eec..de5eae1346 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt @@ -42,7 +42,7 @@ $(document).ready(function() { [% END %] -

[% summary.mainentry %][% IF authtypetext %]([% authtypetext %])[% END %]

+

[% summary.mainentry %][% IF authtypetext %] ([% authtypetext %])[% END %]

[% FOREACH authorize IN summary.authorized %] @@ -76,13 +76,17 @@ $(document).ready(function() {
[% END %] [% IF marcflavour == 'UNIMARC' && summary.otherscript %] -
+
+
Other forms:
+
    [% FOREACH otherscrip IN summary.otherscript %] -
    See also[% PROCESS language lang=otherscript.lang | trim %] term: +
  • + [% PROCESS language lang=otherscrip.lang | trim %]: [% otherscrip.term %] -
  • + [% 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 96fa3e032f..db9e6950e1 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 'opac-authorities.inc' %] [% 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' %] -- 2.39.5