diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js index def85803..13b35414 100644 --- a/mindplot/src/main/javascript/widget/Menu.js +++ b/mindplot/src/main/javascript/widget/Menu.js @@ -38,158 +38,173 @@ mindplot.widget.Menu = new Class({ // Create panels ... var designerModel = designer.getModel(); - var fontFamilyModel = { - getValue: function() { - var nodes = designerModel.filterSelectedTopics(); - var result = null; - for (var i = 0; i < nodes.length; i++) { - var fontFamily = nodes[i].getFontFamily(); - if (result != null && result != fontFamily) { - result = null; - break; + + var fontFamilyBtn = $('fontFamily'); + if (fontFamilyBtn) { + var fontFamilyModel = { + getValue: function() { + var nodes = designerModel.filterSelectedTopics(); + var result = null; + for (var i = 0; i < nodes.length; i++) { + var fontFamily = nodes[i].getFontFamily(); + if (result != null && result != fontFamily) { + result = null; + break; + } + result = fontFamily; } - result = fontFamily; + return result; + }, + + setValue: function(value) { + designer.changeFontFamily(value); + } - return result; - }, + }; + this._toolbarElems.push(new mindplot.widget.FontFamilyPanel("fontFamily", fontFamilyModel)); + this._registerTooltip('fontFamily', "Text font"); + } - setValue: function(value) { - designer.changeFontFamily(value); - - } - }; - this._toolbarElems.push(new mindplot.widget.FontFamilyPanel("fontFamily", fontFamilyModel)); - this._registerTooltip('fontFamily', "Text font"); - - - var fontSizeModel = { - getValue: function() { - var nodes = designerModel.filterSelectedTopics(); - var result = null; - for (var i = 0; i < nodes.length; i++) { - var fontSize = nodes[i].getFontSize(); - if (result != null && result != fontSize) { - result = null; - break; + var fontSizeBtn = $('fontSize'); + if (fontSizeBtn) { + var fontSizeModel = { + getValue: function() { + var nodes = designerModel.filterSelectedTopics(); + var result = null; + for (var i = 0; i < nodes.length; i++) { + var fontSize = nodes[i].getFontSize(); + if (result != null && result != fontSize) { + result = null; + break; + } + result = fontSize; } - result = fontSize; + return result; + }, + setValue: function(value) { + designer.changeFontSize(value); } - return result; - }, - setValue: function(value) { - designer.changeFontSize(value); - } - }; - this._toolbarElems.push(new mindplot.widget.FontSizePanel("fontSize", fontSizeModel)); - this._registerTooltip('fontSize', "Text size"); + }; + this._toolbarElems.push(new mindplot.widget.FontSizePanel("fontSize", fontSizeModel)); + this._registerTooltip('fontSize', "Text size"); + } - - var topicShapeModel = { - getValue: function() { - var nodes = designerModel.filterSelectedTopics(); - var result = null; - for (var i = 0; i < nodes.length; i++) { - var shapeType = nodes[i].getShapeType(); - if (result != null && result != shapeType) { - result = null; - break; + var topicShapeBtn = $('topicShapeBtn'); + if (topicShapeBtn) { + var topicShapeModel = { + getValue: function() { + var nodes = designerModel.filterSelectedTopics(); + var result = null; + for (var i = 0; i < nodes.length; i++) { + var shapeType = nodes[i].getShapeType(); + if (result != null && result != shapeType) { + result = null; + break; + } + result = shapeType; } - result = shapeType; + return result; + }, + setValue: function(value) { + designer.changeTopicShape(value); } - return result; - }, - setValue: function(value) { - designer.changeTopicShape(value); - } - }; - this._toolbarElems.push(new mindplot.widget.TopicShapePanel("topicShape", topicShapeModel)); - this._registerTooltip('topicShape', "Topic shape"); - - - // Create icon panel dialog ... - var topicIconModel = { - getValue: function() { - return null; - }, - setValue: function(value) { - designer.addIconType(value); - } - }; - this._toolbarElems.push(new mindplot.widget.IconPanel('topicIcon', topicIconModel)); - this._registerTooltip('topicIcon', "Icon"); + }; + this._toolbarElems.push(new mindplot.widget.TopicShapePanel("topicShape", topicShapeModel)); + this._registerTooltip('topicShape', "Topic shape"); + } + var topicIconBtn = $('topicIcon'); + if (topicIconBtn) { + // Create icon panel dialog ... + var topicIconModel = { + getValue: function() { + return null; + }, + setValue: function(value) { + designer.addIconType(value); + } + }; + this._toolbarElems.push(new mindplot.widget.IconPanel('topicIcon', topicIconModel)); + this._registerTooltip('topicIcon', "Icon"); + } // Topic color item ... - var topicColorModel = - { - getValue : function() { - var nodes = designerModel.filterSelectedTopics(); - var result = null; - for (var i = 0; i < nodes.length; i++) { - var color = nodes[i].getBackgroundColor(); - if (result != null && result != color) { - result = null; - break; - } - result = color; - } - return result; - }, - setValue : function (hex) { - designer.changeBackgroundColor(hex); - } - }; - this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl)); - this._registerTooltip('topicColor', "Topic color"); + var topicColorBtn = $('topicColor'); + if (topicColorBtn) { + var topicColorModel = { + getValue : function() { + var nodes = designerModel.filterSelectedTopics(); + var result = null; + for (var i = 0; i < nodes.length; i++) { + var color = nodes[i].getBackgroundColor(); + if (result != null && result != color) { + result = null; + break; + } + result = color; + } + return result; + }, + setValue : function (hex) { + designer.changeBackgroundColor(hex); + } + }; + this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl)); + this._registerTooltip('topicColor', "Topic color"); + } // Border color item ... - var borderColorModel = - { - getValue : function() { - var nodes = designerModel.filterSelectedTopics(); - var result = null; - for (var i = 0; i < nodes.length; i++) { - var color = nodes[i].getBorderColor(); - if (result != null && result != color) { - result = null; - break; + var topicBorderBtn = $('topicBorder'); + if (topicBorderBtn) { + var borderColorModel = + { + getValue : function() { + var nodes = designerModel.filterSelectedTopics(); + var result = null; + for (var i = 0; i < nodes.length; i++) { + var color = nodes[i].getBorderColor(); + if (result != null && result != color) { + result = null; + break; + } + result = color; } - result = color; + return result; + }, + setValue : function (hex) { + designer.changeBorderColor(hex); } - return result; - }, - setValue : function (hex) { - designer.changeBorderColor(hex); - } - }; - this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl)); - this._registerTooltip('topicBorder', "Border color"); - + }; + this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl)); + this._registerTooltip('topicBorder', "Border color"); + } // Font color item ... - var fontColorModel = - { - getValue : function() { - var result = null; - var nodes = designerModel.filterSelectedTopics(); - for (var i = 0; i < nodes.length; i++) { - var color = nodes[i].getFontColor(); - if (result != null && result != color) { - result = null; - break; + var fontColorBtn = $('fontColor'); + if (fontColorBtn) { + var fontColorModel = + { + getValue : function() { + var result = null; + var nodes = designerModel.filterSelectedTopics(); + for (var i = 0; i < nodes.length; i++) { + var color = nodes[i].getFontColor(); + if (result != null && result != color) { + result = null; + break; + } + result = color; } - result = color; + return result; + }, + setValue : function (hex) { + designer.changeFontColor(hex); } - return result; - }, - setValue : function (hex) { - designer.changeFontColor(hex); - } - }; - this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl)); - this._registerTooltip('fontColor', "Text color"); - + }; + this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl)); + this._registerTooltip('fontColor', "Text color"); + } this._addButton('export', false, false, function() { var reqDialog = new MooDialog.Request('c/iframeWrapper.htm?url=c/maps/' + mapId + "/exportf", null, @@ -208,7 +223,7 @@ mindplot.widget.Menu = new Class({ this._registerTooltip('export', "Export"); this._addButton('print', false, false, function() { - window.open('c/map/' + mapId + '/print'); + window.open('c/maps/' + mapId + '/print'); }); this._registerTooltip('print', "Print"); diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java index e96bbfcc..8b4d8c7f 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java @@ -20,6 +20,7 @@ package com.wisemapping.ncontroller; import com.wisemapping.filter.UserAgent; +import com.wisemapping.model.CollaborationRole; import com.wisemapping.model.MindMap; import com.wisemapping.security.Utils; import com.wisemapping.service.MindmapService; @@ -61,13 +62,6 @@ public class MindmapController { return "mindmapPrint"; } - @RequestMapping(value = "maps/{id}/view") - public String showViewPage(@PathVariable int id, @NotNull Model model) { - final MindMap mindmap = findMindmap(id); - model.addAttribute("mindmap", mindmap); - return "mindmapPrint"; - } - @RequestMapping(value = "maps/{id}/export") public String showExportPage(@PathVariable int id, @NotNull Model model) throws IOException { final MindMap mindmap = findMindmap(id); @@ -124,23 +118,27 @@ public class MindmapController { return "mindmapList"; } - @RequestMapping(value = "maps/{id}/edit") - public ModelAndView editMap(@PathVariable int id, @NotNull HttpServletRequest request) { - ModelAndView view; - final UserAgent userAgent = UserAgent.create(request); - if (userAgent.needsGCF()) { - view = new ModelAndView("gcfPluginNeeded"); -// view.addObject(MINDMAP_ID_PARAMETER, mindmapId); - } else { + @RequestMapping(value = "maps/{id}/edit", method = RequestMethod.GET) + public String showMindmapEditorPage(@PathVariable int id, @NotNull Model model) { + final MindMapBean mindmapBean = findMindmapBean(id); + final MindMap mindmap = mindmapBean.getDelegated(); - final MindMapBean mindmap = findMindmapBean(id); - view = new ModelAndView("mindmapEditor", "mindmap", mindmap); - view.addObject("editorTryMode", false); - final boolean showHelp = isWelcomeMap(mindmap); - view.addObject("showHelp", showHelp); - view.addObject("user", Utils.getUser()); + String result; + if (mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)) { + model.addAttribute("mindmap", mindmapBean); + result = "mindmapEditor"; + } else { + result = "redirect:view"; } - return view; + return result; + } + + @RequestMapping(value = "maps/{id}/view", method = RequestMethod.GET) + public String showMindmapViewerPage(@PathVariable int id, @NotNull Model model) { + final MindMapBean mindmapBean = findMindmapBean(id); + model.addAttribute("mindmap", mindmapBean); + model.addAttribute("readOnlyMode", true); + return "mindmapEditor"; } @RequestMapping(value = "maps/{id}/embed") diff --git a/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java b/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java deleted file mode 100755 index 6187246c..00000000 --- a/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java +++ /dev/null @@ -1,72 +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. -*/ - -package com.wisemapping.view; - -import java.util.Calendar; -import java.util.Locale; -import java.text.DateFormat; - -public class HistoryBean -{ - private Calendar historyTime; - private String author; - private int mindmapId; - private int historyId; - - public HistoryBean() {} - - public HistoryBean(int mindmapId,int historyId,String author, Calendar time) - { - this.mindmapId = mindmapId; - this.author = author; - this.historyTime = time; - this.historyId = historyId; - } - - public Calendar getHistoryTime() { - return historyTime; - } - - public String getCreation(Locale locale) - { - return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.DEFAULT,locale).format(historyTime.getTime()); - } - - public void setHistoryTime(Calendar historyTime) { - this.historyTime = historyTime; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public int getMindMapId() - { - return mindmapId; - } - - public int getHistoryId() - { - return historyId; - } -} diff --git a/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java b/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java index 7b44927b..c0dee96b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java +++ b/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java @@ -31,11 +31,11 @@ import java.util.*; public class MindMapBean { private MindMap mindMap; private List viewers; - private List colaborators; + private List collaborators; public MindMapBean(final MindMap mindmap) { this.mindMap = mindmap; - this.colaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR); + this.collaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR); this.viewers = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER); } @@ -64,7 +64,7 @@ public class MindMapBean { } public List getCollaborators() { - return colaborators; + return collaborators; } public String getLastEditor() { @@ -96,7 +96,7 @@ public class MindMapBean { } public int getCountCollaborators() { - return colaborators != null ? colaborators.size() : 0; + return collaborators != null ? collaborators.size() : 0; } public int getCountViewers() { @@ -135,4 +135,12 @@ public class MindMapBean { return mindMap.hasPermissions(Utils.getUser(), CollaborationRole.OWNER); } + public boolean isEditor() { + return mindMap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR); + } + + public MindMap getDelegated(){ + return mindMap; + } + } diff --git a/wise-webapp/src/main/webapp/images/es.gif b/wise-webapp/src/main/webapp/images/flag-es.gif similarity index 100% rename from wise-webapp/src/main/webapp/images/es.gif rename to wise-webapp/src/main/webapp/images/flag-es.gif diff --git a/wise-webapp/src/main/webapp/images/fr.gif b/wise-webapp/src/main/webapp/images/flag-fr.gif similarity index 100% rename from wise-webapp/src/main/webapp/images/fr.gif rename to wise-webapp/src/main/webapp/images/flag-fr.gif diff --git a/wise-webapp/src/main/webapp/images/uk.gif b/wise-webapp/src/main/webapp/images/flag-uk.gif similarity index 100% rename from wise-webapp/src/main/webapp/images/uk.gif rename to wise-webapp/src/main/webapp/images/flag-uk.gif diff --git a/wise-webapp/src/main/webapp/js/common.js b/wise-webapp/src/main/webapp/js/common.js deleted file mode 100644 index 8d7c773a..00000000 --- a/wise-webapp/src/main/webapp/js/common.js +++ /dev/null @@ -1,22 +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. - */ - -// @Todo: This must be reviewed ... -function displayLoading() { - $('headerLoading').style.visibility = 'visible'; -} \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/js/mymaps.js b/wise-webapp/src/main/webapp/js/mindmapList.js similarity index 100% rename from wise-webapp/src/main/webapp/js/mymaps.js rename to wise-webapp/src/main/webapp/js/mindmapList.js diff --git a/wise-webapp/src/main/webapp/jsp/header.jsp b/wise-webapp/src/main/webapp/jsp/header.jsp index e765f3ec..e287654b 100644 --- a/wise-webapp/src/main/webapp/jsp/header.jsp +++ b/wise-webapp/src/main/webapp/jsp/header.jsp @@ -25,13 +25,13 @@
- English + English
- Frances + Frances
- Espanol + EspaƱol
diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 8c2a5f01..35f8468c 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -36,6 +36,7 @@ options.persistenceManager = new mindplot.RESTPersistenceManager("service/maps/{id}/document"); var userOptions = ${mindmap.properties}; options.zoom = userOptions.zoom; + options.readOnly = ${!!readOnlyMode}; // Set map id ... options.mapId = mapId; diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditorToolbar.jsf b/wise-webapp/src/main/webapp/jsp/mindmapEditorToolbar.jsf index 199041ee..f987dd2c 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditorToolbar.jsf +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditorToolbar.jsf @@ -2,27 +2,28 @@
-
- -
-
- -
+ +
+ +
+
+ +
+
-
- -
-
-
- + +
+
+ +
+
+ +
-
- -
-
+
@@ -31,55 +32,56 @@
-
-
- + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
-
- +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
-
- -
-
- -
-
- -
-
- -
-
- -
- -
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- +
- +
@@ -87,9 +89,14 @@
-
- +
+
+ +
+ +
+
\ No newline at end of file diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 2ff7f967..d4c95343 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -18,7 +18,7 @@ - +