mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-12 07:10:07 +02:00
Solve partially Firefox 11 issue.
This commit is contained in:
parent
76e5a72aff
commit
a813531731
@ -1,125 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
core.Monitor = new Class({
|
|
||||||
initialize : function(fadeElement, logContentElem) {
|
|
||||||
$assert(fadeElement, "fadeElement can not be null");
|
|
||||||
$assert(logContentElem, "logContentElem can not be null");
|
|
||||||
|
|
||||||
this.pendingMessages = [];
|
|
||||||
this.inProgress = false;
|
|
||||||
this._container = fadeElement;
|
|
||||||
this._currentMessage = null;
|
|
||||||
this._logContentElem = logContentElem;
|
|
||||||
|
|
||||||
this._fxOpacity = fadeElement.effect('opacity', { duration: 6000 });
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
_logMessage : function(msg, msgKind) {
|
|
||||||
this._fxOpacity.clearTimer();
|
|
||||||
if (msgKind == core.Monitor.MsgKind.ERROR) {
|
|
||||||
msg = "<div id='small_error_icon'>" + msg + "</div>";
|
|
||||||
}
|
|
||||||
this._currentMessage = msg;
|
|
||||||
this._fxOpacity.start(1, 0);
|
|
||||||
this._logContentElem.innerHTML = msg;
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
logError : function(userMsg) {
|
|
||||||
this.logMessage(userMsg, core.Monitor.MsgKind.ERROR);
|
|
||||||
console.log(userMsg);
|
|
||||||
},
|
|
||||||
|
|
||||||
logMessage : function(msg, msgKind) {
|
|
||||||
if (!msgKind) {
|
|
||||||
msgKind = core.Monitor.MsgKind.INFO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msgKind == core.Monitor.MsgKind.FATAL) {
|
|
||||||
// In this case, a modal dialog must be shown... No recovery is possible.
|
|
||||||
new Windoo.Alert(msg,
|
|
||||||
{
|
|
||||||
'window': { theme:Windoo.Themes.aero,
|
|
||||||
title:"Outch!!. An unexpected error.",
|
|
||||||
'onClose':function() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
var messages = this.pendingMessages;
|
|
||||||
var monitor = this;
|
|
||||||
|
|
||||||
if (!this.executer) {
|
|
||||||
// Log current message ...
|
|
||||||
monitor._logMessage(msg, msgKind);
|
|
||||||
|
|
||||||
// Start worker thread ...
|
|
||||||
var disptacher = function() {
|
|
||||||
if (messages.length > 0) {
|
|
||||||
var msgToDisplay = messages.shift();
|
|
||||||
monitor._logMessage(msgToDisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop thread?
|
|
||||||
if (messages.length == 0) {
|
|
||||||
$clear(monitor.executer);
|
|
||||||
monitor.executer = null;
|
|
||||||
monitor._fxOpacity.hide();
|
|
||||||
this._currentMessage = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.executer = disptacher.periodical(600);
|
|
||||||
} else {
|
|
||||||
if (this._currentMessage != msg) {
|
|
||||||
messages.push(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
core.Monitor.setInstance = function(monitor) {
|
|
||||||
this.monitor = monitor;
|
|
||||||
};
|
|
||||||
|
|
||||||
core.Monitor.getInstance = function() {
|
|
||||||
var result = this.monitor;
|
|
||||||
if (result == null) {
|
|
||||||
result = {
|
|
||||||
logError: function(msg) {
|
|
||||||
console.log(msg)
|
|
||||||
},
|
|
||||||
|
|
||||||
logMessage: function(msg) {
|
|
||||||
console.log(msg)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
core.Monitor.MsgKind =
|
|
||||||
{
|
|
||||||
INFO:1,
|
|
||||||
WARNING:2,
|
|
||||||
ERROR:3,
|
|
||||||
FATAL:4
|
|
||||||
};
|
|
@ -19,6 +19,13 @@
|
|||||||
web2d.peer.svg.ElementPeer = new Class({
|
web2d.peer.svg.ElementPeer = new Class({
|
||||||
initialize :function(svgElement) {
|
initialize :function(svgElement) {
|
||||||
this._native = svgElement;
|
this._native = svgElement;
|
||||||
|
if (!this._native.addEvent) {
|
||||||
|
// Hack bug: https://bugzilla.mozilla.org/show_bug.cgi?id=740811
|
||||||
|
for (var key in Element) {
|
||||||
|
this._native[key] = Element.prototype[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._size = {width:1,height:1};
|
this._size = {width:1,height:1};
|
||||||
this._changeListeners = {};
|
this._changeListeners = {};
|
||||||
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
|
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
|
||||||
@ -82,7 +89,8 @@ web2d.peer.svg.ElementPeer = new Class({
|
|||||||
* http://developer.mozilla.org/en/docs/addEvent
|
* http://developer.mozilla.org/en/docs/addEvent
|
||||||
*/
|
*/
|
||||||
addEvent : function(type, listener) {
|
addEvent : function(type, listener) {
|
||||||
this._native.addEvent(type, listener);
|
// this._native.addEvent(type, listener);
|
||||||
|
this._native.addEventListener(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
fireEvent : function(type) {
|
fireEvent : function(type) {
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
|
import com.wisemapping.model.User;
|
||||||
|
import com.wisemapping.rest.BaseController;
|
||||||
|
import com.wisemapping.rest.model.RestUser;
|
||||||
|
import com.wisemapping.service.UserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ExportController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserById(@PathVariable long id) throws IOException {
|
||||||
|
final User userBy = userService.getUserBy(id);
|
||||||
|
if (userBy == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email}", produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserByEmail(@PathVariable String email) throws IOException {
|
||||||
|
final User user = userService.getUserBy(email);
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User '" + email + "' could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/username/{username}", produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserByUsername(@PathVariable String username) throws IOException {
|
||||||
|
final User user = userService.getUserByUsername(username);
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User '" + username + "' could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
|
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws IOException, WiseMappingException {
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
|
||||||
|
// User already exists ?
|
||||||
|
final String email = user.getEmail();
|
||||||
|
if (userService.getUserBy(email) != null) {
|
||||||
|
throw new IllegalArgumentException("User already exists with this email.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String username = user.getUsername();
|
||||||
|
if (username == null || username.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("username can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userService.getUserByUsername(username) != null) {
|
||||||
|
throw new IllegalArgumentException("User already exists with this username.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run some other validations ...
|
||||||
|
final User delegated = user.getDelegated();
|
||||||
|
final String lastname = delegated.getLastname();
|
||||||
|
if (lastname == null || lastname.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("lastname can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String firstName = delegated.getFirstname();
|
||||||
|
if (firstName == null || firstName.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("firstname can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally create the user ...
|
||||||
|
userService.createUser(delegated, false);
|
||||||
|
response.setHeader("Location", "/service/admin/users/" + user.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.PUT, value = "admin/users/{id}/password", consumes = {"text/plain"})
|
||||||
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
|
public void changePassword(@RequestBody String password, @PathVariable long id) throws IOException, WiseMappingException {
|
||||||
|
if (password == null) {
|
||||||
|
throw new IllegalArgumentException("Password can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = userService.getUserBy(id);
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User '" + id + "' could not be found");
|
||||||
|
}
|
||||||
|
user.setPassword(password);
|
||||||
|
userService.changePassword(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.DELETE)
|
||||||
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
|
public void getUserByEmail(@PathVariable long id) throws IOException, WiseMappingException {
|
||||||
|
final User user = userService.getUserBy(id);
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User '" + id + "' could not be found");
|
||||||
|
}
|
||||||
|
userService.deleteUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.wisemapping.ncontroller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.model.User;
|
||||||
|
import com.wisemapping.rest.model.RestUser;
|
||||||
|
import com.wisemapping.service.UserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class NMindmapController {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserById(@PathVariable long id) throws IOException {
|
||||||
|
final User userBy = userService.getUserBy(id);
|
||||||
|
if (userBy == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user