Skip to content
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
7 changes: 5 additions & 2 deletions .github/workflows/solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Starting SOLR
run: docker-compose -f docker/sas-solr/docker-compose.yml --project-directory . up -d solr
run: mkdir solr-data && chmod 777 solr-data && docker-compose -f docker/sas-solr/docker-compose.yml --project-directory . up -d solr

- name: checking docker
run: docker ps && docker logs sas_solr

- name: Wait for SOLR to start
run: docker exec -t sas_solr /opt/docker-solr/scripts/wait-for-solr.sh --max-attempts 10 --wait-seconds 5 --solr-url http://0.0.0.0:8983/
run: docker exec -t sas_solr /opt/docker-solr/scripts/wait-for-solr.sh --max-attempts 10 --wait-seconds 10 --solr-url http://0.0.0.0:8983/

- name: Run Tests
run: export "config=solr.properties" && mvn test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ auth.json
*auth.json
node
node_modules
solr-data
5 changes: 3 additions & 2 deletions docker/sas-solr/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ services:
- "8888:8080"
solr:
container_name: sas_solr
image: "solr:latest"
image: "solr:8"
ports:
- "8983:8983"
volumes:
- "./src/main/resources/solr:/tmp/config:ro"
- "./solr-data:/var/solr/data"
entrypoint:
- bash
- "-c"
- "precreate-core testannotations /tmp/config; precreate-core annotations /tmp/config; exec solr -f"
- "solr-precreate testannotations /tmp/config; solr-precreate annotations /tmp/config; exec solr -f"
17 changes: 10 additions & 7 deletions src/main/java/uk/org/llgc/annotation/store/data/Manifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,19 @@ public void setURI(final String pURI) {
*/
public String getShortId() {
if (_shortId == null || _shortId.isEmpty()) {
if (_URI.endsWith("manifest.json")) {
// Its no longer safe to use this NLW shortcut
// as it fails the workbench:
// https://glenrobson.github.io/workbench/manifests/projectmanifest.json"
/*if (_URI.endsWith("manifest.json")) {
String[] tURI = _URI.split("/");
_shortId = tURI[tURI.length - 2];
} else {
try {
_shortId = AnnotationUtils.getHash(_URI, "md5");
} catch (IOException tExcpt) {
tExcpt.printStackTrace();
}
} else {*/
try {
_shortId = AnnotationUtils.getHash(_URI, "md5");
} catch (IOException tExcpt) {
tExcpt.printStackTrace();
}
//}
}
return _shortId;
}
Expand Down
207 changes: 106 additions & 101 deletions src/main/webapp/manifest.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,120 +25,125 @@
<h1 id="collectionName"><h:outputText value="#{manifest.label}" escape="false" /></h1>
</div>

<div class="options">
<div class="option_links">
Manifest options:
<a href="search.xhtml?iiif-content=#{manifest.URI}"><i class="fas fa-wrench"></i> Configure IIIF Search</a> |
<a href="#" data-toggle="modal" data-target="#importAnnotations" onclick="hideMessage('importAnnoMessage');"><i class="fas fa-wrench"></i> Import Annotations</a> |
<!-- <a href="#{manifest.URI}" target="_blank">Manifest Link</a>-->
<c:if test="#{manifest != null}">
<div class="options">
<div class="option_links">
Manifest options:
<a href="search.xhtml?iiif-content=#{manifest.URI}"><i class="fas fa-wrench"></i> Configure IIIF Search</a> |
<a href="#" data-toggle="modal" data-target="#importAnnotations" onclick="hideMessage('importAnnoMessage');"><i class="fas fa-wrench"></i> Import Annotations</a> |
<!-- <a href="#{manifest.URI}" target="_blank">Manifest Link</a>-->

<ui:include src="WEB-INF/templates/content-state.xhtml">
<ui:param name="url" value="#{manifest.URI}" />
<ui:param name="description" value="Link to Manifest. Also draggable using IIIF Content State." />
<ui:param name="mode" value="full" />
</ui:include>
</div>
<div class="right_options">
List: <a href="#" id="all" onClick="toggleAnnotated(this)">all</a> | <a id="annotated" class="selected" href="#" onClick="toggleAnnotated(this)">annotated</a>
<ui:include src="WEB-INF/templates/content-state.xhtml">
<ui:param name="url" value="#{manifest.URI}" />
<ui:param name="description" value="Link to Manifest. Also draggable using IIIF Content State." />
<ui:param name="mode" value="full" />
</ui:include>
</div>
<div class="right_options">
List: <a href="#" id="all" onClick="toggleAnnotated(this)">all</a> | <a id="annotated" class="selected" href="#" onClick="toggleAnnotated(this)">annotated</a>
</div>
</div>
</div>
<hr/>
<c:set var="canvases" value="#{storeService.listAnnoPages(manifest)}" />
<ul id="canvases" class="media-list">
<c:forEach items="#{canvases}" var="annoPage" varStatus="iterMetadata">
<c:set var="short_id" value="#{annoPage.canvas.shortId}" />
<c:set var="isEmpty" value="#{annoPage.count == 0}" />
<c:set var="className" value="canvas" />
<c:if test="#{not isEmpty}">
<c:set var="className" value="anno_canvas" />
</c:if>
<li class="manifestSummary #{className}" id="shortId">
<div class="media-header-div">
<h3 class="box_type">
<c:if test="#{not isEmpty}">
Annotated Canvas
</c:if>
<c:if test="#{isEmpty}">
Canvas
</c:if>
</h3>
</div>
<div class="media-heading">
<h5>
<c:if test="#{not empty annoPage.canvas.label}">
Label: <h:outputText value="#{annoPage.canvas.label}"/>
</c:if>
<c:if test="#{empty annoPage.canvas.label}">
Label: unlabelled
</c:if>
</h5>
</div>
<div class="media">
<a class="align-self-center" href="annotations.xhtml?iiif-content=#{annoPage.canvas.id}">
<img class="align-self-center mr-3 media-img canvas_thum" data-canvas-id="#{annoPage.canvas.id}" src=""/>
</a>
<div class="media-body">
<a href="view.xhtml?collection=#{collection.id}&amp;manifest=#{manifest.URI}&amp;canvas=#{annoPage.canvas.id}" class="btn btn-primary mb-2" title="Open manifest for editing"><i class="far fa-edit"></i> Annotate this page</a>
<c:if test="#{not isEmpty}">
<a href="annotations.xhtml?iiif-content=#{annoPage.canvas.id}&amp;collection=#{request.getParameter('collection')}&amp;manifest=#{param['iiif-content']}" class="btn btn-secondary mb-2" ><i class="fas fa-list"></i> List Annotations (<h:outputText value="#{annoPage.count}"/>)</a>
</c:if>
<hr/>
<c:set var="canvases" value="#{storeService.listAnnoPages(manifest)}" />
<ul id="canvases" class="media-list">
<c:forEach items="#{canvases}" var="annoPage" varStatus="iterMetadata">
<c:set var="short_id" value="#{annoPage.canvas.shortId}" />
<c:set var="isEmpty" value="#{annoPage.count == 0}" />
<c:set var="className" value="canvas" />
<c:if test="#{not isEmpty}">
<c:set var="className" value="anno_canvas" />
</c:if>
<li class="manifestSummary #{className}" id="shortId">
<div class="media-header-div">
<h3 class="box_type">
<c:if test="#{not isEmpty}">
Annotated Canvas
</c:if>
<c:if test="#{isEmpty}">
Canvas
</c:if>
</h3>
</div>
<div class="media-heading">
<h5>
<c:if test="#{not empty annoPage.canvas.label}">
Label: <h:outputText value="#{annoPage.canvas.label}"/>
</c:if>
<c:if test="#{empty annoPage.canvas.label}">
Label: unlabelled
</c:if>
</h5>
</div>
<div class="media">
<a class="align-self-center" href="annotations.xhtml?iiif-content=#{annoPage.canvas.id}">
<img class="align-self-center mr-3 media-img canvas_thum" data-canvas-id="#{annoPage.canvas.id}" src=""/>
</a>
<div class="media-body">
<a href="view.xhtml?collection=#{collection.id}&amp;manifest=#{manifest.URI}&amp;canvas=#{annoPage.canvas.id}" class="btn btn-primary mb-2" title="Open manifest for editing"><i class="far fa-edit"></i> Annotate this page</a>
<c:if test="#{not isEmpty}">
<a href="annotations.xhtml?iiif-content=#{annoPage.canvas.id}&amp;collection=#{request.getParameter('collection')}&amp;manifest=#{param['iiif-content']}" class="btn btn-secondary mb-2" ><i class="fas fa-list"></i> List Annotations (<h:outputText value="#{annoPage.count}"/>)</a>
</c:if>

<p></p><p></p>
<div id="actionBar">
<span>
<c:if test="#{not isEmpty}">
<a class="actionLink" href="annotations/#{user.shortId}/#{short_id}.json" download="#{short_id}.json">Download annotations</a> |
<a class="actionLink" href="#" data-count="#{annoPage.count}" data-canvas-id="#{annoPage.canvas.id}" data-mode="remove_annotations" data-manifest="#{param['iiif-content']}" data-collection="#{param['collection']}" onClick="showConfirm(event); return false;">Remove annotations</a>
</c:if>
</span>
<p></p><p></p>
<div id="actionBar">
<span>
<c:if test="#{not isEmpty}">
<a class="actionLink" href="annotations/#{user.shortId}/#{short_id}.json" download="#{short_id}.json">Download annotations</a> |
<a class="actionLink" href="#" data-count="#{annoPage.count}" data-canvas-id="#{annoPage.canvas.id}" data-mode="remove_annotations" data-manifest="#{param['iiif-content']}" data-collection="#{param['collection']}" onClick="showConfirm(event); return false;">Remove annotations</a>
</c:if>
</span>
</div>
</div>
</div>
</div>
</li>
</c:forEach>
</ul>
</li>
</c:forEach>
</ul>

<script>
let canvas_ids = document.getElementsByClassName("canvas_thum");
fetch('#{manifest.URI}')
.then(response => response.json())
.then(function(manifest) {
for (let thumb of canvas_ids) {
let url = getCanvasThumbnail(manifest, thumb.dataset.canvasId, 0, 100);
thumb.src = url;
};
});
<script>
let canvas_ids = document.getElementsByClassName("canvas_thum");
fetch('#{manifest.URI}')
.then(response => response.json())
.then(function(manifest) {
for (let thumb of canvas_ids) {
let url = getCanvasThumbnail(manifest, thumb.dataset.canvasId, 0, 100);
thumb.src = url;
};
});

if (document.getElementsByClassName("anno_canvas").length === 0) {
toggleAnnotated(document.getElementById("all"));
}
if (document.getElementsByClassName("anno_canvas").length === 0) {
toggleAnnotated(document.getElementById("all"));
}

function toggleAnnotated(link) {
let mode = "";
if (link.id === "all") {
link.className = "selected";
function toggleAnnotated(link) {
let mode = "";
if (link.id === "all") {
link.className = "selected";

let annotatedLink = document.getElementById("annotated");
annotatedLink.className = "";
let annotatedLink = document.getElementById("annotated");
annotatedLink.className = "";

mode = "block";
} else {
link.className = "selected";
mode = "block";
} else {
link.className = "selected";

let annotatedLink = document.getElementById("all");
annotatedLink.className = "";
let annotatedLink = document.getElementById("all");
annotatedLink.className = "";

mode = "none";
mode = "none";
}
let canvases = document.getElementsByClassName("canvas");
Array.prototype.forEach.call(canvases, function (canvas) {
canvas.style.display = mode;
})
}
let canvases = document.getElementsByClassName("canvas");
Array.prototype.forEach.call(canvases, function (canvas) {
canvas.style.display = mode;
})
}

</script>
<ui:include src="WEB-INF/templates/dialogues/importAnnotations.xhtml"/>
<ui:include src="WEB-INF/templates/dialogues/confirm.xhtml"/>

</script>
<ui:include src="WEB-INF/templates/dialogues/importAnnotations.xhtml"/>
<ui:include src="WEB-INF/templates/dialogues/confirm.xhtml"/>
</c:if>
<c:if test="#{manifest == null}">
<p>It looks like there was a problem finding your manifest. Please add it again in the <a class="back_header" href="collections.xhtml?collection=#{param['collection']}">Collections screen.</a></p>
</c:if>
</ui:define>
</ui:composition>
</html>
Expand Down
8 changes: 6 additions & 2 deletions src/main/webapp/stats/manifest.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@
</div>
</main>
<p:panel header="Percentage of items transcribed">
<p:chart type="pie" model="#{statsService.getPercentAnnotated(tManifest)}" style="height:300px; width:500px;"/>
<c:if test="#{tManifest != null}">
<p:chart type="pie" model="#{statsService.getPercentAnnotated(tManifest)}" style="height:300px; width:500px;"/>
</c:if>
</p:panel>

<p:panel header="Annotations per Canvas">
<p:chart type="bar" model="#{statsService.getManifestAnnoCount(tManifest)}" style="height500px;"/>
<c:if test="#{tManifest != null}">
<p:chart type="bar" model="#{statsService.getManifestAnnoCount(tManifest)}" style="height500px;"/>
</c:if>
</p:panel>
</ui:define>
</ui:composition>
Expand Down