diff --git a/.gitignore b/.gitignore
index 9f88813..65acc88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ target/
bin/
build/
node_modules/
+tags.js
# Eclipse
.project
diff --git a/frontend-dev/Gruntfile.js b/frontend-dev/Gruntfile.js
deleted file mode 100644
index 4edb3eb..0000000
--- a/frontend-dev/Gruntfile.js
+++ /dev/null
@@ -1,52 +0,0 @@
-module.exports = function(grunt) {
-
- grunt.initConfig({
- riot: {
- options:{
- //template : 'jade',
- //type : 'coffeescript'
- concat: true
- },
- dist: {
- expand: false,
- src: 'tags/*.tag',
- dest: '../src/main/resources/frontend/js/tags.js',
- }
- },
- copy: {
- main: {
- files: [
- {
- expand:true,
- src: ['css/*.css'],
- dest: '../src/main/resources/frontend/'
- },
- {
- expand:true,
- src: ['../src/main/resources/frontend/**'],
- dest: '/opt/digiverso/goobi/static_assets/plugins/intranda_step_ocrselector/',
- rename: function(dest, src) {
- return dest + ( src.replace(/^..\/src\/main\/resources\/frontend\/?/ ,"") );
- }
- }
- ],
- }
- },
- watcher: {
- scripts: {
- files: ['tags/*.tag', 'css/*.css'],
- tasks: ['riot', 'copy'],
- options: {
- spawn: false,
- },
- },
- }
- });
-
- grunt.loadNpmTasks('grunt-riot');
- grunt.loadNpmTasks('grunt-watcher');
- grunt.loadNpmTasks('grunt-contrib-copy');
-
- grunt.registerTask('default', ['riot', 'copy', 'watcher']);
-
-};
diff --git a/module-base/src/main/java/de/intranda/goobi/plugins/OcrSelector.java b/module-base/src/main/java/de/intranda/goobi/plugins/OcrSelector.java
index f7757b3..edcfc06 100644
--- a/module-base/src/main/java/de/intranda/goobi/plugins/OcrSelector.java
+++ b/module-base/src/main/java/de/intranda/goobi/plugins/OcrSelector.java
@@ -1,55 +1,28 @@
package de.intranda.goobi.plugins;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.HashMap;
-
-import org.goobi.beans.Step;
-import org.goobi.production.enums.PluginGuiType;
-import org.goobi.production.enums.PluginType;
-import org.goobi.production.enums.StepReturnValue;
-import org.goobi.production.plugin.interfaces.IRestGuiPlugin;
-
import de.intranda.goobi.plugins.ocrselector.Routes;
import lombok.Data;
import lombok.extern.log4j.Log4j;
import net.xeoh.plugins.base.annotations.PluginImplementation;
+import org.goobi.beans.Step;
+import org.goobi.production.enums.PluginGuiType;
+import org.goobi.production.enums.PluginType;
+import org.goobi.production.enums.StepReturnValue;
+import org.goobi.production.plugin.interfaces.IGuiPlugin;
+import org.goobi.production.plugin.interfaces.IRestPlugin;
+import org.goobi.production.plugin.interfaces.IStepPlugin;
import spark.Service;
+import java.util.HashMap;
+
@Log4j
@Data
@PluginImplementation
-public class OcrSelector implements IRestGuiPlugin {
+public class OcrSelector implements IRestPlugin, IGuiPlugin, IStepPlugin {
private Step step;
private String returnPath;
private String title = "intranda_step_ocrselector";
- @Override
- public void extractAssets(Path assetsDir) {
- String[] paths = new String[] { "css/style.css", "js/app.js", "js/riot.min.js", "js/tags.js", "js/ugh.js" };
- for (String p : paths) {
- extractFile(p, assetsDir);
- }
- }
-
- private void extractFile(String filePath, Path assetsDir) {
- Path out = assetsDir.resolve("plugins").resolve(title).resolve(filePath);
- try (InputStream is = getClass().getClassLoader().getResourceAsStream("/frontend/" + filePath)) {
- if (!Files.exists(out.getParent())) {
- Files.createDirectories(out.getParent());
- }
- if (is != null) {
- Files.copy(is, out, StandardCopyOption.REPLACE_EXISTING);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- log.error(e);
- }
- }
-
@Override
public String cancel() {
return "/uii/" + returnPath;
@@ -67,7 +40,7 @@ public String finish() {
@Override
public String getPagePath() {
- return "/uii/guiPlugin.xhtml";
+ return "/uii/guiPluginNew.xhtml";
}
@Override
@@ -97,12 +70,16 @@ public PluginType getType() {
@Override
public String[] getJsPaths() {
- return new String[] { "js/riot.min.js", "js/tags.js", "js/app.js", "js/ugh.js" };
+ return new String[] { "riot.min.js", "tags.js", "app.js", "ugh.js" };
+ }
+
+ @Override
+ public String[] getCssPaths() {
+ return new String[] { "style.css" };
}
@Override
public void initRoutes(Service http) {
Routes.initRoutes(http);
-
}
}
diff --git a/module-base/src/main/resources/frontend/css/style.css b/module-base/src/main/resources/frontend/css/style.css
deleted file mode 100644
index 069ef01..0000000
--- a/module-base/src/main/resources/frontend/css/style.css
+++ /dev/null
@@ -1,263 +0,0 @@
-.structure-data-editor__bigimage {
- position: fixed;
- display: flex;
- align-items: center;
- justify-content: center;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- background-color: rgba(238, 238,238,0.7);
- z-index: 999;
-}
-
-.structure-data-editor__bigimage img {
- max-height: 95vh;
- max-width: 95vw;
-}
-
-.structure-data-editor__thumbnails {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- padding: 15px;
-}
-.structure-data-editor__thumbnail {
- height: 500px;
- min-width: 150px;
- margin-right: 10px;
- margin-bottom: 10px;
- text-align: center;
- overflow: hidden;
-}
-.structure-data-editor__thumbnail figure {
- display: flex;
- position: relative;
- flex-direction: column;
-}
-
-.structure-data-editor__thumbnail figure .blurred {
- content: "";
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- background: rgba(238, 238,238,0.7);
- z-index: 25;
-}
-
-.structure-data-editor__thumbnail figure .selected {
- content: "";
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- background: rgba(82,159,242,0.3);
-}
-
-.structure-data-editor__thumbnail img {
- max-height: 400px;
-}
-.structure-data-editor__thumbnail-image-order {
- padding: 5px 10px;
-}
-
-.mets-image__wrapper {
- position: relative;
- display: grid;
- grid-template-columns: auto 2fr;
- justify-content: center;
- padding: 5px 5px 5px 0;
- border: 3px solid rgba(255, 255, 255, 0);
-}
-
-.mets-image__wrapper.selected {
- border-color: rgba(82,159,242,0.3);
-/* background-color: #ccc; */
-}
-
-.mets-image__preloader {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 10;
- background-image: url('/goobi/uii/template/img/goobi/ajaxloader2.gif');
- background-repeat: no-repeat;
-}
-
-.mets-image__paginator {
- padding: 0 15px 5px 5px;
- color: black;
- font-size: 16px;
-}
-.mets-image__structure-type {
- padding: 3px 15px 3px 5px;
- z-index: 12;
-}
-
-.mets-image__structure-type.empty {
- padding: 0 0 0 5px;;
-}
-
-.mets-image__structure-type span.letter-icon {
- display:inline-block;
- font-size:1.3em;
- width:2em;
- height:2em;
- line-height:2em;
- text-align:center;
- border-radius:50%;
- background:red;
- vertical-align:middle;
- color:white;
- font-weight: bold;
- margin: 3px;
- cursor: default;
- z-index: 50;
-}
-
-.mets-image__structure-type .me-tooltip {
- display: none;
- position: absolute;
- border: 1px solid #666;
- padding: 6px;
- top: 0px;
- font-size: 14px;
- color: black;
- background-color: #fff;
- font-weight: normal;
- line-height: 16px;
- z-index: 999;
-}
-
-.mets-image__structure-type .me-tooltip.in {
- display: block;
-}
-
-.mets-image__structure-type .structure-level {
- position: relative;
-}
-
-.mets-image__structure-type span.letter-icon.menu-open,
-.mets-image__structure-type span.letter-icon:hover {
-/* border: 1px solid black; */
-}
-
-
-.alt-menu {
- position: absolute;
- z-index: 50;
-/* width: 300px; */
-/* height: 400px; */
-}
-
-.alt-menu .dropdown-menu {
- display: block;
-}
-
-.metadata-image {
- max-height: 98vh;
- max-width: 100%;
-}
-
-.metadata-docstruct-row {
- margin-bottom: 1vh;
- padding-top: 1vh;
- position:relative;
- height: 99vh;
-}
-
-.metadata-save-button {
- position: absolute;
- bottom: 0px;
- right: 15px;
-}
-
-.show-tree {
- position: fixed;
- top: 50%;
- left: 25px;
- font-size: 25px;
- cursor: pointer;
-}
-
-.side-tree-inside {
- position: relative;
- height: 90vh;
- max-height:100vh;
- overflow: auto;
- font-size: 14px;
-}
-
-.hide-tree {
- position: absolute;
- top: 50%;
- right: 5px;
- font-size: 25px;
- cursor: pointer;
-}
-
-.side-tree {
- position: -webkit-sticky;
- position: sticky;
- top: 10px;
-}
-
-.side-tree ul {
- padding-left: 15px;
- list-style: none;
-}
-
-.side-tree li {
- padding-left: 12px;
-}
-
-.side-tree li.has-children {
- padding-left: 0px;
-}
-
-.side-tree li.has-children:before {
- content: "-";
- margin-right: 5.5px;
-}
-
-.side-tree ul.is-root {
- padding-left: 0px;
-}
-
-.side-tree->ul.is-root->li {
- padding-left: 0px;
-}
-
-.side-tree li.has-children.hiddenchildren:before {
- content: "+";
- margin-right: 4px;
-}
-
-.side-tree ul li a {
- color: black;
-}
-
-.side-tree ul li.has-children a {
- cursor: pointer;
-}
-
-.side-tree ul li.no-children a {
- cursor: text;
-}
-
-#checkboxSelectAllLabel {
- margin-left: 10px;
-}
-
-.footer-actions {
- float: right;
-}
-
-.footer-actions .btn:not(:last-child) {
- margin-right: 15px;
-}
\ No newline at end of file
diff --git a/module-base/src/main/resources/frontend/js/tags.js b/module-base/src/main/resources/frontend/js/tags.js
deleted file mode 100644
index 134dc95..0000000
--- a/module-base/src/main/resources/frontend/js/tags.js
+++ /dev/null
@@ -1,486 +0,0 @@
-riot.tag2('app', '
{msg(\'plugin_intranda_step_ocrselector\')}
', '', '', function(opts) {
- this.generalOpts = window[window["plugin_name"]];
- function Observer() {
- riot.observable(this);
- }
- this.menuObserver = new Observer();
- this.images = [];
- this.imageMap = {};
- this.menuItems = {
- "de": ["antiqua", "fraktur", "keine OCR"],
- "en": ["antiqua", "fracture", "no OCR"],
- "iw": ["antiqua", "fracture", "no OCR"],
- "es": ["antiqua", "fracture", "no OCR"]};
-
- this.on("mount", () => {
- console.log("AAA", this.generalOpts)
- $.ajax( {
- url: "/goobi/plugins/ocrselector/" + this.generalOpts.processId + "/dd",
- type: "GET",
- datatype: "JSON"
- }).then(function(data) {
- this.images = ugh.renderImages(data);
- for(var image of this.images) {
- this.imageMap[image.identifier] = image;
- }
- this.getSavedData();
- this.update();
- }.bind(this))
- fetch(`/goobi/api/messages/${this.generalOpts.language}`, {
- method: 'GET',
- credentials: 'same-origin'
- }).then(resp => {
- resp.json().then(json => {
- this.msgs = json;
- this.update();
- })
- })
- })
-
- this.getSavedData = function() {
- $.ajax( {
- url: "/goobi/plugins/ocrselector/" + this.generalOpts.processId + "/saved",
- type: "GET",
- datatype: "JSON"
- }).then(function(data) {
- if(data.savedData) {
- for(var image of this.images) {
- var name = this.getImageName(image.location);
- image.label = data.savedData[name];
- }
- } else {
- for(var image of this.images) {
- image.label = data.defaultValue;
- }
- }
- this.update();
- }.bind(this))
- }.bind(this)
-
- this.selectDeselectAll = function(e) {
- var checkbox = e.target;
- if (checkbox.checked) {
- console.log("select all")
- this.selectAll();
- } else {
- this.deselectAll();
- }
- console.log(this.images)
- this.blurImages();
- this.update();
- }.bind(this)
-
- this.selectAll = function() {
- for(var image of this.images) {
- image.selected = true;
- }
- }.bind(this)
-
- this.deselectAll = function() {
- for(var image of this.images) {
- image.selected = false;
- }
- }.bind(this)
-
- this.cancel = function() {
- document.getElementById("restPluginFinishLink").click();
- }.bind(this)
-
- this.save = function() {
- var saveData = {};
- for(var image of this.images) {
- var name = this.getImageName(image.location);
- saveData[name] = image.label;
- }
- return $.ajax({
- url: "/goobi/plugins/ocrselector/" + this.generalOpts.processId + "/results",
- type:"POST",
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(saveData)
- })
- }.bind(this)
-
- this.saveAndLeave = function() {
- this.save().then( () => {
- document.getElementById("restPluginFinishLink").click();
- });
- }.bind(this)
-
- this.menuObserver.on('rightclickoutsidemenu', (e) => {
- this.showMenu = false;
- this.update();
-
- })
-
- this.menuObserver.on("itemselected", (option) => {
- console.log("item selceted handler")
- for(var image of this.images) {
- if(image.selected) {
- image.label = option;
- }
- }
- console.log(this.images)
- this.showMenu = false;
- this.unSelectImages();
- this.update();
- })
-
- this.menuObserver.on("openMenu", (e, image) => {
- let selCount = 0;
- for(var im of this.images){
- if(im.selected) {
- selCount++;
- }
- }
- if(selCount < 2) {
- this.unSelectImages();
- image.selected = true;
- }
- this.openMenu(e);
- })
-
- this.openMenu = function(e) {
- this.showMenu = true;
- var height = document.documentElement.clientHeight;
- var width = document.documentElement.clientWidth;
- this.left = Math.min(Math.max(0, e.clientX-201), width-401);
- this.top = Math.min(Math.max(50, e.clientY-201), height-401);
- console.log(this.top, height)
- this.update();
- return false;
- }.bind(this)
-
- this.clickListener = function(e) {
- if(e.button === 2) {
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- if(this.showAltMenu) {
- this.showAltMenu = false;
- } else if(this.showMenu) {
- this.showMenu = false;
- } else {
- this.unSelectImages();
- }
- this.update();
- }.bind(this);
-
- document.addEventListener("click", this.clickListener);
-
- this.mouseenterImage = function(e) {
- this.mouseOverImage = e.item.image;
- }.bind(this)
-
- this.mouseleaveImage = function() {
- this.mouseOverImage = null;
- }.bind(this)
-
- this.imageClick = function(e) {
- e.preventDefault();
- e.stopPropagation();
- if(e.ctrlKey) {
- e.item.image.selected = !e.item.image.selected;
- } else if(e.shiftKey) {
- var startSelected = false;
- var startClick = false;
- for(var image of this.images) {
- if(image.selected) {
- if(startClick) {
- break;
- }
- startSelected = true;
- }
- if(image.identifier == e.item.image.identifier) {
- if(startSelected) {
- image.selected = true;
- break;
- }
- startClick = true;
- }
- if(startClick || startSelected) {
- image.selected = true;
- }
- }
- } else {
- for(var image of this.images) {
- image.selected = false;
- }
- e.item.image.selected = true;
- }
- this.blurImages();
- return false;
- }.bind(this)
-
- this.blurImages = function() {
- var count = 0;
- for(var image of this.images) {
- if(image.selected) {
- count++;
- }
- }
- if(count > 1) {
- for(var image of this.images) {
- if(!image.selected) {
- image.blur = true;
- } else {
- image.blur = false;
- }
- }
- } else {
- for(var image of this.images) {
- image.blur = false;
- }
- }
- }.bind(this)
-
- this.unSelectImages = function() {
- for(var image of this.images) {
- image.blur = false;
- image.selected = false;
- }
- this.blurImages();
- }.bind(this)
-
- this.hideBigImage = function() {
- this.showBigImage = false;
- }.bind(this)
-
- this.keydownListener = function(e) {
- console.log("key down")
-
- if (e.keyCode == 65) {
- e.preventDefault();
- e.stopPropagation();
- if (e.ctrlKey) {
- var checkbox = document.getElementById('checkboxSelectAll');
- checkbox.checked = !e.shiftKey;
- if (!e.shiftKey) {
- this.selectAll();
- } else {
- this.deselectAll();
- }
- this.blurImages();
- this.update();
- }
- return;
- }
-
- if(e.keyCode === 27) {
- if(this.showAltMenu) {
- this.showAltMenu = false;
- } else if(this.showMenu) {
- this.showMenu = false;
- } else if(this.showBigImage) {
- this.hideBigImage();
- } else {
- this.unSelectImages();
- }
- this.update();
- }
- if(e.keyCode === 32) {
- e.preventDefault();
- e.stopPropagation();
- console.log(this.mouseOverImage);
- if(this.showBigImage) {
-
- this.hideBigImage();
- } else {
- this.showBigImage = true;
- this.bigImageUrl = this.getImageUrl(this.mouseOverImage.location, 2000, 2000);
- }
- this.update();
- }
- }.bind(this);
-
- document.addEventListener("keydown", this.keydownListener);
-
- this.getImageName = function(location) {
- let lastSlash = Math.max(location.lastIndexOf("/"), location.lastIndexOf("\\"));
- let lastDot = location.lastIndexOf(".");
- return location.substring(lastSlash+1, lastDot);
- }.bind(this)
-
- this.getImageUrl = function(location, width, height) {
- let imageName = this.getImageName(location);
- let processId = this.generalOpts.processId;
- return `/goobi/api/process/image/${processId}/media/${imageName}/full/!${height},${width}/0/default.jpg`;
- }.bind(this)
- this.msg = function(str) {
- if(!this.msgs || Object.keys(this.msgs).length == 0) {
- return "*".repeat(str.length);
- }
- if(this.msgs[str]) {
- return this.msgs[str];
- }
- return "???" + str + "???";
- }.bind(this)
-});
-riot.tag2('circular-menu', '', 'circular-menu .pie-highlight,[data-is="circular-menu"] .pie-highlight{ position: fixed; width: 400px; text-align: center; z-index: 50; user-select: none; } circular-menu .pie-highlight span,[data-is="circular-menu"] .pie-highlight span{ background-color: rgba(54, 142, 224, 1); color: white; padding: 8px; font-size: 16px; border-radius: 5px; } circular-menu .pie-container,[data-is="circular-menu"] .pie-container{ position: fixed; z-index: 50; } circular-menu .pie,[data-is="circular-menu"] .pie{ position: relative; padding: 0; width: 400px; height: 400px; border-radius: 50%; border: solid 1px rgba(186,183,180,0.5); } circular-menu .line,[data-is="circular-menu"] .line{ position: absolute; height: 1px; width: 50%; top: 50%; left: 50%; transform-origin: 0% 50%; background-color: rgb(54, 142, 224); } circular-menu .line.hidden,[data-is="circular-menu"] .line.hidden{ display: none; } circular-menu .line.dummy,[data-is="circular-menu"] .line.dummy{ background-color: rgba(150, 150, 150, 1); } circular-menu .slice,[data-is="circular-menu"] .slice{ overflow: hidden; position: absolute; top: 0; right: 0; width: 50%; height: 50%; transform-origin: 0% 100%; } circular-menu .slice a,[data-is="circular-menu"] .slice a{ font-size: 16px; color: #fff; } circular-menu .slice-contents,[data-is="circular-menu"] .slice-contents{ text-align: center; position: absolute; left: -100%; width: 200%; height: 200%; border-radius: 50%; background-color: rgba(54, 142, 224, 0.75); } circular-menu .slice-contents span,[data-is="circular-menu"] .slice-contents span{ position: relative; display: inline-block; padding-top: 12px; font-weight: bold; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } circular-menu .slice.remove .slice-contents,[data-is="circular-menu"] .slice.remove .slice-contents{ background-color: rgba(255, 68, 51, 0.75); } circular-menu .slice.remove.active .slice-contents,[data-is="circular-menu"] .slice.remove.active .slice-contents{ background-color: rgb(255, 68, 51); } circular-menu .slice.active .slice-contents,[data-is="circular-menu"] .slice.active .slice-contents{ background-color: rgb(54, 142, 224); } circular-menu li.slice.dummy .slice-contents,[data-is="circular-menu"] li.slice.dummy .slice-contents{ background-color: rgba(222, 222, 222, 0.75); }', '', function(opts) {
- this.manualRot = -90;
- this.on("update", () => {
- if(this.values != opts.values) {
- this.values = opts.values;
- this.calcValues();
- }
- });
-
- this.on("mount", () => {
- this.values = opts.values;
- this.calcValues();
- })
-
- this.rotate = function(e) {
- e.preventDefault();
-
- }.bind(this)
- this.calcValues = function() {
- this.manualRot = -180;
- this.num = this.values.length;
- this.highlight = null;
- this.height = 100;
- this.div = 1;
- this.startDeg = 0;
-
- this.deg = (360/Math.max(4, this.num));
- this.skew = 90 - this.deg;
-
- this.manualRot += this.deg;
- if(this.num < 4) {
- this.manualRot -= this.deg/2;
- }
-
- this.lines = [];
- var i
- for(i=0;i 1 && i%this.div == 0
- });
- }
-
- for(var x=i; x<4; x++) {
- var option = {
- dummy: true,
- allLanguages: {de: "dummy_" + x}
- };
- var rotate = x*this.deg + this.startDeg + this.manualRot;
- this.lines.push({
- deg: rotate,
- unrotate: 90-(this.deg/2),
- option: option,
- hidden: this.div > 1 && x%this.div == 0
- });
- }
- }.bind(this)
- this.mouseover = function(e) {
- if(e.item.option.dummy) {
- this.highlight = null;
- return;
- }
- this.highlight = e.item.option;
- }.bind(this)
- this.mouseClick = function(e) {
- if(e.item.option.dummy) {
- return;
- }
- var circleCenter = {x: this.opts.left+200, y: this.opts.top+200};
- var clickPos = {x: e.clientX, y: e.clientY};
- var dist = Math.sqrt(Math.pow(circleCenter.x - clickPos.x, 2) + Math.pow(circleCenter.y - clickPos.y, 2));
- if(dist <= 200) {
- console.log(e.item)
- opts.observer.trigger('itemselected', e.item.option);
- }
- }.bind(this)
-
- this.onContext = function(e) {
- var circleCenter = {x: this.opts.left+200, y: this.opts.top+200};
- var clickPos = {x: e.clientX, y: e.clientY};
- var dist = Math.sqrt(Math.pow(circleCenter.x - clickPos.x, 2) + Math.pow(circleCenter.y - clickPos.y, 2));
- if(dist > 200) {
- e.preventDefault();
- e.stopPropagation();
- opts.observer.trigger('rightclickoutsidemenu', e);
- }
- }.bind(this)
-
-});
-
-riot.tag2('metsimage', '', '', '', function(opts) {
- this.preloader = false;
- this.physNum = "-";
- this.logicalNum = "-";
- this.height = 400;
- this.width = 400;
- this.src = null;
- this.tooltip = null;
- this.tooltipLeft = 0;
-
- this.on('mount', function() {
- this.fetchDimensions();
-
- this.refs.image.onload = function() {
- this.preloader = false;
- this.update();
- }.bind(this);
- }.bind(this));
-
- this.fetchDimensions = function() {
- let imageName = this.getImageName(this.opts.metsimage.location);
- let processId = this.opts.processid;
- let url = `/goobi/api/process/image/${processId}/media/${imageName}/info.json`;
- fetch(url).then(resp => {
- resp.json().then(json => {
- var ratio = json.width / json.height;
- this.width = 400*ratio;
- this.update();
- this.createObserver();
- });
- })
- }.bind(this)
-
- this.getImageName = function(location) {
- let lastSlash = Math.max(location.lastIndexOf("/"), location.lastIndexOf("\\"));
- return location.substring(lastSlash+1);
- }.bind(this)
-
- this.getImageUrl = function(location, width, height) {
- let imageName = this.getImageName(location);
- let processId = this.opts.processid;
- return `/goobi/api/process/image/${processId}/media/${imageName}/full/!${height},${width}/0/default.jpg`;
- }.bind(this)
-
- this.createObserver = function() {
- var observer;
- var options = {
- rootMargin: "1200px 0px 1200px 0px",
- threshold: 0.9
- };
-
- observer = new IntersectionObserver(this.loadImages, options);
- observer.observe(this.refs.image);
- }.bind(this)
-
- this.onDsContext = function(e) {
- e.preventDefault();
- e.stopPropagation();
- if(e.item.ds) {
- e.item.ds.selected = true;
- }
- this.opts.observer.trigger("openMenu", e, this.opts.metsimage);
- }.bind(this)
-
- this.loadImages = function(entries, observer) {
- entries.forEach( entry => {
- if (entry.isIntersecting && !this.src) {
- this.preloader = true;
- this.src = this.getImageUrl(this.opts.metsimage.location, 1000, 1000);
- this.update();
- }
- });
- }.bind(this)
-});
diff --git a/module-gui/pom.xml b/module-gui/pom.xml
new file mode 100644
index 0000000..d6ab73f
--- /dev/null
+++ b/module-gui/pom.xml
@@ -0,0 +1,54 @@
+
+ 4.0.0
+
+ io.goobi.workflow.plugin
+ plugin-step-ocr-selector
+ 24.06-SNAPSHOT
+
+ plugin-step-ocr-selector-gui
+ jar
+
+
+
+ META-INF/resources
+ src/main/webapp/resources
+
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+ 1.15.0
+
+
+ Install node and npm
+
+ install-node-and-npm
+
+
+
+ npm install
+
+ npm
+
+
+
+ npm run build
+
+ npm
+
+
+ run build
+
+
+
+
+ v21.2.0
+ 10.2.3
+ src/main/webapp/
+ target
+
+
+
+
+
\ No newline at end of file
diff --git a/module-gui/src/main/webapp/Gruntfile.js b/module-gui/src/main/webapp/Gruntfile.js
new file mode 100644
index 0000000..8b71d14
--- /dev/null
+++ b/module-gui/src/main/webapp/Gruntfile.js
@@ -0,0 +1,23 @@
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+ riot: {
+ options:{
+ //template : 'jade',
+ //type : 'coffeescript'
+ concat: true
+ },
+ dist: {
+ expand: false,
+ src: 'tags/*.tag',
+ dest: 'resources/dist/intranda_step_ocrselector/js/tags.js',
+ }
+ }
+ });
+
+ grunt.loadNpmTasks('grunt-riot');
+ grunt.loadNpmTasks('grunt-contrib-copy');
+
+ grunt.registerTask('default', ['riot']);
+
+};
diff --git a/module-gui/src/main/webapp/META-INF/faces-config.xml b/module-gui/src/main/webapp/META-INF/faces-config.xml
new file mode 100644
index 0000000..0448938
--- /dev/null
+++ b/module-gui/src/main/webapp/META-INF/faces-config.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+ org.goobi.production.messages.MyRessourceBundle
+ msgs
+
+
+
diff --git a/frontend-dev/README.md b/module-gui/src/main/webapp/README.md
similarity index 100%
rename from frontend-dev/README.md
rename to module-gui/src/main/webapp/README.md
diff --git a/frontend-dev/package-lock.json b/module-gui/src/main/webapp/package-lock.json
similarity index 100%
rename from frontend-dev/package-lock.json
rename to module-gui/src/main/webapp/package-lock.json
diff --git a/frontend-dev/package.json b/module-gui/src/main/webapp/package.json
similarity index 100%
rename from frontend-dev/package.json
rename to module-gui/src/main/webapp/package.json
diff --git a/frontend-dev/css/style.css b/module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/css/style.css
similarity index 100%
rename from frontend-dev/css/style.css
rename to module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/css/style.css
diff --git a/module-base/src/main/resources/frontend/js/app.js b/module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/app.js
similarity index 100%
rename from module-base/src/main/resources/frontend/js/app.js
rename to module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/app.js
diff --git a/module-base/src/main/resources/frontend/js/riot.min.js b/module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/riot.min.js
similarity index 100%
rename from module-base/src/main/resources/frontend/js/riot.min.js
rename to module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/riot.min.js
diff --git a/module-base/src/main/resources/frontend/js/ugh.js b/module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/ugh.js
similarity index 100%
rename from module-base/src/main/resources/frontend/js/ugh.js
rename to module-gui/src/main/webapp/resources/dist/intranda_step_ocrselector/js/ugh.js
diff --git a/frontend-dev/tags/app.tag b/module-gui/src/main/webapp/tags/app.tag
similarity index 99%
rename from frontend-dev/tags/app.tag
rename to module-gui/src/main/webapp/tags/app.tag
index f38a28a..bf39384 100644
--- a/frontend-dev/tags/app.tag
+++ b/module-gui/src/main/webapp/tags/app.tag
@@ -134,7 +134,7 @@
}
cancel() {
- document.getElementById("restPluginFinishLink").click();
+ document.getElementById("restPluginCancelLink").click();
}
save() {
diff --git a/frontend-dev/tags/circular_menu.tag b/module-gui/src/main/webapp/tags/circular_menu.tag
similarity index 100%
rename from frontend-dev/tags/circular_menu.tag
rename to module-gui/src/main/webapp/tags/circular_menu.tag
diff --git a/frontend-dev/tags/metsImage.tag b/module-gui/src/main/webapp/tags/metsImage.tag
similarity index 100%
rename from frontend-dev/tags/metsImage.tag
rename to module-gui/src/main/webapp/tags/metsImage.tag
diff --git a/pom.xml b/pom.xml
index 3757aaa..b8cd5e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,6 +11,7 @@
pom
module-base
+ module-gui