mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-11 01:33:24 +01:00
fixing import dialog, parameters modification and redirect
This commit is contained in:
parent
7b512ea2f6
commit
1ff3cf2127
@ -25,7 +25,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description" class="control-label col-md-2"><spring:message code="DESCRIPTION"/>: </label>
|
<label for="description" class="control-label col-md-2"><spring:message code="DESCRIPTION"/>: </label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<textarea type="text" name="description" id="description"
|
<textarea name="description" id="description"
|
||||||
placeholder="<spring:message code="MAP_DESCRIPTION_HINT"/>" class="form-control" maxlength="255"></textarea>
|
placeholder="<spring:message code="MAP_DESCRIPTION_HINT"/>" class="form-control" maxlength="255"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -46,25 +46,19 @@
|
|||||||
|
|
||||||
$('#dialogMainForm').submit(function (event) {
|
$('#dialogMainForm').submit(function (event) {
|
||||||
// Load form parameters ...
|
// Load form parameters ...
|
||||||
var title = $('#dialogMainForm #title').attr('value');
|
var title = $('#dialogMainForm #title').val();
|
||||||
title = title == undefined ? "" : title;
|
title = title == undefined ? "" : title;
|
||||||
|
|
||||||
var description = $('#dialogMainForm #description').attr('value');
|
var description = $('#dialogMainForm #description').val();
|
||||||
description = description == undefined ? "" : description;
|
description = description == undefined ? "" : description;
|
||||||
|
|
||||||
// Save status on click ...
|
var onSuccess = function (data, textStatus, jqXHR) {
|
||||||
jQuery.ajax("c/restful/maps?title=" + encodeURI(title) + "&description=" + encodeURI(description),
|
console.log('hola');
|
||||||
{
|
var resourceId = data.getResponseHeader("ResourceId");
|
||||||
async:false,
|
|
||||||
data:fileContent,
|
|
||||||
type:'POST',
|
|
||||||
dataType:'json',
|
|
||||||
contentType:contentType,
|
|
||||||
success:function (data, textStatus, jqXHR) {
|
|
||||||
var resourceId = jqXHR.getResponseHeader("ResourceId");
|
|
||||||
window.location = "c/maps/" + resourceId + "/edit";
|
window.location = "c/maps/" + resourceId + "/edit";
|
||||||
},
|
};
|
||||||
error:function (jqXHR, textStatus, errorThrown) {
|
|
||||||
|
var onError = function (jqXHR, textStatus, errorThrown) {
|
||||||
if (jqXHR.status == 400) {
|
if (jqXHR.status == 400) {
|
||||||
var errors = JSON.parse(jqXHR.responseText);
|
var errors = JSON.parse(jqXHR.responseText);
|
||||||
// Mark fields with errors ...
|
// Mark fields with errors ...
|
||||||
@ -91,6 +85,19 @@
|
|||||||
console.log(jqXHR);
|
console.log(jqXHR);
|
||||||
$('#messagesPanel div').text(errorThrown).parent().show();
|
$('#messagesPanel div').text(errorThrown).parent().show();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Save status on click ...
|
||||||
|
jQuery.ajax("c/restful/maps?title=" + encodeURI(title) + "&description=" + encodeURI(description),
|
||||||
|
{
|
||||||
|
async:false,
|
||||||
|
data:fileContent,
|
||||||
|
type:'POST',
|
||||||
|
dataType:'json',
|
||||||
|
contentType:contentType,
|
||||||
|
statusCode: {
|
||||||
|
201: onSuccess,
|
||||||
|
400: onError
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user