- Add missing changes.

This commit is contained in:
Paulo Gustavo Veiga 2012-02-21 15:37:15 -03:00
parent fb3f9946ae
commit 7b6cae0fd2
8 changed files with 310 additions and 328 deletions

View File

@ -94,7 +94,7 @@
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="XMLMindmapSerializerFactory.js"/> files="XMLMindmapSerializerFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="RestPersistenceManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/> <filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/> <filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>

View File

@ -1,83 +1,57 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
mindplot.DwrPersitenceManager = new Class({ mindplot.RESTPersistenceManager = new Class({
Extends:mindplot.PersistenceManager, Extends:mindplot.PersistenceManager,
initialize: function() { initialize: function(saveUrl) {
this.parent(); this.parent();
}, $assert(saveUrl, "saveUrl can not be null");
this.saveUrl = saveUrl;
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) { },
window.MapEditorService.saveMap(mapId, mapXml, pref, saveHistory, {
callback:function(response) { saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
if (response.msgCode != "OK") {
events.onError(response); var data = {
} else { id:mapId,
events.onSuccess(response); xml: mapXml,
} properties: pref
}, };
errorHandler:function(message) { var request = new Request({
events.onError(message); url:this.saveUrl + mapId,
}, method: 'put',
verb:"POST", onSuccess:function(responseText, responseXML) {
async: true events.onSuccess();
}
) },
}, onException:function(headerName, value) {
events.onError();
loadMapDom : function(mapId) { },
$assert(mapId, "mapId can not be null"); onFailure:function(xhr) {
throw "This must be implemented"; events.onError();
},
// var result = {r:null}; headers: {"Content-Type":"application/json","Accept":"application/json"},
// window.MapEditorService.loadMap(mapId, { emulation:false,
// callback:function(response) { urlEncoded:false
// });
// if (response.msgCode == "OK") { request.put(JSON.encode(data));
// // Explorer Hack with local files ... }
// var xmlContent = response.content; }
// var domDocument = core.Utils.createDocumentFromText(xmlContent); );
// var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument);
// var mindmap = serializer.loadFromDom(domDocument);
// mindmap.setId(mapId);
//
// result.r = mindmap;
// } else {
// // Handle error message ...
// var msg = response.msgDetails;
// var monitor = core.ToolbarNotifier.getInstance();
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
//// wLogger.error(msg);
// }
// },
// verb:"GET",
// async: false,
// errorHandler:function(msg) {
// var monitor = core.ToolbarNotifier.getInstance();
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
//// wLogger.error(msg);
// }
// });
//
// return result.r;
}
}
);

View File

@ -59,7 +59,7 @@ mindplot.widget.IMenu = new Class({
onError: function() { onError: function() {
if (saveHistory) { if (saveHistory) {
saveElem.setStyle('cursor', 'pointer'); saveElem.setStyle('cursor', 'pointer');
$notify("Save could not be completed. Try latter"); $notify("Save could not be completed. Try latter.");
} }
} }
}); });

View File

@ -1,236 +1,241 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
var designer = null; var designer = null;
function buildDesigner(options) { function buildDesigner(options) {
var container = $(options.container); var container = $(options.container);
$assert(container, 'container could not be null'); $assert(container, 'container could not be null');
// Register load events ... // Register load events ...
designer = new mindplot.Designer(options, container); designer = new mindplot.Designer(options, container);
designer.addEvent('loadSuccess', function() { designer.addEvent('loadSuccess', function() {
window.waitDialog.close(); window.waitDialog.close();
window.waitDialog.destroy(); window.waitDialog.destroy();
}); });
designer.addEvent('loadError', function(e) { designer.addEvent('loadError', function(e) {
window.waitDialog.close(); window.waitDialog.close();
window.waitDialog.destroy(); window.waitDialog.destroy();
console.log(e); console.log(e);
}); });
// Configure default persistence manager ... // Configure default persistence manager ...
var persistence; var persistence;
if (options.persistenceManager) { if (options.persistenceManager) {
persistence = eval("new " + options.persistenceManager + "()"); if(options.persistenceManager instanceof String) {
persistence = eval("new " + options.persistenceManager + "()");
} else { }
persistence = new mindplot.LocalStorageManager(); else {
} persistence = options.persistenceManager;
mindplot.PersistenceManager.init(persistence); }
// Register toolbar event ... } else {
if ($('toolbar')) { persistence = new mindplot.LocalStorageManager();
var menu = new mindplot.widget.Menu(designer, 'toolbar',""); }
mindplot.PersistenceManager.init(persistence);
// If a node has focus, focus can be move to another node using the keys.
designer._cleanScreen = function() { // Register toolbar event ...
menu.clear() if ($('toolbar')) {
}; var menu = new mindplot.widget.Menu(designer, 'toolbar',"");
}
// If a node has focus, focus can be move to another node using the keys.
return designer; designer._cleanScreen = function() {
} menu.clear()
};
}
function loadDesignerOptions(jsonConf) {
// Load map options ... return designer;
if (jsonConf) { }
var request = new Request.JSON({
url: jsonConf,
async:false, function loadDesignerOptions(jsonConf) {
onSuccess: // Load map options ...
function(options) { if (jsonConf) {
this.options = options; var request = new Request.JSON({
url: jsonConf,
}.bind(this) async:false,
} onSuccess:
); function(options) {
request.get(); this.options = options;
result = this.options;
} }.bind(this)
else { }
// Set workspace screen size as default. In this way, resize issues are solved. );
var containerSize = { request.get();
height: parseInt(screen.height), result = this.options;
width: parseInt(screen.width) }
}; else {
// Set workspace screen size as default. In this way, resize issues are solved.
var viewPort = { var containerSize = {
height: parseInt(window.innerHeight - 70), // Footer and Header height: parseInt(screen.height),
width: parseInt(window.innerWidth) width: parseInt(screen.width)
}; };
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort,container:'mindplot'};
} var viewPort = {
console.log("result:" + JSON.encode(result)); height: parseInt(window.innerHeight - 70), // Footer and Header
return result; width: parseInt(window.innerWidth)
} };
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort,container:'mindplot'};
editor = {}; }
editor.WaitDialog = new Class({ console.log("result:" + JSON.encode(result));
Extends:MooDialog, return result;
initialize : function() { }
var panel = this._buildPanel();
this.parent({ editor = {};
closeButton:false, editor.WaitDialog = new Class({
destroyOnClose:true, Extends:MooDialog,
autoOpen:true, initialize : function() {
useEscKey:false, var panel = this._buildPanel();
title:'Loading ...', this.parent({
onInitialize: function(wrapper) { closeButton:false,
wrapper.setStyle('opacity', 0); destroyOnClose:true,
this.fx = new Fx.Morph(wrapper, { autoOpen:true,
duration: 100, useEscKey:false,
transition: Fx.Transitions.Bounce.easeOut title:'Loading ...',
}); onInitialize: function(wrapper) {
this.overlay = new Overlay(this.options.inject, { wrapper.setStyle('opacity', 0);
duration: this.options.duration this.fx = new Fx.Morph(wrapper, {
}); duration: 100,
if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this)); transition: Fx.Transitions.Bounce.easeOut
} });
, this.overlay = new Overlay(this.options.inject, {
duration: this.options.duration
onBeforeOpen: function() { });
this.overlay.open(); if (this.options.closeOnOverlayClick) this.overlay.addEvent('click', this.close.bind(this));
this.fx.start({ }
'margin-top': [-200, -100], ,
opacity: [0, 1]
}).chain(function() { onBeforeOpen: function() {
this.fireEvent('show'); this.overlay.open();
}.bind(this)); this.fx.start({
} 'margin-top': [-200, -100],
, opacity: [0, 1]
}).chain(function() {
onBeforeClose: function() { this.fireEvent('show');
this.fx.start({ }.bind(this));
'margin-top': [-100, 0], }
opacity: 0, ,
duration: 200
}).chain(function() { onBeforeClose: function() {
this.fireEvent('hide'); this.fx.start({
}.bind(this)); 'margin-top': [-100, 0],
this.overlay.close(); opacity: 0,
}} duration: 200
) }).chain(function() {
; this.fireEvent('hide');
this.setContent(panel); }.bind(this));
}, this.overlay.close();
}}
_buildPanel : function () { )
var result = new Element('div'); ;
result.setStyles({ this.setContent(panel);
'text-align':'center', },
width: '400px'
}); _buildPanel : function () {
var img = new Element('img', {'src': 'images/ajax-loader.gif'}); var result = new Element('div');
img.inject(result); result.setStyles({
return result; 'text-align':'center',
}, width: '400px'
});
show : function() { var img = new Element('img', {'src': 'images/ajax-loader.gif'});
this.open(); img.inject(result);
} return result;
},
});
show : function() {
editor.Help = { this.open();
buildHelp:function(panel) { }
var container = new Element('div');
container.setStyles({width:'100%', textAlign:'center'}); });
var content1 = Help.buildContentIcon('images/black-keyboard.png', 'Keyboard Shortcuts', function() {
MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false); editor.Help = {
panel.hidePanel(); buildHelp:function(panel) {
}); var container = new Element('div');
var content2 = Help.buildContentIcon('images/firstSteps.png', 'Editor First Steps', function() { container.setStyles({width:'100%', textAlign:'center'});
var wOpen; var content1 = Help.buildContentIcon('images/black-keyboard.png', 'Keyboard Shortcuts', function() {
var sOptions; MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false);
panel.hidePanel();
sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes'; });
sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString(); var content2 = Help.buildContentIcon('images/firstSteps.png', 'Editor First Steps', function() {
sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString(); var wOpen;
sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0'; var sOptions;
wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px"); sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
wOpen.focus(); sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
wOpen.moveTo(0, 0); sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
wOpen.resizeTo(screen.availWidth, screen.availHeight); sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
panel.hidePanel();
}); wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
wOpen.focus();
container.addEvent('show', function() { wOpen.moveTo(0, 0);
content1.effect('opacity', {duration:800}).start(0, 100); wOpen.resizeTo(screen.availWidth, screen.availHeight);
var eff = function() { panel.hidePanel();
content2.effect('opacity', {duration:800}).start(0, 100); });
};
eff.delay(150); container.addEvent('show', function() {
}); content1.effect('opacity', {duration:800}).start(0, 100);
container.addEvent('hide', function() { var eff = function() {
content1.effect('opacity').set(0); content2.effect('opacity', {duration:800}).start(0, 100);
content2.effect('opacity').set(0) };
}); eff.delay(150);
content1.inject(container); });
content2.inject(container); container.addEvent('hide', function() {
return container; content1.effect('opacity').set(0);
}, content2.effect('opacity').set(0)
buildContentIcon:function(image, text, onClickFn) { });
var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'}); content1.inject(container);
content2.inject(container);
var icon = new Element('div'); return container;
icon.addEvent('click', onClickFn); },
var img = new Element('img'); buildContentIcon:function(image, text, onClickFn) {
img.setProperty('src', image); var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'});
img.inject(icon);
icon.inject(container); var icon = new Element('div');
icon.addEvent('click', onClickFn);
var textContainer = new Element('div').setStyles({width:'100%', color:'white'}); var img = new Element('img');
textContainer.innerHTML = text; img.setProperty('src', image);
textContainer.inject(container); img.inject(icon);
icon.inject(container);
container.addEvent('mouseover', function() {
$(this).setStyle('border-top', '1px solid #BBB4D6'); var textContainer = new Element('div').setStyles({width:'100%', color:'white'});
$(this).setStyle('border-bottom', '1px solid #BBB4D6'); textContainer.innerHTML = text;
}.bindWithEvent(container)); textContainer.inject(container);
container.addEvent('mouseout', function() {
$(this).setStyle('border-top', '1px solid transparent'); container.addEvent('mouseover', function() {
$(this).setStyle('border-bottom', '1px solid transparent'); $(this).setStyle('border-top', '1px solid #BBB4D6');
$(this).setStyle('border-bottom', '1px solid #BBB4D6');
}.bindWithEvent(container)); }.bindWithEvent(container));
return container; container.addEvent('mouseout', function() {
} $(this).setStyle('border-top', '1px solid transparent');
}; $(this).setStyle('border-bottom', '1px solid transparent');
}.bindWithEvent(container));
// Show loading dialog ... return container;
waitDialog = new editor.WaitDialog(); }
waitDialog.show(); };
// Loading libraries ...
Asset.javascript("js/mindplot-min.js"); // Show loading dialog ...
waitDialog = new editor.WaitDialog();
waitDialog.show();
// Loading libraries ...
Asset.javascript("js/mindplot-min.js");

View File

@ -18,11 +18,9 @@
package com.wisemapping.model; package com.wisemapping.model;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
@XmlRootElement(name = "user")
public class User public class User
extends Collaborator extends Collaborator
implements Serializable { implements Serializable {

View File

@ -17,12 +17,12 @@ public class AuthenticationProvider implements org.springframework.security.auth
private PasswordEncoder encoder; private PasswordEncoder encoder;
@Override @Override()
public Authentication authenticate(@NotNull final Authentication auth) throws AuthenticationException { public Authentication authenticate(@NotNull final Authentication auth) throws AuthenticationException {
// All your user authentication needs // All your user authentication needs
final String email = auth.getName(); final String email = auth.getName();
final User user = userManager.getUserBy(email); final User user = userManager.getUserBy(email);
final String credentials = (String) auth.getCredentials(); final String credentials = (String) auth.getCredentials();
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) { if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {

View File

@ -2,6 +2,7 @@ package com.wisemapping.test.model;
import com.wisemapping.rest.model.RestMindmap; import com.wisemapping.rest.model.RestMindmap;
import com.wisemapping.rest.model.RestUser;
import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -13,10 +14,14 @@ public class JsonTest {
@Test @Test
void deserialize() throws IOException { void deserialize() throws IOException {
String json = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}"; 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(); ObjectMapper mapper = new ObjectMapper();
final RestMindmap restMindmap = mapper.readValue(json, RestMindmap.class); final RestMindmap restMindmap = mapper.readValue(mapJson, 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);
} }
} }

View File

@ -14,7 +14,7 @@ activationCode BIGINT NOT NULL,
activation_date DATE, activation_date DATE,
allowSendEmail CHAR(1) NOT NULL, allowSendEmail CHAR(1) NOT NULL,
FOREIGN KEY(colaborator_id) REFERENCES colaborator(id) FOREIGN KEY(colaborator_id) REFERENCES colaborator(id)
) ; );
CREATE TABLE MINDMAP ( CREATE TABLE MINDMAP (
id INTEGER NOT NULL IDENTITY, id INTEGER NOT NULL IDENTITY,