Get metadataPrefix even when resuming lists
This commit is contained in:
parent
50075d05b8
commit
e5c96c160f
|
@ -245,7 +245,7 @@ class OAI2Server {
|
||||||
private function createResumptionToken($deliveredRecords, $metadataPrefix, $from, $until) {
|
private function createResumptionToken($deliveredRecords, $metadataPrefix, $from, $until) {
|
||||||
list($usec, $sec) = explode(' ', microtime());
|
list($usec, $sec) = explode(' ', microtime());
|
||||||
$token = ((int)($usec*1000) + (int)($sec*1000));
|
$token = ((int)($usec*1000) + (int)($sec*1000));
|
||||||
$file = fopen($this->token_prefix.$token, 'w');
|
$file = fopen($this->token_prefix.$token.'#'.$metadataPrefix, 'w');
|
||||||
if($file == false) {
|
if($file == false) {
|
||||||
exit('Cannot write resumption token. Writing permission needs to be changed.');
|
exit('Cannot write resumption token. Writing permission needs to be changed.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,13 @@
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:variable name='verb' select="/oai:OAI-PMH/oai:request/@verb"/>
|
<xsl:variable name='verb' select="/oai:OAI-PMH/oai:request/@verb"/>
|
||||||
<xsl:variable name='metadataPrefix' select="/oai:OAI-PMH/oai:request/@metadataPrefix"/>
|
|
||||||
<xsl:variable name='identifier' select="/oai:OAI-PMH/oai:request/@identifier"/>
|
<xsl:variable name='identifier' select="/oai:OAI-PMH/oai:request/@identifier"/>
|
||||||
|
<xsl:if test="/oai:OAI-PMH/oai:request/@metadataPrefix">
|
||||||
|
<xsl:variable name='metadataPrefix' select="/oai:OAI-PMH/oai:request/@metadataPrefix"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="/oai:OAI-PMH/oai:request/@resumptionToken">
|
||||||
|
<xsl:variable name='metadataPrefix' select="substring-after(/oai:OAI-PMH/oai:request/@resumptionToken,'#')"/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:variable name='from' select="/oai:OAI-PMH/oai:request/@from"/>
|
<xsl:variable name='from' select="/oai:OAI-PMH/oai:request/@from"/>
|
||||||
<xsl:variable name='until' select="/oai:OAI-PMH/oai:request/@until"/>
|
<xsl:variable name='until' select="/oai:OAI-PMH/oai:request/@until"/>
|
||||||
|
|
||||||
|
@ -296,7 +301,12 @@ Metadata Format Details
|
||||||
ListIdentifiers
|
ListIdentifiers
|
||||||
-->
|
-->
|
||||||
<xsl:template match="oai:ListIdentifiers">
|
<xsl:template match="oai:ListIdentifiers">
|
||||||
|
<xsl:when test="$metadataPrefix">
|
||||||
<p class="info">This is a list of records' identifiers available for the metadata format <em><xsl:value-of select="$metadataPrefix"/></em>.</p>
|
<p class="info">This is a list of records' identifiers available for the metadata format <em><xsl:value-of select="$metadataPrefix"/></em>.</p>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<p class="info">This is a resumed list of records' identifiers available for the requested metadata format.</p>
|
||||||
|
</xsl:otherwise>
|
||||||
<ol>
|
<ol>
|
||||||
<xsl:apply-templates select="oai:header" />
|
<xsl:apply-templates select="oai:header" />
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -308,7 +318,7 @@ ListIdentifiers
|
||||||
<h3>Record Header <em><xsl:value-of select="oai:identifier"/></em></h3>
|
<h3>Record Header <em><xsl:value-of select="oai:identifier"/></em></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>» <a class="link" href="?verb=ListMetadataFormats&identifier={oai:identifier}">ListMetadataFormats</a></li>
|
<li>» <a class="link" href="?verb=ListMetadataFormats&identifier={oai:identifier}">ListMetadataFormats</a></li>
|
||||||
<li>» <a class="link" href="?verb=GetRecord&metadataPrefix={$metadataPrefix}&identifier={oai:identifier}">GetRecord</a></li>
|
<xsl:if test="$metadataPrefix"><li>» <a class="link" href="?verb=GetRecord&metadataPrefix={$metadataPrefix}&identifier={oai:identifier}">GetRecord</a></li></xsl:if>
|
||||||
</ul>
|
</ul>
|
||||||
<table class="values">
|
<table class="values">
|
||||||
<tr><td class="key">Identifier</td>
|
<tr><td class="key">Identifier</td>
|
||||||
|
@ -330,7 +340,12 @@ ListIdentifiers
|
||||||
ListRecords
|
ListRecords
|
||||||
-->
|
-->
|
||||||
<xsl:template match="oai:ListRecords">
|
<xsl:template match="oai:ListRecords">
|
||||||
|
<xsl:when test="$metadataPrefix">
|
||||||
<p class="info">This is a list of records available for the metadata format <em><xsl:value-of select="$metadataPrefix"/></em>.</p>
|
<p class="info">This is a list of records available for the metadata format <em><xsl:value-of select="$metadataPrefix"/></em>.</p>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<p class="info">This is a resumed list of records available for the requested metadata format.</p>
|
||||||
|
</xsl:otherwise>
|
||||||
<ol>
|
<ol>
|
||||||
<xsl:apply-templates select="oai:record" />
|
<xsl:apply-templates select="oai:record" />
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -361,7 +376,7 @@ Record Details
|
||||||
<h3>Record <em><xsl:value-of select="oai:identifier"/></em></h3>
|
<h3>Record <em><xsl:value-of select="oai:identifier"/></em></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>» <a class="link" href="?verb=ListMetadataFormats&identifier={oai:identifier}">ListMetadataFormats</a></li>
|
<li>» <a class="link" href="?verb=ListMetadataFormats&identifier={oai:identifier}">ListMetadataFormats</a></li>
|
||||||
<xsl:if test="$verb != 'GetRecord'"><li>» <a class="link" href="?verb=GetRecord&metadataPrefix={$metadataPrefix}&identifier={oai:identifier}">GetRecord</a></li></xsl:if>
|
<xsl:if test="$verb != 'GetRecord'"><xsl:if test="$metadataPrefix"><li>» <a class="link" href="?verb=GetRecord&metadataPrefix={$metadataPrefix}&identifier={oai:identifier}">GetRecord</a></li></xsl:if></xsl:if>
|
||||||
</ul>
|
</ul>
|
||||||
<table class="values">
|
<table class="values">
|
||||||
<tr><td class="key">Identifier</td>
|
<tr><td class="key">Identifier</td>
|
||||||
|
@ -400,7 +415,7 @@ Resumption Token
|
||||||
Unknown Metadata
|
Unknown Metadata
|
||||||
-->
|
-->
|
||||||
<xsl:template match="oai:metadata/*" priority='-100'>
|
<xsl:template match="oai:metadata/*" priority='-100'>
|
||||||
<h4>Metadata Format <em><xsl:value-of select="$metadataPrefix"/></em></h4>
|
<h4>Metadata <xsl:if test="$metadataPrefix"><em>(<xsl:value-of select="$metadataPrefix"/>)</em></xsl:if></h4>
|
||||||
<div class="xmlSource">
|
<div class="xmlSource">
|
||||||
<xsl:apply-templates select="." mode='xmlMarkup' />
|
<xsl:apply-templates select="." mode='xmlMarkup' />
|
||||||
</div>
|
</div>
|
||||||
|
@ -410,7 +425,7 @@ Unknown Metadata
|
||||||
DublinCore Metadata
|
DublinCore Metadata
|
||||||
-->
|
-->
|
||||||
<xsl:template match="oai_dc:dc" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
<xsl:template match="oai_dc:dc" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
||||||
<h4>Metadata Format <em>DublinCore</em></h4>
|
<h4>Metadata <em>(DublinCore)</em></h4>
|
||||||
<table>
|
<table>
|
||||||
<xsl:apply-templates select="*" />
|
<xsl:apply-templates select="*" />
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue