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. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Bug 11175: (QA follow-up) Fixes for bug 12561 Bug 12561 changed the prototype for XSLTParse4Display so this patcha accounts for the additional calls to that method introduced in this patchset. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
69a3d0fd8e
commit
b292ebbcce
27
C4/XSLT.pm
27
C4/XSLT.pm
|
|
@ -281,11 +281,10 @@ sub XSLTParse4Display {
|
|||
}
|
||||
}
|
||||
|
||||
my $partsxml = '';
|
||||
# possibly insert component records into Detail views
|
||||
# possibly show analytics link in Detail views
|
||||
if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) {
|
||||
my $biblio //= Koha::Biblios->find( $biblionumber );
|
||||
my $components = $biblio->get_marc_components(300);
|
||||
$biblio //= Koha::Biblios->find( $biblionumber );
|
||||
my $components = $biblio->get_marc_components();
|
||||
$variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1;
|
||||
|
||||
my $showcomp = C4::Context->preference('ShowComponentRecords');
|
||||
|
|
@ -296,25 +295,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 = ('<componentPartRecords>');
|
||||
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, '</componentPartRecords>';
|
||||
$partsxml = join "\n", @componentPartRecordXML;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +306,7 @@ sub XSLTParse4Display {
|
|||
$varxml .= "</variables>\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;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,28 @@ 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_components(300) ) {
|
||||
my $parts;
|
||||
for my $part ( @{$components} ) {
|
||||
$part = MARC::Record->new_from_xml( $part, 'UTF-8' );
|
||||
|
||||
push @{$parts},
|
||||
XSLTParse4Display(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
record => $part,
|
||||
xsl_syspref => "XSLTResultsDisplay",
|
||||
fix_amps => 1,
|
||||
}
|
||||
);
|
||||
}
|
||||
$template->param( ComponentParts => $parts );
|
||||
}
|
||||
}
|
||||
|
||||
# Get acquisition details
|
||||
if ( C4::Context->preference('AcquisitionDetails') ) {
|
||||
my $orders = Koha::Acquisition::Orders->search(
|
||||
|
|
|
|||
|
|
@ -594,7 +594,6 @@ ol {
|
|||
|
||||
li {
|
||||
list-style: decimal;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
&.bibliodetails {
|
||||
|
|
@ -615,14 +614,6 @@ ol {
|
|||
padding: 7px 0;
|
||||
}
|
||||
|
||||
.componentPartRecordsContainer {
|
||||
float: right;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-width: 50%;
|
||||
max-height: 25em;
|
||||
}
|
||||
|
||||
#editions {
|
||||
table,
|
||||
td {
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@
|
|||
</li>
|
||||
[% END %]
|
||||
[% IF ( MARCNOTES || notes ) %]<li><a href="#description">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %]
|
||||
[% IF ( ComponentParts ) %]<li><a href="#components">Components ([% ( ComponentParts.size || 1 ) %])</a></li>[% END %]
|
||||
[% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %]
|
||||
[% IF Koha.Preference('AcquisitionDetails') %]<li><a href="#acq_details">Acquisition details</a></li>[% END %]
|
||||
[% IF suggestions.count %]<li><a href="#suggestion_details">Suggestion details</a></li>[% END %]
|
||||
|
|
@ -674,6 +675,23 @@ Note that permanent location is a code, and location may be an authval.
|
|||
|
||||
[% END %]
|
||||
|
||||
[% IF ComponentParts.size %]
|
||||
<div id="components">
|
||||
<div class="content_set">
|
||||
<table>
|
||||
[% FOR PART IN ComponentParts %]
|
||||
<tr>
|
||||
<td>
|
||||
[% PART | $raw %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% END %]
|
||||
|
||||
[% IF ( subscriptionsnumber ) %]
|
||||
<div id="subscriptions">
|
||||
<div id="catalogue_detail_subscriptions">
|
||||
|
|
|
|||
|
|
@ -115,8 +115,6 @@
|
|||
</h1>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:call-template name="showComponentParts"/>
|
||||
|
||||
<!--Bug 13381 -->
|
||||
<xsl:if test="marc:datafield[@tag=245]">
|
||||
<h1 class="title" property="name">
|
||||
|
|
|
|||
|
|
@ -578,78 +578,6 @@
|
|||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="showComponentParts">
|
||||
<!-- Component part records: Displaying title and author of component part records -->
|
||||
<xsl:if test="marc:componentPartRecords">
|
||||
<xsl:variable name="ComponentPartQuery" select="marc:variables/marc:variable[@name='ComponentPartQuery']" />
|
||||
<div class="results_summary componentPartRecordsContainer">
|
||||
<h5>Component part records</h5>
|
||||
<ol class="componentParts">
|
||||
<xsl:for-each select="marc:componentPartRecords/marc:record">
|
||||
<li>
|
||||
<span class="componentPartRecord">
|
||||
<span class="componentPartRecordTitle">
|
||||
<a>
|
||||
<xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']" /></xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
|
||||
<xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
|
||||
<xsl:for-each select="marc:datafield[@tag=240]">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString">
|
||||
<xsl:call-template name="subfieldSelect">
|
||||
<xsl:with-param name="codes">amnp</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
|
||||
<xsl:for-each select="marc:datafield[@tag=130]">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString">
|
||||
<xsl:call-template name="subfieldSelect">
|
||||
<xsl:with-param name="codes">amnp</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>[Record with no title statement]</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
</span>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
|
||||
-
|
||||
<span class="componentPartRecordAuthor">
|
||||
<xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
|
||||
</span>
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
|
||||
-
|
||||
<span class="componentPartRecordAuthor">
|
||||
<xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
|
||||
</span>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</span>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ol>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(marc:componentPartRecords/marc:record) = 300">
|
||||
<p>Only 300 results are shown: <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($ComponentPartQuery, true())"/></xsl:attribute>show all component parts</a></p>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
|
||||
|
|
|
|||
|
|
@ -292,14 +292,6 @@ th {
|
|||
}
|
||||
|
||||
|
||||
.componentPartRecordsContainer {
|
||||
float: right;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-width: 50%;
|
||||
max-height: 25em;
|
||||
}
|
||||
|
||||
#members {
|
||||
p {
|
||||
color: #727272;
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@
|
|||
[% IF SYNDETICS_SUMMARY %][% SET title_notes_count = title_notes_count + 1 %][% END %]
|
||||
<li id="tab_descriptions"> <a href="#descriptions">Title notes ( [% title_notes_count | html %] )</a></li>
|
||||
[% END %]
|
||||
[% IF ( ComponentParts ) %]<li><a href="#components">Components ([% ( ComponentParts.size || 1 ) %])</a></li>[% END %]
|
||||
[% IF ( SYNDETICS_TOC ) %]
|
||||
<li id="tab_toc"> <a href="#toc">TOC</a></li>
|
||||
[% END %]
|
||||
|
|
@ -584,6 +585,22 @@
|
|||
</div> <!-- / #descriptions -->
|
||||
[% END # / IF MARCNOTES || notes %]
|
||||
|
||||
[% IF ComponentParts.size %]
|
||||
<div id="components">
|
||||
<div class="content_set">
|
||||
<table>
|
||||
[% FOR PART IN ComponentParts %]
|
||||
<tr>
|
||||
<td>
|
||||
[% PART | $raw %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
[% IF ( SyndeticsEnabled ) %]
|
||||
[% IF ( SyndeticsTOC && SYNDETICS_TOC ) %]
|
||||
<div id="toc">
|
||||
|
|
|
|||
|
|
@ -127,8 +127,6 @@
|
|||
</h2>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:call-template name="showComponentParts"/>
|
||||
|
||||
<!--Bug 13381 -->
|
||||
<xsl:if test="marc:datafield[@tag=245]">
|
||||
<h1 class="title" property="name">
|
||||
|
|
|
|||
|
|
@ -542,72 +542,6 @@
|
|||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="showComponentParts">
|
||||
<!-- Component part records: Displaying title and author of component part records -->
|
||||
<xsl:if test="marc:componentPartRecords">
|
||||
<div class="results_summary componentPartRecordsContainer">
|
||||
<h5>Component part records</h5>
|
||||
<ol class="componentParts">
|
||||
<xsl:for-each select="marc:componentPartRecords/marc:record">
|
||||
<li>
|
||||
<span class="componentPartRecord">
|
||||
<span class="componentPartRecordTitle">
|
||||
<a>
|
||||
<xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']" /></xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
|
||||
<xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
|
||||
<xsl:for-each select="marc:datafield[@tag=240]">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString">
|
||||
<xsl:call-template name="subfieldSelect">
|
||||
<xsl:with-param name="codes">amnp</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
|
||||
<xsl:for-each select="marc:datafield[@tag=130]">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString">
|
||||
<xsl:call-template name="subfieldSelect">
|
||||
<xsl:with-param name="codes">amnp</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>[Record with no title statement]</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
</span>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
|
||||
-
|
||||
<span class="componentPartRecordAuthor">
|
||||
<xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
|
||||
</span>
|
||||
</xsl:when>
|
||||
<xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
|
||||
-
|
||||
<span class="componentPartRecordAuthor">
|
||||
<xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
|
||||
</span>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</span>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ol>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
|
||||
|
|
|
|||
|
|
@ -657,6 +657,28 @@ my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
|
|||
my $viewallitems = $query->param('viewallitems');
|
||||
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
|
||||
|
||||
# Get component parts details
|
||||
my $showcomp = C4::Context->preference('ShowComponentRecords');
|
||||
if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
|
||||
if ( my $components = $biblio->get_marc_components(300) ) {
|
||||
my $parts;
|
||||
for my $part ( @{$components} ) {
|
||||
$part = MARC::Record->new_from_xml( $part, 'UTF-8' );
|
||||
|
||||
push @{$parts},
|
||||
XSLTParse4Display(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
record => $part,
|
||||
xsl_syspref => 'OPACXSLTResultsDisplay',
|
||||
fix_amps => 1,
|
||||
}
|
||||
);
|
||||
}
|
||||
$template->param( ComponentParts => $parts );
|
||||
}
|
||||
}
|
||||
|
||||
# Get items on order
|
||||
my ( @itemnumbers_on_order );
|
||||
if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue