Skip to content

Commit eb1cfbe

Browse files
author
Dominick Leppich
committed
Merge pull request 'Release v24.10' (#14) from release_24.10 into master
2 parents c606261 + f2e0fe4 commit eb1cfbe

File tree

8 files changed

+267
-223
lines changed

8 files changed

+267
-223
lines changed

build.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<exec executable="mvn">
99
<arg value="package"/>
1010
</exec>
11-
<copy file="module-main/target/plugin_intranda_step_${name}.jar" todir="/opt/digiverso/goobi/plugins/step/" overwrite="true"/>
12-
<copy file="module-gui/target/plugin_intranda_step_${name}-GUI.jar" todir="/opt/digiverso/goobi/plugins/GUI/" overwrite="true"/>
11+
<copy file="module-base/target/plugin-step-transcription-base.jar" todir="/opt/digiverso/goobi/plugins/step/" overwrite="true"/>
12+
<copy file="module-gui/target/plugin-step-transcription-gui.jar" todir="/opt/digiverso/goobi/plugins/GUI/" overwrite="true"/>
1313
</target>
1414

1515
</project>

module-base/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.goobi.workflow.plugin</groupId>
55
<artifactId>plugin-step-transcription</artifactId>
6-
<version>24.09</version>
6+
<version>24.10</version>
77
</parent>
88
<artifactId>plugin-step-transcription-base</artifactId>
99
<packaging>jar</packaging>

module-base/src/main/java/de/intranda/goobi/plugins/TranscriptionImage.java

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ public class TranscriptionImage {
1313
private Image image;
1414
private String ocrText;
1515
private Path ocrPath;
16-
private boolean hasAlto;
17-
private Path altoPath;
1816

1917
public void setOcrText(String text) {
2018
this.ocrText = text;

module-base/src/main/java/de/intranda/goobi/plugins/TranscriptionStepPlugin.java

+25-18
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.apache.commons.configuration.SubnodeConfiguration;
3535
import org.apache.commons.io.FilenameUtils;
3636
import org.goobi.beans.Step;
37+
import org.goobi.io.BackupFileManager;
3738
import org.goobi.managedbeans.StepBean;
3839
import org.goobi.production.enums.PluginGuiType;
3940
import org.goobi.production.enums.PluginReturnValue;
@@ -95,9 +96,6 @@ public class TranscriptionStepPlugin implements IStepPluginVersion2 {
9596
private List<String> deletionCommand = null;
9697
@Getter
9798
private boolean altoFolderFound;
98-
@Getter
99-
@Setter
100-
private boolean ignoreAltoFolder;
10199

102100
@Override
103101
public void initialize(Step step, String returnPath) {
@@ -145,18 +143,15 @@ public void initImageList(String configuredImageFolder) throws SwapException, DA
145143
images.clear();
146144
Path path = Paths.get(imageFolder);
147145
String ocrTxtDir = step.getProzess().getOcrTxtDirectory();
148-
String ocrAltoDir = step.getProzess().getOcrAltoDirectory();
149146
if (StorageProvider.getInstance().isFileExists(path)) {
150147
List<Path> imageNameList = storageProvider.listFiles(imageFolder, NIOFileUtils.imageOrObjectNameFilter);
151148
int order = 1;
152149
for (Path imagePath : imageNameList) {
153150
Image image = new Image(step.getProzess(), configuredImageFolder, imagePath.getFileName().toString(), order, 800);
154151
String basename = FilenameUtils.removeExtension(imagePath.getFileName().toString());
155152
Path ocrFile = Paths.get(ocrTxtDir, basename + ".txt");
156-
Path altoPath = Paths.get(ocrAltoDir, basename + ".xml");
157-
boolean hasAlto = Files.exists(altoPath);
158153
String currentOcr = readOcrFile(ocrFile);
159-
images.add(new TranscriptionImage(imagePath.getFileName().toString(), image, currentOcr, ocrFile, hasAlto, altoPath));
154+
images.add(new TranscriptionImage(imagePath.getFileName().toString(), image, currentOcr, ocrFile));
160155
order++;
161156
}
162157
}
@@ -166,18 +161,30 @@ public void initImageList(String configuredImageFolder) throws SwapException, DA
166161
this.setImageToIndex();
167162
}
168163

169-
public void deleteSingleAltoResult() throws IOException {
170-
Files.deleteIfExists(image.getAltoPath());
171-
image.setHasAlto(false);
172-
}
173-
174-
public void deleteAltoFolder() throws SwapException, DAOException, IOException, InterruptedException {
175-
String altoDir = step.getProzess().getOcrAltoDirectory();
176-
StorageProvider.getInstance().deleteDir(Paths.get(altoDir));
177-
for (TranscriptionImage image : this.images) {
178-
image.setHasAlto(false);
164+
public void backupAlto() {
165+
if (!this.isAltoFolderFound()) {
166+
return;
167+
}
168+
try {
169+
StorageProviderInterface sp = StorageProvider.getInstance();
170+
Path ocrFolder = Path.of(step.getProzess().getOcrDirectory());
171+
if (sp.isFileExists(ocrFolder)) {
172+
Path backupPath = Paths.get(ocrFolder.getParent().toString(), BackupFileManager.generateBackupName(ocrFolder.getFileName().toString()));
173+
sp.copyDirectory(ocrFolder, backupPath);
174+
String directoryToKeep = step.getProzess().getOcrTxtDirectory();
175+
if (directoryToKeep.endsWith("/")) {
176+
directoryToKeep = directoryToKeep.substring(0, directoryToKeep.length() - 1);
177+
}
178+
for (Path dir : sp.listFiles(ocrFolder.toString())) {
179+
if (!dir.toString().equals(directoryToKeep)) {
180+
sp.deleteDir(dir);
181+
}
182+
}
183+
}
184+
this.altoFolderFound = false;
185+
} catch (IOException | SwapException e) {
186+
log.error("Error backing up Alto results", e);
179187
}
180-
this.altoFolderFound = false;
181188
}
182189

183190
public String saveOcrAndExit() throws IOException {

module-gui/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.goobi.workflow.plugin</groupId>
55
<artifactId>plugin-step-transcription</artifactId>
6-
<version>24.09</version>
6+
<version>24.10</version>
77
</parent>
88
<artifactId>plugin-step-transcription-gui</artifactId>
99
<packaging>jar</packaging>

module-gui/src/main/webapp/resources/uii/TranscriptionPlugin_include_imagenavigation.xhtml

+89-67
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,112 @@
1-
<!--
1+
<!--
22
* This file is part of a plugin for Goobi - a Workflow tool for the support of mass digitization.
3-
*
4-
* Visit the websites for more information.
3+
*
4+
* Visit the websites for more information.
55
* - https://goobi.io
66
* - https://www.intranda.com
77
* - https://github.com/intranda/goobi
8-
*
8+
*
99
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
1010
* Software Foundation; either version 2 of the License, or (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1313
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14-
*
14+
*
1515
* You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59
1616
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
17-
*
17+
*
1818
-->
19-
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:composite="http://xmlns.jcp.org/jsf/composite"
20-
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core"
21-
xmlns:x="http://myfaces.apache.org/tomahawk">
19+
<ui:composition
20+
xmlns="http://www.w3.org/1999/xhtml"
21+
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
22+
xmlns:composite="http://xmlns.jcp.org/jsf/composite"
23+
xmlns:h="http://xmlns.jcp.org/jsf/html"
24+
xmlns:f="http://xmlns.jcp.org/jsf/core"
25+
xmlns:x="http://myfaces.apache.org/tomahawk"
26+
xmlns:jsf="http://xmlns.jcp.org/jsf">
2227

2328
<composite:interface>
2429
</composite:interface>
2530

2631
<composite:implementation>
2732
<!-- navigation for big image -->
28-
<div class="pull-center image-navigation">
29-
<h:commandLink
30-
action="#{AktuelleSchritteForm.myPlugin.cmdMoveFirst}"
31-
styleClass="btn font-size-s margin-right-10"
32-
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lastImage:msgs.firstImage}">
33-
<i class="fa fa-double-angle-left"></i>
34-
<!-- <f:ajax execute="@form" render="@form :qaform:bigimage" onevent="freeJSResources"/> -->
35-
</h:commandLink>
36-
37-
<h:commandLink
38-
onclick="preventDoubleSubmit(this)"
39-
action="#{AktuelleSchritteForm.myPlugin.cmdMovePrevious}"
40-
id="imageBack"
41-
styleClass="btn btn-primary font-size-s"
42-
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lw_nextImage:msgs.lw_previousImage}">
43-
<i class="fa fa-angle-left"></i>
44-
<h:outputText value=" #{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lw_nextImage:msgs.lw_previousImage}" />
45-
<!-- <f:ajax execute="@form" render="@form :qaform:bigimage" onevent="freeJSResources"/> -->
46-
</h:commandLink>
47-
<div class="margin-sides-10">
48-
49-
<x:outputText id="txtImageMoveTo1"
50-
value="#{AktuelleSchritteForm.myPlugin.imageIndex +1} #{msgs.von} #{AktuelleSchritteForm.myPlugin.sizeOfImageList}"
51-
onclick="document.getElementById(this.id).nextSibling.style.display='inline';
52-
document.getElementById(this.id).style.display='none';
53-
document.getElementById(this.id).nextSibling.focus();
54-
document.getElementById(this.id).nextSibling.select();" />
55-
<!-- Seite direkt anspringen -->
56-
<x:inputText value="#{AktuelleSchritteForm.myPlugin.imageMoveTo}" style="display:none;font-size:9px;width:30px"
57-
required="true" id="txtImageMoveTo2"
58-
onblur="document.getElementById(this.id).style.display='none';document.getElementById(this.id).previousSibling.style.display='inline';"
59-
onkeypress="clickOnEnter(event, '.hidden-set-image-button')" />
60-
<x:commandButton action="#{NavigationForm.Reload}" value="go" style="display:none" />
61-
</div>
62-
<h:commandLink
63-
onclick="preventDoubleSubmit(this)"
64-
action="#{AktuelleSchritteForm.myPlugin.cmdMoveNext}"
65-
id="imageNext"
66-
styleClass="btn btn-primary font-size-s"
67-
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lw_previousImage:msgs.lw_nextImage}">
33+
<div class="dataTables__paginator justify-content-center">
34+
<button
35+
class="btn btn-blank"
36+
jsf:action="#{AktuelleSchritteForm.myPlugin.cmdMoveFirst}"
37+
disabled="#{cc.attrs.paginator.getHasPreviousPage()}"
38+
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lastImage:msgs.firstImage}"
39+
data-bs-toggle="tooltip">
40+
<span
41+
aria-hidden="true"
42+
class="fa fa-angle-double-left"/>
43+
<f:ajax render="@form"/>
44+
</button>
45+
<button
46+
class="btn btn-primary-400"
47+
jsf:action="#{AktuelleSchritteForm.myPlugin.cmdMovePrevious}"
48+
jsf:id="imageBack">
49+
<span
50+
aria-hidden="true"
51+
class="fa fa-angle-left" />
52+
<span>
53+
<h:outputText value="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lw_nextImage:msgs.lw_previousImage}"/>
54+
</span>
55+
<f:ajax render="@form"/>
56+
</button>
57+
<div class="dataTables__paginator__page-count">
58+
<h:outputText
59+
id="txtMoveTo1"
60+
forceId="false"
61+
value="#{msgs.seite} #{AktuelleSchritteForm.myPlugin.imageIndex +1} #{msgs.von} #{AktuelleSchritteForm.myPlugin.sizeOfImageList}"
62+
onclick="document.querySelector('[id$=txtMoveTo2]').style.display='inline';
63+
document.querySelector('[id$=txtMoveTo1]').style.display='none';
64+
document.querySelector('[id$=txtMoveTo2]').focus();
65+
document.querySelector('[id$=txtMoveTo2]').select();"/>
66+
<h:inputText
67+
id="txtMoveTo2"
68+
forceId="false"
69+
value="#{AktuelleSchritteForm.myPlugin.imageMoveTo}"
70+
style="display:none;width:30px"
71+
required="true"
72+
onblur="document.querySelector('[id$=txtMoveTo2]').style.display='none';document.querySelector('[id$=txtMoveTo1]').style.display='inline';"
73+
onkeypress="return submitEnter(document.querySelector('[id$=cmdMoveTo]').id,event)"/>
74+
<x:commandButton
75+
action="#{NavigationForm.Reload}"
76+
id="cmdMoveTo"
77+
forceId="false"
78+
value="go"
79+
style="display:none">
80+
</x:commandButton>
81+
</div>
82+
<button
83+
class="btn btn-primary-400"
84+
jsf:action="#{AktuelleSchritteForm.myPlugin.cmdMoveNext}"
85+
jsf:id="imageNext">
86+
<span>
6887
<h:outputText value="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.lw_previousImage:msgs.lw_nextImage} " />
69-
<i class="fa fa-angle-right"></i>
70-
<!-- <f:ajax execute="@form" render="@form :qaform:bigimage" onevent="freeJSResources" /> -->
71-
</h:commandLink>
72-
73-
<h:commandLink
74-
action="#{AktuelleSchritteForm.myPlugin.cmdMoveLast}"
75-
styleClass="btn font-size-s margin-sides-10"
76-
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.firstImage:msgs.lastImage}">
77-
<i class="fa fa-double-angle-right"></i>
78-
<!-- <f:ajax execute="@form" render="@form :qaform:bigimage" onevent="freeJSResources"/> -->
79-
</h:commandLink>
80-
81-
<h:commandLink style="display:none;" class="hidden-set-image-button" action="#{AktuelleSchritteForm.myPlugin.setImageToIndex}"/>
82-
88+
</span>
89+
<span
90+
aria-hidden="true"
91+
class="fa fa-angle-right" />
92+
<f:ajax render="@form"/>
93+
</button>
94+
<button
95+
class="btn btn-blank"
96+
jsf:action="#{AktuelleSchritteForm.myPlugin.cmdMoveLast}"
97+
jsf:id="navlast"
98+
title="#{AktuelleSchritteForm.myPlugin.pagesRTL?msgs.firstImage:msgs.lastImage}">
99+
<span
100+
aria-hidden="true"
101+
class="fa fa-angle-double-right"/>
102+
<f:ajax render="@form"/>
103+
</button>
104+
105+
<h:commandLink style="display:none;" class="hidden-set-image-button" action="#{AktuelleSchritteForm.myPlugin.setImageToIndex}"/>
106+
83107
</div>
84108
<!-- // navigation for big image -->
85-
109+
86110
<script>
87111
function clickOnEnter(event, selector) {
88112
console.log(selector);
@@ -95,5 +119,3 @@
95119

96120
</composite:implementation>
97121
</ui:composition>
98-
99-

0 commit comments

Comments
 (0)