Bug 10647 - Make OPAC MARC plain view work for all flavours of MARC
authorMagnus Enger <magnus@enger.priv.no>
Fri, 7 Mar 2014 08:10:49 +0000 (09:10 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 14 Mar 2014 14:50:13 +0000 (14:50 +0000)
On "MARC view" in the OPAC, clicking on "Plain view" does not work
for UNIMARC and NORMARC.

To test:
- Make sure you have a UNIMARC or NORMARC setup
- Go to the "MARC view" of a record in the OPAC
- Click on "view plain" and observe the "Sorry, plain view is
  temporarily unavailable." error message
- Apply the patch
- Click on "view plain" and observe that a plain view of the MARC
  record is now displayed
- Sign off

I have only tested this on NORMARC, it might be good if someone
can test on UNIMARC.

Updated 2014-03-13: Incoroprates changes suggested by Marcel.
Test plan is the same as before.

Updated 2014-03-13: Tested in my UNIMARC system.
toggled opactheme to all three values, with OPACXSLTDetailsDisplay
and OPACXSLTResultsDisplay both set to default.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with MARC21 and UNIMARC, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACMARCdetail.xsl [deleted file]
koha-tmpl/opac-tmpl/bootstrap/en/xslt/plainMARC.xsl [new file with mode: 0644]
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl [deleted file]
koha-tmpl/opac-tmpl/prog/en/xslt/plainMARC.xsl [new file with mode: 0644]
opac/opac-showmarc.pl

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACMARCdetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACMARCdetail.xsl
deleted file mode 100644 (file)
index fb8a07e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
-<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>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/plainMARC.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/plainMARC.xsl
new file mode 100644 (file)
index 0000000..fb8a07e
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
+<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>
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl
deleted file mode 100644 (file)
index fb8a07e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
-<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>
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/plainMARC.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/plainMARC.xsl
new file mode 100644 (file)
index 0000000..fb8a07e
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE stylesheet [<!ENTITY nbsp "&#160;" >]>
+<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>
index 27ab61c..c78b5b1 100755 (executable)
@@ -71,7 +71,7 @@ if ($view eq 'card' || $view eq 'html') {
         $xslfile = "compact.xsl";
     }
     else { # must be html
-        $xslfile = C4::Context->preference('marcflavour') . "slim2OPACMARCdetail.xsl";
+        $xslfile = 'plainMARC.xsl';
     }
     $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
     $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );