|
|
|
@ -14,6 +14,7 @@ var txtFlag = true;
|
|
|
|
|
var checkedAnnotation = "";
|
|
|
|
|
var algIndexedArray = [];
|
|
|
|
|
var computedLanguage = "";
|
|
|
|
|
var dataMiner = "";
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------------
|
|
|
|
|
// Starting point: get the csv file with algorithm parameters and set the page
|
|
|
|
@ -34,22 +35,20 @@ checkInputLink = function() {
|
|
|
|
|
type : "GET",
|
|
|
|
|
async : true,
|
|
|
|
|
success : function(data, stato) {
|
|
|
|
|
$("#input-textarea").val(data);
|
|
|
|
|
freeText = $("#input-textarea").val();
|
|
|
|
|
freeText = data;
|
|
|
|
|
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?getlang=on&freetext="
|
|
|
|
|
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
|
|
|
|
if(gCubeToken.length > 0)
|
|
|
|
|
uploaderUrl += "&gcube-token=" + gCubeToken;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url : "/nlphub/nlphub-uploader-servlet?getlang=on&freetext="
|
|
|
|
|
+ encodeURIComponent(freeText),
|
|
|
|
|
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.");
|
|
|
|
|
//}
|
|
|
|
|
hideProgress();
|
|
|
|
|
$("#input-textarea").val(freeText);
|
|
|
|
|
computedLanguage = data.language;
|
|
|
|
|
//textAreaEnable(false);
|
|
|
|
|
initApplication();
|
|
|
|
|
},
|
|
|
|
|
error : function(richiesta, stato,
|
|
|
|
@ -64,7 +63,7 @@ checkInputLink = function() {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
error : function(richiesta, stato, errori) {
|
|
|
|
|
alert("Unexpected error reading from link: '" + inputFile + "'.\nStatus: " + richiesta.status + "\nClick OK to start application.");
|
|
|
|
|
alert("Unexpected error reading from link: '" + inputFile + "'.\nStatus: " + richiesta.status + " Error: " + errori + "\nClick OK to start application.");
|
|
|
|
|
hideProgress();
|
|
|
|
|
initApplication();
|
|
|
|
|
}
|
|
|
|
@ -100,11 +99,14 @@ initApplication = function() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
disableExecuteButton();
|
|
|
|
|
|
|
|
|
|
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner);
|
|
|
|
|
if(gCubeToken.length > 0)
|
|
|
|
|
uploaderUrl += "&gcube-token=" + gCubeToken;
|
|
|
|
|
|
|
|
|
|
$("#upload-button")
|
|
|
|
|
.uploadFile(
|
|
|
|
|
{
|
|
|
|
|
url : "/nlphub/nlphub-uploader-servlet",
|
|
|
|
|
url : uploaderUrl,
|
|
|
|
|
fileName : "mytxtfile",
|
|
|
|
|
maxFileCount : 100,
|
|
|
|
|
multiple : false,
|
|
|
|
@ -243,9 +245,13 @@ setEventListeners = function() {
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url : "/nlphub/nlphub-uploader-servlet?freetext="
|
|
|
|
|
+ encodeURIComponent(freeText),
|
|
|
|
|
url : uploaderUrl,
|
|
|
|
|
type : "POST",
|
|
|
|
|
async : true,
|
|
|
|
|
contentType : "text/plain; charset=utf-8",
|
|
|
|
@ -351,6 +357,8 @@ checkLanguage = function(lang) {
|
|
|
|
|
* CSV parser
|
|
|
|
|
*/
|
|
|
|
|
manageCsvData = function(data) {
|
|
|
|
|
var tokensPerLine = 8;
|
|
|
|
|
|
|
|
|
|
// first of all: split on the "newline" character in order to
|
|
|
|
|
// get all lines.
|
|
|
|
|
var lines = data.split("\n");
|
|
|
|
@ -372,14 +380,21 @@ manageCsvData = function(data) {
|
|
|
|
|
if (tokenStart == -1) {
|
|
|
|
|
tokenStart = j;
|
|
|
|
|
} else {
|
|
|
|
|
tokens[tokens.length] = line.substring(tokenStart + 1, j);
|
|
|
|
|
tokens.push(line.substring(tokenStart + 1, j));
|
|
|
|
|
tokenStart = j;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// get the new token and push it in the array
|
|
|
|
|
tokens[tokens.length] = line.substring(tokenStart + 1);
|
|
|
|
|
lineTokens[lineTokens.length] = tokens;
|
|
|
|
|
tokens.push(line.substring(tokenStart + 1));
|
|
|
|
|
|
|
|
|
|
if(tokens.length != tokensPerLine)
|
|
|
|
|
continue; // skip...
|
|
|
|
|
|
|
|
|
|
lineTokens.push(tokens);
|
|
|
|
|
var description = tokens[1].toUpperCase().trim();
|
|
|
|
|
if(description == "CLOUD COMPUTING")
|
|
|
|
|
dataMiner = tokens[2];
|
|
|
|
|
tokens = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -394,6 +409,8 @@ getAlgorithms = function(lineTokens) {
|
|
|
|
|
for (i = 0; i < lineTokens.length; i++) {
|
|
|
|
|
if ((i == 0) || (lineTokens[i].length != 8))
|
|
|
|
|
continue; // skip the header
|
|
|
|
|
if (lineTokens[i][1].toUpperCase().trim() != activePage.toUpperCase())
|
|
|
|
|
continue;
|
|
|
|
|
if (lineTokens[i][7].trim().toUpperCase() == "OK") {
|
|
|
|
|
var algName = lineTokens[i][0].trim();
|
|
|
|
|
var algDescription = lineTokens[i][1].trim();
|
|
|
|
@ -553,12 +570,16 @@ runAlgorithm = function() {
|
|
|
|
|
algList = algList.substring(0, algList.length - 1);
|
|
|
|
|
|
|
|
|
|
var parameters = "annotations=" + annList;
|
|
|
|
|
parameters += "&dataminer=" + encodeURIComponent(dataMiner);
|
|
|
|
|
parameters += "&lang=" + $("#language-select").val();
|
|
|
|
|
parameters += "&plink=" + encodeURI(publicLink);
|
|
|
|
|
parameters += "&plink=" + encodeURIComponent(publicLink);
|
|
|
|
|
parameters += "&algs=" + algList;
|
|
|
|
|
|
|
|
|
|
var nlphubUrl = "/nlphub/nlphub-servlet?" + parameters;
|
|
|
|
|
if(gCubeToken.length > 0)
|
|
|
|
|
nlphubUrl += "&gcube-token=" + gCubeToken;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url : "/nlphub/nlphub-servlet?" + parameters,
|
|
|
|
|
url : nlphubUrl,
|
|
|
|
|
type : "POST",
|
|
|
|
|
async : true,
|
|
|
|
|
success : function(data, stato) {
|
|
|
|
@ -604,8 +625,12 @@ getOutputJson = function(message) {
|
|
|
|
|
parameters += "&tobemap=" + encodeURI(tobemap);
|
|
|
|
|
//console.log(parameters);
|
|
|
|
|
|
|
|
|
|
var mapperUrl = "/nlphub/nlphub-mapper-servlet?" + parameters;
|
|
|
|
|
if(gCubeToken.length > 0)
|
|
|
|
|
mapperUrl += "&gcube-token=" + gCubeToken;
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url : "/nlphub/nlphub-mapper-servlet?" + parameters,
|
|
|
|
|
url : mapperUrl,
|
|
|
|
|
type : "POST",
|
|
|
|
|
async : true,
|
|
|
|
|
success : function(data, stato) {
|
|
|
|
|