From 5ae6328515ba745bdf0556bc7249b714a7b0813e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 9 Aug 2021 08:30:12 +0100 Subject: [PATCH] Bug 11175: Display components in own tab This patch updates the display so that rather than displaying the components using the main XSLT and then using CSS to move them into a box on the right side for display, which causes issues with RTL records; We instead add them in a new tab beneath the rest of the record details alongside holdings and other details. --- C4/XSLT.pm | 25 +------ catalogue/detail.pl | 20 +++++ .../prog/css/src/staff-global.scss | 9 --- .../prog/en/modules/catalogue/detail.tt | 18 +++++ .../en/xslt/MARC21slim2intranetDetail.xsl | 2 - .../prog/en/xslt/MARC21slimUtils.xsl | 73 ------------------- .../opac-tmpl/bootstrap/css/src/opac.scss | 9 --- .../bootstrap/en/modules/opac-detail.tt | 17 +++++ .../en/xslt/MARC21slim2OPACDetail.xsl | 2 - .../bootstrap/en/xslt/MARC21slimUtils.xsl | 67 ----------------- opac/opac-detail.pl | 21 ++++++ 11 files changed, 79 insertions(+), 184 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 0bdfb13039..ee1cbd3b5b 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -282,11 +282,10 @@ sub XSLTParse4Display { } } - my $partsxml = ''; - # possibly insert component records into Detail views + # possibly show analytics link in Detail views if ($xslsyspref =~ m/Details/) { $biblio //= Koha::Biblios->find( $biblionumber ); - my $components = $biblio->get_marc_analytics(300); + my $components = $biblio->get_marc_analytics(); $variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1; my $showcomp = C4::Context->preference('ShowComponentRecords'); @@ -297,25 +296,7 @@ sub XSLTParse4Display { || ( $showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) ) { - $variables->{show_analytics_link} = 0; - - my $search_query = $biblio->get_analytics_query; - $variables->{ComponentPartQuery} = $search_query; - - my @componentPartRecordXML = (''); - for my $cb ( @{ $components } ) { - if( ref $cb eq 'MARC::Record'){ - $cb = $cb->as_xml_record(); - } else { - $cb = decode('utf8', $cb); - } - # Remove the xml header - $cb =~ s/^<\?xml.*?\?>//; - push @componentPartRecordXML,$cb; - } - push @componentPartRecordXML, ''; - $partsxml = join "\n", @componentPartRecordXML; } } @@ -326,7 +307,7 @@ sub XSLTParse4Display { $varxml .= "\n"; my $sysxml = get_xslt_sysprefs(); - $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/; + $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs $xmlrecord =~ s/\&amp;/\&/g; $xmlrecord =~ s/\&\;lt\;/\<\;/g; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index e5efa5c569..c41aa2c455 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -210,6 +210,26 @@ foreach my $subscription (@subscriptions) { push @subs, \%cell; } +# Get component parts details +my $showcomp = C4::Context->preference('ShowComponentRecords'); +if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { + if ( my $components = $biblio->get_marc_analytics(300) ) { + my $xslparts = C4::Context->preference('XSLTResultsDisplay') || "default"; + if ( $xslparts ) { + my $parts; + for my $part ( @{$components} ) { + $part = MARC::Record->new_from_xml( $part, 'UTF-8' ); + + push @{$parts}, + XSLTParse4Display( 1, $part, "XSLTResultsDisplay", 1, + undef, $sysxml, $xslparts, $lang, ); + } + $template->param( + ComponentParts => $parts + ); + } + } +} # Get acquisition details if ( C4::Context->preference('AcquisitionDetails') ) { diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index a8424633e6..26e07c9e1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -583,7 +583,6 @@ ol { li { list-style: decimal; - list-style-position: inside; } &.bibliodetails { @@ -604,14 +603,6 @@ ol { padding: 7px 0; } -.componentPartRecordsContainer { - float: right; - overflow-y: auto; - overflow-x: hidden; - max-width: 50%; - max-height: 25em; -} - #editions { table, td { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 7c2b961d6c..6cd934f77a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -274,6 +274,7 @@ [% END %] [% IF ( MARCNOTES || notes ) %]
  • Descriptions ([% ( MARCNOTES.size || 1 ) | html %])
  • [% END %] +[% IF ( ComponentParts ) %]
  • Components ([% ( ComponentParts.size || 1 ) %])
  • [% END %] [% IF ( subscriptionsnumber ) %]
  • Subscriptions
  • [% END %] [% IF Koha.Preference('AcquisitionDetails') %]
  • Acquisition details
  • [% END %] [% IF suggestions.count %]
  • Suggestion details
  • [% END %] @@ -679,6 +680,23 @@ Note that permanent location is a code, and location may be an authval. [% END %] +[% IF ComponentParts.size %] +
    +
    + + [% FOR PART IN ComponentParts %] + + + + [% END %] +
    + [% PART | $raw %] +
    +
    +
    + +[% END %] + [% IF ( subscriptionsnumber ) %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index 0142de249c..49cbd715f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -115,8 +115,6 @@ - -

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl index f947d4ade9..7ac4911cfd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -577,79 +577,6 @@ - - - - - - - - - [% END # / IF MARCNOTES || notes %] + [% IF ComponentParts.size %] +
    +
    + + [% FOR PART IN ComponentParts %] + + + + [% END %] +
    + [% PART | $raw %] +
    +
    +
    + [% END %] + [% IF ( SyndeticsEnabled ) %] [% IF ( SyndeticsTOC && SYNDETICS_TOC ) %]
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl index 4e42738636..1704004ea1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl @@ -127,8 +127,6 @@

    - -

    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl index 11b1bbebcf..fdd334d7fd 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl @@ -541,73 +541,6 @@ - - - - - - - -