Proposed fix for Bug 5106 - Simplify MARC view choices in the OPAC (Conflict marker fix 2nd try)

- Eliminates the "Extended MARC View" tab
- Points the "MARC View" tab to opac-MARCDetail.pl as it is when XSLT is off
- Offers a "view plain" link on opac-MARCDetail.pl. Clicking this link
  replaces the standard labeled MARC view with an unformatted view similar to the
  one displayed in the pop-up modal MARC view.
- When viewing the "plain view," clicking the "view labeled" link will return
  you to the standard labeled MARC view.
- Adds a new XSL file for displaying MARC data in a slightly-more-formatted
  manner (compared to one big <pre></pre> block).

Removed a conflict marker line from Owen's patch (Marcel).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2010-12-20 20:11:26 +01:00 committed by Chris Cormack
parent 8fe46f3dc1
commit 3f0eeb9c28
8 changed files with 154 additions and 78 deletions

View file

@ -2000,3 +2000,8 @@ div.ft {
background-color : rgb(239, 254, 213);
background-color : rgba(239, 254, 213, 0.4);
}
#plainmarc table { border: 0; margin: .7em 0 0 0; font-family: monospace; font-size: 95%; }
#plainmarc th { background-color : #FFF; border: 0; white-space: nowrap; text-align:left; vertical-align: top; padding: 2px; }
#plainmarc td { border: 0; padding : 2px; vertical-align: top; }

View file

@ -21,14 +21,6 @@
});
//]]>
</script>
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" --><script type="text/javascript">
var GB_ROOT_DIR = "/opac-tmpl/prog/en/lib/greybox/";
</script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/gb_scripts.js"></script>
<link href="/opac-tmpl/prog/en/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
<!-- /TMPL_IF -->
</head>
<body id="opac-isbddetail">
@ -38,21 +30,17 @@
<div id="yui-main">
<div class="yui-b"><div id="opac-detail" class="yui-ge">
<div class="yui-b">
<div id="opac-detail" class="yui-ge">
<div class="yui-u first">
<div class="container">
<div id="catalogue_detail_biblio">
<h1 style="float:left;margin:0 1em 1em 0;">ISBD View</h1> <div id="views">
<span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Normal View</a></span> <!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
<span class="view"><a id="MARCviewPop" href="/cgi-bin/koha/opac-showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC View</a></span>
<span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Expanded MARC View</a></span>
<!-- TMPL_ELSE -->
<span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">MARC View</a></span>
<!-- /TMPL_IF --> <span class="view"><span id="ISBDview">ISBD View</span></span>
</div>
<span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Normal View</a></span> <span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">MARC View</a></span> <span class="view"><span id="ISBDview">ISBD View</span></span></div>
<div id="isbdcontents"><!-- TMPL_VAR name="ISBD" --></div>
</div>
</div>
</div>

View file

@ -17,16 +17,42 @@
YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionfurthersearchesMenu);
});
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
var GB_ROOT_DIR = "/opac-tmpl/prog/en/lib/greybox/";
$(document).ready(function(){
$.ajaxSetup({
error:function(x,e){
switch (x.status) {
case 200: break;
default:
$('#switchview').parent().html("<div class=\"dialog alert\">"+_("Sorry, plain view is temporarily unavailable")+".</div>");
$("#plainmarc").hide();
$("#labeledmarc").show();
break;
}
}
});
var loaded = 0;
$("#switchview").toggle(
function () {
$(this).text(_("view labeled"));
$("#labeledmarc").hide();
if(!loaded){
$("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"/opac-tmpl/prog/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=<!-- TMPL_VAR name="biblionumber" -->&viewas=html");
loaded = 1;
} else {
$("#plainmarc").show();
}
},
function () {
$(this).text(_("view plain"));
$("#labeledmarc").show();
$("#plainmarc").hide();
}
);
});
<!-- /TMPL_IF -->
//]]>
</script>
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/gb_scripts.js"></script>
<link href="/opac-tmpl/prog/en/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
<!-- /TMPL_IF -->
</head>
<body id="opac-marcdetail">
@ -34,28 +60,25 @@
<div id="bd">
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<div id="yui-main">
<div class="yui-b"><div id="opac-detail" class="yui-ge">
<div class="yui-u first">
<div class="container">
<div id="catalogue_detail_biblio">
<h1 style="float:left;margin: 0 1em 1em 0;">MARC View</h1>
<div id="views">
<span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Normal View</a></span>
<h2 style="float:left;margin: 0 1em 1em 0;">MARC View</h2>
<div id="views">
<span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">Normal View</a></span>
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
<span class="view"><a id="MARCviewPop" href="/cgi-bin/koha/opac-showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC View</a></span>
<span class="view"><span id="MARCview">Expanded MARC View</span></span>
<!-- TMPL_ELSE -->
<span class="view"><span id="MARCview">MARC View</span>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="ISBD" --><span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">ISBD View</a></span><!-- /TMPL_IF -->
<span class="view"><span id="MARCview">MARC View</span></span>
<!-- TMPL_IF NAME="ISBD" --><span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->">ISBD View</a></span><!-- /TMPL_IF -->
</div>
<h1 style="clear:both;"><!-- TMPL_VAR NAME="bibliotitle" --> (Record no. <!-- TMPL_VAR NAME="biblionumber" -->)</h1>
<table id="marc">
<h3 style="clear:both;"><!-- TMPL_VAR NAME="bibliotitle" --> (Record no. <!-- TMPL_VAR NAME="biblionumber" -->)</h3>
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
<div>[ <a id="switchview" href="/cgi-bin/koha/opac-showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->&amp;viewas=html">view plain</a> ]</div>
<div id="plainmarc"></div><!-- /TMPL_IF -->
<div id="labeledmarc">
<table id="marc">
<!-- TMPL_LOOP name="0XX" -->
<tr><th colspan="2"><!-- TMPL_VAR name="tag" --></th></tr>
<!-- TMPL_LOOP name="subfield" -->
@ -155,9 +178,10 @@
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
</table>
</div>
<!-- TMPL_IF NAME="item_header_loop" -->
<table id="items">
<caption>Copies</caption>
<caption>Copies</caption>
<tr>
<!-- TMPL_LOOP name="item_header_loop" -->
<th>
@ -176,23 +200,23 @@
</div>
</div>
</div>
<div class="yui-u">
<div class="container">
<div class="yui-u">
<div class="container">
<ul id="action">
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="RequestOnOpac" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="ItemsIssued" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="RequestOnOpac" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="ItemsIssued" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
Print
@ -223,11 +247,11 @@
</div>
<!-- /TMPL_IF -->
<div id="export">
<form method="get" action="/cgi-bin/koha/opac-export.pl">
<label for="format">Save Record:</label>
<select name="format" id="format">
<option value="">-- Choose Format --</option>
<div id="export">
<form method="get" action="/cgi-bin/koha/opac-export.pl">
<label for="format">Save Record:</label>
<select name="format" id="format">
<option value="">-- Choose Format --</option>
<option value="mods">MODS (XML)</option>
<option value="dc">Dublin Core (XML)</option>
<option value="marcxml">MARCXML</option>

View file

@ -47,14 +47,6 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
<style type="text/css">
#addtagl { display: none; }
</style>
<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" --><script type="text/javascript">
var GB_ROOT_DIR = "/opac-tmpl/prog/en/lib/greybox/";
</script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/gb_scripts.js"></script>
<link href="/opac-tmpl/prog/en/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
<!-- /TMPL_IF -->
</head>
<body id="opac-detail">

View file

@ -181,10 +181,9 @@
</xsl:choose>
<div id="views">
<span class="view"><span id="Normalview">Normal View</span> </span>
<span class="view"><a id="MARCviewPop" href="/cgi-bin/koha/opac-showmarc.pl?id={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC" rel="gb_page_center[600,500]">MARC View</a></span>
<span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC">Expanded MARC View</a></span>
<span class="view"><a id="MARCview" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}" title="MARC">MARC View</a></span>
<xsl:if test="$ShowISBD!='0'">
<span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}">Card View (ISBD)</a></span>
<span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber={marc:datafield[@tag=999]/marc:subfield[@code='c']}">ISBD View</a></span>
</xsl:if>
</div>

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"/>
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -63,17 +63,30 @@ if ($importid) {
}
if ($view eq 'card') {
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = $parser->parse_string($xmlrecord);
my $style_doc = $parser->parse_file($xslfile);
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $newxmlrecord = $stylesheet->output_string($results);
#warn $newxmlrecord;
print $input->header(), $newxmlrecord;
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl";
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = $parser->parse_string($xmlrecord);
my $style_doc = $parser->parse_file($xslfile);
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $newxmlrecord = $stylesheet->output_string($results);
#warn $newxmlrecord;
print $input->header(), $newxmlrecord;
exit;
} elsif ($view eq 'html'){
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl";
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = $parser->parse_string($xmlrecord);
my $style_doc = $parser->parse_file($xslfile);
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $newxmlrecord = $stylesheet->output_string($results);
#warn $newxmlrecord;
print $input->header(), $newxmlrecord;
exit;
} else {
$record =GetMarcBiblio($biblionumber) unless $record;