diff --git a/app/controllers/nwbib/Application.java b/app/controllers/nwbib/Application.java index ff78281b..b3e5a74f 100644 --- a/app/controllers/nwbib/Application.java +++ b/app/controllers/nwbib/Application.java @@ -908,7 +908,7 @@ public static Promise showStars(String format, String ids) { } public static Promise showSw(String rpbId) { - String strapiUrl = "https://rpb-cms.lobid.org/admin/content-manager/collectionType/" + String strapiUrl = "https://rpb-cms.lobid.org/admin/content-manager/collection-types/" + "api::rpb-authority.rpb-authority?filters[$and][0][rpbId][$eq]="; return Promise.pure(seeOther(strapiUrl + rpbId)); } diff --git a/app/controllers/nwbib/Lobid.java b/app/controllers/nwbib/Lobid.java index e3209a7c..0cfab6a0 100644 --- a/app/controllers/nwbib/Lobid.java +++ b/app/controllers/nwbib/Lobid.java @@ -678,6 +678,24 @@ private static String locationPolygon(String location) { return location.contains("|") ? location.split("\\|")[1] : location; } + /** + * @param doc The result JSON doc + * @return A mapping of item IDs (URIs) to item details (JSON strings) + */ + public static Map itemDetails(String doc) { + JsonNode items = Json.parse(doc).findValue("hasItem"); + Map result = new HashMap<>(); + if (items != null && (items.isArray() || items.isTextual())) { + Iterator elements = + items.isArray() ? items.elements() : Arrays.asList(items).iterator(); + while (elements.hasNext()) { + JsonNode nextItem = elements.next(); + result.put(nextItem.get("id").asText(), nextItem.toString()); + } + } + return result; + } + /** * @param doc The result JSON doc * @return A mapping of ISILs to item URIs diff --git a/app/views/details.scala.html b/app/views/details.scala.html index 372d905b..72ac4def 100644 --- a/app/views/details.scala.html +++ b/app/views/details.scala.html @@ -13,6 +13,10 @@ @import play.mvc.Controller.session @import play.cache.Cache +@idAndLabelLink(e: JsValue) = { + @((e\"label").asOpt[String].getOrElse("--")) +} + @pageLink(last: Seq[String], key: String, label: String, tip: String) = { @defining((last.indexOf(session(key))-1,last.indexOf(session(key))+1)) { case (prev,next) =>
  • @@ -66,9 +70,9 @@ *@ @tags.search_form(q)
    - @defining(Lobid.items(doc.toString)) { items => - @defining(!(doc\\"containedIn").isEmpty && (doc\"type").toString.contains("Article")){superordination => -
    + @defining((Lobid.items(doc.toString), Lobid.itemDetails(doc.toString))) { case (items, itemDetails) => + @defining(items.isEmpty && !(doc\\"containedIn").isEmpty && (doc\"type").toString.contains("Article")){superordination => +
    @defining((doc\"rpbId").asOpt[String].getOrElse(q)){ id =>
    @tags.star_button(id) Titeldetails: @@ -80,6 +84,45 @@ }
    + @if(!items.isEmpty || doc.toString.contains("fulltextOnline") || superordination){ +
    +
    + @if(doc.toString.contains("fulltextOnline")){ +
    Online-Ressource:
    +
    + + + + + + @result_field("Link", "fulltextOnline", doc, TableRow.LINKS) +
    +
    + } + @if(superordination){ +
    Bestandsangaben:
    +
    + + + + + + + + + +
    Zum Bestand siehe:@idAndLabelLink((doc\"containedIn").as[Seq[JsValue]].head)
    +
    + } + @if(!superordination && !items.isEmpty && !doc.toString.contains("fulltextOnline")){ + @defining(items.size){num => +
    Bestand in @num Bibliothek@if(num>1){en}:
    + } +
    @tags.items_map(items, itemDetails)
    + } +
    +
    + } } }
    diff --git a/app/views/tags/items_map.scala.html b/app/views/tags/items_map.scala.html new file mode 100644 index 00000000..7b78fa47 --- /dev/null +++ b/app/views/tags/items_map.scala.html @@ -0,0 +1,134 @@ +@* Copyright 2014-2024 Fabian Steeg, hbz. Licensed under the GPLv2 *@ + +@(items: Map[String,List[String]], itemDetails: Map[String,String]) + +@import play.api.libs.ws.WS +@import play.api.libs.json.JsArray +@import play.api.libs.json.Json +@import play.api.libs.json.JsValue +@import scala.concurrent._ +@import ExecutionContext.Implicits.global +@import scala.concurrent.duration._ +@import play.api.Play.current +@import controllers.nwbib._ +@import play.api.cache.Cache + +@string(value: JsValue) = { @value.asOpt[String].getOrElse("--") } + + + +@**@ + + + +
    + +
    +

    +

    +@map_credits() +

    + + +@if(items.size > 1){Details zum Bestand als Liste anzeigen} + + +@markers(items: Map[String,List[String]]) = { + @for((key,i) <- items.keySet.toList.sortWith((k1:String,k2:String)=>Lobid.compareIsil(k1,k2)).zipWithIndex; + owner = Application.CONFIG.getString("orgs.api")+"/"+key; + json = Json.parse(Lobid.cachedJsonCall(owner).toString); + ownerUrl = if((json\\"url").isEmpty) owner else (json\\"url")(0).as[String]; + ownerName = if((json\\"name").isEmpty) "" else (json\\"name")(0).as[String]) { + @for((itemId,i) <- items(key).zipWithIndex; + shortItemId = itemId.substring(itemId.lastIndexOf(":") + 1, itemId.lastIndexOf("#")); + itemJson = Json.parse(itemDetails(itemId)); + owners = (itemJson\\"heldBy"); + if(!owners.isEmpty); + signatures = (itemJson\\"callNumber"); + signature = if(signatures.isEmpty) "" else signatures(0).as[String]; + urls = (itemJson\\"electronicLocator"); + url = if(urls.isEmpty) "" else urls(0).as[String]; + seeAlso = (itemJson\\"seeAlso"); + opacLink = if(seeAlso.isEmpty) null else seeAlso(0).as[Seq[JsValue]].map(_.as[String])) { + var details = 'Bibliothek:'+ + '@if(!ownerName.isEmpty){@ownerName}else{<Keine Angabe>}' + @if(opacLink!=null){+'Verfügbarkeit:'+'Lokalen Katalog abfragen'}; + tableDetails = details; + if(allTableDetails=='') + allTableDetails += tableDetails; + else + allTableDetails += '' + tableDetails; + var sig = '@if(!signature.isEmpty){Signatur:}@if(!urls.isEmpty){Elektronische Ressource:}'+ + '@if(!url.isEmpty){@shortItemId} else {@if(!signature.isEmpty){@signature}}'; + @for(noteSeq <- (itemJson\"note").asOpt[Seq[String]]; note = noteSeq(0)) {sig += 'Notiz:' + '@note' + '';} + tableDetails += sig; + allTableDetails += sig; + } + @if( + !(json \\ "lon").isEmpty && (json \\ "lon").head.asOpt[String].isDefined && + !(json \\ "lat").isEmpty && (json \\ "lat").head.asOpt[String].isDefined) { + @defining(i) { id => + var lat = @string((json \\ "lat").head) + var lon = @string((json \\ "lon").head) + var latlng@(id) = L.latLng(lat, lon); + var icon@(id) = L.icon({ + iconUrl: '@controllers.routes.Assets.at("javascripts/images/marker-icon-red.png")', + iconSize: [20, 30], + iconAnchor: [10, 30], + popupAnchor: [0, -30] + }); + var marker@(id) = L.marker([lat, lon],{ + title: "@ownerName (@key)", + icon: icon@(id) + }); + markers[latlng@(id).toString()] = marker@(id); + bindPopup@(id)(tableDetails); + marker@(id).on('click', function(e) { + zoomDetails@(id)(); + }); + marker@(id).on('popupclose', function(e) { + map.setView(rlp, 7); + }); + marker@(id).addTo(map); + markerCount++; + if(@items.size == 1){ + bindPopup@(id)(allTableDetails); + zoomDetails@(id)(); + } + function zoomDetails@(id)() { + map.setView(latlng@(id), 17); + marker@(id).openPopup(); + } + function bindPopup@(id)(content) { + marker@(id).bindPopup( + ''+ + content+ + '
    ', + { + keepInView: true, + maxWidth: 250 + }); + } + } + } + } +} diff --git a/app/views/tags/map_credits.scala.html b/app/views/tags/map_credits.scala.html index 3ef0a9d6..7ff669d7 100644 --- a/app/views/tags/map_credits.scala.html +++ b/app/views/tags/map_credits.scala.html @@ -1,9 +1,7 @@ @* Copyright 2015 Fabian Steeg, hbz. Licensed under the GPLv2 *@ -

    - Katalog- und Bestandsdaten von lobid.org unter - CC0 | - Kartenbilder von Wikimedia, - Kartendaten von OpenStreetMap - unter CC-BY-SA -

    \ No newline at end of file +
    + Kartenbilder & -daten von Wikimedia & + OpenStreetMap, + CC-BY-SA +
    \ No newline at end of file diff --git a/app/views/tags/result_doc.scala.html b/app/views/tags/result_doc.scala.html index 67be7015..a49e7b55 100644 --- a/app/views/tags/result_doc.scala.html +++ b/app/views/tags/result_doc.scala.html @@ -131,7 +131,7 @@ types = (agents(0) \ "type").asOpt[Seq[String]].getOrElse(Seq())) { @label - @if(id.isDefined && !id.get.contains("/sw/")){} + @if(id.isDefined && id.get.startsWith("http") && !id.get.contains("/sw/")){} @if(c!=cs.last){ | } } @@ -146,10 +146,6 @@ @for(subject <- subjects; components = (subject \ "componentList").asOpt[Seq[JsValue]].getOrElse(Seq(subject)); component <- components; - sourceLabel = (component\"source"\"label").asOpt[String]; - if !sourceLabel.getOrElse("").contains("Nordrhein-Westfälischen"); - if !sourceLabel.getOrElse("").contains("Rheinland-Pfälzischen"); - if !sourceLabel.getOrElse("").contains("Dewey"); label <- (component \ "label").asOpt[String]; id = (component \ "id").asOpt[String].getOrElse("")) { @label @@ -275,7 +271,7 @@ @raumsystematik("https://rpb.lobid.org/spatial") @sachsystematik("http://purl.org/lobid/rpb") - @subjects((doc \ "subject").asOpt[Seq[JsValue]].getOrElse(Seq()).filter(v => !(v \ "source").toString.contains("Systematik"))) + @subjects((doc \ "subject").asOpt[Seq[JsValue]].getOrElse(Seq()).filter(v => !(v \ "source").toString.matches(".*(Systematik|Notationen|Dewey).*"))) @result_field("Schlagwortfolge", "subjectChain", doc, TableRow.VALUES, valueLabel = Option(Seq())) diff --git a/public/javascripts/images/marker-icon-red.png b/public/javascripts/images/marker-icon-red.png new file mode 100644 index 00000000..49076928 Binary files /dev/null and b/public/javascripts/images/marker-icon-red.png differ