diff --git a/gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js b/gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js index d49f38cd4daaa16fb1f6778bd0f39dd3b56eddd0..52fcbddadb1bee81bbebc7db326b2b47a96f3e01 100644 --- a/gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js +++ b/gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js @@ -9,11 +9,11 @@ var startCharacter, endCharacter; * This function will fire when the DOM is ready */ $(document).ready(function() { - let fullSubmissionId = getValueFromUrl("fullSubmissionId"); - let category = getValueFromUrl("category"); + let fullSubmissionId = getQueryVariable("fullSubmissionId"); + let category = getQueryVariable("category"); // fetch full submission from database - getFullSubmission(getValueFromUrl("fullSubmissionId"), function (response) { + getFullSubmission(getQueryVariable("fullSubmissionId"), function (response) { // set text $('#documentText').html(response.text); @@ -610,8 +610,8 @@ function toggleButtonHandler(id) { function saveNewAnnotation(title, comment, startCharacter, endCharacter) { // initialize target - let targetId = getValueFromUrl("fullSubmissionId"); - let targetCategory = getValueFromUrl("category"); + let targetId = getQueryVariable("fullSubmissionId"); + let targetCategory = getQueryVariable("category"); let userToken = getUserTokenFromUrl(); // build annotationPostRequest diff --git a/gemeinsamforschen/src/main/webapp/assets/js/project-student.js b/gemeinsamforschen/src/main/webapp/assets/js/project-student.js index 52d70fce190a33b61943161dd21b71688945a553..520600a93a3444968585c2d382cd2497acb5c0b5 100644 --- a/gemeinsamforschen/src/main/webapp/assets/js/project-student.js +++ b/gemeinsamforschen/src/main/webapp/assets/js/project-student.js @@ -1,6 +1,6 @@ $(document).ready(function(){ // fetch all submission part project representations from database - getSubmissionPartsByProjectId(getValueFromUrl("projectId"), function (response) { + getSubmissionPartsByProjectId(getQueryVariable("projectId"), function (response) { // iterate over response and display each element for (let i = 0; i < response.length; i++) { @@ -12,7 +12,7 @@ $(document).ready(function(){ let fullSubmissionId = $(this).closest("li").data("fullSubmissionId"); let category = $(this).closest("li").data("category"); location.href="annotation-document.jsp?token=" + getUserTokenFromUrl() + - "&projectId=" + getValueFromUrl("projectId") + + "&projectId=" + getQueryVariable("projectId") + "&fullSubmissionId=" + fullSubmissionId + "&category=" + category; }); @@ -37,7 +37,7 @@ $(document).ready(function(){ }); $('#btnUnstructuredUpload').click(function () { - location.href="unstructured-upload.jsp?token="+getUserTokenFromUrl() + "&projectId=" + getValueFromUrl("projectId"); + location.href="unstructured-upload.jsp?token="+getUserTokenFromUrl() + "&projectId=" + getQueryVariable("projectId"); }) }); diff --git a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js index ce860a8239e768fe8b76c25ca813f972ea10ac46..f420bbbd12047f018cbba3c6c4d306e03b3cf3e3 100644 --- a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js +++ b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js @@ -26,7 +26,7 @@ $(document).ready(function() { }, function () { // jump to upload page on error - location.href="unstructured-upload.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getValueFromUrl("projectId"); + location.href="unstructured-upload.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getQueryVariable("projectId"); }); // set click listener to save button @@ -285,7 +285,7 @@ function saveButtonHandler() { $.when.apply($, promises).then(function () { // redirect user to project page after saving - location.href="project-student.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getValueFromUrl("projectId"); + location.href="project-student.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getQueryVariable("projectId"); }); // redirect user to project page after saving diff --git a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredUpload.js b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredUpload.js index a024e123aff2d536041ab11c0d964bbcac28bbda..66ef3253fb067df445fa217227415361f9b0ed33 100644 --- a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredUpload.js +++ b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredUpload.js @@ -14,7 +14,7 @@ $(document).ready(function() { var fullSubmissionPostRequest = { user: user, text: text, - projectId: getValueFromUrl("projectId") + projectId: getQueryVariable("projectId") }; // save request in database @@ -23,7 +23,7 @@ $(document).ready(function() { $('#upload-textarea').val(""); // jump to next page - location.href="unstructured-annotation.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getValueFromUrl("projectId") + "&submission=" + response.id; + location.href="unstructured-annotation.jsp?token=" + getUserTokenFromUrl() + "&projectId=" + getQueryVariable("projectId") + "&submission=" + response.id; }); } }); diff --git a/gemeinsamforschen/src/main/webapp/assets/js/utility.js b/gemeinsamforschen/src/main/webapp/assets/js/utility.js index 40197ba6a20c5ceacd0bca910d85b13efb11c624..31e65be1d371cae08ae0e5c1a0a1bbabd2b8a977 100644 --- a/gemeinsamforschen/src/main/webapp/assets/js/utility.js +++ b/gemeinsamforschen/src/main/webapp/assets/js/utility.js @@ -13,7 +13,7 @@ function getUserTokenFromUrl() { } -function getValueFromUrl(name) { +function getQueryVariable(name) { var parts = window.location.search.substr(1).split("&"); var $_GET = {}; for (var i = 0; i < parts.length; i++) {