mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Mindmap list new using rest services ...
This commit is contained in:
parent
bca68f407d
commit
70b8fe8727
@ -1,7 +1,6 @@
|
||||
package com.wisemapping.rest;
|
||||
|
||||
|
||||
import com.sun.jdi.IntegerType;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.MindmapUser;
|
||||
|
@ -1,7 +1,7 @@
|
||||
log4j.rootLogger=WARN, stdout, R
|
||||
log4j.logger.com.wisemapping=WARN,stdout,R
|
||||
log4j.logger.org.springframework=WARN,stdout,R
|
||||
log4j.logger.org.codehaus.jackson=WARN,stdout,R
|
||||
log4j.logger.org.springframework=DEBUG,stdout,R
|
||||
log4j.logger.org.codehaus.jackson=DEBUG,stdout,R
|
||||
|
||||
# Stdout logger <20>
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
|
@ -115,11 +115,6 @@
|
||||
<put name="body" value="/jsp/newMap.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="newMap" extends="pageTemplate">
|
||||
<put name="title" value="NEW_MINDMAP"/>
|
||||
<put name="details" value="FIELD_REQUIRED_MSG"/>
|
||||
<put name="body" value="/jsp/newMap.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="newMapError" extends="pageTemplate">
|
||||
<put name="title" value="NEW_MINDMAP"/>
|
||||
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Panel = new Class({
|
||||
options:{
|
||||
width:'140px',
|
||||
height:250,
|
||||
opacity:0.9,
|
||||
panelButton:null,
|
||||
content:null,
|
||||
frame:null,
|
||||
onStart:Class.empty,
|
||||
onComplete:Class.empty
|
||||
},
|
||||
initialize:function(options){
|
||||
this.setOptions(options);
|
||||
|
||||
this.buildBody();
|
||||
|
||||
//atach listener to button
|
||||
this.options.panelButton.addEvent('click',this.openPanel.bindWithEvent(this));
|
||||
},
|
||||
buildBody:function(){
|
||||
var opts = this.options;
|
||||
opts.frame = new Element('div');
|
||||
if($defined(opts.content))
|
||||
{
|
||||
this.setContent(opts.content);
|
||||
}
|
||||
|
||||
},
|
||||
setContent:function(content){
|
||||
this.options.content=content;
|
||||
this.options.content.inject(this.options.frame);
|
||||
this.setInitialStyles();
|
||||
this.options.frame.injectBefore(this.options.panelButton);
|
||||
},
|
||||
setInitialStyles:function(){
|
||||
var opts = this.options;
|
||||
var buttonTop = opts.panelButton.getTop();
|
||||
var buttonLeft = opts.panelButton.getLeft();
|
||||
var bodyHeight = parseInt(opts.panelButton.getParent().getStyle('height'));
|
||||
var coordinates = opts.panelButton.getCoordinates();
|
||||
var width = opts.width || coordinates.width;
|
||||
var elemCoords = {
|
||||
top:'0px',
|
||||
left:coordinates.left,
|
||||
width:width,
|
||||
height:'0px',
|
||||
zIndex:'10',
|
||||
overflow:'hidden'
|
||||
};
|
||||
var elemStyles = {
|
||||
backgroundColor: opts.backgroundColor||'blue',
|
||||
opacity: opts.opacity,
|
||||
position:'absolute'
|
||||
}
|
||||
opts.frame.setStyles(elemCoords).setStyles(elemStyles);
|
||||
},
|
||||
openPanel:function(){
|
||||
this.fireEvent('onStart');
|
||||
|
||||
var button = this.options.panelButton;
|
||||
button.removeEvents('click');
|
||||
button.addEvent('click',this.hidePanel.bindWithEvent(this));
|
||||
var top = parseInt(this.options.frame.getStyle('top'));
|
||||
var fx = this.options.frame.effects({duration:500, onComplete:function(){this.options.content.fireEvent('show');}.bind(this)});
|
||||
fx.start({'height':[0,this.options.height],'top':[top, top-this.options.height]});
|
||||
|
||||
this.fireEvent('onComplete');
|
||||
},
|
||||
hidePanel:function(){
|
||||
this.fireEvent('onStart');
|
||||
|
||||
var button = this.options.panelButton;
|
||||
button.removeEvents('click');
|
||||
button.addEvent('click',this.openPanel.bindWithEvent(this));
|
||||
var top = parseInt(this.options.frame.getStyle('top'));
|
||||
this.options.content.fireEvent('hide');
|
||||
var fx = this.options.frame.effects({duration:500});
|
||||
fx.start({'height':[this.options.height,0],'top':[top, top+this.options.height]});
|
||||
|
||||
this.fireEvent('onComplete');
|
||||
}
|
||||
});
|
||||
|
||||
Panel.implement(new Events, new Options);
|
@ -50,7 +50,6 @@ jQuery.fn.dataTableExt.removeSelectedRows = function() {
|
||||
url: "../service/maps/batch?ids=" + mapIds.join(","),
|
||||
type:"DELETE",
|
||||
success : function(data, textStatus, jqXHR) {
|
||||
console.log("delete success");
|
||||
var trs = $('.select input:checked[id!="selectAll"]').parent().parent();
|
||||
trs.each(function() {
|
||||
$('#mindmapListTable').dataTable().fnDeleteRow(this);
|
||||
@ -60,6 +59,4 @@ jQuery.fn.dataTableExt.removeSelectedRows = function() {
|
||||
alert("Unexpected error removing maps. Refresh before continue.");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
<link rel="icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon"/>
|
||||
<script type='text/javascript' src='../js/mootools-core.js'></script>
|
||||
|
||||
<link rel="stylesheet/less" type="text/css" href="css/mymaps.less"/>
|
||||
<script src="js/less.js" type="text/javascript"></script>
|
||||
|
||||
@ -163,8 +161,37 @@
|
||||
$("#buttons .newMap").button({
|
||||
icons: { primary: "ui-icon-circle-plus" }
|
||||
}).click(function() {
|
||||
window.location = "c/newMap.htm"
|
||||
});
|
||||
$("#new-dialog-modal").dialog({
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Create": function() {
|
||||
var formData = {};
|
||||
$('#new-dialog-modal input').each(function(index, elem) {
|
||||
formData[elem.name] = elem.value;
|
||||
});
|
||||
|
||||
jQuery.ajax("../service/maps", {
|
||||
async:false,
|
||||
dataType: 'json',
|
||||
data: JSON.stringify(formData),
|
||||
type: 'POST',
|
||||
contentType:"application/json; charset=utf-8",
|
||||
success : function(data, textStatus, jqXHR) {
|
||||
var location = jqXHR.getResponseHeader("Location");
|
||||
var mapId = location.substring(location.lastIndexOf('/') + 1, location.length);
|
||||
window.location = "c/editor.htm?action=open&mapId=" + mapId;
|
||||
},
|
||||
error: function() {
|
||||
alert("Unexpected error removing maps. Refresh before continue.");
|
||||
}
|
||||
});
|
||||
},
|
||||
Cancel: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#buttons .importMap").button({
|
||||
icons: { primary: "ui-icon-trash" }
|
||||
@ -196,8 +223,6 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -217,6 +242,27 @@
|
||||
<div id="delete-dialog-modal" title="Delete maps" style="display: none">
|
||||
<p>Are you sure you want to delete maps <span></span> ?</p>
|
||||
</div>
|
||||
<div id="new-dialog-modal" title="New" style="display: none">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<span class="fieldRequired">*</span>
|
||||
<label for="title"><spring:message code="NAME"/>:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input name="title" id="title" tabindex="1" type="text" required="true"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formLabel">
|
||||
<label for="description"><spring:message code="DESCRIPTION"/>:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input name="description" id="description" tabindex="2"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="share-dialog-modal" title="Share maps" style="display: none">
|
||||
<p>Are you sure you want to share maps <span></span> ?</p>
|
||||
</div>
|
||||
|
@ -14,11 +14,30 @@ public class JsonTest {
|
||||
|
||||
@Test
|
||||
void deserialize() throws IOException {
|
||||
String mapJson = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}";
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
final RestMindmap restMindmap = mapper.readValue(mapJson, RestMindmap.class);
|
||||
|
||||
String json1 = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}";
|
||||
mapper.readValue(json1, RestMindmap.class);
|
||||
|
||||
String json2 = "{\"title\":\"some title\",\"description\":\"description here\"}";
|
||||
mapper.readValue(json2, RestMindmap.class);
|
||||
|
||||
String userJson = "{\"username\":\"admin\",\"email\":\"admin@wisemapping.org\",\"tags\":[],\"creationDate\":1329706800000,\"firstname\":\"Wise\",\"lastname\":\"test\",\"password\":\"test\"}";
|
||||
final RestUser restUser = mapper.readValue(userJson, RestUser.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void serialize() throws IOException {
|
||||
String mapJson = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
final RestMindmap value = new RestMindmap();
|
||||
value.setTitle("titl");
|
||||
value.setTitle("desck");
|
||||
final String restMindmap = mapper.writeValueAsString(value);
|
||||
System.out.println(restMindmap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user