Bugzilla – Attachment 33551 Details for
Bug 13151
staff marc preview not wrapping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13151 - staff marc preview not wrapping
Bug-13151---staff-marc-preview-not-wrapping.patch (text/plain), 8.08 KB, created by
Frédéric Demians
on 2014-11-14 08:59:02 UTC
(
hide
)
Description:
Bug 13151 - staff marc preview not wrapping
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2014-11-14 08:59:02 UTC
Size:
8.08 KB
patch
obsolete
>From 94fb475e28e0b3e20bd6ba3215bd6ea822f2f53e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 13 Nov 2014 12:49:42 -0500 >Subject: [PATCH] Bug 13151 - staff marc preview not wrapping > >The MARC preview available on the staff client detail page doesn't wrap >long lines of text because it uses a huge block of whitespace-formatted >text in a <pre> tag. The OPAC doesn't have this problem because the MARC >preview is formated in a table. > >This patch copies the OPAC's "plainMARC.xsl" file for use in the staff >client. The preview modal has been converted to use Bootstrap following >the method used in Bug 12755 > >To test, apply the patch and clear your browser cache. View the >detail page for a bibliographic record in the staff client. Click the >link to show the MARC preview. Confirm that the modal looks correct, >works correctly, and adapts gracefully to different browser widths. > >Confirm that the MARC preview and Card links still work from Z39.50 >searches. > >Note: This patch assumes that UNIMARC records display correctly using >xslt/plainMARC.xsl. Please let me know if that is wrong. > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > >I confirm it works: nice modal dialog box; display aligned on opac display; >works also with Unimarc biblios. >--- > catalogue/showmarc.pl | 10 +++- > .../intranet-tmpl/prog/en/css/staff-global.css | 7 +++ > .../prog/en/modules/catalogue/detail.tt | 24 ++++++++- > koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl | 59 ++++++++++++++++++++++ > 4 files changed, 96 insertions(+), 4 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl > >diff --git a/catalogue/showmarc.pl b/catalogue/showmarc.pl >index 97bc6fe..1954ce8 100755 >--- a/catalogue/showmarc.pl >+++ b/catalogue/showmarc.pl >@@ -54,10 +54,16 @@ if(!ref $record) { > exit; > } > >-if($view eq 'card') { >+if($view eq 'card' || $view eq 'html') { > my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber); >- my $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC' >+ my $xsl; >+ if ( $view eq 'card' ){ >+ $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC' > ? 'UNIMARC_compact.xsl' : 'compact.xsl'; >+ } >+ else { >+ $xsl = 'plainMARC.xsl'; >+ } > my $htdocs = C4::Context->config('intrahtdocs'); > my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'intranet', $input); > $xsl = "$htdocs/$theme/$lang/xslt/$xsl"; >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 dc557c3..cc1fdfa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css >@@ -1721,6 +1721,13 @@ span.permissiondesc { > color: black; > } > >+#marcPreview table { border: 0; margin: .7em 0 0 0; font-family: monospace; font-size: 95%; } >+#marcPreview th { background-color : #FFF; border: 0; white-space: nowrap; text-align:left; vertical-align: top; padding: 2px; } >+#marcPreview td { border: 0; padding : 2px; vertical-align: top; } >+#marcPreview tbody tr:nth-child(2n+1) td { background-color: #FFF; } >+#marcPreview { width : 80%; margin-left : -40%; } >+@media (max-width: 767px) { #marcPreview { margin: 0; width : auto; } } >+ > #cartDetails { > background-color : #FFF; > border: 1px solid #739acf; >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 efd1dc4..89ddb87 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -175,6 +175,15 @@ function verify_images() { > [% IF ( LocalCoverImages && ! localimages.0 ) %] > showNoImageMessage(); > [% END %] >+ $("body").on("click",".previewMARC", function(e){ >+ e.preventDefault(); >+ var page = $(this).attr("href"); >+ $("#marcPreview .modal-body").load(page + " table"); >+ $('#marcPreview').modal({show:true}); >+ }); >+ $("#marcPreview").on("hidden", function(){ >+ $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >+ }); > }); > > [% IF ( AmazonCoverImages ) %]$(window).load(function() { >@@ -363,7 +372,7 @@ function verify_images() { > [% END %] > </span> > [% END %] >- <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC Preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Show</a></span> >+ <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC Preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber %]&viewas=html" title="MARC" class="previewMARC">Show</a></span> > [% IF ( holdcount ) %]<span class="results_summary"><span class="label">Holds:</span> <span class="holdcount"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber %]">[% holdcount %]</a></span></span>[% ELSE %][% END %] > > [% IF ( AmazonCoverImages ) %]</div><div class="yui-u" id="bookcoverimg"> >@@ -1009,7 +1018,18 @@ function verify_images() { > </form> > </div> > >- >+<div id="marcPreview" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h3 id="marcPreviewLabel">MARC preview</h3> >+ </div> >+ <div class="modal-body"> >+ <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> >+ </div> >+</div> > > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl >new file mode 100644 >index 0000000..84c2753 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl >@@ -0,0 +1,59 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> >+<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >+ <xsl:output method="html" encoding="UTF-8"/> >+ >+ <xsl:template match="/"> >+ <html> >+ <head><title>MARC View</title></head> >+ <body> >+ <xsl:apply-templates/> >+ </body> >+ </html> >+ </xsl:template> >+ >+ <xsl:template match="marc:record"> >+ <table> >+ <tr> >+ <th style="white-space:nowrap"> >+ 000 >+ </th> >+ <td colspan="2"></td> >+ <td> >+ <xsl:value-of select="marc:leader"/> >+ </td> >+ </tr> >+ <xsl:apply-templates select="marc:datafield|marc:controlfield"/> >+ </table> >+ </xsl:template> >+ >+ <xsl:template match="marc:controlfield"> >+ <tr> >+ <th style="white-space:nowrap"> >+ <xsl:value-of select="@tag"/> >+ </th> >+ <td colspan="2"></td> >+ <td> >+ <xsl:value-of select="."/> >+ </td> >+ </tr> >+ </xsl:template> >+ >+ <xsl:template match="marc:datafield"> >+ <tr> >+ <th style="white-space:nowrap"> >+ <xsl:value-of select="@tag"/> >+ </th> >+ <td><xsl:value-of select="@ind1"/></td> >+ <td><xsl:value-of select="@ind2"/></td> >+ <td><xsl:apply-templates select="marc:subfield"/></td> >+ </tr> >+ </xsl:template> >+ >+ <xsl:template match="marc:subfield"> >+ <strong>_<xsl:value-of select="@code"/></strong> <xsl:value-of select="."/> >+ <xsl:choose> >+ <xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when><xsl:otherwise><br /></xsl:otherwise></xsl:choose> >+ </xsl:template> >+ >+</xsl:stylesheet> >-- >2.1.2
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 13151
:
32796
|
33529
|
33551
|
33796