This commit is contained in:
Erik Perrone 2018-02-20 15:41:48 +00:00
parent 2098082241
commit 7bfc647ed8
1 changed files with 44 additions and 3 deletions

View File

@ -27,6 +27,7 @@
var publicLink = null; var publicLink = null;
var pageGreen = "#4CAF50"; var pageGreen = "#4CAF50";
var pageGray = "#A0A0A0"; var pageGray = "#A0A0A0";
var savedAnnotations = "";
$("#execute-button").css("background-color", pageGray); $("#execute-button").css("background-color", pageGray);
// ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------
@ -63,6 +64,7 @@
onLoad : function(obj) { onLoad : function(obj) {
$("#file-info").remove(); $("#file-info").remove();
$("#fu-container").append("<div id=\"file-info\"></div>"); $("#fu-container").append("<div id=\"file-info\"></div>");
savedAnnotations = "";
}, },
onSuccess : function(files, data, xhr) { onSuccess : function(files, data, xhr) {
console.log("files: " + files); console.log("files: " + files);
@ -241,6 +243,7 @@
annList += list[i] + ","; annList += list[i] + ",";
} }
annList = annList.substring(0, annList.length-1); annList = annList.substring(0, annList.length-1);
savedAnnotations = annList;
var algList = ""; var algList = "";
for(j in algorithms) { for(j in algorithms) {
@ -259,10 +262,10 @@
url : "/nlphub/nlphub-servlet?" + parameters, url : "/nlphub/nlphub-servlet?" + parameters,
type : "POST", type : "POST",
async : true, async : true,
//contentType : "text/plain; charset=utf-8",
success : function(data, stato) { success : function(data, stato) {
if(typeof(data.response) != 'undefined') if(typeof(data.response) != 'undefined') {
alert(data.message); var jsonOut = getOutputJson(data.message);
}
else if (typeof(data.error) != 'undefined') else if (typeof(data.error) != 'undefined')
alert(data.message); alert(data.message);
else else
@ -273,6 +276,44 @@
} }
}); });
//publicLink = null;
}
getOutputJson = function(message) {
var tobemap = "";
for(var i=0; i<message.length; i++) {
tobemap += message[i] + "|";
}
tobemap = tobemap.substring(0, tobemap.length-1);
var parameters = "annotations=" + savedAnnotations;
parameters += "&plink=" + encodeURI(publicLink);
parameters += "&lang=" + $("#language-select").val();
parameters += "&tobemap=" + encodeURI(tobemap);
$
.ajax({
url : "/nlphub/nlphub-mapper-servlet?" + parameters,
type : "POST",
async : true,
success : function(data, stato) {
console.log(data);
/*
if(typeof(data.response) != 'undefined') {
var jsonOut = getOutputJson(data.message);
}
else if (typeof(data.error) != 'undefined')
alert(data.message);
else
alert("Unexpected response");*/
},
error : function(richiesta, stato, errori) {
alert("Unexpected Error");
}
});
savedAnnotations = "";
publicLink = null; publicLink = null;
} }