diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java index 0fe7672b..9ef6acc4 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java @@ -35,9 +35,8 @@ public class BaseController { @ExceptionHandler(IllegalArgumentException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody - public String handleClientErrors(@NotNull Exception ex) { - ex.printStackTrace(); - return ex.getMessage(); + public RestErrors handleClientErrors(@NotNull IllegalArgumentException ex) { + return new RestErrors(ex.getMessage()); } @ExceptionHandler(Exception.class) diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index 3267beb2..693c1eb7 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -76,7 +76,6 @@ public class MindmapController extends BaseController { return new ModelAndView("transformViewWise", values); } - @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/freemind"}, params = {"download=mm"}) @ResponseBody public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException { @@ -105,6 +104,14 @@ public class MindmapController extends BaseController { return new ModelAndView("mapsView", "list", restMindmapList); } + + @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/history", produces = {"application/json", "text/html", "application/xml"}) + public ModelAndView retrieveHistory(@PathVariable int id) throws IOException { + final User user = com.wisemapping.security.Utils.getUser(); + + return null; + } + @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException { @@ -302,6 +309,7 @@ public class MindmapController extends BaseController { final ByteArrayInputStream stream = new ByteArrayInputStream(freemindXml); mindMap = importer.importMap(title, "", stream); } catch (ImporterException e) { + // @Todo: This should be an illegal argument exception. Review the all the other cases. throw buildValidationException("xml", "The selected file does not seems to be a valid Freemind or WiseMapping file. Contact support in case the problem persists."); } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestErrors.java b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestErrors.java index b07ae67b..a544afad 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestErrors.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestErrors.java @@ -27,6 +27,10 @@ import java.util.*; public class RestErrors { @JsonIgnore private Errors errors; + + @JsonIgnore + private List globalErrors; + @JsonIgnore MessageSource messageSource; @@ -38,9 +42,14 @@ public class RestErrors { this.errors = errors; this.messageSource = messageSource; + this.globalErrors = this.processGlobalErrors(errors, messageSource); } - public List getGlobalErrors() { + public RestErrors(@NotNull String errorMsg) { + globalErrors.add(errorMsg); + } + + private List processGlobalErrors(@NotNull Errors errors, @NotNull MessageSource messageSource) { final List result = new ArrayList(); final List globalErrors = errors.getGlobalErrors(); for (ObjectError globalError : globalErrors) { @@ -49,6 +58,10 @@ public class RestErrors { return result; } + public List getGlobalErrors() { + return globalErrors; + } + public void setGlobalErrors(List list) { // Implemented only for XML serialization contract ... } diff --git a/wise-webapp/src/main/webapp/images/info.png b/wise-webapp/src/main/webapp/images/info.png deleted file mode 100644 index 12cd1aef..00000000 Binary files a/wise-webapp/src/main/webapp/images/info.png and /dev/null differ diff --git a/wise-webapp/src/main/webapp/images/key.png b/wise-webapp/src/main/webapp/images/key.png deleted file mode 100644 index 4ec1a928..00000000 Binary files a/wise-webapp/src/main/webapp/images/key.png and /dev/null differ diff --git a/wise-webapp/src/main/webapp/js/mymaps.js b/wise-webapp/src/main/webapp/js/mymaps.js index 96969e25..0d280e32 100644 --- a/wise-webapp/src/main/webapp/js/mymaps.js +++ b/wise-webapp/src/main/webapp/js/mymaps.js @@ -445,6 +445,10 @@ $(function() { showEmbeddedDialog("c/maps/import", 'import-dialog-modal', true); }); + $("#shareBtn").click(function() { + showEmbeddedDialog("c/maps/{mapId}/share", 'share-dialog-modal', true); + }); + var showEmbeddedDialog = function(urlTemplate, dialogElemId, ignore) { var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); diff --git a/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp b/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp index 6d7de593..79cf6c00 100644 --- a/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp +++ b/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp @@ -9,12 +9,10 @@ - + - -
diff --git a/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp b/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp index 1c4abaeb..71a32392 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp @@ -72,7 +72,14 @@ inputField.parent().addClass('error'); } } - + var globalErrors = errors.globalErrors; + if (globalErrors) { + for (var error in globalErrors) { + // Mark the field with errors ... + $("#dialogMainForm").find(".errorMessage").text(error).addClass("alert alert-error"); + inputField.parent().addClass('error'); + } + } } else { console.log(errorThrown); console.log(jqXHR); diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 2bf136cf..9f10d618 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -279,6 +279,22 @@
+ + + + diff --git a/wise-webapp/src/main/webapp/jsp/mindmapShare.jsp b/wise-webapp/src/main/webapp/jsp/mindmapShare.jsp index c759c973..adb8aba1 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapShare.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapShare.jsp @@ -1,39 +1,209 @@ <%@ include file="/jsp/init.jsp" %> -

Who has access

+

Who has access:

- - - - - - - - +
NameEmailAction
-
-
- -
+
+
+

Add People:

+ + + +