Working on a "REST" version of import.

This commit is contained in:
Paulo Gustavo Veiga
2012-06-03 19:19:48 -03:00
parent b914bbb8a8
commit 3907e04ff6
12 changed files with 82 additions and 222 deletions

View File

@@ -6,24 +6,63 @@
</h1>
<p><spring:message code="${requestScope.details}"/></p>
<form:form method="post" commandName="importMap" enctype="multipart/form-data">
<form method="post" enctype="multipart/form-data" action="#">
<fieldset>
<label for="title"><spring:message code="NAME"/></label>
<form:input path="title" id="title" tabindex="1" required="required"/>
<form:errors path="title" cssClass="errorMsg"/>
<input type="text" id="title" required="required"/>
<label for="title"><spring:message code="DESCRIPTION"/></label>
<form:input path="description" id="description" tabindex="2"/>
<form:errors path="description" cssClass="errorMsg"/>
<label for="description"><spring:message code="DESCRIPTION"/></label>
<input type="text" name="description" id="description"/>
<label><spring:message code="DESCRIPTION"/> </label>
<input type="radio" name="type" value="mm"/> Freemind (0.9)
<input type="radio" name="type" value="wxml"/> WiseMapping
<label for="mapFile"><spring:message code="FREE_MIND_FILE"/></label>
<input type="file" name="mapFile" id="mapFile"/>
<form:errors path="mapFile" cssClass="errorMsg"/>
</fieldset>
<input type="submit" value="<spring:message code="IMPORT"/>" class="btn btn-primary"/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn"
onclick="window.location='/c/maps/'">
</form:form>
<input type="button" id="acceptButton" value="<spring:message code="IMPORT"/>" class="btn btn-primary"/>
<input type="button" id="cancelButton" value="<spring:message code="CANCEL"/>" class="btn">
</form>
</div>
<script type="text/javascript">
// Save status on click ...
$('#cancelButton').click(function() {
window.location = '/c/maps/';
});
$('#acceptButton').click(function(event) {
// http://www.html5rocks.com/en/tutorials/file/dndfiles/
var content;
if (window.FileReader) {
reader = new FileReader();
reader.onloadend = function (e) {
content = e.target.result;
};
reader.readAsDataURL(file);
}
jQuery.ajax("service/maps", {
async:false,
dataType: 'application/freemind',
data: "",
type: 'PUT',
contentType:"text/plain",
success : function(data, textStatus, jqXHR) {
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
});
// Hook for interaction with the main parent window ...
var submitDialogForm = function() {
$('#dialogMainForm').submit();
}
</script>