From e79e546737e966ca302fe7f0ad08e18d6f93a98e Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 7 Aug 2019 19:29:59 +0200 Subject: [PATCH 01/47] Gitflow testing: only miniminiminimal changes :-) --- js/Storytelling/StorytellingWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index b9c9d70..669dace 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -100,7 +100,7 @@ StorytellingWidget.prototype = { } else { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); - $(uploadToDARIAH).append(" [upload to DARIAH storage]"); + $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); uploadToDARIAH.title = ""; uploadToDARIAH.href = dataset.url; From 3a0c80f91fc6ed50bd247772f2c2c5205c874f07 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 7 Aug 2019 19:39:13 +0200 Subject: [PATCH 02/47] More minor typos fixed --- js/Storytelling/StorytellingWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 669dace..79550c4 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -100,7 +100,7 @@ StorytellingWidget.prototype = { } else { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); - $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); + $(uploadToDARIAH).append(" [upload to DARIAH-DE OwnStorage]"); uploadToDARIAH.title = ""; uploadToDARIAH.href = dataset.url; From 61f7b4f726d5aad95eae865543b39103b0584fd7 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 12 Aug 2019 19:30:47 +0200 Subject: [PATCH 03/47] Begin implementing HTTP GET with DARIAH-DE OAuth tokens. --- js/Dataloader/Dataloader.js | 123 +++++++++++----------- js/GeoTemConfig.js | 198 +++++++++++++++++++----------------- 2 files changed, 168 insertions(+), 153 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 62b65d3..5e1777a 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -29,7 +29,7 @@ function Dataloader(parent) { this.dataLoader = this; - + this.parent = parent; this.options = parent.options; @@ -56,17 +56,17 @@ Dataloader.prototype = { this.addLocalKMLLoader(); this.addLocalCSVLoader(); this.addLocalXLSXLoader(); - - // trigger change event on the select so + + // trigger change event on the select so // that only the first loader div will be shown $(this.parent.gui.loaderTypeSelect).change(); }, - + getFileName : function(url) { var fileName = $.url(url).attr('file'); if ( (typeof fileName === "undefined") || (fileName.length === 0) ){ fileName = $.url(url).attr('path'); - //startsWith and endsWith defined in SIMILE Ajax (string.js) + //startsWith and endsWith defined in SIMILE Ajax (string.js) while (fileName.endsWith("/")){ fileName = fileName.substr(0,fileName.length-1); } @@ -77,25 +77,25 @@ Dataloader.prototype = { } return fileName; }, - + distributeDataset : function(dataSet) { GeoTemConfig.addDataset(dataSet); }, - + distributeDatasets : function(datasets) { GeoTemConfig.addDatasets(datasets); }, - + addStaticLoader : function() { if (this.options.staticKML.length > 0){ $(this.parent.gui.loaderTypeSelect).append(""); - + this.StaticLoaderTab = document.createElement("div"); $(this.StaticLoaderTab).attr("id","StaticLoader"); - + this.staticKMLList = document.createElement("select"); $(this.StaticLoaderTab).append(this.staticKMLList); - + var staticKMLList = this.staticKMLList; var isFirstHeader = true; $(this.options.staticKML).each(function(){ @@ -113,7 +113,7 @@ Dataloader.prototype = { //close last optgroup (if there were any) if (!isFirstHeader) $(staticKMLList).append(""); - + this.loadStaticKMLButton = document.createElement("button"); $(this.loadStaticKMLButton).text("load"); $(this.loadStaticKMLButton).addClass(GeoTemConfig.buttonCssClass); @@ -130,7 +130,7 @@ Dataloader.prototype = { var kml = GeoTemConfig.getKml(kmlURL); if ((typeof kml !== "undefined") && (kml != null)) { var dataSet = new Dataset(GeoTemConfig.loadKml(kml), fileName, origURL); - + if (dataSet != null) this.distributeDataset(dataSet); } else @@ -140,37 +140,37 @@ Dataloader.prototype = { $(this.parent.gui.loaders).append(this.StaticLoaderTab); } }, - + addKMLLoader : function() { $(this.parent.gui.loaderTypeSelect).append(""); - + this.KMLLoaderTab = document.createElement("div"); $(this.KMLLoaderTab).attr("id","KMLLoader"); - + this.kmlURL = document.createElement("input"); $(this.kmlURL).attr("type","text"); $(this.KMLLoaderTab).append(this.kmlURL); - + this.loadKMLButton = document.createElement("button"); $(this.loadKMLButton).text("load KML"); $(this.KMLLoaderTab).append(this.loadKMLButton); - + $(this.loadKMLButton).click($.proxy(function(){ var kmlURL = $(this.kmlURL).val(); - + if (kmlURL.length === 0) return; var origURL = kmlURL; var fileName = this.getFileName(kmlURL); - + if (typeof GeoTemConfig.proxy != 'undefined') { kmlURL = GeoTemConfig.proxy + kmlURL; } - + var kml = GeoTemConfig.getKml(kmlURL); if ((typeof kml !== "undefined") && (kml != null)) { var dataSet = new Dataset(GeoTemConfig.loadKml(kml), fileName, origURL); - + if (dataSet != null) this.distributeDataset(dataSet); } else @@ -178,28 +178,28 @@ Dataloader.prototype = { "proxy may prevent the file from loading. In that case please send us an email, " + "and we gladly add your host to the white list."); },this)); - + $(this.parent.gui.loaders).append(this.KMLLoaderTab); }, - + addKMZLoader : function() { $(this.parent.gui.loaderTypeSelect).append(""); - + this.KMZLoaderTab = document.createElement("div"); $(this.KMZLoaderTab).attr("id","KMZLoader"); - + this.kmzURL = document.createElement("input"); $(this.kmzURL).attr("type","text"); $(this.KMZLoaderTab).append(this.kmzURL); - + this.loadKMZButton = document.createElement("button"); $(this.loadKMZButton).text("load KMZ"); $(this.KMZLoaderTab).append(this.loadKMZButton); $(this.loadKMZButton).click($.proxy(function(){ - + var dataLoader = this; - + var kmzURL = $(this.kmzURL).val(); if (kmzURL.length === 0) return; @@ -207,11 +207,11 @@ Dataloader.prototype = { var fileName = dataLoader.getFileName(kmzURL); if (typeof GeoTemConfig.proxy != 'undefined') kmzURL = GeoTemConfig.proxy + kmzURL; - + GeoTemConfig.getKmz(kmzURL, function(kmlArray){ $(kmlArray).each(function(){ var dataSet = new Dataset(GeoTemConfig.loadKml(this), fileName, origURL); - + if (dataSet != null) dataLoader.distributeDataset(dataSet); }); @@ -220,24 +220,24 @@ Dataloader.prototype = { $(this.parent.gui.loaders).append(this.KMZLoaderTab); }, - + addCSVLoader : function() { $(this.parent.gui.loaderTypeSelect).append(""); - + this.CSVLoaderTab = document.createElement("div"); $(this.CSVLoaderTab).attr("id","CSVLoader"); - + this.csvURL = document.createElement("input"); $(this.csvURL).attr("type","text"); $(this.CSVLoaderTab).append(this.csvURL); - + this.loadCSVButton = document.createElement("button"); $(this.loadCSVButton).text("load CSV"); $(this.CSVLoaderTab).append(this.loadCSVButton); $(this.loadCSVButton).click($.proxy(function(){ var dataLoader = this; - + var csvURL = $(this.csvURL).val(); if (csvURL.length === 0) return; @@ -248,29 +248,28 @@ Dataloader.prototype = { GeoTemConfig.getCsv(csvURL, function(json){ if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); - + if (dataSet != null) dataLoader.distributeDataset(dataSet); } else alert("Could not load file. Please check your URL. If the URL is correct, our " + - "proxy may prevent the file from loading. In that case please send us an email, " + - "and we gladly add your host to the white list."); + "proxy may prevent the file from loading. In that case please send us an email, " + "and we gladly add your host to the white list."); }); },this)); $(this.parent.gui.loaders).append(this.CSVLoaderTab); - }, - + }, + addLocalKMLLoader : function() { $(this.parent.gui.loaderTypeSelect).append(""); - + this.localKMLLoaderTab = document.createElement("div"); $(this.localKMLLoaderTab).attr("id","LocalKMLLoader"); - + this.kmlFile = document.createElement("input"); $(this.kmlFile).attr("type","file"); $(this.localKMLLoaderTab).append(this.kmlFile); - + this.loadLocalKMLButton = document.createElement("button"); $(this.loadLocalKMLButton).text("load KML"); $(this.localKMLLoaderTab).append(this.loadLocalKMLButton); @@ -281,7 +280,7 @@ Dataloader.prototype = { var file = filelist[0]; var fileName = file.name; var reader = new FileReader(); - + reader.onloadend = ($.proxy(function(theFile) { return function(e) { var dataSet = new Dataset(GeoTemConfig.loadKml($.parseXML(reader.result)), fileName); @@ -296,17 +295,17 @@ Dataloader.prototype = { $(this.parent.gui.loaders).append(this.localKMLLoaderTab); }, - + addLocalCSVLoader : function() { $(this.parent.gui.loaderTypeSelect).append(""); - + this.localCSVLoaderTab = document.createElement("div"); $(this.localCSVLoaderTab).attr("id","LocalCSVLoader"); - + this.csvFile = document.createElement("input"); $(this.csvFile).attr("type","file"); $(this.localCSVLoaderTab).append(this.csvFile); - + this.loadLocalCSVButton = document.createElement("button"); $(this.loadLocalCSVButton).text("load CSV"); $(this.localCSVLoaderTab).append(this.loadLocalCSVButton); @@ -317,13 +316,13 @@ Dataloader.prototype = { var file = filelist[0]; var fileName = file.name; var reader = new FileReader(); - + reader.onloadend = ($.proxy(function(theFile) { return function(e) { var json = GeoTemConfig.convertCsv(reader.result); var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName); if (dataSet != null) - this.distributeDataset(dataSet); + this.distributeDataset(dataSet); }; }(file),this)); @@ -333,12 +332,12 @@ Dataloader.prototype = { $(this.parent.gui.loaders).append(this.localCSVLoaderTab); }, - + addLocalStorageLoader : function() { var dataLoader = this; this.localStorageLoaderTab = document.createElement("div"); $(this.localStorageLoaderTab).attr("id","LocalStorageLoader"); - + var localDatasets = document.createElement("select"); $(this.localStorageLoaderTab).append(localDatasets); @@ -353,7 +352,7 @@ Dataloader.prototype = { $(localDatasets).append(""); } } - + //only show if there are datasets if (localStorageDatasetCount > 0) $(this.parent.gui.loaderTypeSelect).append(""); @@ -378,7 +377,7 @@ Dataloader.prototype = { $(this.parent.gui.loaders).append(this.localStorageLoaderTab); }, - + addLocalXLSXLoader : function() { //taken from http://oss.sheetjs.com/js-xlsx/ var fixdata = function(data) { @@ -387,16 +386,16 @@ Dataloader.prototype = { o+=String.fromCharCode.apply(null, new Uint8Array(data.slice(o.length))); return o; } - + $(this.parent.gui.loaderTypeSelect).append(""); - + this.LocalXLSXLoader = document.createElement("div"); $(this.LocalXLSXLoader).attr("id","LocalXLSXLoader"); - + this.xlsxFile = document.createElement("input"); $(this.xlsxFile).attr("type","file"); $(this.LocalXLSXLoader).append(this.xlsxFile); - + this.loadLocalXLSXButton = document.createElement("button"); $(this.loadLocalXLSXButton).text("load XLS/XLSX"); $(this.LocalXLSXLoader).append(this.loadLocalXLSXButton); @@ -407,7 +406,7 @@ Dataloader.prototype = { var file = filelist[0]; var fileName = file.name; var reader = new FileReader(); - + reader.onloadend = ($.proxy(function(theFile) { return function(e) { var workbook; @@ -421,10 +420,10 @@ Dataloader.prototype = { var csv = XLS.utils.sheet_to_csv(workbook.Sheets[workbook.SheetNames[0]]); var json = GeoTemConfig.convertCsv(csv); } - + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName); if (dataSet != null) - this.distributeDataset(dataSet); + this.distributeDataset(dataSet); }; }(file),this)); diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 2b3e3ff..25245dc 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -31,8 +31,8 @@ // credits: user76888, The Digital Gabeg (http://stackoverflow.com/questions/1539367) $.fn.cleanWhitespace = function() { - textNodes = this.contents().filter( function() { - return (this.nodeType == 3 && !/\S/.test(this.nodeValue)); + textNodes = this.contents().filter( function() { + return (this.nodeType == 3 && !/\S/.test(this.nodeValue)); }).remove(); return this; }; @@ -46,9 +46,9 @@ GeoTemConfig = { allowFilter : true, // if filtering should be allowed highlightEvents : true, // if updates after highlight events selectionEvents : true, // if updates after selection events - tableExportDataset : true, // export dataset to KML + tableExportDataset : true, // export dataset to KML allowCustomColoring : false, // if DataObjects can have an own color (useful for weighted coloring) - allowUserShapeAndColorChange: false, // if the user can change the shapes and color of datasets + allowUserShapeAndColorChange: false, // if the user can change the shapes and color of datasets // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, @@ -263,7 +263,7 @@ GeoTemConfig.assignedColorCount = 0; GeoTemConfig.getColor = function(id){ if (typeof GeoTemConfig.datasets[id].color === "undefined"){ var color; - + while (true){ if( GeoTemConfig.colors.length <= GeoTemConfig.assignedColorCount ){ color = { @@ -276,17 +276,17 @@ GeoTemConfig.getColor = function(id){ }; } else color = GeoTemConfig.colors[GeoTemConfig.assignedColorCount]; - + //make sure that no other dataset has this color //TODO: one could also check that they are not too much alike var found = false; for (var i = 0; i < GeoTemConfig.datasets.length; i++){ var dataset = GeoTemConfig.datasets[i]; - + if (typeof dataset.color === "undefined") continue; - if ( (dataset.color.r1 == color.r1) && + if ( (dataset.color.r1 == color.r1) && (dataset.color.g1 == color.g1) && (dataset.color.b1 == color.b1) ){ found = true; @@ -331,7 +331,7 @@ GeoTemConfig.getAverageDatasetColor = function(id, objects){ avgColor.r1 = 0; avgColor.g1 = 0; avgColor.b1 = 0; - + $(objects).each(function(){ if (this.hasColorInformation){ avgColor.r0 += this.color.r0; @@ -349,14 +349,14 @@ GeoTemConfig.getAverageDatasetColor = function(id, objects){ avgColor.b1 += datasetColor.b1; } }); - + c.r0 = Math.floor(avgColor.r0/objects.length); c.g0 = Math.floor(avgColor.g0/objects.length); c.b0 = Math.floor(avgColor.b0/objects.length); c.r1 = Math.floor(avgColor.r1/objects.length); c.g1 = Math.floor(avgColor.g1/objects.length); c.b1 = Math.floor(avgColor.b1/objects.length); - + return c; }; @@ -391,7 +391,7 @@ GeoTemConfig.getJson = function(url,asyncFunc) { if( asyncFunc ){ async = true; } - + var data; $.ajax({ url : url, @@ -404,7 +404,7 @@ GeoTemConfig.getJson = function(url,asyncFunc) { } } }); - + if (async){ return data; } @@ -443,7 +443,7 @@ GeoTemConfig.addDataset = function(newDataset){ GeoTemConfig.addDatasets = function(newDatasets){ $(newDatasets).each(function(){ GeoTemConfig.datasets.push(this); - }); + }); Publisher.Publish('filterData', GeoTemConfig.datasets, null); }; @@ -454,7 +454,7 @@ GeoTemConfig.removeDataset = function(index){ /** * converts the csv-file into json-format - * + * * @param {String} * text */ @@ -471,7 +471,7 @@ GeoTemConfig.convertCsv = function(text){ for (var i = 1; i < csvArray.length; i++) { var innerArray = csvArray[i]; var dataObject = new Object(); - var tableContent = new Object(); + var tableContent = new Object(); /* exclude lines with no content */ var hasContent = false; for (var j = 0; j < innerArray.length; j++) { @@ -483,7 +483,7 @@ GeoTemConfig.convertCsv = function(text){ hasContent = true; } } - + if (hasContent === true) break; } @@ -517,17 +517,17 @@ GeoTemConfig.convertCsv = function(text){ /* TimeSpan:end */ else if (usedHeaders[j] == expectedHeaders[7]) { tableContent["TimeSpan:end"] = ""+innerArray[j]; - } + } /* weight */ else if (usedHeaders[j] == expectedHeaders[8]) { dataObject["weight"] = ""+innerArray[j]; - } - /* Longitude */ - else if (usedHeaders[j] == expectedHeaders[3]) { - dataObject["lon"] = parseFloat(innerArray[j]); - } - /* Latitude */ - else if (usedHeaders[j] == expectedHeaders[4]) { + } + /* Longitude */ + else if (usedHeaders[j] == expectedHeaders[3]) { + dataObject["lon"] = parseFloat(innerArray[j]); + } + /* Latitude */ + else if (usedHeaders[j] == expectedHeaders[4]) { dataObject["lat"] = parseFloat(innerArray[j]); } else { @@ -537,12 +537,12 @@ GeoTemConfig.convertCsv = function(text){ tableContent[header] = ""+innerArray[j]; } } - + dataObject["tableContent"] = tableContent; - + json.push(dataObject); } - + return json; }; @@ -576,12 +576,12 @@ GeoTemConfig.getKml = function(url,asyncFunc) { } /** - * returns an array of all xml dom object of the kmls + * returns an array of all xml dom object of the kmls * found in the zip file from the given url - * - * can only be used with asyncFunc (because of browser + * + * can only be used with asyncFunc (because of browser * constraints regarding arraybuffer) - * + * * @param {String} url the url of the file to load * @return xml dom object of given file */ @@ -593,8 +593,8 @@ GeoTemConfig.getKmz = function(url,asyncFunc) { //if no asyncFunc is given return an empty array return kmlDom; } - - //use XMLHttpRequest as "arraybuffer" is not + + //use XMLHttpRequest as "arraybuffer" is not //supported in jQuery native $.get var req = new XMLHttpRequest(); req.open("GET",url,async); @@ -603,21 +603,21 @@ GeoTemConfig.getKmz = function(url,asyncFunc) { var zip = new JSZip(); zip.load(req.response, {base64:false}); var kmlFiles = zip.file(new RegExp("kml$")); - + $(kmlFiles).each(function(){ var kml = this; if (kml.data != null) { kmlDom.push($.parseXML(kml.data)); } }); - + asyncFunc(kmlDom); }; req.send(); }; /** - * returns the JSON "object" + * returns the JSON "object" * from the csv file from the given url * @param {String} url the url of the file to load * @return xml dom object of given file @@ -627,28 +627,44 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { if( asyncFunc ){ async = true; } - - //use XMLHttpRequest as synchronous behaviour + + //use XMLHttpRequest as synchronous behaviour //is not supported in jQuery native $.get var req = new XMLHttpRequest(); req.open("GET",url,async); + + // Set token and logID as HTTP header, if token is existing. + // FIXME Set these only for DARIAH-DE OwnStorage?? + + console.log("tok: " + sessionStorage.getItem('tok')); + + if (sessionStorage.getItem('tok')) { + var token = 'bearer ' + sessionStorage.getItem('tok'); + var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); + req.setRequestHeader('Authorization', token); + req.setRequestHeader('X-Transaction-ID', logID); + } + //can only be set on asynchronous now //req.responseType = "text"; var json; req.onload = function() { - json = GeoTemConfig.convertCsv(req.response); + + console.log("response: ", req.response); + + json = GeoTemConfig.convertCsv(req.response); if( asyncFunc ) asyncFunc(json); }; req.send(); - + if( !async ){ return json; } }; /** - * loads a binary file + * loads a binary file * @param {String} url of the file to load * @return binary data */ @@ -658,7 +674,7 @@ GeoTemConfig.getBinary = function(url,asyncFunc) { var req = new XMLHttpRequest(); req.open("GET",url,async); req.responseType = "arraybuffer"; - + var binaryData; req.onload = function() { var arrayBuffer = req.response; @@ -732,13 +748,13 @@ GeoTemConfig.getTimeData = function(xmlTime) { isValidDate = false; } else isValidDate = false; - + if (!isValidDate){ if ((GeoTemConfig.debug)&&(typeof console !== "undefined")) console.error(xmlTime + " is no valid time format"); return null; } - + return { date : date, granularity : granularity @@ -808,14 +824,14 @@ GeoTemConfig.loadJson = function(JSON) { var weight = parseInt(item.weight) || 1; //add all "other" attributes to table data //this is a hack to allow "invalid" JSONs - var specialAttributes = ["id", "name", "description", "lon", "lat", "place", "time", + var specialAttributes = ["id", "name", "description", "lon", "lat", "place", "time", "tableContent", "location", "time"]; for (var attribute in item){ if ($.inArray(attribute, specialAttributes) == -1){ tableContent[attribute] = item[attribute]; } } - + var mapTimeObject = new DataObject(name, description, locations, dates, weight, tableContent); mapTimeObject.setIndex(index); mapTimeObjects.push(mapTimeObject); @@ -842,8 +858,8 @@ GeoTemConfig.loadKml = function(kml) { } var index = 0; var descriptionTableHeaders = []; - var xmlSerializer = new XMLSerializer(); - + var xmlSerializer = new XMLSerializer(); + for (var i = 0; i < elements.length; i++) { var placemark = elements[i]; var name, description, place, granularity, lon, lat, tableContent = [], time = [], location = []; @@ -852,12 +868,12 @@ GeoTemConfig.loadKml = function(kml) { try { description = placemark.getElementsByTagName("description")[0].childNodes[0].nodeValue; - + //cleanWhitespace removes non-sense text-nodes (space, tab) //and is an addition to jquery defined above try { var descriptionDocument = $($.parseXML(description)).cleanWhitespace(); - + //check whether the description element contains a table //if yes, this data will be loaded as separate columns $(descriptionDocument).find("table").each(function(){ @@ -865,7 +881,7 @@ GeoTemConfig.loadKml = function(kml) { function() { var isHeader = true; var lastHeader = ""; - + $(this).find("td").each( function() { if (isHeader) { @@ -873,7 +889,7 @@ GeoTemConfig.loadKml = function(kml) { isHeader = false; } else { var value = ""; - + //if this td contains HTML, serialize all //it's children (the "content"!) $(this).children().each( @@ -881,22 +897,22 @@ GeoTemConfig.loadKml = function(kml) { value += xmlSerializer.serializeToString(this); } ); - + //no HTML content (or no content at all) if (value.length == 0) value = $(this).text(); if (typeof value === "undefined") value = ""; - + if ($.inArray(lastHeader, descriptionTableHeaders) === -1) descriptionTableHeaders.push(lastHeader); - + if (tableContent[lastHeader] != null) - //append if a field occures more than once + //append if a field occures more than once tableContent[lastHeader] += "\n" + value; else tableContent[lastHeader] = value; - + isHeader = true; } } @@ -908,29 +924,29 @@ GeoTemConfig.loadKml = function(kml) { //couldn't be parsed, so it contains no html table //or is not in valid XHTML syntax } - + //check whether the description element contains content in the form of equations //e.g. someDescriptor = someValue, where these eqations are separated by
//if yes, this data will be loaded as separate columns - var descriptionRows = description.replace(/<\s*br\s*[\/]*\s*>/g,"
"); + var descriptionRows = description.replace(/<\s*br\s*[\/]*\s*>/g,"
"); $(descriptionRows.split("
")).each(function(){ var row = this; - + if (typeof row === "undefined") return; - + var headerAndValue = row.split("="); if (headerAndValue.length != 2) return; var header = $.trim(headerAndValue[0]); var value = $.trim(headerAndValue[1]); - + if ($.inArray(header, descriptionTableHeaders) === -1) descriptionTableHeaders.push(header); if (tableContent[header] != null) - //append if a field occures more than once + //append if a field occures more than once tableContent[header] += "\n" + value; else tableContent[header] = value; @@ -949,7 +965,7 @@ GeoTemConfig.loadKml = function(kml) { name = tableContent["name"]; else name = ""; - } + } try { place = placemark.getElementsByTagName("address")[0].childNodes[0].nodeValue; @@ -994,7 +1010,7 @@ GeoTemConfig.loadKml = function(kml) { (typeof tableContent["TimeSpan:end"] === "undefined") ){ var timeStart = $(placemark).find("TimeSpan begin").text(); var timeEnd = $(placemark).find("TimeSpan end").text(); - + if ( (timeStart != "") && (timeStart != "") ){ tableContent["TimeSpan:begin"] = timeStart; tableContent["TimeSpan:end"] = timeEnd; @@ -1013,7 +1029,7 @@ GeoTemConfig.loadKml = function(kml) { index++; mapObjects.push(object); } - + //make sure that all "description table" columns exists in all rows if (descriptionTableHeaders.length > 0){ $(mapObjects).each(function(){ @@ -1060,10 +1076,10 @@ GeoTemConfig.createKMLfromDataset = function(index){ ISOString += '.' + String( (date.getMilliseconds()/1000).toFixed(3) ).slice( 2, 5 ); ISOString += 'Z'; } - + return ISOString; }; - + $(GeoTemConfig.datasets[index].objects).each(function(){ var name = this.name; var description = this.description; @@ -1071,14 +1087,14 @@ GeoTemConfig.createKMLfromDataset = function(index){ var place = this.getPlace(0,0); var lat = this.getLatitude(0); var lon = this.getLongitude(0); - + var kmlEntry = ""; - + kmlEntry += ""; kmlEntry += "
"; kmlEntry += ""; kmlEntry += "" + lon + "," + lat + ""; - + if (this.isTemporal){ kmlEntry += "" + dateToISOString(this.getDate(0), this.getTimeGranularity(0)) + ""; } else if (this.isFuzzyTemporal){ @@ -1087,14 +1103,14 @@ GeoTemConfig.createKMLfromDataset = function(index){ "" + dateToISOString(this.TimeSpanEnd.utc().toDate(), this.TimeSpanEndGranularity) + "" + ""; } - + kmlEntry += "
"; - + kmlContent += kmlEntry; }); - + kmlContent += ""; - + return(kmlContent); }; @@ -1102,23 +1118,23 @@ GeoTemConfig.createCSVfromDataset = function(index){ var csvContent = ""; var header = ["name", "description", "weight"]; var tableContent = []; - + var firstDataObject = GeoTemConfig.datasets[index].objects[0]; - + for(var key in firstDataObject.tableContent){ var found = false; $(header).each(function(index,val){ if (val === key){ found = true; return false; - } + } }); if (found === true) continue; else tableContent.push(key); } - + var isFirst = true; $(header).each(function(key,val){ if (isFirst){ @@ -1145,17 +1161,17 @@ GeoTemConfig.createCSVfromDataset = function(index){ //Names according to CSV import definition csvContent += ",\"Address\",\"Latitude\",\"Longitude\",\"TimeStamp\""; csvContent += "\n"; - + var isFirstRow = true; $(GeoTemConfig.datasets[index].objects).each(function(){ var elem = this; - + if (isFirstRow){ isFirstRow = false; } else { csvContent += "\n"; } - + var isFirst = true; $(header).each(function(key,val){ if (isFirst){ @@ -1173,7 +1189,7 @@ GeoTemConfig.createCSVfromDataset = function(index){ } csvContent += "\""+elem.tableContent[val]+"\""; }); - + csvContent += ","; csvContent += "\""; if (elem.isGeospatial){ @@ -1194,7 +1210,7 @@ GeoTemConfig.createCSVfromDataset = function(index){ csvContent += elem.getLongitude(0); } csvContent += "\""; - + csvContent += ","; csvContent += "\""; if ( (elem.isTemporal) && (typeof elem.getDate(0) !== "undefined") ){ @@ -1203,7 +1219,7 @@ GeoTemConfig.createCSVfromDataset = function(index){ } csvContent += "\""; }); - + return(csvContent); }; /** @@ -1233,7 +1249,7 @@ GeoTemConfig.loadDataObjectColoring = function(dataObjects) { b1 = parseInt("0x"+color.substr(5,2)); } } - + if ( (typeof r0 !== "undefined") && (typeof g0 !== "undefined") && (typeof b0 !== "undefined") && (typeof r1 !== "undefined") && (typeof g1 !== "undefined") && (typeof b1 !== "undefined") ){ this.setColor(r0,g0,b0,r1,g1,b1); @@ -1304,7 +1320,7 @@ GeoTemConfig.renameColumns = function(dataset, renames){ for (var i = 0; i < dataset.objects.length; i++){ var dataObject = dataset.objects[i]; - + //get value from old column name var value; if (oldColumObject.type == 1){ @@ -1326,7 +1342,7 @@ GeoTemConfig.renameColumns = function(dataset, renames){ if (!keepOld){ delete dataObject[oldColumObject.name][oldColumObject.arrayIndex][oldColumObject.attribute]; } - } + } //create new column if (newColumObject.type == 1){ @@ -1344,7 +1360,7 @@ GeoTemConfig.renameColumns = function(dataset, renames){ if (typeof dataObject[newColumObject.name][newColumObject.arrayIndex] == "undefined"){ dataObject[newColumObject.name][newColumObject.arrayIndex] = {}; } - dataObject[newColumObject.name][newColumObject.arrayIndex][newColumObject.attribute] = value; + dataObject[newColumObject.name][newColumObject.arrayIndex][newColumObject.attribute] = value; } } } @@ -1355,7 +1371,7 @@ GeoTemConfig.renameColumns = function(dataset, renames){ //save index var index = dataObject.index; - dataset.objects[i] = new DataObject(dataObject.name, dataObject.description, dataObject.locations, + dataset.objects[i] = new DataObject(dataObject.name, dataObject.description, dataObject.locations, dataObject.dates, dataObject.weight, dataObject.tableContent, dataObject.projection); //set index dataset.objects[i].setIndex(index); From 44f3b9eebbba8aab832729acd0782fe385211b5d Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 13 Aug 2019 12:05:01 +0200 Subject: [PATCH 04/47] Add token header for loading if token is existing --- js/GeoTemConfig.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 25245dc..b5e4362 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -636,6 +636,8 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { // Set token and logID as HTTP header, if token is existing. // FIXME Set these only for DARIAH-DE OwnStorage?? + console.log("url: " + url); + console.log("tok: " + sessionStorage.getItem('tok')); if (sessionStorage.getItem('tok')) { From fa61ce30c1e3a79ac1425323934e8434b96f56d2 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 17:14:56 +0200 Subject: [PATCH 05/47] Delete proxy.php? Die war doch noch nicht hier? Oder doch? Add new proxy_beta.php --- js/GeoTemConfig.js | 7 +++++-- php/download.php | 14 +++++++------- php/proxy.php | 1 - 3 files changed, 12 insertions(+), 10 deletions(-) delete mode 120000 php/proxy.php diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index b5e4362..33a7b79 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -52,7 +52,7 @@ GeoTemConfig = { // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - proxy : 'php/proxy.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + proxy : 'php/proxy_beta.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected colors : [{ r1 : 255, @@ -634,7 +634,7 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { req.open("GET",url,async); // Set token and logID as HTTP header, if token is existing. - // FIXME Set these only for DARIAH-DE OwnStorage?? + // FIXME Set these only for DARIAH-DE OwnStorage!! console.log("url: " + url); @@ -645,6 +645,9 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); req.setRequestHeader('Authorization', token); req.setRequestHeader('X-Transaction-ID', logID); + + console.log("tok: " + token); + console.log("logID: " + logID); } //can only be set on asynchronous now diff --git a/php/download.php b/php/download.php index 38e1ac6..88f8d01 100644 --- a/php/download.php +++ b/php/download.php @@ -19,20 +19,20 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ - + if (!empty($_POST['file'])) { - + $file = $_POST['file']; $filesize = strlen($file); - + $mime = array('application/octet-stream'); - + header('Content-Type: '.$mime); header('Content-Disposition: attachment; filename="test.kml"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.sprintf('%d', $filesize)); header('Expires: 0'); - + // check for IE only headers // credits to: cballou, http://stackoverflow.com/questions/2019964/php-form-download-to-zip if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { @@ -41,7 +41,7 @@ } else { header('Pragma: no-cache'); } - + echo $file; } -?> \ No newline at end of file +?> diff --git a/php/proxy.php b/php/proxy.php deleted file mode 120000 index 9e77f0a..0000000 --- a/php/proxy.php +++ /dev/null @@ -1 +0,0 @@ -/etc/geobrowser/proxy.php \ No newline at end of file From 480ff4f324f6591a312a744554ffda921e2a8942 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 17:29:02 +0200 Subject: [PATCH 06/47] Use beta proxy in beta, reset geotemconfig --- js/GeoTemConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 33a7b79..c304c7e 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -52,7 +52,7 @@ GeoTemConfig = { // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - proxy : 'php/proxy_beta.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + proxy : 'php/proxy.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected colors : [{ r1 : 255, From a2f861463b2c3f2b947e487b19549b198d246781 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 17:52:02 +0200 Subject: [PATCH 07/47] Add token for proxy via X-Tok, not Authorization header --- js/GeoTemConfig.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index c304c7e..bdc3b91 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -54,6 +54,7 @@ GeoTemConfig = { allowColumnRenaming : true, proxy : 'php/proxy.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected + dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', colors : [{ r1 : 255, g1 : 101, @@ -638,12 +639,14 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { console.log("url: " + url); + console.log(url.startsWith(dariahOwnStorageURL)); + console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok')) { + if (sessionStorage.getItem('tok') && url.startsWith(dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); - req.setRequestHeader('Authorization', token); + req.setRequestHeader('X-Tok', token); req.setRequestHeader('X-Transaction-ID', logID); console.log("tok: " + token); From c7c10620a42de1c59e6bbfdf98bda0412f9ca85f Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 18:18:28 +0200 Subject: [PATCH 08/47] Correct storagge url config --- js/GeoTemConfig.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index bdc3b91..3169427 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -639,17 +639,17 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { console.log("url: " + url); - console.log(url.startsWith(dariahOwnStorageURL)); + console.log(url.startsWith(GeoTemConfig.dariahOwnStorageURL)); console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok') && url.startsWith(dariahOwnStorageURL)) { + if (sessionStorage.getItem('tok') && url.startsWith(GeoTemConfig.dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); req.setRequestHeader('X-Tok', token); req.setRequestHeader('X-Transaction-ID', logID); - console.log("tok: " + token); + console.log("tokwb: " + token); console.log("logID: " + logID); } From eb96e8454f472c8f58c101f5142060329b847125 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 18:26:35 +0200 Subject: [PATCH 09/47] aergl! error fixed --- js/GeoTemConfig.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 3169427..a4649d5 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -638,12 +638,12 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { // FIXME Set these only for DARIAH-DE OwnStorage!! console.log("url: " + url); - - console.log(url.startsWith(GeoTemConfig.dariahOwnStorageURL)); + console.log("arl: " + GeoTemConfig.dariahOwnStorageURL); + console.log(url.contains("adress=" + GeoTemConfig.dariahOwnStorageURL)); console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok') && url.startsWith(GeoTemConfig.dariahOwnStorageURL)) { + if (sessionStorage.getItem('tok') && url.contains("adress=" + GeoTemConfig.dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); req.setRequestHeader('X-Tok', token); From c17c398cf36e4070004f300d74130828f2a5fe63 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 18:32:56 +0200 Subject: [PATCH 10/47] includes! not! contains! argl! --- js/GeoTemConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index a4649d5..8661ae6 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -639,11 +639,11 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { console.log("url: " + url); console.log("arl: " + GeoTemConfig.dariahOwnStorageURL); - console.log(url.contains("adress=" + GeoTemConfig.dariahOwnStorageURL)); + console.log(url.includes("adress=" + GeoTemConfig.dariahOwnStorageURL)); console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok') && url.contains("adress=" + GeoTemConfig.dariahOwnStorageURL)) { + if (sessionStorage.getItem('tok') && url.includes("adress=" + GeoTemConfig.dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); req.setRequestHeader('X-Tok', token); From 2bca86f821b230faa1be76fb79f8dbbd7d099213 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 20 Aug 2019 18:38:28 +0200 Subject: [PATCH 11/47] argl argl arglllll!!!!! it is address! not! adress! --- js/GeoTemConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 8661ae6..ff627c1 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -639,11 +639,11 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { console.log("url: " + url); console.log("arl: " + GeoTemConfig.dariahOwnStorageURL); - console.log(url.includes("adress=" + GeoTemConfig.dariahOwnStorageURL)); + console.log(url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)); console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok') && url.includes("adress=" + GeoTemConfig.dariahOwnStorageURL)) { + if (sessionStorage.getItem('tok') && url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); req.setRequestHeader('X-Tok', token); From 5f95afd12245d856451b3d906a86e3a6a06264a7 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 23 Aug 2019 13:05:53 +0200 Subject: [PATCH 12/47] Testing proxy and token --- js/GeoTemConfig.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index ff627c1..5f58743 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -52,10 +52,10 @@ GeoTemConfig = { // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - proxy : 'php/proxy.php?address=', //set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + proxy : 'php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected - dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', - colors : [{ + colors : [{ r1 : 255, g1 : 101, b1 : 0, @@ -634,9 +634,7 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { var req = new XMLHttpRequest(); req.open("GET",url,async); - // Set token and logID as HTTP header, if token is existing. - // FIXME Set these only for DARIAH-DE OwnStorage!! - + // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). console.log("url: " + url); console.log("arl: " + GeoTemConfig.dariahOwnStorageURL); console.log(url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)); From 7271b7cca67133c26876d32954010335e5bf40f0 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 23 Aug 2019 18:44:28 +0200 Subject: [PATCH 13/47] Fix reading from proxy with token --- js/GeoTemConfig.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 5f58743..cc45d4a 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -635,36 +635,30 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { req.open("GET",url,async); // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). - console.log("url: " + url); - console.log("arl: " + GeoTemConfig.dariahOwnStorageURL); - console.log(url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)); - - console.log("tok: " + sessionStorage.getItem('tok')); - if (sessionStorage.getItem('tok') && url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)) { var token = 'bearer ' + sessionStorage.getItem('tok'); var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); + // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! req.setRequestHeader('X-Tok', token); req.setRequestHeader('X-Transaction-ID', logID); - - console.log("tokwb: " + token); - console.log("logID: " + logID); } + // FIXME handle errors from proxy! + + // FOXME handle forwarding to PDP! + //can only be set on asynchronous now //req.responseType = "text"; var json; req.onload = function() { - - console.log("response: ", req.response); - json = GeoTemConfig.convertCsv(req.response); - if( asyncFunc ) + if (asyncFunc) { asyncFunc(json); + } }; req.send(); - if( !async ){ + if(!async) { return json; } }; From b9ff3e7aba37a3b703d422069a2305c2a7e324b3 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 13 Sep 2019 11:11:56 +0200 Subject: [PATCH 14/47] More mergging... --- js/GeoTemConfig.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 8d59fdf..56b3dc9 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -1220,10 +1220,7 @@ GeoTemConfig.createCSVfromDataset = function(index){ } csvContent += "\""; }); -<<<<<<< HEAD -======= ->>>>>>> develop return(csvContent); }; /** From 8ec1268e271d4e843749ae85fce47ce94aa9307f Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 20 Jan 2020 18:51:46 +0100 Subject: [PATCH 15/47] Add empty proxy.php --- php/proxy.php | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 php/proxy.php diff --git a/php/proxy.php b/php/proxy.php new file mode 100644 index 0000000..2b3dc77 --- /dev/null +++ b/php/proxy.php @@ -0,0 +1,76 @@ + $value){ + if ($key == 'address') + continue; + if ($isFirst == 1){ + $isFirst = 0; + $address .= "?"; + } else { + $address .= "&"; + } + $address .= $key . "=" . $value; + } + + $request_body = file_get_contents('php://input'); + + if (empty($request_body)){ + echo file_get_contents($address); + } else { + $opts = array('http' => + array( + 'method' => 'POST', + 'header' => 'Content-type: '.$_SERVER["CONTENT_TYPE"], + 'content' => $request_body + ) + ); + + $context = stream_context_create($opts); + + echo file_get_contents($address, false, $context); + } + } + } +?> From 0598079769caa672a367bc9d56cea762d76b2ad5 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 21 Jan 2020 16:16:13 +0100 Subject: [PATCH 16/47] Change proxy to proxy_beta.php file... --- js/GeoTemConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 56b3dc9..ff41b8f 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -52,7 +52,7 @@ GeoTemConfig = { // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - proxy : 'php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + proxy : 'php/proxy_beta.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected colors : [{ From 0e87a4605f26e7b20163e720c6d3dbbcbd6b304c Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 22 Jan 2020 10:58:44 +0100 Subject: [PATCH 17/47] Add error handling for token proxy calls --- js/GeoTemConfig.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index ff41b8f..bf97a47 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -632,6 +632,28 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { //use XMLHttpRequest as synchronous behaviour //is not supported in jQuery native $.get var req = new XMLHttpRequest(); + + /* + 0: request not initialized + 1: server connection established + 2: request received + 3: processing request + 4: request finished and response is ready + */ + // FIXME handle errors from proxy! + req.onreadystatechange = function() { + if (this.readyState == 4) { + if (this.status == 200) { + // Action to be performed when the document is read; + console.log("status " + this.status); + } else (this.status == 401) { + console.log("noauth " + this.status); + } else { + console.log("error " + this.status); + } + } + }; + req.open("GET",url,async); // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). @@ -643,8 +665,6 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { req.setRequestHeader('X-Transaction-ID', logID); } - // FIXME handle errors from proxy! - // FOXME handle forwarding to PDP! //can only be set on asynchronous now From 3904b5eedc1e0d99af5d3ddeadea3d6f2ebb7f34 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 22 Jan 2020 17:21:57 +0100 Subject: [PATCH 18/47] arglmalneubauen... --- js/Dataloader/Dataloader.js | 11 +++++------ js/GeoTemConfig.js | 36 +++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 5e1777a..dc6acf6 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -36,6 +36,8 @@ function Dataloader(parent) { this.initialize(); } +var addToProxysWhitelistMessage = "Could not load file. Please check your URL. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; + Dataloader.prototype = { show : function() { @@ -164,7 +166,7 @@ Dataloader.prototype = { var fileName = this.getFileName(kmlURL); if (typeof GeoTemConfig.proxy != 'undefined') { - kmlURL = GeoTemConfig.proxy + kmlURL; + kmlURL = GeoTemConfig.proxy + kmlURL; } var kml = GeoTemConfig.getKml(kmlURL); @@ -174,9 +176,7 @@ Dataloader.prototype = { if (dataSet != null) this.distributeDataset(dataSet); } else - alert("Could not load file. Please check your URL. If the URL is correct, our " + - "proxy may prevent the file from loading. In that case please send us an email, " + - "and we gladly add your host to the white list."); + alert(addToProxysWhitelistMessage); },this)); $(this.parent.gui.loaders).append(this.KMLLoaderTab); @@ -252,8 +252,7 @@ Dataloader.prototype = { if (dataSet != null) dataLoader.distributeDataset(dataSet); } else - alert("Could not load file. Please check your URL. If the URL is correct, our " + - "proxy may prevent the file from loading. In that case please send us an email, " + "and we gladly add your host to the white list."); + alert(addToProxysWhitelistMessage); }); },this)); diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index bf97a47..83fb411 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -52,7 +52,8 @@ GeoTemConfig = { // this turns MapConfig.useGraphics auto-on, but uses circles as default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - proxy : 'php/proxy_beta.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + // proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) + proxy : 'https://geobrowser.de.dariah.eu/beta/php/proxy_beta.php?address=', dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected colors : [{ @@ -629,10 +630,20 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { async = true; } - //use XMLHttpRequest as synchronous behaviour - //is not supported in jQuery native $.get + // Use XMLHttpRequest as synchronous behaviour (is not supported in jQuery native $.get) var req = new XMLHttpRequest(); + req.open("GET",url,async); + + // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). + if (sessionStorage.getItem('tok') && url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)) { + var token = 'bearer ' + sessionStorage.getItem('tok'); + var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); + // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! + req.setRequestHeader('X-Tok', token); + req.setRequestHeader('X-Transaction-ID', logID); + } + /* 0: request not initialized 1: server connection established @@ -640,30 +651,21 @@ GeoTemConfig.getCsv = function(url,asyncFunc) { 3: processing request 4: request finished and response is ready */ - // FIXME handle errors from proxy! + // Handle errors from proxy! +/* req.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) { // Action to be performed when the document is read; console.log("status " + this.status); - } else (this.status == 401) { + } else if (this.status == 401) { console.log("noauth " + this.status); } else { console.log("error " + this.status); } - } + } }; - - req.open("GET",url,async); - - // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). - if (sessionStorage.getItem('tok') && url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)) { - var token = 'bearer ' + sessionStorage.getItem('tok'); - var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); - // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! - req.setRequestHeader('X-Tok', token); - req.setRequestHeader('X-Transaction-ID', logID); - } +*/ // FOXME handle forwarding to PDP! From eb3e6de927866053abbb46b243720c579dd83ca7 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 24 Jan 2020 10:43:32 +0100 Subject: [PATCH 19/47] Opening data from Datasheet Editor using tokens is working now --- js/Dataloader/Dataloader.js | 4 +- js/Dataloader/DataloaderWidget.js | 86 +++++++------- js/GeoTemConfig.js | 189 ++++++++++++++++++++---------- 3 files changed, 170 insertions(+), 109 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index dc6acf6..7c90633 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -243,12 +243,10 @@ Dataloader.prototype = { return; var origURL = csvURL; var fileName = dataLoader.getFileName(csvURL); - if (typeof GeoTemConfig.proxy != 'undefined') - csvURL = GeoTemConfig.proxy + csvURL; + // Chose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); - if (dataSet != null) dataLoader.distributeDataset(dataSet); } else diff --git a/js/Dataloader/DataloaderWidget.js b/js/Dataloader/DataloaderWidget.js index 038b61a..2ef8a5a 100644 --- a/js/Dataloader/DataloaderWidget.js +++ b/js/Dataloader/DataloaderWidget.js @@ -35,9 +35,9 @@ DataloaderWidget = function(core, div, options) { this.options = (new DataloaderConfig(options)).options; this.gui = new DataloaderGui(this, div, this.options); - + this.dataLoader = new Dataloader(this); - + this.datasets = []; } @@ -80,7 +80,7 @@ DataloaderWidget.prototype = { reset : function() { }, - + loadRenames : function(){ //load (optional!) attribute renames //each rename param is {latitude:..,longitude:..,place:..,date:..,timeSpanBegin:..,timeSpanEnd:..} @@ -103,15 +103,15 @@ DataloaderWidget.prototype = { if (typeof dataset === "undefined") return; - + var renameFunc = function(index,latAttr,lonAttr,placeAttr,dateAttr,timespanBeginAttr, timespanEndAttr,indexAttr){ var renameArray = []; - + if (typeof index === "undefined"){ index = 0; } - + if ((typeof latAttr !== "undefined") && (typeof lonAttr !== "undefined")){ renameArray.push({ oldColumn:latAttr, @@ -122,7 +122,7 @@ DataloaderWidget.prototype = { newColumn:"locations["+index+"].longitude" }); } - + if (typeof placeAttr !== "undefined"){ renameArray.push({ oldColumn:placeAttr, @@ -137,7 +137,7 @@ DataloaderWidget.prototype = { }); } - if ((typeof timespanBeginAttr !== "undefined") && + if ((typeof timespanBeginAttr !== "undefined") && (typeof timespanEndAttr !== "undefined")){ renameArray.push({ oldColumn:timespanBeginAttr, @@ -155,10 +155,10 @@ DataloaderWidget.prototype = { newColumn:"index" }); } - + GeoTemConfig.renameColumns(dataset,renameArray); }; - + var renames = JSON.parse(paramValue); if (renames instanceof Array){ @@ -173,7 +173,7 @@ DataloaderWidget.prototype = { } }); }, - + loadFilters : function(){ //load (optional!) filters //those will create a new(!) dataset, that only contains the filtered IDs @@ -191,10 +191,10 @@ DataloaderWidget.prototype = { } } dataset = datasets[datasetID]; - + if (typeof dataset === "undefined") return; - + var filterValues = function(paramValue){ var filter = JSON.parse(paramValue); var filteredObjects = []; @@ -207,7 +207,7 @@ DataloaderWidget.prototype = { var filteredDataset = new Dataset(filteredObjects, dataset.label + " (filtered)", dataset.url, dataset.type); datasets.push(filteredDataset); } - + if (paramValue instanceof Array){ for (var i=0; i < paramValue.length; i++){ filterValues(paramValue[i]); @@ -217,9 +217,9 @@ DataloaderWidget.prototype = { } } - }); + }); }, - + loadColors : function(){ //Load the (optional!) dataset colors var dataLoaderWidget = this; @@ -234,21 +234,21 @@ DataloaderWidget.prototype = { var colorsSelectedUnselected = paramValue.split(","); if (colorsSelectedUnselected.length > 2) return; - + var color1 = colorsSelectedUnselected[0]; if (color1.length != 6) return; - + color.r1 = parseInt(color1.substr(0,2),16); color.g1 = parseInt(color1.substr(2,2),16); color.b1 = parseInt(color1.substr(4,2),16); - + //check if a unselected color is given if (colorsSelectedUnselected.length == 2){ var color0 = colorsSelectedUnselected[1]; if (color0.length != 6) return; - + color.r0 = parseInt(color0.substr(0,2),16); color.g0 = parseInt(color0.substr(2,2),16); color.b0 = parseInt(color0.substr(4,2),16); @@ -258,14 +258,14 @@ DataloaderWidget.prototype = { color.g0 = Math.round(color.g1/2); color.b0 = Math.round(color.b1/2); } - + datasets[datasetID].color = color; - } + } } - } - }); + } + }); }, - + loadFromURL : function() { var dataLoaderWidget = this; dataLoaderWidget.datasets = []; @@ -276,9 +276,9 @@ DataloaderWidget.prototype = { $.each(parametersHash,function(paramName, paramValue){ parametersArray.push({paramName:paramName, paramValue:paramValue}); }); - + var parseParam = function(paramNr){ - + if (paramNr==parametersArray.length){ dataLoaderWidget.loadRenames(); dataLoaderWidget.loadFilters(); @@ -295,31 +295,33 @@ DataloaderWidget.prototype = { } } datasets = tempDatasets; - + if (datasets.length > 0){ dataLoaderWidget.dataLoader.distributeDatasets(datasets); } return; } - + var paramName = parametersArray[paramNr].paramName; var paramValue = parametersArray[paramNr].paramValue; - var datasetID = parseInt(paramName.replace(/\D/g,'')); - + //startsWith and endsWith defined in SIMILE Ajax (string.js) var fileName = dataLoaderWidget.dataLoader.getFileName(paramValue); var origURL = paramValue; - if (typeof GeoTemConfig.proxy != 'undefined') - paramValue = GeoTemConfig.proxy + paramValue; if (paramName.toLowerCase().startsWith("kml")){ + // Add proxy to KML data URL. + // FIXME Use direct download for KML files, too! + if (typeof GeoTemConfig.proxy != 'undefined') { + paramValue = GeoTemConfig.proxy + paramValue; + } GeoTemConfig.getKml(paramValue, function(kmlDoc){ var dataSet = new Dataset(GeoTemConfig.loadKml(kmlDoc), fileName, origURL); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; } else { - datasets.push(dataSet); + datasets.push(dataSet); } } setTimeout(function(){parseParam(paramNr+1)},1); @@ -332,20 +334,20 @@ DataloaderWidget.prototype = { if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; } else { - datasets.push(dataSet); + datasets.push(dataSet); } } setTimeout(function(){parseParam(paramNr+1)},1); }); } else if (paramName.toLowerCase().startsWith("json")){ - GeoTemConfig.getJson(paramValue,function(json ){ + GeoTemConfig.getJson(paramValue,function(json){ var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; } else { - datasets.push(dataSet); + datasets.push(dataSet); } } setTimeout(function(){parseParam(paramNr+1)},1); @@ -362,7 +364,7 @@ DataloaderWidget.prototype = { if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; } else { - datasets.push(dataSet); + datasets.push(dataSet); } } setTimeout(function(){parseParam(paramNr+1)},1); @@ -373,7 +375,7 @@ DataloaderWidget.prototype = { for(var i = 0; i != data.length; ++i){ arr[i] = String.fromCharCode(data[i]); } - + var workbook; var json; if (paramName.toLowerCase().startsWith("xlsx")){ @@ -385,13 +387,13 @@ DataloaderWidget.prototype = { var csv = XLS.utils.sheet_to_csv(workbook.Sheets[workbook.SheetNames[0]]); var json = GeoTemConfig.convertCsv(csv); } - + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; } else { - datasets.push(dataSet); + datasets.push(dataSet); } } setTimeout(function(){parseParam(paramNr+1)},1); @@ -400,7 +402,7 @@ DataloaderWidget.prototype = { setTimeout(function(){parseParam(paramNr+1)},1); } }; - + if (parametersArray.length>0){ parseParam(0) } diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 83fb411..2a28ec9 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -28,7 +28,6 @@ * @version date: 2012-07-27 */ - // credits: user76888, The Digital Gabeg (http://stackoverflow.com/questions/1539367) $.fn.cleanWhitespace = function() { textNodes = this.contents().filter( function() { @@ -37,6 +36,9 @@ $.fn.cleanWhitespace = function() { return this; }; +/* + * Configuration + */ GeoTemConfig = { debug : false, //show debug output (esp. regarding corrupt datasets) incompleteData : true, // show/hide data with either temporal or spatial metadata @@ -49,12 +51,15 @@ GeoTemConfig = { tableExportDataset : true, // export dataset to KML allowCustomColoring : false, // if DataObjects can have an own color (useful for weighted coloring) allowUserShapeAndColorChange: false, // if the user can change the shapes and color of datasets - // this turns MapConfig.useGraphics auto-on, but uses circles as default + // this turns MapConfig.useGraphics auto-on, but uses circles as + // default loadColorFromDataset : false, // if DataObject color should be loaded automatically (from column "color") allowColumnRenaming : true, - // proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass X-Domain problems) - proxy : 'https://geobrowser.de.dariah.eu/beta/php/proxy_beta.php?address=', + proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass + // X-Domain problems) dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage + dariahOwnStorageBearerPrefix : 'bearer ', + dariahOwnStorageLogIDPrefix : 'GEOBRO_', //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected colors : [{ r1 : 255, @@ -214,6 +219,9 @@ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { } } +/* + * + */ GeoTemConfig.getIndependentId = function(target){ if( target == 'map' ){ return ++GeoTemConfig.independentMapId; @@ -224,6 +232,9 @@ GeoTemConfig.getIndependentId = function(target){ return 0; }; +/* + * + */ GeoTemConfig.setHexColor = function(hex,index,fill){ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if( fill ){ @@ -238,6 +249,9 @@ GeoTemConfig.setHexColor = function(hex,index,fill){ } } +/* + * + */ GeoTemConfig.setRgbColor = function(r,g,b,index,fill){ if( fill ){ GeoTemConfig.colors[index].r0 = r; @@ -251,16 +265,24 @@ GeoTemConfig.setRgbColor = function(r,g,b,index,fill){ } } +/* + * + */ GeoTemConfig.configure = function(urlPrefix) { GeoTemConfig.urlPrefix = urlPrefix; GeoTemConfig.path = GeoTemConfig.urlPrefix + "images/"; } +/* + * + */ GeoTemConfig.applySettings = function(settings) { $.extend(this, settings); }; -//Keeps track of how many colors where assigned yet. +/* + * Keeps track of how many colors where assigned yet. + */ GeoTemConfig.assignedColorCount = 0; GeoTemConfig.getColor = function(id){ if (typeof GeoTemConfig.datasets[id].color === "undefined"){ @@ -313,6 +335,9 @@ GeoTemConfig.getColor = function(id){ return GeoTemConfig.datasets[id].color; }; +/* + * + */ GeoTemConfig.getAverageDatasetColor = function(id, objects){ var c = new Object(); var datasetColor = GeoTemConfig.getColor(id); @@ -362,12 +387,16 @@ GeoTemConfig.getAverageDatasetColor = function(id, objects){ return c; }; +/* + * + */ GeoTemConfig.getString = function(field) { if ( typeof Tooltips[GeoTemConfig.language] == 'undefined') { GeoTemConfig.language = 'en'; } return Tooltips[GeoTemConfig.language][field]; } + /** * returns the actual mouse position * @param {Event} e the mouseevent @@ -383,6 +412,7 @@ GeoTemConfig.getMousePosition = function(e) { left : e.pageX ? e.pageX : e.clientX }; } + /** * returns the json object of the file from the given url * @param {String} url the url of the file to load @@ -412,6 +442,9 @@ GeoTemConfig.getJson = function(url,asyncFunc) { } } +/* + * + */ GeoTemConfig.mergeObjects = function(set1, set2) { var inside = []; var newSet = []; @@ -435,20 +468,20 @@ GeoTemConfig.mergeObjects = function(set1, set2) { return newSet; }; +/* + * + */ GeoTemConfig.datasets = []; - GeoTemConfig.addDataset = function(newDataset){ GeoTemConfig.datasets.push(newDataset); Publisher.Publish('filterData', GeoTemConfig.datasets, null); }; - GeoTemConfig.addDatasets = function(newDatasets){ $(newDatasets).each(function(){ GeoTemConfig.datasets.push(this); }); Publisher.Publish('filterData', GeoTemConfig.datasets, null); }; - GeoTemConfig.removeDataset = function(index){ GeoTemConfig.datasets.splice(index,1); Publisher.Publish('filterData', GeoTemConfig.datasets, null); @@ -457,8 +490,7 @@ GeoTemConfig.removeDataset = function(index){ /** * converts the csv-file into json-format * - * @param {String} - * text + * @param {String} text Text to convert. */ GeoTemConfig.convertCsv = function(text){ /* convert here from CSV to JSON */ @@ -485,7 +517,6 @@ GeoTemConfig.convertCsv = function(text){ hasContent = true; } } - if (hasContent === true) break; } @@ -541,7 +572,6 @@ GeoTemConfig.convertCsv = function(text){ } dataObject["tableContent"] = tableContent; - json.push(dataObject); } @@ -619,70 +649,68 @@ GeoTemConfig.getKmz = function(url,asyncFunc) { }; /** - * returns the JSON "object" - * from the csv file from the given url - * @param {String} url the url of the file to load + * Loads the CSV file from the given URL and converts it to KML. + * + * @param {String} url The url of the file to load. + * @param {boolean} asyncFunc Method to call if using async data loading. * @return xml dom object of given file */ -GeoTemConfig.getCsv = function(url,asyncFunc) { - var async = false; - if( asyncFunc ){ - async = true; - } +GeoTemConfig.getCsv = function(url, asyncFunc) { - // Use XMLHttpRequest as synchronous behaviour (is not supported in jQuery native $.get) - var req = new XMLHttpRequest(); + // For DARIAH-DE OwnStorage do load data directly... + if (url.includes(GeoTemConfig.dariahOwnStorageURL)) { - req.open("GET",url,async); + console.log(" ## DIRECT ACCESS: " + url); +/* + // Set token and logID, if existing. + if (sessionStorage.getItem('tok')) { + var token = 'bearer ' + sessionStorage.getItem('tok'); + var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); + // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! + req.setRequestHeader('X-Tok', token); + req.setRequestHeader('X-Transaction-ID', logID); + } +*/ - // Set token and logID as HTTP header, if token is existing (only for DARIAH-DE OwnStorage!). - if (sessionStorage.getItem('tok') && url.includes("address=" + GeoTemConfig.dariahOwnStorageURL)) { - var token = 'bearer ' + sessionStorage.getItem('tok'); - var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); - // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! - req.setRequestHeader('X-Tok', token); - req.setRequestHeader('X-Transaction-ID', logID); + // Load file from storage directly. + GeoTemConfig.loadFromDariahStorage(url, asyncFunc); } - /* - 0: request not initialized - 1: server connection established - 2: request received - 3: processing request - 4: request finished and response is ready - */ - // Handle errors from proxy! -/* - req.onreadystatechange = function() { - if (this.readyState == 4) { - if (this.status == 200) { - // Action to be performed when the document is read; - console.log("status " + this.status); - } else if (this.status == 401) { - console.log("noauth " + this.status); - } else { - console.log("error " + this.status); - } + // ...handle proxy requests otherwise. + else { + + // Check proxy setting and add proxy URL. + if (typeof GeoTemConfig.proxy != 'undefined') { + url = GeoTemConfig.proxy + url; } - }; -*/ - // FOXME handle forwarding to PDP! + console.log(" ## PROXY ACCESS: " + url); - //can only be set on asynchronous now - //req.responseType = "text"; - var json; - req.onload = function() { - json = GeoTemConfig.convertCsv(req.response); - if (asyncFunc) { - asyncFunc(json); + var async = false; + if(asyncFunc) { + async = true; } - }; - req.send(); - if(!async) { - return json; - } + // Use XMLHttpRequest as synchronous behaviour (is not supported in jQuery native $.get) + var req = new XMLHttpRequest(); + + req.open("GET", url, async); + + //can only be set on asynchronous now + //req.responseType = "text"; + var json; + req.onload = function() { + json = GeoTemConfig.convertCsv(req.response); + if (asyncFunc) { + asyncFunc(json); + } + }; + req.send(); + + if(!async) { + return json; + } + } }; /** @@ -1399,4 +1427,37 @@ GeoTemConfig.renameColumns = function(dataset, renames){ //set index dataset.objects[i].setIndex(index); } +} + +/** + * Load file from DARIAH-DE storage. + */ +GeoTemConfig.loadFromDariahStorage = function(url, asyncFunc) { + // Assemble bearer token and logID. + var token = GeoTemConfig.dariahOwnStorageBearerPrefix + sessionStorage.getItem('tok'); + var logID = GeoTemConfig.dariahOwnStorageLogIDPrefix + (new Date()).getMilliseconds(); + $.ajax({ + url: url, + type: 'GET', + headers: { 'Authorization': token, 'X-Transaction-ID': logID }, + success: function(data) { + json = GeoTemConfig.convertCsv(data); + asyncFunc(json); + }, + error: function(xhr, textStatus, errorThrown) { + // Have we got a token already? If not, just do authenticate first! + if (sessionStorage.getItem('tok') === null) { + // FIXME do redirect to authentication! + console.log("DO AUTHENTICATE!"); + } + // If a token does exist and no read access is granted, just give the correct error. + else { + var title = 'Error loading dataset: ' + xhr.status + ' ' + errorThrown + '! '; + var message = 'The dataset with URL ' + url + ' could not be loaded from the DARIAH-DE Storage!'; + alert(title + message);s + // FIXME DO HANDLE ERROR! + console.log("ERROR: ", xhr); + } + } + }); }; From 60ba2e6c8a3b05743ddb800b3d197860b277522d Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 24 Jan 2020 14:59:14 +0100 Subject: [PATCH 20/47] Change some upper/lowercase settings --- js/Dataloader/Dataloader.js | 14 +++--- js/FuzzyTimeline/FuzzyTimelineRangeSlider.js | 48 ++++++++++---------- js/Overlayloader/Overlayloader.js | 20 ++++---- js/Storytelling/StorytellingWidget.js | 7 +-- js/Table/Table.js | 36 +++++++-------- js/Util/Tooltips.js | 2 +- loader.html | 8 ++-- loader_devel.html | 8 ++-- loader_empty.html | 14 +++--- minifier.html | 4 +- 10 files changed, 81 insertions(+), 80 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 7c90633..5283897 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -90,7 +90,7 @@ Dataloader.prototype = { addStaticLoader : function() { if (this.options.staticKML.length > 0){ - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.StaticLoaderTab = document.createElement("div"); $(this.StaticLoaderTab).attr("id","StaticLoader"); @@ -144,7 +144,7 @@ Dataloader.prototype = { }, addKMLLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.KMLLoaderTab = document.createElement("div"); $(this.KMLLoaderTab).attr("id","KMLLoader"); @@ -183,7 +183,7 @@ Dataloader.prototype = { }, addKMZLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.KMZLoaderTab = document.createElement("div"); $(this.KMZLoaderTab).attr("id","KMZLoader"); @@ -222,7 +222,7 @@ Dataloader.prototype = { }, addCSVLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.CSVLoaderTab = document.createElement("div"); $(this.CSVLoaderTab).attr("id","CSVLoader"); @@ -258,7 +258,7 @@ Dataloader.prototype = { }, addLocalKMLLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.localKMLLoaderTab = document.createElement("div"); $(this.localKMLLoaderTab).attr("id","LocalKMLLoader"); @@ -294,7 +294,7 @@ Dataloader.prototype = { }, addLocalCSVLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.localCSVLoaderTab = document.createElement("div"); $(this.localCSVLoaderTab).attr("id","LocalCSVLoader"); @@ -384,7 +384,7 @@ Dataloader.prototype = { return o; } - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.LocalXLSXLoader = document.createElement("div"); $(this.LocalXLSXLoader).attr("id","LocalXLSXLoader"); diff --git a/js/FuzzyTimeline/FuzzyTimelineRangeSlider.js b/js/FuzzyTimeline/FuzzyTimelineRangeSlider.js index 5fc3bb0..b1a0af3 100644 --- a/js/FuzzyTimeline/FuzzyTimelineRangeSlider.js +++ b/js/FuzzyTimeline/FuzzyTimelineRangeSlider.js @@ -29,27 +29,27 @@ function FuzzyTimelineRangeSlider(parent) { var rangeSlider = this; - + this.parent = parent; this.options = parent.options; - + this.spans; - + this.datasets; - + this.sliderParentTable = this.parent.gui.sliderTable; var headerRow = $(""); var controlsRow = $(""); $(this.sliderParentTable).append(headerRow).append(controlsRow); - + headerRow.append("Time start"); this.rangeStart = document.createElement("select"); controlsRow.append($("").append(this.rangeStart)); - + headerRow.append("Time unit"); this.rangeDropdown = document.createElement("select"); controlsRow.append($("").append(this.rangeDropdown)); - + headerRow.append("Scaling"); this.scalingDropdown = document.createElement("select"); controlsRow.append($("").append(this.scalingDropdown)); @@ -67,8 +67,8 @@ function FuzzyTimelineRangeSlider(parent) { this.pauseAnimation = document.createElement("div"); $(this.pauseAnimation).addClass("smallButton pauseDisabled"); controlsRow.append($("").append(this.startAnimation).append(this.pauseAnimation)); - - headerRow.append("Dated Objects"); + + headerRow.append("Dated objects"); this.numberDatedObjects = 0; this.numberDatedObjectsDIV = document.createElement("div"); $(this.numberDatedObjectsDIV).addClass("ddbElementsCount"); @@ -105,10 +105,10 @@ FuzzyTimelineRangeSlider.prototype = { if ((typeof smallestSpan !== 'undefined') && (smallestSpan.asMilliseconds() === 1)) return false; }); - + //show number of objects that have a time in header $(rangeSlider.numberDatedObjectsDIV).empty().append(rangeSlider.numberDatedObjects + " results"); - + if (typeof smallestSpan === 'undefined') return; @@ -158,9 +158,9 @@ FuzzyTimelineRangeSlider.prototype = { )) rangeSlider.spans.push(fixedSpans[i]); } - + $(rangeSlider.rangeDropdown).empty(); - + $(rangeSlider.rangeDropdown).append(""); var index = 0; $(rangeSlider.spans).each(function(){ @@ -196,16 +196,16 @@ FuzzyTimelineRangeSlider.prototype = { $(rangeSlider.rangeDropdown).change(function( eventObject ){ var handlePosition = $(rangeSlider.rangeDropdown).find("option:selected").first().attr("index"); //if there is no index, "continuous" is selected - so the density plot will be drawn - + if (typeof handlePosition === "undefined"){ rangeSlider.parent.switchViewMode("density"); } else { rangeSlider.parent.switchViewMode("barchart"); } - + rangeSlider.parent.slidePositionChanged(rangeSlider.spans[handlePosition]); }); - + $(rangeSlider.rangeStart).empty(); //add start of timeline selections //TODO: add Months/Days/etc., atm there are only years @@ -225,24 +225,24 @@ FuzzyTimelineRangeSlider.prototype = { last = date; } $(starts).each(function(){ - $(rangeSlider.rangeStart).append(""); + $(rangeSlider.rangeStart).append(""); }); $(rangeSlider.rangeStart).change(function( eventObject ){ var handlePosition = rangeSlider.rangeStart.selectedIndex; var start = starts[handlePosition]; - + rangeSlider.parent.overallMin = moment().year(start); $(rangeSlider.rangeDropdown).change(); }); $(rangeSlider.rangeDropdown).change(); - + $(rangeSlider.startAnimation).click(function(){ if ($(rangeSlider.startAnimation).hasClass("playEnabled")){ $(rangeSlider.startAnimation).removeClass("playEnabled").addClass("playDisabled"); $(rangeSlider.pauseAnimation).removeClass("pauseDisabled").addClass("pauseEnabled"); - + rangeSlider.parent.startAnimation(); } }); @@ -252,12 +252,12 @@ FuzzyTimelineRangeSlider.prototype = { if ($(rangeSlider.pauseAnimation).hasClass("pauseEnabled")){ $(rangeSlider.startAnimation).removeClass("playDisabled").addClass("playEnabled"); $(rangeSlider.pauseAnimation).removeClass("pauseEnabled").addClass("pauseDisabled"); - + rangeSlider.parent.pauseAnimation(); } }); }, - + triggerHighlight : function(columnElement) { }, @@ -280,8 +280,8 @@ FuzzyTimelineRangeSlider.prototype = { reset : function() { }, - - show : function() { + + show : function() { }, hide : function() { diff --git a/js/Overlayloader/Overlayloader.js b/js/Overlayloader/Overlayloader.js index b6dc97f..7a23d5c 100644 --- a/js/Overlayloader/Overlayloader.js +++ b/js/Overlayloader/Overlayloader.js @@ -154,7 +154,7 @@ Overlayloader.prototype = { newOverlay.layers = []; var newLayer = new OpenLayers.Layer.XYZ( - "XYZ Layer", + "XYZ layer", [ xyzURL ], { @@ -179,7 +179,7 @@ Overlayloader.prototype = { }, addKMLLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.KMLLoaderTab = document.createElement("div"); $(this.KMLLoaderTab).attr("id","KMLLoader"); @@ -206,7 +206,7 @@ Overlayloader.prototype = { }, addKMZLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.KMZLoaderTab = document.createElement("div"); $(this.KMZLoaderTab).attr("id","KMZLoader"); @@ -251,7 +251,7 @@ Overlayloader.prototype = { $(this.ArcGISWMSLoaderTab).append(this.wmsLayer); this.loadArcGISWMSButton = document.createElement("button"); - $(this.loadArcGISWMSButton).text("load Layer"); + $(this.loadArcGISWMSButton).text("load layer"); $(this.ArcGISWMSLoaderTab).append(this.loadArcGISWMSButton); $(this.loadArcGISWMSButton).click($.proxy(function(){ @@ -267,7 +267,7 @@ Overlayloader.prototype = { }, addXYZLoader : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.XYZLoaderTab = document.createElement("div"); $(this.XYZLoaderTab).attr("id","XYZLoader"); @@ -279,7 +279,7 @@ Overlayloader.prototype = { $(this.XYZLoaderTab).append(this.xyzURL); this.loadXYZButton = document.createElement("button"); - $(this.loadXYZButton).text("load Layer"); + $(this.loadXYZButton).text("load layer"); $(this.XYZLoaderTab).append(this.loadXYZButton); $(this.loadXYZButton).click($.proxy(function(){ @@ -301,7 +301,7 @@ Overlayloader.prototype = { $(this.RomanEmpireLoaderTab).attr("id","RomanEmpireLoader"); this.loadRomanEmpireButton = document.createElement("button"); - $(this.loadRomanEmpireButton).text("load Layer"); + $(this.loadRomanEmpireButton).text("load layer"); $(this.RomanEmpireLoaderTab).append(this.loadRomanEmpireButton); $(this.loadRomanEmpireButton).click($.proxy(function(){ @@ -312,13 +312,13 @@ Overlayloader.prototype = { }, addMapsForFreeWaterLayer : function() { - $(this.parent.gui.loaderTypeSelect).append(""); + $(this.parent.gui.loaderTypeSelect).append(""); this.MapsForFreeWaterTab = document.createElement("div"); $(this.MapsForFreeWaterTab).attr("id","MapsForFreeWaterLayerLoader"); this.loadMapsForFreeWaterLayerButton = document.createElement("button"); - $(this.loadMapsForFreeWaterLayerButton).text("load Layer"); + $(this.loadMapsForFreeWaterLayerButton).text("load layer"); $(this.MapsForFreeWaterTab).append(this.loadMapsForFreeWaterLayerButton); $(this.loadMapsForFreeWaterLayerButton).click($.proxy(function(){ @@ -347,7 +347,7 @@ Overlayloader.prototype = { $(this.ConfigLoaderTab).append(this.ConfigMapSelect); this.loadConfigMapButton = document.createElement("button"); - $(this.loadConfigMapButton).text("load Layer"); + $(this.loadConfigMapButton).text("load layer"); $(this.ConfigLoaderTab).append(this.loadConfigMapButton); $(this.loadConfigMapButton).click($.proxy(function(){ diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 79550c4..616cd90 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -180,12 +180,13 @@ StorytellingWidget.prototype = { var magneticLink = document.createElement('a'); magneticLink.setAttribute('class', 'magneticLink'); - $(magneticLink).append("Magnetic Link"); - magneticLink.title = "Use this link to reload currently loaded (online) data."; + $(magneticLink).append("Magnetic link"); + magneticLink.title = "Use this link to reload or share currently loaded view of online datasets."; magneticLink.href = "?"+this.datasetLink; var currentStatusParam = $.param(this.currentStatus); - if (currentStatusParam.length > 0) + if (currentStatusParam.length > 0) { magneticLink.href += "¤tStatus="+currentStatusParam; + } magneticLink.target = '_'; $(this.gui.storytellingContainer).prepend(magneticLink); }, diff --git a/js/Table/Table.js b/js/Table/Table.js index 605c39a..cb17a53 100644 --- a/js/Table/Table.js +++ b/js/Table/Table.js @@ -143,7 +143,7 @@ Table.prototype = { table.parent.tableSelection(); } } - + this.showSelectedItems = false; if (table.options.tableShowSelected) { this.showSelected = document.createElement('div'); @@ -171,7 +171,7 @@ Table.prototype = { table.update(); } } - + if (table.options.tableSelectByText) { this.selectByTextDiv = document.createElement('div'); $(this.selectByTextDiv).css("float","left"); @@ -188,14 +188,14 @@ Table.prototype = { //TODO: add button-image $(this.selectByTextButton).val("search"); $(this.selectByTextDiv).append(this.selectByTextButton); - + table.selectByTextDiv.title = GeoTemConfig.getString('selectByTextHelp'); selectors.appendChild(this.selectByTextDiv); $(this.selectByTextButton).click($.proxy(function() { this.selectByText($(this.selectByTextInput).val()); },this)); - } - + } + if (table.options.tableCreateNewFromSelected) { this.createNewFromSelected = document.createElement('div'); this.createNewFromSelected.setAttribute('class', 'smallButton createNewRefined'); @@ -211,15 +211,15 @@ Table.prototype = { if (this.selected) newObjects.push(this.object); }); - + var newDataset = new Dataset(); newDataset.label = tableWidget.datasets[copyID].label + " refined"; newDataset.objects = newObjects; - + GeoTemConfig.addDataset(newDataset); }; - } - + } + this.selectors = selectors; // selectors.style.width = (this.filter.offsetWidth + this.selectAll.offsetWidth + this.selectPage.offsetWidth)+"px"; @@ -260,7 +260,7 @@ Table.prototype = { } } dropdown.div.title = GeoTemConfig.getString('paginationDropdownHelp'); - + this.firstPage = document.createElement('div'); this.firstPage.setAttribute('class', 'paginationButton'); this.firstPage.title = GeoTemConfig.getString('paginationFirsPageHelp'); @@ -330,13 +330,13 @@ Table.prototype = { var cell = document.createElement('th'); this.elementListHeader.appendChild(cell); } - + //Bottom pagination elements this.bottomToolbar = document.createElement("table"); this.bottomToolbar.setAttribute('class', 'ddbToolbar'); this.bottomToolbar.style.overflow = 'auto'; this.tableDiv.appendChild(this.bottomToolbar); - + var bottomNavigation = document.createElement("tr"); this.bottomToolbar.appendChild(bottomNavigation); @@ -366,7 +366,7 @@ Table.prototype = { table.update(); } } - + this.bottomPageInfo = document.createElement('div'); this.bottomPageInfo.setAttribute('class', 'pageInfo'); $(this.bottomPageInfo).css('float', 'right'); @@ -465,13 +465,13 @@ Table.prototype = { } this.elements.sort(sortFunction); }, - + selectByText : function(text) { //deselect all elements $(this.elements).each(function(){ this.selected = false; }); - + var selectedCount = 0; $(this.elements).filter(function(index){ return this.object.contains(text); @@ -479,12 +479,12 @@ Table.prototype = { this.selected = true; selectedCount++; }); - + //only show selected elements this.showSelectedItems = true; this.showElementsLength = selectedCount; this.showSelected.setAttribute('class', 'smallButton showAll'); - + this.update(); this.parent.tableSelection(); }, @@ -499,7 +499,7 @@ Table.prototype = { setResultsText : function() { if (this.elements.length == 0) { - this.resultsInfo.innerHTML = '0 Results'; + this.resultsInfo.innerHTML = '0 results'; } else { var infoText = GeoTemConfig.getString('resultsInfo'); var first = this.page * this.resultsPerPage + 1; diff --git a/js/Util/Tooltips.js b/js/Util/Tooltips.js index ee6f67a..5d9e749 100644 --- a/js/Util/Tooltips.js +++ b/js/Util/Tooltips.js @@ -81,7 +81,7 @@ var Tooltips = { "timeFeather" : "Adjust time range feather to smoothen map animations", "allResults" : "all", "pageInfo" : "Page PAGE_ID of PAGES_ID", - "resultsInfo" : "RESULTS_FROM_ID-RESULTS_TO_ID of RESULTS_ID Results", + "resultsInfo" : "RESULTS_FROM_ID-RESULTS_TO_ID of RESULTS_ID results", "otherResults" : "others", "mapAggregation" : "Aggregation", "aggregation" : "Circle aggregation", diff --git a/loader.html b/loader.html index 11e1dbf..15a9118 100644 --- a/loader.html +++ b/loader.html @@ -54,7 +54,7 @@
Data History -
+ @@ -81,17 +81,17 @@ var mapDiv = document.getElementById("mapContainerDiv"); var map = new WidgetWrapper(); var mapWidget = new MapWidget(map,mapDiv,{ - mapTitle: "Publication Place" + mapTitle: "Publication place" }); var timeDiv = document.getElementById("plotContainerDiv"); var time = new WidgetWrapper(); var timeWidget = new FuzzyTimelineWidget(time,timeDiv,{ - timeTitle: "Publication Date" + timeTitle: "Publication date" }); var tableDiv = document.getElementById("tableContainerDiv"); var table = new WidgetWrapper(); var tableWidget = new TableWidget(table,tableDiv); - + var dataloaderDiv = document.getElementById("dataloaderContainerDiv"); var dataloader = new WidgetWrapper(); var dataloaderWidget = new DataloaderWidget(dataloader,dataloaderDiv); diff --git a/loader_devel.html b/loader_devel.html index 36f14cb..124396b 100644 --- a/loader_devel.html +++ b/loader_devel.html @@ -55,7 +55,7 @@
Data History -
+ @@ -83,17 +83,17 @@ var mapDiv = document.getElementById("mapContainerDiv"); var map = new WidgetWrapper(); var mapWidget = new MapWidget(map,mapDiv,{ - mapTitle: "Publication Place" + mapTitle: "Publication place" }); var timeDiv = document.getElementById("plotContainerDiv"); var time = new WidgetWrapper(); var timeWidget = new FuzzyTimelineWidget(time,timeDiv,{ - timeTitle: "Publication Date" + timeTitle: "Publication date" }); var tableDiv = document.getElementById("tableContainerDiv"); var table = new WidgetWrapper(); var tableWidget = new TableWidget(table,tableDiv); - + var dataloaderDiv = document.getElementById("dataloaderContainerDiv"); var dataloader = new WidgetWrapper(); var dataloaderWidget = new DataloaderWidget(dataloader,dataloaderDiv); diff --git a/loader_empty.html b/loader_empty.html index 413e8da..a715d99 100644 --- a/loader_empty.html +++ b/loader_empty.html @@ -54,7 +54,7 @@
Data History -
+ @@ -81,17 +81,17 @@ var mapDiv = document.getElementById("mapContainerDiv"); var map = new WidgetWrapper(); var mapWidget = new MapWidget(map,mapDiv,{ - mapTitle: "Publication Place" + mapTitle: "Publication place" }); var timeDiv = document.getElementById("plotContainerDiv"); var time = new WidgetWrapper(); var timeWidget = new FuzzyTimelineWidget(time,timeDiv,{ - timeTitle: "Publication Date" + timeTitle: "Publication date" }); var tableDiv = document.getElementById("tableContainerDiv"); var table = new WidgetWrapper(); var tableWidget = new TableWidget(table,tableDiv); - + var dataloaderDiv = document.getElementById("dataloaderContainerDiv"); var dataloader = new WidgetWrapper(); var dataloaderWidget = new DataloaderWidget(dataloader,dataloaderDiv); @@ -100,15 +100,15 @@ var overlayloader = new WidgetWrapper(); var overlayloaderWidget = new OverlayloaderWidget(overlayloader,overlayloaderDiv); overlayloaderWidget.attachMapWidget(mapWidget); - + var piechartDiv = document.getElementById("piechartContainerDiv"); var piechart = new WidgetWrapper(); var piechartWidget = new PieChartWidget(piechart,piechartDiv); - + var storytellingDiv = document.getElementById("storytellingContainerDiv"); var storytelling = new WidgetWrapper(); var storytellingWidget = new StorytellingWidget(storytelling,storytellingDiv); - + dataloaderWidget.loadFromURL(); diff --git a/minifier.html b/minifier.html index f7bb167..5b580b0 100644 --- a/minifier.html +++ b/minifier.html @@ -27,12 +27,12 @@ var mapDiv = document.getElementById("mapContainerDiv"); var map = new WidgetWrapper(); var mapWidget = new MapWidget(map,mapDiv,{ - mapTitle: "Publication Place" + mapTitle: "Publication place" }); var timeDiv = document.getElementById("plotContainerDiv"); var time = new WidgetWrapper(); var timeWidget = new TimeWidget(time,timeDiv,{ - timeTitle: "Publication Date" + timeTitle: "Publication date" }); var tableDiv = document.getElementById("tableContainerDiv"); var table = new WidgetWrapper(); From 09262ff1f689e07d32a7fd2210a2a075f84646e1 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Fri, 31 Jan 2020 18:15:20 +0100 Subject: [PATCH 21/47] Add store to OwnStorage Add colors to data links --- js/Dataloader/Dataloader.js | 6 +-- js/GeoTemConfig.js | 70 +++++++++++++++------------ js/Storytelling/StorytellingWidget.js | 60 +++++++++-------------- 3 files changed, 66 insertions(+), 70 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 5283897..9906f18 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -36,7 +36,7 @@ function Dataloader(parent) { this.initialize(); } -var addToProxysWhitelistMessage = "Could not load file. Please check your URL. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; +var addToProxysWhitelistMessage = "Could not load file!\n\nPlease check your URL. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; Dataloader.prototype = { @@ -136,7 +136,7 @@ Dataloader.prototype = { if (dataSet != null) this.distributeDataset(dataSet); } else - alert("Could not load file."); + alert("Could not load file!\n\nData type seems not to be KML!"); },this)); $(this.parent.gui.loaders).append(this.StaticLoaderTab); @@ -243,7 +243,7 @@ Dataloader.prototype = { return; var origURL = csvURL; var fileName = dataLoader.getFileName(csvURL); - // Chose proxy or direct access in GeoTemConfig.getCSV(). + // Choose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 2a28ec9..9b0a23f 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -659,20 +659,6 @@ GeoTemConfig.getCsv = function(url, asyncFunc) { // For DARIAH-DE OwnStorage do load data directly... if (url.includes(GeoTemConfig.dariahOwnStorageURL)) { - - console.log(" ## DIRECT ACCESS: " + url); -/* - // Set token and logID, if existing. - if (sessionStorage.getItem('tok')) { - var token = 'bearer ' + sessionStorage.getItem('tok'); - var logID = 'GEO-BRO_' + (new Date()).getMilliseconds(); - // NOTE PHP proxy takes X-Tok and transforms it to X-Authorization! - req.setRequestHeader('X-Tok', token); - req.setRequestHeader('X-Transaction-ID', logID); - } -*/ - - // Load file from storage directly. GeoTemConfig.loadFromDariahStorage(url, asyncFunc); } @@ -684,8 +670,6 @@ GeoTemConfig.getCsv = function(url, asyncFunc) { url = GeoTemConfig.proxy + url; } - console.log(" ## PROXY ACCESS: " + url); - var async = false; if(asyncFunc) { async = true; @@ -693,11 +677,9 @@ GeoTemConfig.getCsv = function(url, asyncFunc) { // Use XMLHttpRequest as synchronous behaviour (is not supported in jQuery native $.get) var req = new XMLHttpRequest(); - req.open("GET", url, async); - //can only be set on asynchronous now - //req.responseType = "text"; + // Can only be set on asynchronous now var json; req.onload = function() { json = GeoTemConfig.convertCsv(req.response); @@ -706,7 +688,6 @@ GeoTemConfig.getCsv = function(url, asyncFunc) { } }; req.send(); - if(!async) { return json; } @@ -1430,7 +1411,7 @@ GeoTemConfig.renameColumns = function(dataset, renames){ } /** - * Load file from DARIAH-DE storage. + * Load file from DARIAH-DE OwnStorage. */ GeoTemConfig.loadFromDariahStorage = function(url, asyncFunc) { // Assemble bearer token and logID. @@ -1441,23 +1422,52 @@ GeoTemConfig.loadFromDariahStorage = function(url, asyncFunc) { type: 'GET', headers: { 'Authorization': token, 'X-Transaction-ID': logID }, success: function(data) { - json = GeoTemConfig.convertCsv(data); + var json = GeoTemConfig.convertCsv(data); asyncFunc(json); }, error: function(xhr, textStatus, errorThrown) { - // Have we got a token already? If not, just do authenticate first! + // Have we got a token already? If not, tell the user to authenticate first! if (sessionStorage.getItem('tok') === null) { - // FIXME do redirect to authentication! - console.log("DO AUTHENTICATE!"); + var title = 'Error loading dataset: ' + xhr.status + ' ' + errorThrown + '!'; + var message = 'The dataset with URL ' + url + ' could not be loaded from the DARIAH-DE Storage! It seems the above resource is not yours or not shared yet! Please do login to view your dataset or share it in the Datasheet Editor!'; + alert(title + "\n\n" + message); } // If a token does exist and no read access is granted, just give the correct error. else { - var title = 'Error loading dataset: ' + xhr.status + ' ' + errorThrown + '! '; - var message = 'The dataset with URL ' + url + ' could not be loaded from the DARIAH-DE Storage!'; - alert(title + message);s - // FIXME DO HANDLE ERROR! - console.log("ERROR: ", xhr); + var title = 'Error loading dataset: ' + xhr.status + ' ' + errorThrown + '!'; + var message = 'The dataset with URL ' + url + ' could not be loaded from the DARIAH-DE Storage! It seems the above resource is not publicly available!'; + alert(title + "\n\n" + message); } } }); }; + +/* + * Store file to DARIAH-DE OwnStorage. + */ +GeoTemConfig.storeToDariahStorage = function(postdata, asyncFunc) { + // Assemble bearer token and logID. + var token = GeoTemConfig.dariahOwnStorageBearerPrefix + sessionStorage.getItem('tok'); + var logID = GeoTemConfig.dariahOwnStorageLogIDPrefix + (new Date()).getMilliseconds(); + $.ajax({ + url: GeoTemConfig.dariahOwnStorageURL, + type: 'POST', + headers: { 'Authorization': token, 'X-Transaction-ID': logID }, + contentType: 'text/csv', + data: postdata, + success: function(data, status, xhr) { + var location = xhr.getResponseHeader('Location'); + var id = location.substring(location.lastIndexOf('/') + 1); + // Prevent getting false locations from storage, such as http instead of https and or productive locations from test storage... therefore set new dataset location. + var newLocation = GeoTemConfig.dariahOwnStorageURL + id; + asyncFunc(newLocation, id); + var title = 'Dataset has been stored to DARIAH-DE Storage!'; + var message = 'Your dataset has been successfully stored to the the DARIAH-DE Storage! It has got the ID ' + id + ' and URL: ' + newLocation; + alert(title + "\n\n" + message); + }, + error: function(xhr, textStatus, errorThrown) { + var title = 'Error storing dataset to the DARIAH-DE Storage: ' + xhr.status + ' ' + errorThrown + '!'; + var message = 'The dataset with URL ' + url + ' could not be stored to the DARIAH-DE Storage!'; + alert(title + "\n\n" + message); } + }); +} diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 616cd90..a0e935d 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -70,10 +70,14 @@ StorytellingWidget.prototype = { $(storytellingWidget.datasets).each(function(){ var dataset = this; - if (magneticLinkParam.length > 0) + if (magneticLinkParam.length > 0) { magneticLinkParam += "&"; + } - var paragraph = $("

"); + // Get color of dataset and create

tag. + var color = 'rgb(' + dataset.color.r0 + ',' + dataset.color.g0 + ',' + dataset.color.b0 + ')'; + // Style color hack. Don't do it! :-D --fu + var paragraph = $("

"); paragraph.append(dataset.label); if (typeof dataset.url !== "undefined"){ //TODO: makes only sense for KML or CSV URLs, so "type" of @@ -100,38 +104,22 @@ StorytellingWidget.prototype = { } else { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); - $(uploadToDARIAH).append(" [upload to DARIAH-DE OwnStorage]"); - uploadToDARIAH.title = ""; + $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); + uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; uploadToDARIAH.href = dataset.url; - var localDatasetIndex = new Number(datasetIndex); - $(uploadToDARIAH).click(function(){ + $(uploadToDARIAH).click(function(){ var csv = GeoTemConfig.createCSVfromDataset(localDatasetIndex); - // taken from dariah.storage.js - var storageURL = "https://geobrowser.de.dariah.eu/storage/" - $.ajax({ - url: storageURL, - type: 'POST', - contentType: 'text/csv', - data: csv, - success: function(data, status, xhr) { - var location = xhr.getResponseHeader('Location'); - // the dariah storage id - dsid = location.substring(location.lastIndexOf('/')+1); - - //add URL to dataset - storytellingWidget.datasets[localDatasetIndex].url = location; - storytellingWidget.datasets[localDatasetIndex].type = "csv"; - //refresh list - storytellingWidget.initWidget(storytellingWidget.datasets); - }, - error: function (data, text, error) { - alert('Could not create file in DARIAH storage: ' + text); - console.log(data); - console.log(text); - console.log(error); - } - }); + GeoTemConfig.storeToDariahStorage(csv, function(location, id) { + // Set (global) DSID. + dsid = id; + // Add URL to dataset. + storytellingWidget.datasets[localDatasetIndex].url = location; + storytellingWidget.datasets[localDatasetIndex].type = "csv"; + storytellingWidget.datasets[localDatasetIndex].label = dsid; + // Refresh list. + storytellingWidget.initWidget(storytellingWidget.datasets); + }); //discard link click-event return(false); }); @@ -143,23 +131,19 @@ StorytellingWidget.prototype = { $(saveToLocalStorage).append(" [save to local storage]"); saveToLocalStorage.title = ""; saveToLocalStorage.href = dataset.url; - var localDatasetIndex = new Number(datasetIndex); $(saveToLocalStorage).click(function(){ var csv = GeoTemConfig.createCSVfromDataset(localDatasetIndex); - var storageName = "GeoBrowser_dataset_"+GeoTemConfig.datasets[localDatasetIndex].label; $.remember({ name:storageName, value:csv }); - //add URL to dataset storytellingWidget.datasets[localDatasetIndex].url = storageName; storytellingWidget.datasets[localDatasetIndex].type = "local"; //refresh list storytellingWidget.initWidget(storytellingWidget.datasets); - //discard link click-event return(false); }); @@ -180,7 +164,7 @@ StorytellingWidget.prototype = { var magneticLink = document.createElement('a'); magneticLink.setAttribute('class', 'magneticLink'); - $(magneticLink).append("Magnetic link"); + $(magneticLink).append("Magnetic link (online datasets only)"); magneticLink.title = "Use this link to reload or share currently loaded view of online datasets."; magneticLink.href = "?"+this.datasetLink; var currentStatusParam = $.param(this.currentStatus); @@ -188,7 +172,9 @@ StorytellingWidget.prototype = { magneticLink.href += "¤tStatus="+currentStatusParam; } magneticLink.target = '_'; - $(this.gui.storytellingContainer).prepend(magneticLink); + var paragraph = $("

"); + paragraph.append(magneticLink); + $(this.gui.storytellingContainer).prepend(paragraph); }, highlightChanged : function(objects) { From c1a6b638c0f2e67d0a8b3d5dbf811c16ff0ee342 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 3 Feb 2020 16:00:54 +0100 Subject: [PATCH 22/47] Add open datasheet in magnetic link section --- js/GeoTemConfig.js | 1 + js/Storytelling/StorytellingWidget.js | 32 ++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 9b0a23f..9dd5c64 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -58,6 +58,7 @@ GeoTemConfig = { proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass // X-Domain problems) dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage + datasheetEditorURL : '/edit/index.html', // URL of the Datasheet Editor dariahOwnStorageBearerPrefix : 'bearer ', dariahOwnStorageLogIDPrefix : 'GEOBRO_', //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index a0e935d..dcd324c 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -80,32 +80,43 @@ StorytellingWidget.prototype = { var paragraph = $("

"); paragraph.append(dataset.label); if (typeof dataset.url !== "undefined"){ - //TODO: makes only sense for KML or CSV URLs, so "type" of - //URL should be preserved (in dataset). - //startsWith and endsWith defined in SIMILE Ajax (string.js) + // TODO: makes only sense for KML or CSV URLs, so "type" of + // URL should be preserved (in dataset). + // startsWith and endsWith defined in SIMILE Ajax (string.js) var type="csv"; - if (typeof dataset.type !== "undefined") + if (typeof dataset.type !== "undefined") { type = dataset.type; - else { - if (dataset.url.toLowerCase().endsWith("kml")) + } else { + if (dataset.url.toLowerCase().endsWith("kml")) { type = "kml"; + } } magneticLinkParam += type+linkCount+"="; linkCount++; magneticLinkParam += dataset.url; - var tableLinkDiv = document.createElement('a'); - tableLinkDiv.title = dataset.url; + var tableLinkDiv = document.createElement('a'); + tableLinkDiv.title = 'Open dataset ' + dataset.label + ' directly in DARIAH-DE OwnStorage. The dataset must be public or you need to be owner of the dataset.'; tableLinkDiv.href = dataset.url; tableLinkDiv.target = '_'; tableLinkDiv.setAttribute('class', 'externalLink'); paragraph.append(tableLinkDiv); + // Provide link to Datasheet Editor if stored in DARIAH-DE OwnStorage. + if (dataset.url.includes(GeoTemConfig.dariahOwnStorageURL)) { + var datasheetLinkDiv = document.createElement('a'); + $(datasheetLinkDiv).append("[open datasheet]"); + datasheetLinkDiv.title = 'Open datasheet ' + dataset.label + ' from DARIAH-DE OwnStorage in Datasheet Editor. The dataset must be public or you need to be owner of the dataset.'; + datasheetLinkDiv.href = GeoTemConfig.datasheetEditorURL + '?id=' + dataset.label; + datasheetLinkDiv.target = '_'; + paragraph.append(' '); + paragraph.append(datasheetLinkDiv); + } } else { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); - uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; + uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. If the dataset is not already in CSV format, it will be comverted automatically and then be uploaded. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; uploadToDARIAH.href = dataset.url; var localDatasetIndex = new Number(datasetIndex); $(uploadToDARIAH).click(function(){ @@ -164,7 +175,7 @@ StorytellingWidget.prototype = { var magneticLink = document.createElement('a'); magneticLink.setAttribute('class', 'magneticLink'); - $(magneticLink).append("Magnetic link (online datasets only)"); + $(magneticLink).append("Magnetic link"); magneticLink.title = "Use this link to reload or share currently loaded view of online datasets."; magneticLink.href = "?"+this.datasetLink; var currentStatusParam = $.param(this.currentStatus); @@ -174,6 +185,7 @@ StorytellingWidget.prototype = { magneticLink.target = '_'; var paragraph = $("

"); paragraph.append(magneticLink); + paragraph.append(' (online datasets only)'); $(this.gui.storytellingContainer).prepend(paragraph); }, From 11f0dee7640025366163e9a951c9478940516551 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 10:40:14 +0200 Subject: [PATCH 23/47] adding tests for name labels --- js/Dataloader/DataloaderConfig.js | 2 +- js/Map/Binning.js | 1 - js/Map/MapConfig.js | 2 +- js/Map/MapWidget.js | 32 +++++++++++++-------------- js/Map/PlacenameTags.js | 17 +++++++++----- js/Storytelling/StorytellingWidget.js | 2 +- js/Table/Table.js | 6 +++++ 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/js/Dataloader/DataloaderConfig.js b/js/Dataloader/DataloaderConfig.js index 0f550ba..f4ef9ad 100644 --- a/js/Dataloader/DataloaderConfig.js +++ b/js/Dataloader/DataloaderConfig.js @@ -84,7 +84,7 @@ function DataloaderConfig(options) { url: dl +"data/flickr/U2.kml" }, { - label: "Muse", + label: "Muse", url: dl +"data/flickr/Muse.kml" }, { header: "Political Data" }, diff --git a/js/Map/Binning.js b/js/Map/Binning.js index f2680a9..564afc4 100644 --- a/js/Map/Binning.js +++ b/js/Map/Binning.js @@ -746,4 +746,3 @@ Binning.prototype = { } } - diff --git a/js/Map/MapConfig.js b/js/Map/MapConfig.js index 1a7d993..f87af1d 100644 --- a/js/Map/MapConfig.js +++ b/js/Map/MapConfig.js @@ -263,7 +263,7 @@ function MapConfig(options) { bingApiKey : 'none', // bing maps api key, see informations at http://bingmapsportal.com/ osmMaps : true, // enable/disable OSM maps osmMapsMapQuest : false, // enable/disable OSM maps with MapQuest tiles - baseLayer : 'Open Street Map', // initial layer to show (e.g. 'Google Streets') + baseLayer : 'OpenStreetMap', // initial layer to show (e.g. 'Google Streets') resetMap : true, // show/hide map reset button countrySelect : true, // show/hide map country selection control button polygonSelect : true, // show/hide map polygon selection control button diff --git a/js/Map/MapWidget.js b/js/Map/MapWidget.js index c3e54f3..2f5c54f 100644 --- a/js/Map/MapWidget.js +++ b/js/Map/MapWidget.js @@ -541,7 +541,7 @@ MapWidget.prototype = { this.zoomSlider.setMaxAndLevels(1000, this.openlayersMap.getNumZoomLevels()); this.zoomSlider.setValue(this.getZoom()); } - + Publisher.Subscribe('mapChanged', this, function(mapName) { this.client.setBaseLayerByName(mapName); this.client.gui.setMap(); @@ -562,7 +562,7 @@ MapWidget.prototype = { layers[i].name, [ layers[i].url - ], + ], { sphericalMercator: true, transitionEffect: "resize", @@ -570,20 +570,20 @@ MapWidget.prototype = { numZoomLevels: 12, transparent : true, attribution: layers[i].attribution - }, + }, { isBaseLayer : true } ); } else { layer = new OpenLayers.Layer.WMS( - layers[i].name, layers[i].url, + layers[i].name, layers[i].url, { projection : "EPSG:4326", layers : layers[i].layer, transparent : "true", format : "image/png" - }, + }, { attribution: layers[i].attribution, isBaseLayer : true @@ -651,18 +651,18 @@ MapWidget.prototype = { this.baseLayers.push(aerial); } if (this.options.osmMaps) { - this.baseLayers.push(new OpenLayers.Layer.OSM('Open Street Map', '', { + this.baseLayers.push(new OpenLayers.Layer.OSM('OpenStreetMap', '', { sphericalMercator : true, zoomOffset : 1, resolutions : this.resolutions })); } if (this.options.osmMapsMapQuest) { - this.baseLayers.push(new OpenLayers.Layer.OSM('Open Street Map (MapQuest)', + this.baseLayers.push(new OpenLayers.Layer.OSM('OpenStreetMap (MapQuest)', ["http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png", "http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png", "http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png", - "http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png"], + "http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.png"], { sphericalMercator : true, zoomOffset : 1, @@ -1101,7 +1101,7 @@ MapWidget.prototype = { hideEmptyCircles = true; } } - + if( !GeoTemConfig.highlightEvents ){ return; } @@ -1116,13 +1116,13 @@ MapWidget.prototype = { for (var i in points ) { for (var j in points[i] ) { var point = points[i][j]; - + if (hideEmptyCircles){ point.feature.style.display = 'none'; } else { point.feature.style.display = ''; - } - + } + this.updatePoint(points[i][j], polygon); } } @@ -1230,7 +1230,7 @@ MapWidget.prototype = { this.core.triggerSelection(this.selection); this.filterBar.reset(true); }, - + triggerMapChanged : function(mapName) { Publisher.Publish('mapChanged', mapName, this); }, @@ -1380,12 +1380,12 @@ MapWidget.prototype = { } this.openlayersMap.zoomTo(Math.floor(this.getZoom())); this.openlayersMap.setBaseLayer(this.baseLayers[index]); - if (this.baseLayers[index].name == 'Open Street Map') { + if (this.baseLayers[index].name == 'OpenStreetMap') { this.gui.osmLink.style.visibility = 'visible'; } else { this.gui.osmLink.style.visibility = 'hidden'; } - if (this.baseLayers[index].name == 'Open Street Map (MapQuest)') { + if (this.baseLayers[index].name == 'OpenStreetMap (MapQuest)') { this.gui.osmMapQuestLink.style.visibility = 'visible'; } else { this.gui.osmMapQuestLink.style.visibility = 'hidden'; @@ -1524,7 +1524,7 @@ MapWidget.prototype = { } } } else { - //if there are no points on the map, zoom to max + //if there are no points on the map, zoom to max this.openlayersMap.zoomTo(0); if (this.zoomSlider) { this.zoomSlider.setValue(this.getZoom()); diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 3709cef..51512c3 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -49,7 +49,7 @@ function PlacenameTags(circle, map) { var k = this.circle.search; var weight = 0; var labels = []; - + var levelOfDetail = 0; if (this.map.options.placenameTagsStyle === 'zoom') levelOfDetail = this.map.getLevelOfDetail(); @@ -59,7 +59,7 @@ function PlacenameTags(circle, map) { var maxLevel; for (var i = 0; i < elements.length; i++) { var level = elements[i].placeDetails[this.map.options.mapIndex].length-1; - + if (typeof maxLevel === "undefined") maxLevel = level; if (maxLevel > level) @@ -72,15 +72,15 @@ function PlacenameTags(circle, map) { for (levelOfDetail = 0; levelOfDetail < maxLevel; levelOfDetail++){ var differenceFound = false; for (var i = 0; i < (elements.length-1); i++) { - if ( elements[i].getPlace(this.map.options.mapIndex, levelOfDetail) !== + if ( elements[i].getPlace(this.map.options.mapIndex, levelOfDetail) !== elements[i+1].getPlace(this.map.options.mapIndex, levelOfDetail)) differenceFound = true; } - if (differenceFound === true) + if (differenceFound === true) break; - } + } } - + for (var i = 0; i < elements.length; i++) { weight += elements[i].weight; var found = false; @@ -302,6 +302,11 @@ function PackPlacenameTags(circle, map) { weight += elements[i].weight; var found = false; var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); + + var nameLabel = elements[i].getName(this.map.options.mapIndex, levelOfDetail); + + console.log(label + " " + nameLabel); + if (label == "") { label = "unknown"; } diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index dcd324c..fd9db20 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -97,7 +97,7 @@ StorytellingWidget.prototype = { magneticLinkParam += dataset.url; var tableLinkDiv = document.createElement('a'); - tableLinkDiv.title = 'Open dataset ' + dataset.label + ' directly in DARIAH-DE OwnStorage. The dataset must be public or you need to be owner of the dataset.'; + tableLinkDiv.title = 'Open/download dataset ' + dataset.label + ' directly from source location. Datasets from DARIAH-DE OwnStorage must be public or you need to be owner of the dataset.'; tableLinkDiv.href = dataset.url; tableLinkDiv.target = '_'; tableLinkDiv.setAttribute('class', 'externalLink'); diff --git a/js/Table/Table.js b/js/Table/Table.js index cb17a53..b974107 100644 --- a/js/Table/Table.js +++ b/js/Table/Table.js @@ -442,6 +442,9 @@ Table.prototype = { } } for (var key in this.elements[0].object.tableContent) { + + console.log("key: " + key + " - tableContent: " + this.elements[0].object.tableContent); + addSortButton(key); } }, @@ -663,6 +666,9 @@ Table.prototype = { var key = table.keyHeaderList[k]; //vhz var text = e.object.tableContent[key]; + + console.log(k + ". key: " + key + " - text: " + text); + if (typeof text === "undefined") text = ""; var cell = $("").appendTo(itemRow); From 73aeebbb3d04347287f719991f50b8a8152e3055 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 10:41:01 +0200 Subject: [PATCH 24/47] removed labels again... :-) --- js/Map/PlacenameTags.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 51512c3..043de6d 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -302,11 +302,6 @@ function PackPlacenameTags(circle, map) { weight += elements[i].weight; var found = false; var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); - - var nameLabel = elements[i].getName(this.map.options.mapIndex, levelOfDetail); - - console.log(label + " " + nameLabel); - if (label == "") { label = "unknown"; } From 389e666be1b69ce76719b0898d2b7d97e8497777 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 10:41:44 +0200 Subject: [PATCH 25/47] added labels again... ARGL! :-D --- js/Map/PlacenameTags.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 043de6d..7eaf6ae 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -302,6 +302,15 @@ function PackPlacenameTags(circle, map) { weight += elements[i].weight; var found = false; var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); + + // ++TODO++ + + var nameLabel = elements[i].getName(this.map.options.mapIndex, levelOfDetail); + + console.log(label + " " + nameLabel); + + // ++TODO++ + if (label == "") { label = "unknown"; } From 6ac5eb20560b241c066f9afef3b7e074b6cf0d00 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 11:29:30 +0200 Subject: [PATCH 26/47] Testing name and place label changes. --- js/Map/PlacenameTags.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 7eaf6ae..5fa3e7b 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -301,16 +301,13 @@ function PackPlacenameTags(circle, map) { for (var i = 0; i < elements.length; i++) { weight += elements[i].weight; var found = false; - var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); - - // ++TODO++ - - var nameLabel = elements[i].getName(this.map.options.mapIndex, levelOfDetail); - - console.log(label + " " + nameLabel); - - // ++TODO++ - + // Take "name" as label per default. + var label = elements[i].getName(this.map.options.mapIndex, levelOfDetail); + // If name value is empty, take label from "Address" (Place). + if (label == "") { + label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); + } + // If label still is empty, set to "unknown". if (label == "") { label = "unknown"; } From f382f9a89d2a314d28a7ea5a37a18e064f484e28 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 12:25:12 +0200 Subject: [PATCH 27/47] More placename tag testing... --- js/Map/PlacenameTags.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 5fa3e7b..dc6a3af 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -302,6 +302,11 @@ function PackPlacenameTags(circle, map) { weight += elements[i].weight; var found = false; // Take "name" as label per default. + + + console.log("elements: ", elements); + + var label = elements[i].getName(this.map.options.mapIndex, levelOfDetail); // If name value is empty, take label from "Address" (Place). if (label == "") { From c0001be520f495ede867abb4edeb5bf8d19c5590 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 12:48:24 +0200 Subject: [PATCH 28/47] ...more testing... --- js/Map/PlacenameTags.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index dc6a3af..895fcb1 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -294,6 +294,9 @@ function PackPlacenameTags(circle, map) { this.getLabelList = function(circle) { var elements = circle.elements; + + console.log("elements: ", elements); + var k = circle.search; var weight = 0; var labels = []; From 416bbae9a8ff47e4ac5216a85a2a88af177f49f0 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 16:26:33 +0200 Subject: [PATCH 29/47] ...more popup label testing... --- js/Map/PlacenameTags.js | 23 ++++++++--------------- js/Table/Table.js | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 895fcb1..0102c66 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -294,9 +294,6 @@ function PackPlacenameTags(circle, map) { this.getLabelList = function(circle) { var elements = circle.elements; - - console.log("elements: ", elements); - var k = circle.search; var weight = 0; var labels = []; @@ -304,22 +301,18 @@ function PackPlacenameTags(circle, map) { for (var i = 0; i < elements.length; i++) { weight += elements[i].weight; var found = false; - // Take "name" as label per default. - - - console.log("elements: ", elements); - - - var label = elements[i].getName(this.map.options.mapIndex, levelOfDetail); - // If name value is empty, take label from "Address" (Place). - if (label == "") { - label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); - } - // If label still is empty, set to "unknown". + var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); if (label == "") { label = "unknown"; } + + console.log("label: " + label); + for (var j = 0; j < labels.length; j++) { + + console.log("labels: ", labels[j]); + console.log("elements: ", elements[i]); + if (labels[j].place == label) { labels[j].elements.push(elements[i]); labels[j].weight += elements[i].weight; diff --git a/js/Table/Table.js b/js/Table/Table.js index b974107..dc09b56 100644 --- a/js/Table/Table.js +++ b/js/Table/Table.js @@ -443,7 +443,7 @@ Table.prototype = { } for (var key in this.elements[0].object.tableContent) { - console.log("key: " + key + " - tableContent: " + this.elements[0].object.tableContent); +// console.log("key: " + key + " - tableContent: " + this.elements[0].object.tableContent); addSortButton(key); } From 8a8d62ff381905275707cbdec659049b99d3859b Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 10 Jun 2020 17:43:02 +0200 Subject: [PATCH 30/47] Remove some unused console.logs. Add name usage for circle popups: if name is existing, we use name, if not, we use place, if not, we use "nknown" now! --- js/Map/PlacenameTags.js | 26 ++++++++++++++------------ js/Table/Table.js | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/js/Map/PlacenameTags.js b/js/Map/PlacenameTags.js index 0102c66..dda301a 100644 --- a/js/Map/PlacenameTags.js +++ b/js/Map/PlacenameTags.js @@ -32,7 +32,7 @@ function PlacenameTags(circle, map) { this.circle = circle; this.map = map; - this.placeLabels + this.placeLabels this.selectedLabel this.allLabel @@ -51,10 +51,11 @@ function PlacenameTags(circle, map) { var labels = []; var levelOfDetail = 0; - if (this.map.options.placenameTagsStyle === 'zoom') + if (this.map.options.placenameTagsStyle === 'zoom') { levelOfDetail = this.map.getLevelOfDetail(); + } - if (this.map.options.placenameTagsStyle === 'value'){ + if (this.map.options.placenameTagsStyle === 'value') { //find max level that _all_ elements have a value for var maxLevel; for (var i = 0; i < elements.length; i++) { @@ -84,11 +85,19 @@ function PlacenameTags(circle, map) { for (var i = 0; i < elements.length; i++) { weight += elements[i].weight; var found = false; - var label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); + + // First take "name" as label... + var label = elements[i].name; + // ...if "name" is empty, try place... + if (label == "") { + label = elements[i].getPlace(this.map.options.mapIndex, levelOfDetail); + } + // In the end, set to unknown. if (label == "") { label = "unknown"; } - for (var j = 0; j < labels.length; j++) { + + for (var j = 0; j < labels.length; j++) { if (labels[j].place == label) { labels[j].elements.push(elements[i]); labels[j].weight += elements[i].weight; @@ -305,14 +314,7 @@ function PackPlacenameTags(circle, map) { if (label == "") { label = "unknown"; } - - console.log("label: " + label); - for (var j = 0; j < labels.length; j++) { - - console.log("labels: ", labels[j]); - console.log("elements: ", elements[i]); - if (labels[j].place == label) { labels[j].elements.push(elements[i]); labels[j].weight += elements[i].weight; diff --git a/js/Table/Table.js b/js/Table/Table.js index dc09b56..f44dbc0 100644 --- a/js/Table/Table.js +++ b/js/Table/Table.js @@ -667,7 +667,7 @@ Table.prototype = { //vhz var text = e.object.tableContent[key]; - console.log(k + ". key: " + key + " - text: " + text); +// console.log(k + ". key: " + key + " - text: " + text); if (typeof text === "undefined") text = ""; From f4e6bcbf4b7645fa5b009ec0cfbb2df9ef95a708 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Tue, 8 Sep 2020 15:56:58 +0200 Subject: [PATCH 31/47] Add logging to CSV and KML URL loading. --- js/Dataloader/Dataloader.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 9906f18..9f4768b 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -36,7 +36,8 @@ function Dataloader(parent) { this.initialize(); } -var addToProxysWhitelistMessage = "Could not load file!\n\nPlease check your URL. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; +var addToProxysWhitelistMessage1 = "Could not load data!\n\nPlease check your URL: "; +var addToProxysWhitelistMessage2 = ". If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; Dataloader.prototype = { @@ -176,7 +177,7 @@ Dataloader.prototype = { if (dataSet != null) this.distributeDataset(dataSet); } else - alert(addToProxysWhitelistMessage); + alert(addToProxysWhitelistMessage1 + kmlURL + addToProxysWhitelistMessage2); },this)); $(this.parent.gui.loaders).append(this.KMLLoaderTab); @@ -245,12 +246,15 @@ Dataloader.prototype = { var fileName = dataLoader.getFileName(csvURL); // Choose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ + + console.log("type of json: ", json, json.length); + if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); if (dataSet != null) dataLoader.distributeDataset(dataSet); } else - alert(addToProxysWhitelistMessage); + alert(addToProxysWhitelistMessage1 + csvURL + addToProxysWhitelistMessage2); }); },this)); From b199f4818e5e93a93528b010d0e77ee6f868de0c Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 15:31:36 +0200 Subject: [PATCH 32/47] Testing bug #33217... --- js/Dataloader/Dataloader.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 9f4768b..7d92a15 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -36,8 +36,8 @@ function Dataloader(parent) { this.initialize(); } -var addToProxysWhitelistMessage1 = "Could not load data!\n\nPlease check your URL: "; -var addToProxysWhitelistMessage2 = ". If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; +var addToProxysWhitelistMessage1 = "Could not load data!\n\nPlease check your URL <"; +var addToProxysWhitelistMessage2 = ">. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; Dataloader.prototype = { @@ -247,7 +247,8 @@ Dataloader.prototype = { // Choose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ - console.log("type of json: ", json, json.length); + console.log("json --> ", json); + console.log("type of json --> ", typeof json); if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); From 72ad1670b5fe1958db7478fd65c39e320b2b44dc Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 15:41:38 +0200 Subject: [PATCH 33/47] More testing... --- js/GeoTemConfig.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 9dd5c64..7a5f9ee 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -494,6 +494,9 @@ GeoTemConfig.removeDataset = function(index){ * @param {String} text Text to convert. */ GeoTemConfig.convertCsv = function(text){ + + console.log("text --> ", text); + /* convert here from CSV to JSON */ var json = []; /* define expected csv table headers (first line) */ @@ -576,6 +579,8 @@ GeoTemConfig.convertCsv = function(text){ json.push(dataObject); } + console.log("json --> ", json); + return json; }; From efe479d7f1b19a9ba93296af2493900c6bc70a53 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 16:08:45 +0200 Subject: [PATCH 34/47] mc --- js/GeoTemConfig.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 7a5f9ee..5bf8f00 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -503,6 +503,9 @@ GeoTemConfig.convertCsv = function(text){ var expectedHeaders = new Array("Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end","weight"); /* convert csv string to array of arrays using ucsv library */ var csvArray = CSV.csvToArray(text); + + console.log("array --> ", csvArray); + /* get real used table headers from csv file (first line) */ var usedHeaders = csvArray[0]; /* loop outer array, begin with second line */ From 3cc80b6f67e77d840659c2326115e04d2700d3f9 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 16:43:15 +0200 Subject: [PATCH 35/47] mc --- js/GeoTemConfig.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 5bf8f00..e968602 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -508,6 +508,9 @@ GeoTemConfig.convertCsv = function(text){ /* get real used table headers from csv file (first line) */ var usedHeaders = csvArray[0]; + + console.log("usedHeaders --> ", usedHeaders); + /* loop outer array, begin with second line */ for (var i = 1; i < csvArray.length; i++) { var innerArray = csvArray[i]; From d2eb85450ac0df2471489c58ea7bfe7f86656865 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 17:00:24 +0200 Subject: [PATCH 36/47] Add TODO to js file. Add a more specific error message. --- js/Dataloader/Dataloader.js | 6 +++--- js/GeoTemConfig.js | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 7d92a15..f48c3da 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -37,7 +37,7 @@ function Dataloader(parent) { } var addToProxysWhitelistMessage1 = "Could not load data!\n\nPlease check your URL <"; -var addToProxysWhitelistMessage2 = ">. If the URL is correct, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; +var addToProxysWhitelistMessage2 = ">. If the URL is correct, and the file is a non-empty Geo-Browser CSV data file, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; Dataloader.prototype = { @@ -247,8 +247,8 @@ Dataloader.prototype = { // Choose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ - console.log("json --> ", json); - console.log("type of json --> ", typeof json); +// console.log("json --> ", json); +// console.log("type of json --> ", typeof json); if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index e968602..d2afb1f 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -495,7 +495,7 @@ GeoTemConfig.removeDataset = function(index){ */ GeoTemConfig.convertCsv = function(text){ - console.log("text --> ", text); +// console.log("text --> ", text); /* convert here from CSV to JSON */ var json = []; @@ -504,12 +504,12 @@ GeoTemConfig.convertCsv = function(text){ /* convert csv string to array of arrays using ucsv library */ var csvArray = CSV.csvToArray(text); - console.log("array --> ", csvArray); +// console.log("array --> ", csvArray); /* get real used table headers from csv file (first line) */ var usedHeaders = csvArray[0]; - console.log("usedHeaders --> ", usedHeaders); +// console.log("usedHeaders --> ", usedHeaders); /* loop outer array, begin with second line */ for (var i = 1; i < csvArray.length; i++) { @@ -585,7 +585,9 @@ GeoTemConfig.convertCsv = function(text){ json.push(dataObject); } - console.log("json --> ", json); +// console.log("json --> ", json); + + // TODO We should devide three cases here for not displaying the data: (i) proxy could not load file, (ii) file is empty or invalid and non-interpretable Geo-Browser CSV data, and (iii) file is a Geo-Browser CSV file (at least some of the expectedHeaders existing) and no content!! return json; }; From cba06e1ae3bd53345b386d997c5837ed289e18dc Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Wed, 9 Sep 2020 17:06:06 +0200 Subject: [PATCH 37/47] Add CSV and KML to error message. --- js/Dataloader/Dataloader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index f48c3da..84e1701 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -37,7 +37,7 @@ function Dataloader(parent) { } var addToProxysWhitelistMessage1 = "Could not load data!\n\nPlease check your URL <"; -var addToProxysWhitelistMessage2 = ">. If the URL is correct, and the file is a non-empty Geo-Browser CSV data file, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; +var addToProxysWhitelistMessage2 = "> and CSV or KML file content. If the URL is correct, and the file is a non-empty Geo-Browser CSV or KML data file, our proxy may prevent the file from loading. In that case please send us an email, we gladly add your host to the proxy's white list."; Dataloader.prototype = { From c91d428dd2809e147b4c04ca24b4313da62554c6 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 13:37:15 +0100 Subject: [PATCH 38/47] Update map source attributions Fixes #34120 --- js/Map/MapConfig.js | 105 ++++++++++++-------------- js/Map/MapGui.js | 10 +-- js/Storytelling/StorytellingWidget.js | 10 +-- 3 files changed, 55 insertions(+), 70 deletions(-) diff --git a/js/Map/MapConfig.js b/js/Map/MapConfig.js index f87af1d..fd34515 100644 --- a/js/Map/MapConfig.js +++ b/js/Map/MapConfig.js @@ -30,7 +30,11 @@ function MapConfig(options) { var gsurl = 'https://ref.de.dariah.eu/geoserver'; - var mpiwgurl = 'http://geoserver.mpiwg-berlin.mpg.de/geoserver'; + + var euroGraphicsAttribution = "© EuroGeographics for the administrative boundaries"; + var mapsForFreeAttribution = "© Maps for Free, released under Creative Commons CC0"; + var dareAttribution = "© Johan Åhlfeldt, Digital Atlas of the Roman Empire (DARE)"; + var thinkQuestAttribution = "© ThinkQuest Team C006628"; this.options = { mapWidth : false, // false or desired width css definition for the map @@ -42,16 +46,28 @@ function MapConfig(options) { name: '-----------------------------------', }, { - name: 'Contemporary map 2014', + name: 'Contemporary map of 2014', url: gsurl + '/eurostat/wms', layer: 'eurostat:CNTR_RG_03M_2014', - attribution: "© EuroGeographics for the administrative boundaries" + attribution: euroGraphicsAttribution }, { - name: 'Contemporary map 2013', + name: 'Contemporary map of 2013', url: gsurl + '/eurostat/wms', layer: 'eurostat:CNTR_RG_03M_2013', - attribution: "© EuroGeographics for the administrative boundaries" + attribution: euroGraphicsAttribution + }, + { + name: 'Contemporary map of 2010', + url: gsurl + '/eurostat/wms', + layer: 'eurostat:CNTR_RG_03M_2010', + attribution: euroGraphicsAttribution + }, + { + name: 'Contemporary map of 2006', + url: gsurl + '/eurostat/wms', + layer: 'eurostat:CNTR_RG_03M_2006 ', + attribution: euroGraphicsAttribution }, { name: '-----------------------------------', @@ -60,182 +76,155 @@ function MapConfig(options) { name: 'Maps-for-Free relief map', url: 'https://maps-for-free.com/layer/relief/z${z}/row${y}/${z}_${x}-${y}.jpg', type:'XYZ', - attribution: "© Maps for Free" + attribution: mapsForFreeAttribution }, { name: 'Digital Atlas of the Roman Empire', url: 'https://dh.gu.se/tiles/imperium/${z}/${x}/${y}.png', type:'XYZ', - attribution: "© Johan Åhlfeldt, Digital Atlas of the Roman Empire (DARE)" + attribution: dareAttribution }, { name: '-----------------------------------', }, - { - name: 'Historical map of 2010', - url: gsurl + '/eurostat/wms', - layer: 'eurostat:CNTR_RG_03M_2010', - attribution: "© EuroGeographics for the administrative boundaries" - }, - { - name: 'Historical map of 2006', - url: gsurl + '/eurostat/wms', - layer: 'eurostat:CNTR_RG_03M_2006 ', - attribution: "© EuroGeographics for the administrative boundaries" - }, { name: 'Historical map of 1994', url: gsurl + '/historic/wms', layer: 'historic:cntry1994', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1949', url: gsurl + '/historic/wms', layer: 'historic:cntry1949', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1938', url: gsurl + '/historic/wms', layer: 'historic:cntry1938', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1920', url: gsurl + '/historic/wms', layer: 'historic:cntry1920', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1914', url: gsurl + '/historic/wms', layer: 'historic:cntry1914', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1880', url: gsurl + '/historic/wms', layer: 'historic:cntry1880', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1815', url: gsurl + '/historic/wms', layer: 'historic:cntry1815', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1783', url: gsurl + '/historic/wms', layer: 'historic:cntry1783', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1715', url: gsurl + '/historic/wms', layer: 'historic:cntry1715', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1650', url: gsurl + '/historic/wms', layer: 'historic:cntry1650', - attribution: "© ThinkQuest Team C006628" - }, + attribution: thinkQuestAttribution + }, { name: 'Historical map of 1530', url: gsurl + '/historic/wms', layer: 'historic:cntry1530', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1492', url: gsurl + '/historic/wms', layer: 'historic:cntry1492', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1279', url: gsurl + '/historic/wms', layer: 'historic:cntry1279', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1000', url: gsurl + '/historic/wms', layer: 'historic:cntry1000', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 800', url: gsurl + '/historic/wms', layer: 'historic:cntry800', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 600', url: gsurl + '/historic/wms', layer: 'historic:cntry600', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 400', url: gsurl + '/historic/wms', layer: 'historic:cntry400', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry1bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 200 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry200bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 323 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry323bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 500 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry500bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 1000 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry1000bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, { name: 'Historical map of 2000 BC', url: gsurl + '/historic/wms', layer: 'historic:cntry2000bc', - attribution: "© ThinkQuest Team C006628" + attribution: thinkQuestAttribution }, -// { -// name: '-----------------------------------', -// }, -// { -// name: 'CSHAPE borders 1994-12-15', -// url: mpiwgurl + '/mpiwg/wms', -// layer: 'mpiwg:borders_1994_12_15', -// attribution: "© ++TODO++" -// }, -// { -// name: 'Historical map 1957-03-06', -// url: gsurl + '/mpiwg/wms', -// layer: 'mpiwg:borders_1957_3_6Polygon', -// attribution: "© ++TODO++" -// }, ], legend : true, // if a legend at the bottom of the map should be shown or not mapMerge : false, // if the elements of distinct datasets should be merged into one set or not diff --git a/js/Map/MapGui.js b/js/Map/MapGui.js index 9f538d6..2df9474 100644 --- a/js/Map/MapGui.js +++ b/js/Map/MapGui.js @@ -114,7 +114,7 @@ function MapGui(map, div, options, iid) { mapSum.appendChild(this.mapElements); tools.appendChild(mapSum); } - + this.lockTitle = document.createElement("td"); titles.appendChild(this.lockTitle); this.lockIcon = document.createElement("td"); @@ -236,16 +236,12 @@ function MapGui(map, div, options, iid) { this.mapWindow.appendChild(this.legendDiv); } - var linkForOsm = 'http://www.openstreetmap.org/'; - var linkForLicense = 'http://creativecommons.org/licenses/by-sa/2.0/'; this.osmLink = document.createElement("div"); this.osmLink.setAttribute('class', 'osmLink'); - this.osmLink.innerHTML = '(c) OpenStreetMap contributors, CC-BY-SA'; this.mapWindow.appendChild(this.osmLink); - this.osmMapQuestLink = document.createElement("div"); + this.osmMapQuestLink = document.createElement("div"); this.osmMapQuestLink.setAttribute('class', 'osmLink'); - this.osmMapQuestLink.innerHTML = '(c) Data, imagery and map information provided by MapQuest MapQuest OpenStreetMap contributors, CC-BY-SA'; this.mapWindow.appendChild(this.osmMapQuestLink); // var tooltip = document.createElement("div"); @@ -342,7 +338,7 @@ function MapGui(map, div, options, iid) { var stroke = 'rgb(' + c.r1 + ',' + c.g1 + ',' + c.b1 + ')'; var svg = ''; $(''+svg+'').appendTo(row); - } + } $(''+datasets[i].label+'').appendTo(row); } }; diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index fd9db20..9f96479 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -83,7 +83,7 @@ StorytellingWidget.prototype = { // TODO: makes only sense for KML or CSV URLs, so "type" of // URL should be preserved (in dataset). // startsWith and endsWith defined in SIMILE Ajax (string.js) - var type="csv"; + var type = "csv"; if (typeof dataset.type !== "undefined") { type = dataset.type; } else { @@ -92,7 +92,7 @@ StorytellingWidget.prototype = { } } - magneticLinkParam += type+linkCount+"="; + magneticLinkParam += type+linkCount + "="; linkCount++; magneticLinkParam += dataset.url; @@ -137,7 +137,7 @@ StorytellingWidget.prototype = { paragraph.append(uploadToDARIAH); } // TODO: if layout is more usable, both options could be used ("else" removed) - else if (storytellingWidget.options.localStorage){ + else if (storytellingWidget.options.localStorage) { var saveToLocalStorage = document.createElement('a'); $(saveToLocalStorage).append(" [save to local storage]"); saveToLocalStorage.title = ""; @@ -145,7 +145,7 @@ StorytellingWidget.prototype = { var localDatasetIndex = new Number(datasetIndex); $(saveToLocalStorage).click(function(){ var csv = GeoTemConfig.createCSVfromDataset(localDatasetIndex); - var storageName = "GeoBrowser_dataset_"+GeoTemConfig.datasets[localDatasetIndex].label; + var storageName = "GeoBrowser_dataset_" + GeoTemConfig.datasets[localDatasetIndex].label; $.remember({ name:storageName, value:csv @@ -177,7 +177,7 @@ StorytellingWidget.prototype = { magneticLink.setAttribute('class', 'magneticLink'); $(magneticLink).append("Magnetic link"); magneticLink.title = "Use this link to reload or share currently loaded view of online datasets."; - magneticLink.href = "?"+this.datasetLink; + magneticLink.href = "?" + this.datasetLink; var currentStatusParam = $.param(this.currentStatus); if (currentStatusParam.length > 0) { magneticLink.href += "¤tStatus="+currentStatusParam; From 63b62198ab3bb22f87a81bbc4b78ba3d705f04c3 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 15:39:16 +0100 Subject: [PATCH 39/47] Fix little bug visualising magnetic link if map changes --- js/Storytelling/StorytellingWidget.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 9f96479..d34a313 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -171,10 +171,11 @@ StorytellingWidget.prototype = { }, createLink : function() { - $(this.gui.storytellingContainer).find('.magneticLink').remove(); + // Remove

"); + + // Add paragraph containing newly created magnetic link. + var paragraph = document.createElement('p'); + paragraphg.setAttribute('class', 'magneticLink'); paragraph.append(magneticLink); paragraph.append(' (online datasets only)'); $(this.gui.storytellingContainer).prepend(paragraph); From b8db08bd36fc56669b77c185294db4105bcaac7d Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 16:43:06 +0100 Subject: [PATCH 40/47] Correct typo --- js/Storytelling/StorytellingWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index d34a313..aa16eb7 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -116,7 +116,7 @@ StorytellingWidget.prototype = { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); - uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. If the dataset is not already in CSV format, it will be comverted automatically and then be uploaded. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; + uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. If the dataset is not already in CSV format, it will be converted automatically and then be uploaded. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; uploadToDARIAH.href = dataset.url; var localDatasetIndex = new Number(datasetIndex); $(uploadToDARIAH).click(function(){ From 17faf71ae74359774cf0b975e4f3b3d8de1b8fec Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 17:03:24 +0100 Subject: [PATCH 41/47] Fix typo in magnetic link creation --- js/Storytelling/StorytellingWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index aa16eb7..9430595 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -187,7 +187,7 @@ StorytellingWidget.prototype = { // Add paragraph containing newly created magnetic link. var paragraph = document.createElement('p'); - paragraphg.setAttribute('class', 'magneticLink'); + paragraph.setAttribute('class', 'magneticLink'); paragraph.append(magneticLink); paragraph.append(' (online datasets only)'); $(this.gui.storytellingContainer).prepend(paragraph); From 14640cae9a0d27d8ca29c18935c0bab64bd3c421 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 18:06:56 +0100 Subject: [PATCH 42/47] Add logging for magnetic link dataset type --- js/Storytelling/StorytellingWidget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 9430595..a2d4fc8 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -70,6 +70,8 @@ StorytellingWidget.prototype = { $(storytellingWidget.datasets).each(function(){ var dataset = this; + console.log("dataset: " + dataset); + if (magneticLinkParam.length > 0) { magneticLinkParam += "&"; } From 40105dbfbc1794ebb520d4fb2f2ca995174e9bde Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 18:17:43 +0100 Subject: [PATCH 43/47] ...Correct logging --- js/Storytelling/StorytellingWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index a2d4fc8..c8af89d 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -70,7 +70,7 @@ StorytellingWidget.prototype = { $(storytellingWidget.datasets).each(function(){ var dataset = this; - console.log("dataset: " + dataset); + console.log(dataset); if (magneticLinkParam.length > 0) { magneticLinkParam += "&"; From 7688d17c86b841b844677157fe17d2f958de4e4e Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 19:22:25 +0100 Subject: [PATCH 44/47] Add login hint to alert if storing to dariah storage fails. Add dataset.type if loading from URL. --- js/Dataloader/DataloaderWidget.js | 11 ++++++----- js/GeoTemConfig.js | 5 ++++- js/Storytelling/StorytellingWidget.js | 4 ++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/js/Dataloader/DataloaderWidget.js b/js/Dataloader/DataloaderWidget.js index 2ef8a5a..81cca6c 100644 --- a/js/Dataloader/DataloaderWidget.js +++ b/js/Dataloader/DataloaderWidget.js @@ -316,7 +316,7 @@ DataloaderWidget.prototype = { paramValue = GeoTemConfig.proxy + paramValue; } GeoTemConfig.getKml(paramValue, function(kmlDoc){ - var dataSet = new Dataset(GeoTemConfig.loadKml(kmlDoc), fileName, origURL); + var dataSet = new Dataset(GeoTemConfig.loadKml(kmlDoc), fileName, origURL, "kml"); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; @@ -329,7 +329,7 @@ DataloaderWidget.prototype = { } else if (paramName.toLowerCase().startsWith("csv")){ GeoTemConfig.getCsv(paramValue,function(json){ - var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL, "csv"); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; @@ -342,7 +342,7 @@ DataloaderWidget.prototype = { } else if (paramName.toLowerCase().startsWith("json")){ GeoTemConfig.getJson(paramValue,function(json){ - var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL, "json"); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; @@ -382,13 +382,14 @@ DataloaderWidget.prototype = { workbook = XLSX.read(arr.join(""), {type:"binary"}); var csv = XLSX.utils.sheet_to_csv(workbook.Sheets[workbook.SheetNames[0]]); var json = GeoTemConfig.convertCsv(csv); - } else { + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL, "xlsx"); + } else { workbook = XLS.read(arr.join(""), {type:"binary"}); var csv = XLS.utils.sheet_to_csv(workbook.Sheets[workbook.SheetNames[0]]); var json = GeoTemConfig.convertCsv(csv); + var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL, "xls"); } - var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); if (dataSet != null){ if (!isNaN(datasetID)){ datasets[datasetID] = dataSet; diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index d2afb1f..ca7cbb4 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -1481,7 +1481,10 @@ GeoTemConfig.storeToDariahStorage = function(postdata, asyncFunc) { }, error: function(xhr, textStatus, errorThrown) { var title = 'Error storing dataset to the DARIAH-DE Storage: ' + xhr.status + ' ' + errorThrown + '!'; - var message = 'The dataset with URL ' + url + ' could not be stored to the DARIAH-DE Storage!'; + var message = 'The dataset could not be stored to the DARIAH-DE Storage!'; + if (xhr.status == "401") { + message += " Please try logging in first and then re-load your local file. We apologise for the inconvenience!"; + } alert(title + "\n\n" + message); } }); } diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index c8af89d..4b23fa4 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -82,6 +82,10 @@ StorytellingWidget.prototype = { var paragraph = $("

"); paragraph.append(dataset.label); if (typeof dataset.url !== "undefined"){ + + console.log(dataset.url); + console.log(dataset.type); + // TODO: makes only sense for KML or CSV URLs, so "type" of // URL should be preserved (in dataset). // startsWith and endsWith defined in SIMILE Ajax (string.js) From f45f8a7d6edf612ccfa7ecb3c0f6971430eecee1 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 19:28:35 +0100 Subject: [PATCH 45/47] Remove logging --- js/Dataloader/Dataloader.js | 4 ---- js/Storytelling/StorytellingWidget.js | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/js/Dataloader/Dataloader.js b/js/Dataloader/Dataloader.js index 84e1701..193a539 100644 --- a/js/Dataloader/Dataloader.js +++ b/js/Dataloader/Dataloader.js @@ -246,10 +246,6 @@ Dataloader.prototype = { var fileName = dataLoader.getFileName(csvURL); // Choose proxy or direct access in GeoTemConfig.getCSV(). GeoTemConfig.getCsv(csvURL, function(json){ - -// console.log("json --> ", json); -// console.log("type of json --> ", typeof json); - if ((typeof json !== "undefined") && (json.length > 0)) { var dataSet = new Dataset(GeoTemConfig.loadJson(json), fileName, origURL); if (dataSet != null) diff --git a/js/Storytelling/StorytellingWidget.js b/js/Storytelling/StorytellingWidget.js index 4b23fa4..17d0684 100644 --- a/js/Storytelling/StorytellingWidget.js +++ b/js/Storytelling/StorytellingWidget.js @@ -70,8 +70,6 @@ StorytellingWidget.prototype = { $(storytellingWidget.datasets).each(function(){ var dataset = this; - console.log(dataset); - if (magneticLinkParam.length > 0) { magneticLinkParam += "&"; } @@ -83,9 +81,6 @@ StorytellingWidget.prototype = { paragraph.append(dataset.label); if (typeof dataset.url !== "undefined"){ - console.log(dataset.url); - console.log(dataset.type); - // TODO: makes only sense for KML or CSV URLs, so "type" of // URL should be preserved (in dataset). // startsWith and endsWith defined in SIMILE Ajax (string.js) @@ -122,7 +117,7 @@ StorytellingWidget.prototype = { if (storytellingWidget.options.dariahStorage){ var uploadToDARIAH = document.createElement('a'); $(uploadToDARIAH).append(" [upload to DARIAH-DE Storage]"); - uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. If the dataset is not already in CSV format, it will be converted automatically and then be uploaded. The filename of your uploaded file will be lost, we apologise for the inconvenience!"; + uploadToDARIAH.title = "Only CSV documents can be uploaded to the DARIAH-DE Storage, so you can edit them using the Datasheet Editor. If the dataset is not already in CSV format, it will be converted automatically and then be uploaded. The filename of your uploaded file will be lost and you have to login first! We apologise for the inconvenience!"; uploadToDARIAH.href = dataset.url; var localDatasetIndex = new Number(datasetIndex); $(uploadToDARIAH).click(function(){ From f4aec68cad38d1693dab822042078220aa523bc5 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Mon, 16 Nov 2020 19:40:35 +0100 Subject: [PATCH 46/47] Add BETA datasheet editor URL to config, DO REMOVE FOR RELEASE! :-D --- js/GeoTemConfig.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index ca7cbb4..9b5f07c 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -58,7 +58,8 @@ GeoTemConfig = { proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass // X-Domain problems) dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage - datasheetEditorURL : '/edit/index.html', // URL of the Datasheet Editor + // FIXME REMOVE the "/beta" for Release! + datasheetEditorURL : '/beta/edit/index.html', // URL of the Datasheet Editor dariahOwnStorageBearerPrefix : 'bearer ', dariahOwnStorageLogIDPrefix : 'GEOBRO_', //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected From 22d9c3f163119773b17c2680dfca3efc2d319711 Mon Sep 17 00:00:00 2001 From: "Stefan E. Funk" Date: Thu, 19 Nov 2020 15:04:50 +0100 Subject: [PATCH 47/47] Remove trst and pdpdev things --- js/GeoTemConfig.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/GeoTemConfig.js b/js/GeoTemConfig.js index 9b5f07c..779b8fb 100644 --- a/js/GeoTemConfig.js +++ b/js/GeoTemConfig.js @@ -57,9 +57,8 @@ GeoTemConfig = { allowColumnRenaming : true, proxy : '/php/proxy.php?address=', // set this if a HTTP proxy shall be used (e.g. to bypass // X-Domain problems) - dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/test/dariah/', // URL of DARIAH-DE OwnStorage - // FIXME REMOVE the "/beta" for Release! - datasheetEditorURL : '/beta/edit/index.html', // URL of the Datasheet Editor + dariahOwnStorageURL : 'https://cdstar.de.dariah.eu/dariah/', // URL of DARIAH-DE OwnStorage + datasheetEditorURL : '/edit/index.html', // URL of the Datasheet Editor dariahOwnStorageBearerPrefix : 'bearer ', dariahOwnStorageLogIDPrefix : 'GEOBRO_', //colors for several datasets; rgb1 will be used for selected objects, rgb0 for unselected