Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add collections info for electronic resources UMA #167

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions isbn/man-sru.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein
* man-sru?isbn=ISBN&format=json
* man-sru?isbn=ISBN&format=holdings
*
* man-sru?isbn=ISBN&format=holdings&with=collections
*
* Sucht übergebene ISBN bzw. PPN in der SRU-Schnittstelle der UB Mannheim
* und gibt maximal 10 Ergebnisse als MARCXML, JSON zurück oder eine
* formattierte Bestandsangabe (eine kurze Zeile und die Details in einer
Expand Down Expand Up @@ -118,6 +119,7 @@

$map = STANDARD_MARC_MAP;
$map['bestand'] = '//datafield[@tag="AVA"]/subfield[@code="b"]';
$map['sammlung'] = '//datafield[@tag="AVE"]/subfield[@code="m"]';

if (!isset($_GET['format'])) {
header('Content-type: text/xml');
Expand Down Expand Up @@ -173,6 +175,7 @@
echo "</table>\n";
echo "<hr/>\n";
if ($aveNodes) {
$collections = [];
echo "<table>\n";
foreach ($aveNodes as $node) {
echo "<tr>\n";
Expand All @@ -183,6 +186,10 @@
echo " <td>" . $value . "</td>";
}
echo "\n</tr>\n";
$collection = $node->xpath('./subfield[@code="m"]');
if ($collection) {
$collections[] = getValues($collection[0]);
}
}
echo "</table>\n";
echo "<hr/>\n";
Expand All @@ -195,10 +202,14 @@
}
if ($aveNodes) {
echo "E";
if ($_GET['with']) {
echo ' (' . implode(" | ", $collections) . ')';
}
}
echo '</div>';
} elseif ($aveNodes and !$avaNodes) {
echo "<table>\n";
$collections = [];
foreach ($aveNodes as $node) {
echo "<tr>\n";
$subfields = $node->xpath('./subfield');
Expand All @@ -208,10 +219,18 @@
echo " <td>" . $value . "</td>";
}
echo "\n</tr>\n";
$collection = $node->xpath('./subfield[@code="m"]');
if ($collection) {
$collections[] = getValues($collection[0]);
}
}
echo "</table>\n";
echo "<hr/>\n";
echo '<div>Bestand der UB Mannheim: E</div>';
echo '<div>Bestand der UB Mannheim: E';
if ($_GET['with']) {
echo ' (' . implode(" | ", $collections) . ')';
}
echo '</div>';
} elseif ($size > 100) {
//if the isbn is not found, then the $outputString is a minimal xml document
//of size 48, for larger size something might be found...
Expand Down
6 changes: 4 additions & 2 deletions tools/bestandsabgleich.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!--
function listeEingabe() {
var isbnListe = $("#isbnListe").val();
$('#ausgabe').empty();
var isbnArray = isbnListe.split("\n");
$('#ausgabe').empty();
$("#total").html(isbnArray.length);
isbnArray.forEach(function(value, index) {
check(index, encodeURIComponent(value));
Expand All @@ -22,9 +22,10 @@
function check(index, value) {
$('#ausgabe').append('<div id="query-' + index + '"/>');
$('#query-'+index).attr("data-isbn", value);
var suffix = (document.getElementById("mitSammlungen").checked) ? "&with=collections" : "";
var numberOfDigits = value.replace(/\D/g, '').length;
if (numberOfDigits>=9) {
$.get("../isbn/man-sru.php?format=holdings&isbn="+value, function(data) {
$.get("../isbn/man-sru.php?format=holdings&isbn="+value+suffix, function(data) {
var pattern = /<div>Bestand der UB Mannheim: (.*)</;
var holdingsMAN = pattern.exec(data);
if (holdingsMAN && value) {
Expand Down Expand Up @@ -76,6 +77,7 @@ <h2>Eingabe</h2>
<textarea id="isbnListe" cols="100" rows="20"></textarea><br/>
<input type="checkbox" name="verlinken" value="Bike" id="mitLink"> Mit Link
<input type="checkbox" name="verlinken" id="mitISBN"> Mit ISBN
<input type="checkbox" name="verlinken" id="mitSammlungen"> Sammlungen anzeigen
<input type="button" value="Bestand prüfen" onclick='listeEingabe();' />
</form>

Expand Down
Loading