This commit is contained in:
Erik Perrone 2018-04-11 09:43:11 +00:00
parent cee6ef152a
commit 4f161ecff4
1 changed files with 34 additions and 34 deletions

View File

@ -15,6 +15,7 @@ var checkedAnnotation = "";
var algIndexedArray = []; var algIndexedArray = [];
var computedLanguage = ""; var computedLanguage = "";
var dataMiner = ""; var dataMiner = "";
var appRoot = "/nlphub";
// ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------
// Starting point: get the csv file with algorithm parameters and set the page // Starting point: get the csv file with algorithm parameters and set the page
@ -36,7 +37,7 @@ checkInputLink = function() {
async : true, async : true,
success : function(data, stato) { success : function(data, stato) {
freeText = data; freeText = data;
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?getlang=on&freetext=" var uploaderUrl = appRoot + "/nlphub-uploader-servlet?getlang=on&freetext="
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner); + encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
if(gCubeToken.length > 0) if(gCubeToken.length > 0)
uploaderUrl += "&gcube-token=" + gCubeToken; uploaderUrl += "&gcube-token=" + gCubeToken;
@ -99,7 +100,7 @@ initApplication = function() {
}); });
disableExecuteButton(); disableExecuteButton();
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner); var uploaderUrl = appRoot + "/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner);
if(gCubeToken.length > 0) if(gCubeToken.length > 0)
uploaderUrl += "&gcube-token=" + gCubeToken; uploaderUrl += "&gcube-token=" + gCubeToken;
@ -243,36 +244,36 @@ setEventListeners = function() {
// must be written in the workspace and the public link // must be written in the workspace and the public link
// is set. // is set.
if ($("#input-textarea").val().length > 0) { if ($("#input-textarea").val().length > 0) {
if(publicLink == null) { //if(publicLink == null) {
freeText = $("#input-textarea").val(); freeText = $("#input-textarea").val();
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?freetext=" var uploaderUrl = appRoot + "/nlphub-uploader-servlet?freetext="
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner); + encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
if(gCubeToken.length > 0) if(gCubeToken.length > 0)
uploaderUrl += "&gcube-token=" + gCubeToken; uploaderUrl += "&gcube-token=" + gCubeToken;
$.ajax({ $.ajax({
url : uploaderUrl, url : uploaderUrl,
type : "POST", type : "POST",
async : true, async : true,
contentType : "text/plain; charset=utf-8", contentType : "text/plain; charset=utf-8",
success : function(data, stato) { success : function(data, stato) {
publicLink = data.message; publicLink = data.message;
if (publicLink == null) { if (publicLink == null) {
alert("Error uploading file."); alert("Error uploading file.");
}
runAlgorithm();
},
error : function(richiesta, stato,
errori) {
alert("Unexpected Error. Status: "
+ richiesta.status);
hideProgress();
textAreaEnable(true);
$("#file-info").empty();
} }
}); runAlgorithm();
} },
else runAlgorithm(); error : function(richiesta, stato,
errori) {
alert("Unexpected Error. Status: "
+ richiesta.status);
hideProgress();
textAreaEnable(true);
$("#file-info").empty();
}
});
//}
//else runAlgorithm();
} }
else { else {
@ -579,7 +580,7 @@ runAlgorithm = function() {
parameters += "&plink=" + encodeURIComponent(publicLink); parameters += "&plink=" + encodeURIComponent(publicLink);
parameters += "&algs=" + algList; parameters += "&algs=" + algList;
var nlphubUrl = "/nlphub/nlphub-servlet?" + parameters; var nlphubUrl = appRoot + "/nlphub-servlet?" + parameters;
if(gCubeToken.length > 0) if(gCubeToken.length > 0)
nlphubUrl += "&gcube-token=" + gCubeToken; nlphubUrl += "&gcube-token=" + gCubeToken;
$.ajax({ $.ajax({
@ -629,7 +630,7 @@ getOutputJson = function(message) {
parameters += "&tobemap=" + encodeURI(tobemap); parameters += "&tobemap=" + encodeURI(tobemap);
//console.log(parameters); //console.log(parameters);
var mapperUrl = "/nlphub/nlphub-mapper-servlet?" + parameters; var mapperUrl = appRoot + "/nlphub-mapper-servlet?" + parameters;
if(gCubeToken.length > 0) if(gCubeToken.length > 0)
mapperUrl += "&gcube-token=" + gCubeToken; mapperUrl += "&gcube-token=" + gCubeToken;
@ -1001,7 +1002,7 @@ resizeTable = function() {
+ "\" value=\"" + annotations[i] + "\" value=\"" + annotations[i]
+ "\" checked=\"checked\"></input> <label for=\"check-" + i + "\" checked=\"checked\"></input> <label for=\"check-" + i
+ "\">" + annotations[i] + "</label>"; + "\">" + annotations[i] + "</label>";
if(annotations[i].toLowerCase() == "keyword") { if((annotations[i].toLowerCase() == "keyword") || (annotations[i].toLowerCase() == "event")) {
annotationElement = "<input type=\"checkbox\" id=\"check-" + i annotationElement = "<input type=\"checkbox\" id=\"check-" + i
+ "\" value=\"" + annotations[i] + "\" value=\"" + annotations[i]
+ "\"></input> <label for=\"check-" + i + "\"></input> <label for=\"check-" + i
@ -1081,7 +1082,6 @@ buildLanguageList = function() {
selectAnnotationsByLanguage(); selectAnnotationsByLanguage();
}); });
$("#language-select").change();
} }
/* /*