From 24c6ee0f60cffc76eb08242aee45c641c081a688 Mon Sep 17 00:00:00 2001 From: yordankailieva Date: Fri, 23 Oct 2015 13:05:36 +0300 Subject: [PATCH] #85 --- web/pages/publish/index.jsp | 14 +++ web/pages/transformations/details.jsp | 21 +++- web/scripts/main-dp.js | 137 +++++++++++++++++++++++++- 3 files changed, 167 insertions(+), 5 deletions(-) diff --git a/web/pages/publish/index.jsp b/web/pages/publish/index.jsp index 6ebf898..39ef44b 100644 --- a/web/pages/publish/index.jsp +++ b/web/pages/publish/index.jsp @@ -151,5 +151,19 @@ ${wizard.emptyNew()} + + + \ No newline at end of file diff --git a/web/pages/transformations/details.jsp b/web/pages/transformations/details.jsp index 859625b..d9bb3c6 100644 --- a/web/pages/transformations/details.jsp +++ b/web/pages/transformations/details.jsp @@ -148,7 +148,12 @@ ${userbean.putInCookie(pageContext.request, pageContext.response, pageContext.se
- Publish data page + + Publish data page + + + Publish data page + Download results
@@ -172,5 +177,19 @@ $(window).load(function() {
+ + + diff --git a/web/scripts/main-dp.js b/web/scripts/main-dp.js index bad61f1..cc06aa1 100644 --- a/web/scripts/main-dp.js +++ b/web/scripts/main-dp.js @@ -92,10 +92,12 @@ $(document).ready(function() { return; } var regexName = /^[a-zA-Z0-9.,-\s]+$/i; - if (!regexName.test($("#createoauth input[id=r-name]").val())){ - $(".alert").removeClass("hide"); - $(".errormessage").html("Valid characters for Name are: English letters and numbers, space and punctuations."); - return; + if ($("#createoauth input[id=r-name]").val()!=''){ + if (!regexName.test($("#createoauth input[id=r-name]").val())){ + $(".alert").removeClass("hide"); + $(".errormessage").html("Valid characters for Name are: English letters and numbers, space and punctuations."); + return; + } } @@ -456,6 +458,41 @@ $(document).ready(function() { }); $("#uploadrawbutton").click(function(){ + + + + $('#complete-dialog-spinner').modal('show'); + // open dialog + + var opts = { + lines: 12, // The number of lines to draw + length: 7, // The length of each line + width: 5, // The line thickness + radius: 10, // The radius of the inner circle + rotate: 0, // Rotation offset + corners: 1, // Roundness (0..1) + color: '#5264ae', // #rgb or #rrggbb + direction: 1, // 1: clockwise, -1: counterclockwise + speed: 1, // Rounds per second + trail: 100, // Afterglow percentage + opacity: 1/4, // Opacity of the lines + fps: 20, // Frames per second when using setTimeout() + zIndex: 2e9, // Use a high z-index by default + className: 'spinner', // CSS class to assign to the element + top: '30%', // center vertically + left: '50%', // center horizontally + position: 'relative' // element position + } + var spinner = new Spinner(opts).spin(); + $("#containerl").empty(); + $("#containerl").append("

Uploading raw data. Please wait ...

"); + $("#containerl").append(spinner.el); + + + + + + var xhr = new XMLHttpRequest(); url = Application.contextPath +"/BaseGateway/create.json"; xhr.open("POST", url, true); @@ -476,7 +513,14 @@ $(document).ready(function() { xhr.onload = (function(_this) { return function(e) { // $("#contenttype").attr('disabled', true); + spinner.stop(); + response = jQuery.parseJSON(xhr.responseText); + if (response.error){ + $("#containerl").empty(); + $("#containerl").append("

"+response.error.message+"

"); + }else{ document.location=Application.contextPath +"/pages/publish/details.jsp"; + } }; })(this); @@ -490,6 +534,91 @@ $(document).ready(function() { });*/ + $("#execsrepositoryupdate").click(function (){ + $('#complete-dialog-spinner').modal('show'); + // open dialog + + var opts = { + lines: 12, // The number of lines to draw + length: 7, // The length of each line + width: 5, // The line thickness + radius: 10, // The radius of the inner circle + rotate: 0, // Rotation offset + corners: 1, // Roundness (0..1) + color: '#5264ae', // #rgb or #rrggbb + direction: 1, // 1: clockwise, -1: counterclockwise + speed: 1, // Rounds per second + trail: 100, // Afterglow percentage + opacity: 1/4, // Opacity of the lines + fps: 20, // Frames per second when using setTimeout() + zIndex: 2e9, // Use a high z-index by default + className: 'spinner', // CSS class to assign to the element + top: '30%', // center vertically + left: '50%', // center horizontally + position: 'relative' // element position + } + var spinner = new Spinner(opts).spin(); + $("#containerl").empty(); + $("#containerl").append("

Publishing data. Please wait ...

"); + $("#containerl").append(spinner.el); + + + + var xhr = new XMLHttpRequest(); + url = Application.contextPath +"/BaseGateway/create.json"; + xhr.open("POST", url, true); + // xhr.withCredentials = !!this.options.withCredentials; + headers = { + "Accept": "application/json", + "Cache-Control": "no-cache", + "X-Requested-With": "XMLHttpRequest" + }; + for (headerName in headers) { + headerValue = headers[headerName]; + xhr.setRequestHeader(headerName, headerValue); + } + xhr.onerror = (function(_this) { + return function() { + + }; + })(this); + xhr.onload = (function(_this) { + return function(e) { + spinner.stop(); + response = jQuery.parseJSON(xhr.responseText); + if (response.error){ + $("#containerl").empty(); + $("#containerl").append("

"+response.error.message+"

"); + }else{ + document.location=Application.contextPath +"/pages/publish/details.jsp"; + } + }; + })(this); + + +// var formData = new FormData(); + +// formData.append("datapageid", $("#datapageid").val()); +// formData.append("datasetname", $("#datasetname").val()); +// formData.append("description", $("#description").val()); +// formData.append("keyword", $("#keyword").tokenfield('getTokensList')); +// formData.append("licensing", $("#licensing").val()); +// formData.append("usagerights", $("#usagerights").val()); +// formData.append("bytesize", $("#bytesize").val()); +// formData.append("portalparam", $("#portalparam").val()); +// formData.append("portaltitle", $("#portaltitle").val()); +// if ($("#contenttype").val()){ +// formData.append("filecontenttype", $("#contenttype").val()); +// } +// formData.append("public", $("#ispublic").is(":checked")); +// formData.append("israw", $("#savedataset").data("israw")); + xhr.send(); + + + + //document.location=Application.contextPath +"/pages/publish/details.jsp"; + }); + $("#execsrepository").click(function (){ document.location=Application.contextPath +"/pages/publish/details.jsp"; });