Index: lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/IdeaJSON.java =================================================================== diff -u -r9cda52bbbc8ef19343bd53f563c0734560af1a3a -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/IdeaJSON.java (.../IdeaJSON.java) (revision 9cda52bbbc8ef19343bd53f563c0734560af1a3a) +++ lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/IdeaJSON.java (.../IdeaJSON.java) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -63,12 +63,16 @@ // TODO support more than one main node. mindmup does it, our database code does not /** Create JSON objects from the database model */ - public IdeaJSON(NodeModel node, int level) throws JSONException { + public IdeaJSON(NodeModel node, int level, boolean includeCreator) throws JSONException { super(); this.put(MAPJS_JSON_ID_KEY, node.getConcept().getId()); this.put(MAPJS_JSON_TITLE_KEY, node.getConcept().getText()); - this.put("creator", node.getConcept().getCreator()); // LAMS custom value + + if ( includeCreator ) { + // only needed for multi user maps + this.put("creator", node.getConcept().getCreator()); // LAMS custom value + } JSONObject attr = new JSONObject(); if ( node.getConcept().isEdit() == 0) { @@ -82,15 +86,15 @@ if (level == 0) { int rank = 1; for (NodeModel childNode : node.getBranch()) { - ideasList.put(String.valueOf(rank), new IdeaJSON(childNode, nextLevel)); + ideasList.put(String.valueOf(rank), new IdeaJSON(childNode, nextLevel, includeCreator)); rank = -rank; if (rank > 0) rank++; } } else { int rank = 1; for (NodeModel childNode : node.getBranch()) { - ideasList.put(String.valueOf(rank++), new IdeaJSON(childNode, nextLevel)); + ideasList.put(String.valueOf(rank++), new IdeaJSON(childNode, nextLevel, includeCreator)); } } this.put(MAPJS_JSON_IDEAS_KEY, ideasList); Index: lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/RootJSON.java =================================================================== diff -u -r9cda52bbbc8ef19343bd53f563c0734560af1a3a -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/RootJSON.java (.../RootJSON.java) (revision 9cda52bbbc8ef19343bd53f563c0734560af1a3a) +++ lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/dto/RootJSON.java (.../RootJSON.java) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -26,10 +26,8 @@ import java.util.Iterator; import org.apache.log4j.Logger; -import org.apache.tomcat.util.json.JSONArray; import org.apache.tomcat.util.json.JSONException; import org.apache.tomcat.util.json.JSONObject; -import org.lamsfoundation.lams.tool.mindmap.util.xmlmodel.NodeConceptModel; import org.lamsfoundation.lams.tool.mindmap.util.xmlmodel.NodeModel; /** A JSONObject in the MapJs v3 format as per https://github.com/mindmup/mapjs/wiki/Data-Format. @@ -56,7 +54,7 @@ // TODO support more than one main node. mindmup does it, our database code does not /** Create JSON objects from the database model */ - public RootJSON(NodeModel node) throws JSONException { + public RootJSON(NodeModel node, boolean includeCreator) throws JSONException { super(); // create special root level JSON object @@ -69,7 +67,7 @@ // start the recursion to create the ideas objects JSONObject ideas = new JSONObject(); - ideas.put("1", new IdeaJSON(node, 0) ); + ideas.put("1", new IdeaJSON(node, 0, includeCreator) ); this.put(IdeaJSON.MAPJS_JSON_IDEAS_KEY, ideas); } Index: lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/AuthoringAction.java =================================================================== diff -u -r9cda52bbbc8ef19343bd53f563c0734560af1a3a -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 9cda52bbbc8ef19343bd53f563c0734560af1a3a) +++ lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -165,7 +165,7 @@ mindmapId, rootNodeModel, null, false, true, false); JSONObject jsonObject = new JSONObject(); - jsonObject.put("mindmap", new RootJSON(currentNodeModel)); + jsonObject.put("mindmap", new RootJSON(currentNodeModel, false)); response.setContentType("application/x-json;charset=utf-8"); response.getWriter().print(jsonObject.toString()); Index: lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/LearningAction.java =================================================================== diff -u -r0e594c4a472245d5f4fc8b4978d20a1e7c99867b -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/LearningAction.java (.../LearningAction.java) (revision 0e594c4a472245d5f4fc8b4978d20a1e7c99867b) +++ lams_tool_mindmap/src/java/org/lamsfoundation/lams/tool/mindmap/web/actions/LearningAction.java (.../LearningAction.java) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -200,22 +200,6 @@ String currentMindmapUser = mindmapUser.getFirstName() + " " + mindmapUser.getLastName(); request.setAttribute("currentMindmapUser", currentMindmapUser); - // pollServer Parameter - String pollServerParam = Configuration.get(ConfigurationKeys.SERVER_URL) - + "tool/lamind10/learning.do?dispatch=pollServerAction%26mindmapId=" + mindmap.getUid() + "%26userId=" - + mindmapUser.getUid() + "%26sessionId=" + mindmapSession.getSessionId(); - request.setAttribute("pollServerParam", pollServerParam); - - // notifyServer Parameter - String notifyServerParam = Configuration.get(ConfigurationKeys.SERVER_URL) - + "tool/lamind10/learning.do?dispatch=notifyServerAction%26mindmapId=" + mindmap.getUid() + "%26userId=" - + mindmapUser.getUid() + "%26sessionId=" + mindmapSession.getSessionId(); - request.setAttribute("notifyServerParam", notifyServerParam); - - String localizationPath = Configuration.get(ConfigurationKeys.SERVER_URL) - + "tool/lamind10/learning.do?dispatch=setLocale"; - request.setAttribute("localizationPath", localizationPath); - // setting userId for reflection request.setAttribute("userIdParam", mindmapUser.getUid()); request.setAttribute("toolContentIdParam", mindmap.getUid()); @@ -517,7 +501,7 @@ mindmap.isLockOnFinished() && mindmapUser.isFinishedActivity()); JSONObject jsonObject = new JSONObject(); - jsonObject.put("mindmap", new RootJSON(currentNodeModel)); + jsonObject.put("mindmap", new RootJSON(currentNodeModel, mindmap.isMultiUserMode())); // adding lastActionId if (mindmap.isMultiUserMode()) { Long lastActionId = mindmapService.getLastGlobalIdByMindmapId(mindmap.getUid(), toolSessionId); Index: lams_tool_mindmap/web/common/mapjs.jsp =================================================================== diff -u -r0e594c4a472245d5f4fc8b4978d20a1e7c99867b -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/web/common/mapjs.jsp (.../mapjs.jsp) (revision 0e594c4a472245d5f4fc8b4978d20a1e7c99867b) +++ lams_tool_mindmap/web/common/mapjs.jsp (.../mapjs.jsp) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -19,6 +19,7 @@ requestsProcessed = new Array(), contentAggregate = null, // mindmup variable - dummy root idea that has all visible ideas mindMupContent = null; // mindmup content processor - used for reloading map. + // *** getMindmapContainerId() and loadRootIdea(content) called by customised mapjs code *** // window.mapModel is set up by mapjs in main.js. @@ -40,7 +41,12 @@ initialActionId = response.lastActionId; lastActionId = initialActionId; var idea = content(response.mindmap); - window.mapModel.setIdea(idea); + + + window.mapModel.setLabelGenerator(labelGenerator, "CreatorNameLabels"); + + + window.mapModel.setIdea(idea); window.mapModel.setEditingEnabled(false); @@ -94,6 +100,21 @@ + // set the creator labels for Multimode mindmaps + labelGenerator = function(idea) { + var labelMap = {}; + addLabel = function(idea) { + if ( idea.creator ) { + labelMap[idea.id] = idea.creator; + } + if ( idea.ideas ) { + Object.values(idea.ideas).forEach(addLabel); + } + }; + addLabel(idea); + return labelMap; + } + function updateLastActionId( newActionId ) { @@ -157,13 +178,14 @@ updateUnsavedNodeIds(response.nodeId); ideaToUpdate.id = response.nodeId; contentAggregate.invalidateIdCache(); - window.mapModel.rebuildRequired(); } else if ( args[0] > response.nodeId ) { // unexpected case - tell user to abort so we can't make anything worse. abortSave(); return; } + ideaToUpdate.creator = "${currentMindmapUser}"; + window.mapModel.rebuildRequired(); } }, error: function (response) { @@ -273,8 +295,9 @@ // add node response.nodeId, response.title, response.color contentAggregate.addSubIdea(action.nodeId, action.title, action.childNodeId); var newChildNode = contentAggregate.findSubIdeaById(action.childNodeId); - newChildNode.attr = {}; - newChildNode.attr.contentLocked = true; + newChildNode.attr = {}; + newChildNode.attr.contentLocked = true; + newChildNode.creator = action.creator; if ( action.color ) { newChildNode.attr.style = {}; newChildNode.attr.style.background = action.color; Index: lams_tool_mindmap/web/includes/css/mindmap.scss =================================================================== diff -u -rc4111cb04c54f01b5ba38e9f193e00039cfd7e18 -r960e6b751430fc4832cf844b878fc470d99ad118 --- lams_tool_mindmap/web/includes/css/mindmap.scss (.../mindmap.scss) (revision c4111cb04c54f01b5ba38e9f193e00039cfd7e18) +++ lams_tool_mindmap/web/includes/css/mindmap.scss (.../mindmap.scss) (revision 960e6b751430fc4832cf844b878fc470d99ad118) @@ -11,3 +11,16 @@ width: 100%; border: $border-thin-solid; } + +// Override the default mapjs styles +.mapjs-node .mapjs-label { + background: white; + opacity: 0.5; + color: white; + display: inline-block; + font-size: $font-size-small; +} + +.mapjs-node:hover .mapjs-label { + color: black; +}