Skip to content

Commit

Permalink
option to load UI configuration file
Browse files Browse the repository at this point in the history
documentation updated and layout changed
  • Loading branch information
Johannes Heinecke committed Nov 3, 2024
1 parent fca3c38 commit 42f5eaf
Show file tree
Hide file tree
Showing 10 changed files with 399 additions and 300 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## Version 2.29.0
* new option to load UI configuration file added
* new dependency to snakeyaml

## Version 2.28.1
* java import error corrected

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM openjdk:17-alpine

ARG VERSION=2.28.0
# docker build --build-arg VERSION=2.28.0 -t jheinecke/conllueditor:2.28.0 .
# docker build --build-arg VERSION=2.28.0 -t jheinecke/conllueditor:latest .
ARG VERSION=2.29.0
# docker build --build-arg VERSION=2.29.0 -t jheinecke/conllueditor:2.29.0 .
# docker build --build-arg VERSION=2.29.0 -t jheinecke/conllueditor:latest .
# docker run -t --rm --name conllueditor -p 5555:5555 --user 1000:1000 -v </absolute/path/to/datadir>:/data --env filename=tt.conllu jheinecke/conllueditor:latest
# docker push jheinecke/conllueditor:2.26.0
# docker push jheinecke/conllueditor:2.29.0
# docker push jheinecke/conllueditor:latest

# docker exec -it conllueditor /bin/sh
Expand All @@ -27,7 +27,7 @@ COPY dockerstart.sh .

EXPOSE 5555
WORKDIR /data
CMD /usr/src/ConlluEditor/dockerstart.sh "$filename" "$validator" "$UPOS" "$XPOS" "$deprels" "$features" "$language" "${include_unused}" "$shortcuts" "$saveAfter" "$compare"
CMD /usr/src/ConlluEditor/dockerstart.sh "$filename" "$validator" "$uiconfig" "$UPOS" "$XPOS" "$deprels" "$features" "$language" "${include_unused}" "$shortcuts" "$saveAfter" "$compare"



Expand Down
215 changes: 103 additions & 112 deletions README.md

Large diffs are not rendered by default.

Binary file added doc/custom-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions dockerstart.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# this script is only needed to launche the server in an docker container
# this script is only needed to launch the server in an docker container
# outside docker please use bin/conlluedit.sh

filename=$1
Expand All @@ -13,6 +13,11 @@ if [ "$1" != "" ]; then
fi
shift

if [ "$1" != "" ]; then
iuiconfig="--uiconfig $1"
fi
shift

if [ "$1" != "" ]; then
iupos="--UPOS $1"
fi
Expand Down Expand Up @@ -59,13 +64,14 @@ fi
shift

echo "options given:"
echo " uiconfig $iuiconfig"
echo " validator $ivalidator"
echo " upos $iupos"
echo " xpos $ixpos"
echo " deprels $ideprels"
echo " features $ifeats"
echo " language $ilang"
echo " include unused $iunused"
echo " include_unused $iunused"
echo " shortcuts $ishortcuts"
echo " saveafter $isaveafter"
echo " compare $icompare"
Expand All @@ -74,7 +80,6 @@ echo " filename $filename"
java -Xmx4g -cp /usr/src/ConlluEditor/ConlluEditor.jar \
com.orange.labs.editor.ConlluEditor \
--rootdir /usr/src/ConlluEditor \
$ivalidator $iupos $ixpos $ideprels $ifeats $ilang $iunused $ishortcuts $isaveafter \
$icompare \
$iuiconfig $ivalidator $iupos $ixpos $ideprels $ifeats $ilang $iunused $ishortcuts $isaveafter $icompare \
${filename} 5555

138 changes: 119 additions & 19 deletions gui/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author Johannes Heinecke
@version 2.28.0 as of 6th October 2024
@version 2.29.0 as of 3rd November 2024
*/


Expand All @@ -44,7 +44,14 @@ var URL_BASE = 'http://' + window.location.hostname + ':12347/edit';
//}


// TODO add new sentence
var graphtype = 1; // 1: tree, 2: hedge, 3: table
var showfeats = false;
var showmisc = false;
var showr2l = false;
var autoadaptwidth = true;
var showshortcuthelp = false;



var isIE = /*@cc_on!@*/false || !!document.documentMode;
var isEdge = !isIE && !!window.StyleMedia;
Expand Down Expand Up @@ -88,7 +95,7 @@ function enableTab(id) {

// get caret position/selection
var val = this.value,
start = this.selectionStart,
start = this.selectionStart,misc
end = this.selectionEnd;

// set textarea value to: text before caret + tab + text after caret
Expand Down Expand Up @@ -434,7 +441,106 @@ function getServerInfo() {
} else {
$('#save').hide();
}

// deactivate buttons as defined in uiconfig.json
console.log("UI", data.uiconfig);
if (data.uiconfig) {

if (data.uiconfig.right2left_show === "hidden") {
$("#r2l").hide();
}
if (data.uiconfig.right2left_status === "active") {
showr2l = true;
$("#r2l").addClass('active');
} else {
showr2l = false;
$("#r2l").removeClass('active');
}

if (data.uiconfig.features_show === "hidden") {
$("#feat2").hide();
}
if (data.uiconfig.features_status === "active") {
showfeats = true;
$("#feat2").addClass('active');
} else {
showfeats = false;
$("#feat2").removeClass('active');
}

if (data.uiconfig.misc_show === "hidden") {
$("#misc2").hide();
} else if (data.uiconfig.misc_status === "active") {
showmisc= true;
$("#misc2").addClass('active');
} else {
showmisc = false;
$("#misc2").removeClass('active');
}

if (data.uiconfig.display === "flat") {
graphtype = 2;
$("#flat3").val("flat");
} else if (data.uiconfig.display === "table") {
graphtype = 3;
$("#flat3").val("table");
} else {
graphtype = 1;
$("#flat3").val("tree");
}

if (data.uiconfig.searchmode === "simple") {
$("#searchmode").val("simple");
}
if (data.uiconfig.searchmode === "searchreplace") {
$("#searchmode").val("complex");
}
if (data.uiconfig.searchmode === "grew") {
$("#searchmode").val("grew");
}
if (data.uiconfig.searchmode === "none") {
$("#searchmode").val("hide");
}
$("#searchmode").click();


if (data.uiconfig.shortcuts === "show") {
showshortcuthelp = false;
ToggleShortcutHelp();
}

if (data.uiconfig.nodewidth_show === "hidden") {
$("#adaptwidth").removeClass('onlyWithTree');
$("#adaptwidth").hide();
} else if (data.uiconfig.nodewidth_status === "variable") {
autoadaptwidth= false;
$("#adaptwidth").click();
//$("#misc2").addClass('active');
} else {
autoadaptwidth = true;
$("#adaptwidth").click();
//$("#misc2").removeClass('active');
}


if (data.uiconfig.latex === "hidden") {
$("#latex").removeClass('onlyWithTree');
$("#latex").hide();
}
if (data.uiconfig.conllu === "hidden") {
$("#conllu").removeClass('onlyWithTree');
$("#conllu").hide();
}
if (data.uiconfig.sdparse === "hidden") {
$("#sdparse").removeClass('onlyWithTree');
$("#sdparse").hide();
}
if (data.uiconfig.spacy === "hidden") {
$("#json").removeClass('onlyWithTree');
$("#json").hide();
}

}
// set version number to logo (shown if mouse hovers on the logo)
//$('#logo').attr("title", data.version);
$('#ce_version').text(data.version);
Expand Down Expand Up @@ -581,7 +687,7 @@ function switchSearch(on) {
$('body').css("margin-top", "280px");
} else {
$(".search").hide();
if (!showshortcathelp)
if (!showshortcuthelp)
$('body').css("margin-top", "150px"); // header is smaller, decrease body margin
}
}
Expand Down Expand Up @@ -619,24 +725,22 @@ function switchGrewmatchReplace(on) {
}


var showshortcathelp = false;

function switchSCHelp(on) {
if (on) {
$("#shortcuthelp").show();
$('body').css("margin-top", "290px");
showshortcathelp = true;
showshortcuthelp = true;
} else {
$("#shortcuthelp").hide();
// if (!more)
// $('body').css("margin-top", "150px"); // header is smaller, decrease body margin
showshortcathelp = false;
showshortcuthelp = false;
}
}

function ToggleShortcutHelp() {
//console.log("SC", showshortcathelp, more, lastmore);
if (showshortcathelp) {
//console.log("SC", showshortcuthelp, more, lastmore);
if (showshortcuthelp) {
// hide short cut help
switchSCHelp(false);
$("#searchmode").click();
Expand Down Expand Up @@ -1555,11 +1659,7 @@ function unhighlight() {


//var flatgraph = false;
var graphtype = 1; // 1: tree, 2: hedge, 3: table
var showfeats = false;
var showmisc = false;
var showr2l = false;
var autoadaptwidth = true;

var backwards = false;
var show_basic_in_enhanced = false; // if true we display enhanced deps which are identical two basic deps
var editing_enhanced = false;
Expand Down Expand Up @@ -2217,7 +2317,7 @@ $(document).ready(function () {
switchSubtree(false);
switchGrewmatchReplace(false);
$('body').css("margin-top", "200px"); // header is smaller, decrease body margin
if (showshortcathelp) {
if (showshortcuthelp) {
switchSCHelp(false);
}
}
Expand All @@ -2227,7 +2327,7 @@ $(document).ready(function () {
switchSearchReplace(false);
switchSubtree(true);
switchGrewmatchReplace(false);
if (showshortcathelp) {
if (showshortcuthelp) {
switchSCHelp(false);
}
}
Expand All @@ -2238,7 +2338,7 @@ $(document).ready(function () {
switchSubtree(false);
switchGrewmatchReplace(true);
$('body').css("margin-top", "160px"); // header is smaller, decrease body margin
if (showshortcathelp) {
if (showshortcuthelp) {
switchSCHelp(false);
}
}
Expand All @@ -2248,7 +2348,7 @@ $(document).ready(function () {
switchSubtree(false);
switchGrewmatchReplace(false);
$('body').css("margin-top", "260px"); // header is smaller, decrease body margin
if (showshortcathelp) {
if (showshortcuthelp) {
switchSCHelp(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<option value="table">table view</option>
</select>
</span>
<button class="mycheck mybutton" id="r2l" title="activate for sentennces in Arabic or Hebrew script">right to left</button>
<button class="mycheck mybutton" id="r2l" title="activate for sentences in Arabic or Hebrew script">right to left</button>
<!--button class="mycheck mybutton" id="extracols" title="show contents of columns > 10">extra cols</button-->

<button class ="editbuttons mybutton editmode" title="save file before min edits are reached (option --saveAfter)" id="save">save changes</button>
Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
author Johannes Heinecke
version 2.28.0 as of 6th October 2024
version 2.29.0 as of 6th October 2024
-->

<modelVersion>4.0.0</modelVersion>
<groupId>com.orange.labs</groupId>
<artifactId>ConlluEditor</artifactId>
<version>2.28.0</version>
<version>2.29.0</version>
<packaging>jar</packaging>

<properties>
Expand Down Expand Up @@ -285,6 +285,11 @@
<version>4.13.1</version>
</dependency>

</dependencies>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>

</dependencies>
</project>
Loading

0 comments on commit 42f5eaf

Please sign in to comment.