diff --git a/.gitignore b/.gitignore index 0aaf83f..3118d6e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /bnb/BNBDaten/* /dist/phpcs.phar *~ +*.bak diff --git a/index.html b/index.html index 2e00014..03d4050 100644 --- a/index.html +++ b/index.html @@ -19,8 +19,12 @@

malibu - Mannheim library utilities

malibu ist Open Source Software. Den Quellcode findet man auf GitHub zusammen mit der Möglichkeit eigene Issues oder Pull Requests zu stellen: https://github.com/UB-Mannheim/malibu

Ansprechperson: Philipp Zumstein

diff --git a/isbn/alma-sru.php b/isbn/alma-sru.php new file mode 100644 index 0000000..9c53582 --- /dev/null +++ b/isbn/alma-sru.php @@ -0,0 +1,285 @@ + + * + * This is free software licensed under the terms of the GNU GPL, + * version 3, or (at your option) any later version. + * See for more details. + * + * Aufruf aus Webbrowser: + * alma-sru?isbn=ISBN + * ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen + * ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein + * alma-sru?bibliothek=BIB&isbn=ISBN&format=json + * alma-sru?bibliothek=BIB&isbn=ISBN&format=holdings + * alma-sru?bibliothek=BIB&isbn=ISBN&format=holdings&with=collections +* + * Sucht übergebene ISBN bzw. PPN in der SRU-Schnittstelle einer Alma-Bibliothek + * und gibt maximal 10 Ergebnisse als MARCXML, JSON zurück oder eine + * formattierte Bestandsangabe (eine kurze Zeile und die Details in einer + * Tabelle). + */ + +include 'conf.php'; +include 'lib.php'; + +$file = file_get_contents('./srulibraries.json'); +$json = json_decode($file, true); +if (isset($_GET['bibliothek']) and isset($json[$_GET['bibliothek']])) { + $urlBase = $json[$_GET['bibliothek']]['sru']; +} else { + echo "Bibliothek nicht gefunden in der Liste der bekannten Alma-SRU-Schnittstellen.\n"; + exit; +} + +$urlBase = $urlBase . '?version=1.2&operation=searchRetrieve&recordSchema=marcxml&query='; + +if (!isset($_GET['ppn']) and !isset($_GET['isbn'])) { + echo "Weder isbn noch ppn Parameter für eine Suche angegeben.\n"; + exit; +} + +$suchString = ''; + +if (isset($_GET['ppn'])) { + $n = trim($_GET['ppn']); + $searchObject = "ppn"; +} +if (isset($_GET['isbn'])) { + $n = trim($_GET['isbn']); + $searchObject = "isbn"; +} +$nArray = preg_split("/\s*(or|,|;)\s*/i", $n, -1, PREG_SPLIT_NO_EMPTY); +$suchString = 'alma.all=' . implode('+OR+alma.all=', $nArray); +$filteredSuchString = 'alma.mms_tagSuppressed=false' . '+AND+(' . $suchString . ')'; + +# work around ExLibris server configuration issue +# and increase timeout (i.e. waiting time) +$contextOptions = [ + 'ssl' => [ + 'verify_peer' => true, + 'ciphers' => 'DEFAULT@SECLEVEL=1', + ], + 'http' => [ + 'timeout' => 10, + ], +]; +$context = stream_context_create($contextOptions); +$result = file_get_contents($urlBase . $filteredSuchString, false, $context); + +if ($result === false) { + header('HTTP/1.1 400 Bad Request'); + echo "Verbindung zu SRU-Schnittstelle fehlgeschlagen\n"; + var_dump($urlBase . $filteredSuchString); + exit; +} + +// Delete namespaces such that we don't need to specify them +// in every xpath query. +$result = str_replace(' xmlns:xs="http://www.w3.org/2001/XMLSchema"', '', $result); +$result = str_replace(' xmlns="http://www.loc.gov/MARC21/slim"', '', $result); + +$doc = new DOMDocument(); +$doc->preserveWhiteSpace = false; +@$doc->loadHTML($result); +$xpath = new DOMXPath($doc); + +$records = $xpath->query("//records/record/recorddata/record"); //beachte: kein CamelCase sondern alles klein schreiben + +$outputString = "\n"; +$outputString .= "\n"; +$outputArray = []; + +foreach ($records as $record) { + // Filter out any other results which contain the ISBN but not in the 020 or 776 field + // or the PPN in the 001 or 035 field(s). + $pattern = [ + "isbn" => './/datafield[@tag="020" or @tag="776"]/subfield', + "ppn" => './/controlfield[@tag="001"]|.//datafield[@tag="035"]/subfield' + ]; + $foundMatch = false; + $nodes = $xpath->query($pattern[$searchObject], $record); + foreach ($nodes as $foundNode) { + $foundValue = $foundNode->nodeValue; + foreach ($nArray as $queryValue) { + $testString = $queryValue; + if ($searchObject == "isbn") { + $testString = preg_replace('/[^0-9xX]/', '', $testString); + $foundValue = preg_replace('/[^0-9xX]/', '', $foundValue); + if (strlen($testString) == 13) { + // Delete the 978-prefix and the check value at the end for ISBN13 + $testString = substr($testString, 3, -1); + } elseif (strlen($testString) == 10) { + // Delete check value at the end for ISBN10 + $testString = substr($testString, 0, -1); + } + // for isbn, check that the test string is part of the found value + if (strpos($foundValue, $testString) !== false) { + $foundMatch = true; + } + } else { + // for ppn (or other ids), skip the possible prefix in paranthesis and then they need to be exactly the same + $foundValue = preg_replace('/^\(.*\)/', '', $foundValue); + if ($foundValue == $testString) { + $foundMatch = true; + } + } + } + } + if ($foundMatch) { + $outputString .= $doc->saveXML($record); + array_push($outputArray, $doc->saveXML($record)); + } +} +$outputString .= ""; + + +$map = STANDARD_MARC_MAP; +$map['bestand'] = '//datafield[@tag="AVA"]/subfield[@code="b"]'; +$map['sammlung'] = '//datafield[@tag="AVE"]/subfield[@code="m"]'; +// TODO Prüfen ob man die SW nicht allgemeingültig so wie folgt behandeln könnte +// (Feld 689 wird von HBZ und SWISS genutzt und Feld 650 von SWISS; +// Unterfeld 2 hat nur SWISS mit "gnd" gefüllt; aber alle nutzen Unterfeld +// 0 zur Verlinkung mit der GND beginnend mit "(DE-588)". Aber unklar wie dies +// etwa bei Formschlagwörtern ohne Verlinkung aussieht.) +$map['sw'] = array( + 'mainPart' => '//datafield[starts-with(@tag,"6") and (starts-with(subfield[@code="0"],"(DE-588)") or subfield[@code="2"]="gnd")]', + 'value' => './subfield[@code="a"]', + 'subvalues' => './subfield[@code="b" or @code="t"]', + 'additional' => './subfield[@code="g" or @code="z"]', + 'key' => './subfield[@code="0" and contains(text(), "(DE-588)")]' + ); + +if (!isset($_GET['format'])) { + header('Content-type: text/xml'); + echo $outputString; +} elseif ($_GET['format'] == 'json') { + $outputXml = simplexml_load_string($outputString); + + $outputMap = performMapping($map, $outputXml); + $outputIndividualMap = []; + for ($j = 0; $j < count($outputArray); $j++) { + $outputXml = simplexml_load_string($outputArray[$j]); + $outputSingleMap = performMapping($map, $outputXml); + array_push($outputIndividualMap, $outputSingleMap); + } + $outputMap["einzelaufnahmen"] = $outputIndividualMap; + + + header('Content-type: application/json'); + echo json_encode($outputMap, JSON_PRETTY_PRINT); +} elseif ($_GET['format'] == 'holdings') { + echo "\n\n Bestand Alma-SRU zu ISBN-Suche\n \n \n\n\n"; + $outputXml = simplexml_load_string($outputString); + $avaNodes = $outputXml->xpath('//datafield[@tag="AVA"]'); + $aveNodes = $outputXml->xpath('//datafield[@tag="AVE"]'); + $size = strlen($outputString); + if ($avaNodes) { + echo "\n"; + $bestand = []; + foreach ($avaNodes as $node) { + echo "\n"; + $subfields = $node->xpath('./subfield'); + foreach ($subfields as $subfield) { + $code = $subfield[0]["code"]; + $value = getValues($subfield[0]); + echo " "; + } + echo "\n\n"; + + $location = getValues($node->xpath('./subfield[@code="b"]')[0]); + $sublocation = getValues($node->xpath('./subfield[@code="c"]')[0]); + + $node_f = $node->xpath('./subfield[@code="f"]'); + $number = count($node_f) ? getValues($node_f[0]) : 0; + if (array_key_exists($location, $bestand)) { + $bestand[$location] += $number; + } else { + $bestand[$location] = $number; + } + } + echo "
" . $value . "
\n"; + echo "
\n"; + if ($aveNodes) { + $collections = []; + echo "\n"; + foreach ($aveNodes as $node) { + echo "\n"; + $subfields = $node->xpath('./subfield'); + foreach ($subfields as $subfield) { + $code = $subfield[0]["code"]; + $value = getValues($subfield[0]); + echo " "; + } + echo "\n\n"; + $collection = $node->xpath('./subfield[@code="m"]'); + if ($collection) { + $collectionValue = getValues($collection[0]); + $availability = $node->xpath('./subfield[@code="e"]'); + if ($availability and getValues($availability[0]) != "Available") { + $collectionValue .= " [" . getValues($availability[0]) . "]"; + } + $collections[] = $collectionValue; + } + } + echo "
" . $value . "
\n"; + echo "
\n"; + } + + + echo '
Bestand Alma-SRU: '; + foreach ($bestand as $loc => $n) { + echo $n . "x" . $loc . ", "; + } + if ($aveNodes) { + echo "E"; + if ($_GET['with']) { + echo ' (' . implode(" | ", $collections) . ')'; + } + } + echo '
'; + } elseif ($aveNodes and !$avaNodes) { + echo "\n"; + $collections = []; + foreach ($aveNodes as $node) { + echo "\n"; + $subfields = $node->xpath('./subfield'); + foreach ($subfields as $subfield) { + $code = $subfield[0]["code"]; + $value = getValues($subfield[0]); + echo " "; + } + echo "\n\n"; + $collection = $node->xpath('./subfield[@code="m"]'); + if ($collection) { + $collectionValue = getValues($collection[0]); + $availability = $node->xpath('./subfield[@code="e"]'); + if ($availability and getValues($availability[0]) != "Available") { + $collectionValue .= " [" . getValues($availability[0]) . "]"; + } + $collections[] = $collectionValue; + } + } + echo "
" . $value . "
\n"; + echo "
\n"; + echo '
Bestand Alma-SRU: E'; + if ($_GET['with']) { + echo ' (' . implode(" | ", $collections) . ')'; + } + echo '
'; + } elseif ($size > 100) { + //if the isbn/ppn is not found, then the $outputString is a minimal xml document + //of size 48, for larger size something might be found... + $sruUrl = str_replace('format=holdings', '', $_SERVER['REQUEST_URI']); + echo '
Bestand Alma-SRU: eventuell da (' . $size . ")
\n"; + echo '
See SRU Result
'; + } else { + echo 'Es wurde nichts gefunden'; + } + echo "\n\n"; +} diff --git a/isbn/dnb.php b/isbn/dnb.php new file mode 100644 index 0000000..57d1cf8 --- /dev/null +++ b/isbn/dnb.php @@ -0,0 +1,105 @@ + + * + * This is free software licensed under the terms of the GNU GPL, + * version 3, or (at your option) any later version. + * See for more details. + * + * Aufruf aus Webbrowser: + * dnb.php?isbn=ISBN + * ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen + * ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein + * dnb.php?isbn=ISBN&format=json + * + * Sucht übergebene ISBN bzw. PPN in der SRU-Schnittstelle der DNB + * und gibt maximal 10 Ergebnisse als MARCXML oder JSON zurück. + */ + + /* +Explain SRU + +https://services.dnb.de/sru/dnb?version=1.1&operation=explain + +(v1.2 not supported, Bestandsdaten im Format MARC21plus-xml aber Mehraufwand und daher mal weggelassen) + +https://www.dnb.de/DE/Professionell/Metadatendienste/Datenbezug/SRU/sru_node.html + +*/ + +include 'conf.php'; +include 'lib.php'; + +if (isset($_GET['ppn'])) { + $ppn = trim($_GET['ppn']); + $suchString = 'dnb.idn=' . $ppn; +} + +$urlBase = 'https://services.dnb.de/sru/dnb?version=1.1&operation=searchRetrieve&recordSchema=MARC21-xml&query='; +if (isset($_GET['isbn'])) { + $n = trim($_GET['isbn']); + $nArray = preg_split("/\s*(or|,|;)\s*/i", $n, -1, PREG_SPLIT_NO_EMPTY); + $suchString = 'dnb.num=' . implode('+OR+dnb.num=', $nArray); +} + +$result = file_get_contents($urlBase . $suchString, false); + +if ($result === false) { + header('HTTP/1.1 400 Bad Request'); + echo "Verbindung zu SRU-Schnittstelle fehlgeschlagen\n"; + var_dump($urlBase . $suchString); + exit; +} + +// Delete namespaces such that we don't need to specify them +// in every xpath query. +$result = str_replace(' xmlns:xs="http://www.w3.org/2001/XMLSchema"', '', $result); +$result = str_replace(' xmlns="http://www.loc.gov/MARC21/slim"', '', $result); + +$doc = new DOMDocument(); +$doc->preserveWhiteSpace = false; +@$doc->loadHTML($result); +$xpath = new DOMXPath($doc); + +$records = $xpath->query("//records/record/recorddata/record"); //beachte: kein CamelCase sondern alles klein schreiben + +$outputString = "\n"; +$outputString .= "\n"; +$outputArray = []; + + +foreach ($records as $record) { + $outputString .= $doc->saveXML($record); + array_push($outputArray, $doc->saveXML($record)); +} +$outputString .= ""; + +$map = STANDARD_MARC_MAP; +// SW Zusätze im Unterfeld 9 sind nur "rswk-swf", was wir nicht wollen, +// daher müssen wir den Teil hier überschreiben mit den restlichen Unterfelder +$map['sw']['additional'] = './subfield[@code="g" or @code="z"]'; + +if (!isset($_GET['format'])) { + header('Content-type: text/xml'); + echo $outputString; +} elseif ($_GET['format'] == 'json') { + $outputXml = simplexml_load_string($outputString); + + $outputMap = performMapping($map, $outputXml); + $outputIndividualMap = []; + for ($j = 0; $j < count($outputArray); $j++) { + $outputXml = simplexml_load_string($outputArray[$j]); + $outputSingleMap = performMapping($map, $outputXml); + array_push($outputIndividualMap, $outputSingleMap); + } + $outputMap["einzelaufnahmen"] = $outputIndividualMap; + + + header('Content-type: application/json'); + echo json_encode($outputMap, JSON_PRETTY_PRINT); +} diff --git a/isbn/hbz.php b/isbn/hbz.php index a57d9f1..5af217c 100644 --- a/isbn/hbz.php +++ b/isbn/hbz.php @@ -1,116 +1,4 @@ - * - * This is free software licensed under the terms of the GNU GPL, - * version 3, or (at your option) any later version. - * See for more details. - * - * Aufruf aus Webbrowser: - * hbz?isbn=ISBN - * ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen - * ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein - * hbz?ppn=PPN - * PPN ist die eine ID-Nummer des HBZ - * hbz?isbn=ISBN&format=json - * hbz?ppn=PPN&format=json - * Ausgabe erfolgt als JSON - * - * Sucht übergebene ISBN bzw. PPN im HBZ-Katalog - * und gibt maximal 10 Ergebnisse als MABXML zurück - * bzw. als JSON. - */ - -include 'conf.php'; -include 'lib.php'; - -$id = yaz_connect(HBZ_URL); -yaz_syntax($id, HBZ_SYNTAX); - -yaz_range($id, 1, 10); -yaz_element($id, HBZ_ELEMENTSET); - -if (isset($_GET['ppn'])) { - $ppn = trim($_GET['ppn']); - yaz_search($id, "rpn", '@attr 5=100 @attr 1=12 "' . $ppn . '"'); -} -if (isset($_GET['isbn'])) { - $n = trim($_GET['isbn']); - $nArray = explode(",", $n); - if (count($nArray) > 1) { - //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147" - //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird - $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \"' - . implode('\" @attr 1=7 \"', $nArray) . '\"'; - yaz_search($id, "rpn", $suchString); - } else { - yaz_search($id, "rpn", '@attr 5=100 @attr 1=7 "' . $n . '"'); - } - // @attr 5=100 -> no truncation, ist aber Standardeinstellung, kann daher auch weg -} - -yaz_wait(); -$error = yaz_error($id); -if (!empty($error)) { - echo "Error Number: " . yaz_errno($id); - echo "Error Description: " . $error; - echo "Additional Error Information: " . yaz_addinfo($id); -} - -$outputString = "\n"; -$outputString .= "\n"; -$outputArray = []; - -for ($p = 1; $p <= yaz_hits($id); $p++) { - $record = yaz_record($id, $p, "render;charset=iso5426,utf8"); //render;charset=iso5426,utf8 - $error = yaz_error($id); - if (!empty($error)) { - echo "Error Number: " . yaz_errno($id); - echo "Error Description: " . $error; - echo "Additional Error Information: " . yaz_addinfo($id); - } - $recordArray = explode("\x1e", $record); - $header = substr($recordArray[0], 0, 24); - $recordContent = '' . "\n"; - $recordContent .= printLine(substr($recordArray[0], 24)); - - - for ($j = 1; $j < count($recordArray); $j++) { - $recordContent .= printLine($recordArray[$j]); - } - - $recordContent .= '' . "\n"; - $outputString .= $recordContent; - array_push($outputArray, $recordContent); -} - -$outputString .= ""; -yaz_close($id); - -$map = STANDARD_MAB_MAP; - -if (!isset($_GET['format'])) { - header('Content-type: text/xml'); - echo $outputString; -} elseif ($_GET['format'] == 'json') { - $outputXml = simplexml_load_string($outputString); - $outputMap = performMapping($map, $outputXml); - $outputIndividualMap = []; - for ($j = 0; $j < count($outputArray); $j++) { - $outputXml = simplexml_load_string($outputArray[$j]); - $outputSingleMap = performMapping($map, $outputXml); - array_push($outputIndividualMap, $outputSingleMap); - } - $outputMap["einzelaufnahmen"] = $outputIndividualMap; - - - header('Content-type: application/json'); - echo json_encode($outputMap, JSON_PRETTY_PRINT); -} +// Redirect +$url = str_replace('/hbz.php', '/alma-sru.php', $_SERVER['REQUEST_URI']) . "&bibliothek=DE-HBZ"; +header('Location: '. $url); diff --git a/isbn/malibu_light.css b/isbn/malibu_light.css index 30bf09b..08dd171 100644 --- a/isbn/malibu_light.css +++ b/isbn/malibu_light.css @@ -301,8 +301,8 @@ input, select { /*text-decoration: none;*/ } -#rvkB3KAT, #rvkHBZ, #rvkK10PLUS, #rvkHEBIS, #rvkOBVSG, #rvkSWB, #rvkSWISS, -#swB3KAT, #swHBZ, #swK10PLUS, #swHEBIS, #swOBVSG, #swSWB, #swSWISS, #rvkaggregiert a { +/* #rvkB3KAT, #swK10PLUS, #rvkaggregiert etc. */ +[id^=rvk] a, [id^=sw] a { font-weight: bold; diff --git a/isbn/obvsg.php b/isbn/obvsg.php index d08d15e..5c8d8b0 100644 --- a/isbn/obvsg.php +++ b/isbn/obvsg.php @@ -1,141 +1,4 @@ - * - * This is free software licensed under the terms of the GNU GPL, - * version 3, or (at your option) any later version. - * See for more details. - * - * Aufruf aus Webbrowser: - * obvsg.php?isbn=ISBN - * ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen - * ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein - * obvsg.php?isbn=ISBN&format=json - * - * Sucht übergebene ISBN bzw. PPN in der SRU-Schnittstelle von obvsg.at (OBV-LIT) - * und gibt maximal 10 Ergebnisse als MARCXML oder JSON zurück. - */ - -include 'conf.php'; -include 'lib.php'; - -/* -SRU access - -https://www.obvsg.at/services/verbundsystem/sru -*/ -$urlBase = 'https://services.obvsg.at/sru/OBV-LIT?operation=searchRetrieve&query='; - -$searchISBN = false; -$searchPPN = false; - -if (isset($_GET['ppn'])) { - $n = trim($_GET['ppn']); - $searchPPN = true; -} -if (!$searchPPN && isset($_GET['isbn'])) { - $n = trim($_GET['isbn']); - $searchISBN = true; -} -if ($searchPPN || $searchISBN) { - $nArray = preg_split("/\s*(or|,|;)\s*/i", $n, -1, PREG_SPLIT_NO_EMPTY); - $suchString = 'alma.all=' . implode('+OR+alma.all=', $nArray); -} - -$filteredSuchString = 'alma.mms_tagSuppressed=false+AND+(' . $suchString . ')&maximumRecords=10'; - -$contextOptions = [ - 'http' => [ - 'header' => 'Connection: close\r\n', - 'timeout' => 10, - ], -]; -$context = stream_context_create($contextOptions); -$result = file_get_contents($urlBase . $filteredSuchString, false, $context); - -if ($result === false) { - header('HTTP/1.1 400 Bad Request'); - echo "Verbindung zu SRU-Schnittstelle fehlgeschlagen\n"; - var_dump($urlBase . $filteredSuchString); - exit; -} - -// Delete namespaces such that we don't need to specify them -// in every xpath query. -$result = str_replace(' xmlns:xs="http://www.w3.org/2001/XMLSchema"', '', $result); -$result = str_replace(' xmlns="http://www.loc.gov/MARC21/slim"', '', $result); - -$doc = new DOMDocument(); -$doc->preserveWhiteSpace = false; -@$doc->loadHTML($result); -$xpath = new DOMXPath($doc); - -$records = $xpath->query("//records/record/recorddata/record"); //beachte: kein CamelCase sondern alles klein schreiben - -$outputString = "\n"; -$outputString .= "\n"; -$outputArray = []; - - -foreach ($records as $record) { - // Filter out any other results which contain the ISBN but not in the 020 or 776 field - $foundMatch = false; - if ($searchISBN) { - $foundIsbns = $xpath->query('.//datafield[@tag="020" or @tag="776"]/subfield', $record); - foreach ($foundIsbns as $foundNode) { - $foundValue = $foundNode->nodeValue; - foreach ($nArray as $queryValue) { - $testString = preg_replace('/[^0-9xX]/', '', $queryValue); - if (strlen($testString) == 13) { - // Delete the 978-prefix and the check value at the end for ISBN13 - $testString = substr($testString, 3, -1); - } elseif (strlen($testString) == 10) { - // Delete check value at the end for ISBN10 - $testString = substr($testString, 0, -1); - } - if (strpos(preg_replace('[^0-9xX]', '', $foundValue), $testString) !== false) { - $foundMatch = true; - } - } - } - } - if (!$searchISBN || $foundMatch) { - $outputString .= $doc->saveXML($record); - array_push($outputArray, $doc->saveXML($record)); - } -} -$outputString .= ""; - -$map = STANDARD_MARC_MAP; -$map['sw'] = array( - 'mainPart' => '//datafield[starts-with(@tag,"689")]', - 'value' => './subfield[@code="a"]', - 'subvalues' => './subfield[@code="b" or @code="t"]', - 'additional' => './subfield[@code="g" or @code="z"]', - 'key' => './subfield[@code="0" and contains(text(), "(DE-588)")]' - ); - -if (!isset($_GET['format'])) { - header('Content-type: text/xml'); - echo $outputString; -} elseif ($_GET['format'] == 'json') { - $outputXml = simplexml_load_string($outputString); - - $outputMap = performMapping($map, $outputXml); - $outputIndividualMap = []; - for ($j = 0; $j < count($outputArray); $j++) { - $outputXml = simplexml_load_string($outputArray[$j]); - $outputSingleMap = performMapping($map, $outputXml); - array_push($outputIndividualMap, $outputSingleMap); - } - $outputMap["einzelaufnahmen"] = $outputIndividualMap; - - - header('Content-type: application/json'); - echo json_encode($outputMap, JSON_PRETTY_PRINT); -} +// Redirect +$url = str_replace('/obvsg.php', '/alma-sru.php', $_SERVER['REQUEST_URI']) . "&bibliothek=AT-OBVSG"; +header('Location: '. $url); diff --git a/isbn/rendering.js b/isbn/rendering.js index 769784e..f72cea4 100644 --- a/isbn/rendering.js +++ b/isbn/rendering.js @@ -169,17 +169,19 @@ function renderLinks(linkArray) } } -function renderBestandSWB(bestandArray, id) +function renderBestand(bestandArray, id, verbund) { var bibArray = $.map(bestandArray, function (sigel) { - if (sigel === "180") { + if (sigel === "180" && verbund == "k10plus") { return '180'; } else { return sigel; } }); - var outputString = "Insgesamt "+bibArray.length+" Bibliotheken im SWB mit Bestand: "+bibArray.join(", "); - return outputString; + if (bibArray.length > 0) { + return "Insgesamt "+bibArray.length+" Bibliotheken im " + verbund.toUpperCase() + " mit Bestand: "+bibArray.join(", "); + } + return ""; } @@ -200,6 +202,7 @@ function htmlEscape(str) function renderSW(swObject) { var swArray = []; + var swTextArray = []; $.each(swObject, function (key, value) { if (typeof value == 'string') { var swUrl = 'https://d-nb.info/gnd/' + value + '/about/html'; @@ -207,8 +210,12 @@ function renderSW(swObject) } else { swArray.push(key); } + swTextArray.push(key); }); - return swArray.join('; '); + if (swArray.length > 0) { + return swArray.join('; ') + " "; + } + return ""; } function bestellInfo(databaseText, currentRecord) @@ -226,6 +233,21 @@ function bestellInfo(databaseText, currentRecord) return content; } +function renderTitle(data) +{ + var info = ""+data["titel"][0] + " " + data["autor"][0] + "
"; + if (data["gesamttitel"].length>0) { + info += "("+data["gesamttitel"]+")
"; + } + if (data["hochschulvermerk"].length>0) { + info += data["hochschulvermerk"]+"
"; + } + if (data["isbn"].length>0) { + info += data["isbn"].join(", ")+"
"; + } + return info; +} + function coins(currentRecord) { // rudimentärer COinS Daten um beispielsweise Titel in Citavi, Zotero oder Mendeley zu speichern diff --git a/isbn/srulibraries.json b/isbn/srulibraries.json new file mode 100644 index 0000000..00baf7f --- /dev/null +++ b/isbn/srulibraries.json @@ -0,0 +1,169 @@ +{ + "CH-UBS" : { + "name": "Basel U", + "sru": "https://ubs.swisscovery.slsp.ch/view/sru/41SLSP_UBS" + }, + "CH-BFH" : { + "name": "Bern FH", + "sru": "https://bfh.swisscovery.slsp.ch/view/sru/41SLSP_BFH" + }, + "CH-UBE" : { + "name": "Bern U", + "sru": "https://ube.swisscovery.slsp.ch/view/sru/41SLSP_UBE" + }, + "CH-BCUFR" : { + "name": "Fribourg BCU", + "sru": "https://bcufr.swisscovery.slsp.ch/view/sru/41SLSP_BCUFR" + }, + "CH-HSG " : { + "name": "St. Gallen U", + "sru": "https://hsg.swisscovery.slsp.ch/view/sru/41SLSP_HSG" + }, + "CH-UGE" : { + "name": "Genève UGE", + "sru": "https://uge.swisscovery.slsp.ch/view/sru/41SLSP_UGE" + }, + "CH-EPF" : { + "name": "Lausanne EPFL", + "sru": "https://epf.swisscovery.slsp.ch/view/sru/41SLSP_EPF" + }, + "CH-USI" : { + "name": "Lugano USI", + "sru": "https://usi.swisscovery.slsp.ch/view/sru/41SLSP_USI" + }, + "CH-RZS" : { + "name": "Luzern RZS", + "sru": "https://rzs.swisscovery.slsp.ch/view/sru/41SLSP_RZS" + }, + "CH-UNE" : { + "name": "Neuchâtel UNE", + "sru": "https://une.swisscovery.slsp.ch/view/sru/41SLSP_UNE" + }, + "CH-FHNW" : { + "name": "Nordwestschweiz FHNW", + "sru": "https://fhnw.swisscovery.slsp.ch/view/sru/41SLSP_FNW" + }, + "CH-OSTFH" : { + "name": "Ostschweiz FH", + "sru": "https://ostgre.swisscovery.slsp.ch/view/sru/41SLSP_FHO" + }, + "CH-ETH" : { + "name": "Zürich ETH", + "sru": "https://eth.swisscovery.slsp.ch/view/sru/41SLSP_ETH" + }, + "CH-UZB": { + "name": "Zürich UZB", + "sru": "https://uzb.swisscovery.slsp.ch/view/sru/41SLSP_UZB" + }, + "CH-ZHAW" : { + "name": "Zürich ZHAW", + "sru": "https://zhaw.swisscovery.slsp.ch/view/sru/41SLSP_ZAW" + }, + "AT-UBG" : { + "name": "Graz U", + "sru": "https://obv-at-ubg.userservices.exlibrisgroup.com/view/sru/43ACC_UBG" + }, + "AT-TUG" : { + "name": "Graz TU", + "sru": "https://obv-at-ubtug.userservices.exlibrisgroup.com/view/sru/43ACC_TUG" + }, + "AT-UBI" : { + "name": "Innsbruck U", + "sru": "https://obv-at-ubi.alma.exlibrisgroup.com/view/sru/43ACC_UBI" + }, + "AT-UBK" : { + "name": "Klagenfurt U", + "sru": "https://obv-at-ubk.userservices.exlibrisgroup.com/view/sru/43ACC_UBK" + }, + "AT-UBL" : { + "name": "Linz U", + "sru": "https://obv-at-ubl.userservices.exlibrisgroup.com/view/sru/43ACC_UBL" + }, + "AT-UBS" : { + "name": "Salzburg U", + "sru": "https://obv-at-ubs.userservices.exlibrisgroup.com/view/sru/43ACC_UBS" + }, + "AT-UBWW" : { + "name": "Wien WU", + "sru": "https://obv-at-ubww.userservices.exlibrisgroup.com/view/sru/43ACC_WUW" + }, + "AT-UBW" : { + "name": "Wien U", + "sru": "https://obv-at-ubw.userservices.exlibrisgroup.com/view/sru/43ACC_UBW" + }, + "AT-TUW" : { + "name": "Wien TU", + "sru": "https://obv-at-ubtuw.userservices.exlibrisgroup.com/view/sru/43ACC_TUW" + }, + "DE-FUB" : { + "name": "Berlin FU", + "sru": "https://fu-berlin.alma.exlibrisgroup.com/view/sru/49KOBV_FUB" + }, + "DE-TUBUDK" : { + "name": "Berlin TU+UdK", + "sru": "https://tuudk-berlin.alma.exlibrisgroup.com/view/sru/49KOBV_TUBUDK" + }, + "DE-BIE" : { + "name": "Bielefeld U", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_BIE" + }, + "DE-ULB" : { + "name": "Bonn ULB", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_ULB" + }, + "DE-UBD" : { + "name": "Dortmund TU", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_UBD" + }, + "DE-FUH" : { + "name": "Hagen FernU", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_FUH" + }, + "DE-RTU" : { + "name": "Kaiserslautern/Landau TU", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_RTU" + }, + "DE-MAN" : { + "name": "Mannheim U", + "sru": "https://uni-mannheim.alma.exlibrisgroup.com/view/sru/49MAN_INST" + }, + "DE-BSB" : { + "name": "München BSB", + "sru": "https://bsb.alma.exlibrisgroup.com/view/sru/49BVB_BSB" + }, + "DE-ULM" : { + "name": "Münster ULB", + "sru": "https://katalogplus.uni-muenster.de/view/sru/49HBZ_ULM" + }, + "DE-PAD" : { + "name": "Paderborn U", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_PAD" + }, + "DE-SIE" : { + "name": "Siegen U", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_SIE" + }, + "DE-WUP" : { + "name": "Wuppertal U", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_WUP" + }, + "DE-HBZ" : { + "name": "HBZ (keine Bestandsdaten)", + "holdings": false, + "doku": "https://service-wiki.hbz-nrw.de/display/VDBE/Zugriff+auf+die+hbz-Verbunddatenbank+via+SRU", + "sru": "https://eu04.alma.exlibrisgroup.com/view/sru/49HBZ_NETWORK" + }, + "CH-SWISS" : { + "name": "SWISS (keine Bestandsdaten)", + "holdings": false, + "doku": "https://slsp.ch/de/metadata", + "sru": "https://swisscovery.slsp.ch/view/sru/41SLSP_NETWORK" + }, + "AT-OBVSG" : { + "name": "OBVSG (keine Bestandsdaten)", + "holdings": false, + "doku": "https://www.obvsg.at/services/verbundsystem/sru", + "sru": "https://services.obvsg.at/sru/OBV-LIT" + } + +} \ No newline at end of file diff --git a/isbn/suche.html b/isbn/suche.html index 1585c25..2ae1661 100644 --- a/isbn/suche.html +++ b/isbn/suche.html @@ -19,10 +19,10 @@ - + - - + + - + + + + + + + + +

Bestandsabgleich Alma-SRU

+ +

Anhand einer Liste von ISBNs wird der Bestand über eine Alma-SRU-Schnittstelle abgefragt und die Ergebnisse in der gleichen Reihenfolge wiedergegeben.

+ +

Eingabe

+ +
+ + +Bookmark +
+
+ Mit Link + Mit ISBN + Sammlungen anzeigen + +
+ +

Ausgabe

+ +

Status: 0 von 0 ISBNs geprüft

+ + + +
+ + + + + + + diff --git a/tools/ppnListe.html b/tools/ppnListe.html index 0bede26..0244ddc 100644 --- a/tools/ppnListe.html +++ b/tools/ppnListe.html @@ -22,12 +22,13 @@ function check(index, value) { $('#ausgabe').append('
'); $('#query-'+index).attr("data-ppn", value); - value = value.replace(/^(\w*).*$/, '$1'); + value = value.replace(/^([\w-]*).*$/, '$1'); if (value.length > 0) { + var typ = $("#eingabetyp :selected").text(); var verbund = $("#verbund :selected").text(); var feld = $("#feld :selected").text(); var filter = $("#filter").val(); - $.get("../isbn/" + verbund + ".php?format=json&ppn=" + value, function(data) { + $.get("../isbn/" + verbund + ".php?format=json&" + typ + "=" + value, function(data) { if (document.getElementById("mit").checked) { $('#query-'+index).text(value + ": "); } @@ -64,13 +65,19 @@ -

PPN-Liste anreichern

+

PPN/ISBN-Liste anreichern

-

Eine Liste mit PPNs kann hier eingegeben werden und mit Werten eines Feldes z.B. ISBN, RVK, Bestand, Schlagwörter aus dem gleichen Verbund angereichert werden.

+

Eine Liste mit PPNs oder ISBNs kann hier eingegeben werden und mit Werten eines Feldes z.B. RVK, Bestand, Schlagwörter aus dem gleichen Verbund angereichert werden.

Eingabe

+ + +

@@ -93,21 +101,21 @@

Eingabe

-
+

(Eingabe von RegExp auch möglich, z.B. "(21.*|180)" für Bestand)

- a) PPN ausgeben; + a) PPN/ISBN mit ausgeben; b) Trennzeichen

Ausgabe

-

Status: 0 von 0 PPNs geprüft

+

Status: 0 von 0 PPNs/ISBNs geprüft