Skip to content

Commit

Permalink
Add collections info for electronic resources UMA
Browse files Browse the repository at this point in the history
The new option is only for man-sru.php and currently only used
for bestandsabgleich.html for Mannheim. For example for the ISBNs
9781118823828 and 9781118823835 besides that they are online
available (E) one can now also see in which collection i.e. on
which platform (e.g. EBC or O'Reilly) they are available.
  • Loading branch information
zuphilip committed Jul 7, 2024
1 parent 4d3582b commit 5bacd1c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
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

0 comments on commit 5bacd1c

Please sign in to comment.