Skip to content

Commit

Permalink
#85
Browse files Browse the repository at this point in the history
  • Loading branch information
yordankailieva committed Oct 23, 2015
1 parent 7ea585d commit 24c6ee0
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 5 deletions.
14 changes: 14 additions & 0 deletions web/pages/publish/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,19 @@ ${wizard.emptyNew()}
</div>
</div>

<!-- dialog for spinner -->
<div id="complete-dialog-spinner" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Uploading raw data</h4></div>
<div class="modal-body">
<div id="containerl"> </div>
</div>
</div>
</div>
</div>

</jsp:body>
</template:genericpage>
21 changes: 20 additions & 1 deletion web/pages/transformations/details.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,12 @@ ${userbean.putInCookie(pageContext.request, pageContext.response, pageContext.se
</div>
</c:if>
<div id="content" class="publish-div ${not empty wizard.uploadesFile.file? 'up': 'down'}">
<a type="button" class="btn btn-primary btn-raised theme-bg ${ (transformation.transformationType == 'pipe') ? 'disabled' : '' }" id="execsrepository" href="#">Publish data page</a>
<c:if test="${wizard.action =='edit'}">
<a type="button" class="btn btn-primary btn-raised theme-bg ${ (transformation.transformationType == 'pipe') ? 'disabled' : '' }" id="execsrepositoryupdate" href="#">Publish data page</a>
</c:if>
<c:if test="${wizard.action =='new'}">
<a type="button" class="btn btn-primary btn-raised theme-bg ${ (transformation.transformationType == 'pipe') ? 'disabled' : '' }" id="execsrepository" href="#">Publish data page</a>
</c:if>
<a type="button" class="btn btn-primary btn-raised theme-bg publish-button" id="execdlresult" href="#"> Download results </a>
</div>
</div>
Expand All @@ -172,5 +177,19 @@ $(window).load(function() {
</div>
<div id="dialog-confirm" title="Delete?"></div>
<script type="text/javascript" src="${contextPath}/scripts/grafterizerPostMessage.js" async></script>

<!-- dialog for spinner -->
<div id="complete-dialog-spinner" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Publishing Data</h4></div>
<div class="modal-body">
<div id="containerl"> </div>
</div>
</div>
</div>
</div>
</jsp:body>
</template:genericpage>
137 changes: 133 additions & 4 deletions web/scripts/main-dp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}


Expand Down Expand Up @@ -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("<h4>Uploading raw data. Please wait ...</h4>");
$("#containerl").append(spinner.el);






var xhr = new XMLHttpRequest();
url = Application.contextPath +"/BaseGateway/create.json";
xhr.open("POST", url, true);
Expand All @@ -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("<h4>"+response.error.message+"</h4>");
}else{
document.location=Application.contextPath +"/pages/publish/details.jsp";
}
};
})(this);

Expand All @@ -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("<h4>Publishing data. Please wait ...</h4>");
$("#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("<h4>"+response.error.message+"</h4>");
}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";
});
Expand Down

0 comments on commit 24c6ee0

Please sign in to comment.