From 4f161ecff4b595505de944db03b47cd047c8cf2c Mon Sep 17 00:00:00 2001 From: Erik Perrone Date: Wed, 11 Apr 2018 09:43:11 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@165848 82a268e6-3cf1-43bd-a215-b396298e98cf --- src/main/webapp/js/main.js | 68 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/main/webapp/js/main.js b/src/main/webapp/js/main.js index 7805c64..693a262 100644 --- a/src/main/webapp/js/main.js +++ b/src/main/webapp/js/main.js @@ -15,6 +15,7 @@ var checkedAnnotation = ""; var algIndexedArray = []; var computedLanguage = ""; var dataMiner = ""; +var appRoot = "/nlphub"; // ------------------------------------------------------------------------------------------------------ // Starting point: get the csv file with algorithm parameters and set the page @@ -36,7 +37,7 @@ checkInputLink = function() { async : true, success : function(data, stato) { 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); if(gCubeToken.length > 0) uploaderUrl += "&gcube-token=" + gCubeToken; @@ -99,7 +100,7 @@ initApplication = function() { }); disableExecuteButton(); - var uploaderUrl = "/nlphub/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner); + var uploaderUrl = appRoot + "/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner); if(gCubeToken.length > 0) uploaderUrl += "&gcube-token=" + gCubeToken; @@ -243,36 +244,36 @@ setEventListeners = function() { // must be written in the workspace and the public link // is set. if ($("#input-textarea").val().length > 0) { - if(publicLink == null) { - freeText = $("#input-textarea").val(); - var uploaderUrl = "/nlphub/nlphub-uploader-servlet?freetext=" - + encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner); - if(gCubeToken.length > 0) - uploaderUrl += "&gcube-token=" + gCubeToken; + //if(publicLink == null) { + freeText = $("#input-textarea").val(); + var uploaderUrl = appRoot + "/nlphub-uploader-servlet?freetext=" + + encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner); + if(gCubeToken.length > 0) + uploaderUrl += "&gcube-token=" + gCubeToken; - $.ajax({ - url : uploaderUrl, - type : "POST", - async : true, - contentType : "text/plain; charset=utf-8", - success : function(data, stato) { - publicLink = data.message; - if (publicLink == null) { - alert("Error uploading file."); - } - runAlgorithm(); - }, - error : function(richiesta, stato, - errori) { - alert("Unexpected Error. Status: " - + richiesta.status); - hideProgress(); - textAreaEnable(true); - $("#file-info").empty(); + $.ajax({ + url : uploaderUrl, + type : "POST", + async : true, + contentType : "text/plain; charset=utf-8", + success : function(data, stato) { + publicLink = data.message; + if (publicLink == null) { + alert("Error uploading file."); } - }); - } - else runAlgorithm(); + runAlgorithm(); + }, + error : function(richiesta, stato, + errori) { + alert("Unexpected Error. Status: " + + richiesta.status); + hideProgress(); + textAreaEnable(true); + $("#file-info").empty(); + } + }); + //} + //else runAlgorithm(); } else { @@ -579,7 +580,7 @@ runAlgorithm = function() { parameters += "&plink=" + encodeURIComponent(publicLink); parameters += "&algs=" + algList; - var nlphubUrl = "/nlphub/nlphub-servlet?" + parameters; + var nlphubUrl = appRoot + "/nlphub-servlet?" + parameters; if(gCubeToken.length > 0) nlphubUrl += "&gcube-token=" + gCubeToken; $.ajax({ @@ -629,7 +630,7 @@ getOutputJson = function(message) { parameters += "&tobemap=" + encodeURI(tobemap); //console.log(parameters); - var mapperUrl = "/nlphub/nlphub-mapper-servlet?" + parameters; + var mapperUrl = appRoot + "/nlphub-mapper-servlet?" + parameters; if(gCubeToken.length > 0) mapperUrl += "&gcube-token=" + gCubeToken; @@ -1001,7 +1002,7 @@ resizeTable = function() { + "\" value=\"" + annotations[i] + "\" checked=\"checked\"> "; - if(annotations[i].toLowerCase() == "keyword") { + if((annotations[i].toLowerCase() == "keyword") || (annotations[i].toLowerCase() == "event")) { annotationElement = "