mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 04:30:42 +02:00
Finish mindmapHistory rest service.
This commit is contained in:
parent
33131d4e9e
commit
5e67811dcf
@ -374,7 +374,7 @@ mindplot.widget.Menu = new Class({
|
||||
if (historyElem) {
|
||||
|
||||
this._addButton('history', false, false, function() {
|
||||
var reqDialog = new MooDialog.Request('c/history?action=list&goToMindmapList&mapId=' + mapId, null,
|
||||
var reqDialog = new MooDialog.Request('c/iframeWrapper?url=c/maps/' + mapId + "/historyf", null,
|
||||
{'class': 'modalDialog historyModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
|
@ -1,71 +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.controller;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import com.wisemapping.service.UserService;
|
||||
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public abstract class BaseMultiActionController
|
||||
extends MultiActionController {
|
||||
|
||||
private MindmapService mindmapService;
|
||||
private UserService userService;
|
||||
|
||||
protected MindMap getMindmapFromRequest(HttpServletRequest request) {
|
||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMNAME);
|
||||
assert mapIdStr != null : "mapId parameter can not be null";
|
||||
logger.info("MapIdStr:" + mapIdStr);
|
||||
MindMap map = null;
|
||||
int mapId;
|
||||
try {
|
||||
mapId = Integer.parseInt(mapIdStr);
|
||||
map = mindmapService.getMindmapById(mapId);
|
||||
} catch (Exception e) {
|
||||
logger.debug("An error ocurred trying to get mapId " + mapIdStr + "'", e);
|
||||
}
|
||||
|
||||
if (map == null) {
|
||||
throw new IllegalStateException("Map with id '" + mapIdStr + "' can not be found");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public MindmapService getMindmapService() {
|
||||
return mindmapService;
|
||||
}
|
||||
|
||||
public void setMindmapService(MindmapService mindmapService) {
|
||||
this.mindmapService = mindmapService;
|
||||
}
|
||||
|
||||
public UserService getUserService() {
|
||||
return userService;
|
||||
}
|
||||
|
||||
public void setUserService(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
public static final String MAP_ID_PARAMNAME = "mapId";
|
||||
public static final String MINDMAP_EMAILS_PARAMNAME = "userEmails";
|
||||
}
|
@ -46,17 +46,10 @@ public class BaseSimpleFormController extends SimpleFormController
|
||||
return mindmapService;
|
||||
}
|
||||
|
||||
public void setMindmapService(MindmapService mindmapService) {
|
||||
this.mindmapService = mindmapService;
|
||||
}
|
||||
|
||||
public String getErrorView() {
|
||||
return errorView;
|
||||
}
|
||||
|
||||
public void setErrorView(String errorView) {
|
||||
this.errorView = errorView;
|
||||
}
|
||||
|
||||
@Override protected org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, org.springframework.validation.BindException bindException) throws java.lang.Exception
|
||||
{
|
||||
@ -69,15 +62,6 @@ public class BaseSimpleFormController extends SimpleFormController
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
/* TODO codigo repetido en BaseMultiActionController */
|
||||
protected MindMap getMindmapFromRequest(HttpServletRequest request) {
|
||||
final String mapIdStr = request.getParameter(BaseMultiActionController.MAP_ID_PARAMNAME);
|
||||
assert mapIdStr != null : "mapId parameter can not be null";
|
||||
logger.info("MapIdStr:" + mapIdStr);
|
||||
int mapId = Integer.parseInt(mapIdStr);
|
||||
return mindmapService.getMindmapById(mapId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,82 +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.controller;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.MindMapHistory;
|
||||
import com.wisemapping.view.HistoryBean;
|
||||
import com.wisemapping.view.MindMapBean;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HistoryController
|
||||
extends BaseMultiActionController
|
||||
{
|
||||
private static final String HISTORY_ID = "historyId";
|
||||
|
||||
public ModelAndView list(HttpServletRequest request, HttpServletResponse response)
|
||||
throws java.lang.Exception {
|
||||
|
||||
final MindMap map = getMindmapFromRequest(request);
|
||||
final List<HistoryBean> historyBeanList = createHistoryBeanList(map);
|
||||
|
||||
final Map<String,Object> attr = new HashMap<String,Object>();
|
||||
attr.put("minmap",new MindMapBean(map));
|
||||
attr.put("goToMindmapList",request.getParameter("goToMindmapList"));
|
||||
attr.put("historyBeanList",historyBeanList);
|
||||
return new ModelAndView("mindmapHistory",attr);
|
||||
}
|
||||
|
||||
public ModelAndView revert(HttpServletRequest request, HttpServletResponse response)
|
||||
throws java.lang.Exception {
|
||||
|
||||
final MindMap map = getMindmapFromRequest(request);
|
||||
final int revertId = Integer.parseInt(request.getParameter(HISTORY_ID));
|
||||
getMindmapService().revertMapToHistory(map, revertId);
|
||||
final StringBuilder redirectionTo = new StringBuilder("redirect:");
|
||||
|
||||
String goToMindmapList = request.getParameter("goToMindmapList");
|
||||
if (goToMindmapList != null)
|
||||
{
|
||||
redirectionTo.append("maps/");
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectionTo.append("editor?mapId=");
|
||||
redirectionTo.append(map.getId());
|
||||
redirectionTo.append("&action=open");
|
||||
}
|
||||
return new ModelAndView(redirectionTo.toString());
|
||||
}
|
||||
|
||||
private List<HistoryBean> createHistoryBeanList(MindMap map) {
|
||||
final List<MindMapHistory> list = getMindmapService().getMindMapHistory(map.getId());
|
||||
final List<HistoryBean> historyBeanList = new ArrayList<HistoryBean>(list.size());
|
||||
for (MindMapHistory mindMapHistory : list) {
|
||||
historyBeanList.add(new HistoryBean(mindMapHistory.getMindmapId(),mindMapHistory.getId(),mindMapHistory.getCreator(),mindMapHistory.getCreationTime()));
|
||||
}
|
||||
return historyBeanList;
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMeth
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class SettingsController extends BaseMultiActionController {
|
||||
public class SettingsController {
|
||||
|
||||
public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
|
||||
throws Exception {
|
||||
|
@ -37,7 +37,7 @@ public class TagsController
|
||||
//~ Methods ..............................................................................................
|
||||
protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception {
|
||||
|
||||
final MindMap mindmap = getMindmapFromRequest(httpServletRequest);
|
||||
final MindMap mindmap = null;
|
||||
final User user = Utils.getUser(httpServletRequest);
|
||||
final User dbUser = getUserService().getUserBy(user.getId());
|
||||
|
||||
|
@ -47,7 +47,7 @@ public interface MindmapManager {
|
||||
|
||||
void saveMindmap(MindMap mindMap);
|
||||
|
||||
void updateMindmap(MindMap mindMap, boolean saveHistory);
|
||||
void updateMindmap(@NotNull MindMap mindMap, boolean saveHistory);
|
||||
|
||||
void removeCollaborator(@NotNull Collaborator collaborator);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
@ -20,11 +19,8 @@
|
||||
package com.wisemapping.ncontroller;
|
||||
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.filter.UserAgent;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import com.wisemapping.view.MindMapBean;
|
||||
@ -32,77 +28,100 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class MindmapController {
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
@Qualifier("mindmapService")
|
||||
@Autowired
|
||||
private MindmapService mindmapService;
|
||||
|
||||
@RequestMapping(value = "maps/{id}/export")
|
||||
public ModelAndView showExportPage(@PathVariable int id) throws IOException {
|
||||
final MindMapBean modelObject = findMindmapBean(id);
|
||||
return new ModelAndView("mindmapExport", "mindmap", modelObject);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/import")
|
||||
public ModelAndView showImportPAge() throws IOException {
|
||||
return new ModelAndView("mindmapImport");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/exportf")
|
||||
public ModelAndView showExportPageFull(@PathVariable int id) throws IOException {
|
||||
final MindMapBean modelObject = findMindmapBean(id);
|
||||
return new ModelAndView("mindmapExportFull", "mindmap", modelObject);
|
||||
public String showImportPage() {
|
||||
return "mindmapImport";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/details")
|
||||
public ModelAndView showDetails(@PathVariable int id) {
|
||||
final MindMapBean modelObject = findMindmapBean(id);
|
||||
final ModelAndView view = new ModelAndView("mindmapDetail", "wisemapDetail", modelObject);
|
||||
view.addObject("user", Utils.getUser());
|
||||
return view;
|
||||
public String showDetails(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMapBean mindmap = findMindmapBean(id);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapDetail";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/print")
|
||||
public ModelAndView showPrintPage(@PathVariable int id) {
|
||||
public String showPrintPage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
return new ModelAndView("mindmapPrint", "mindmap", mindmap);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
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);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapExport";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/exportf")
|
||||
public String showExportPageFull(@PathVariable int id, @NotNull Model model) throws IOException {
|
||||
showExportPage(id, model);
|
||||
return "mindmapExportFull";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/share")
|
||||
public ModelAndView showSharePage(@PathVariable int id) {
|
||||
public String showSharePage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
return new ModelAndView("mindmapShare", "mindmap", mindmap);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapShare";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/sharef")
|
||||
public ModelAndView showSharePageFull(@PathVariable int id) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
return new ModelAndView("mindmapShareFull", "mindmap", mindmap);
|
||||
public String showSharePageFull(@PathVariable int id, @NotNull Model model) {
|
||||
showSharePage(id, model);
|
||||
return "mindmapShareFull";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/publish")
|
||||
public ModelAndView showPublishPage(@PathVariable int id) {
|
||||
public String showPublishPage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
return new ModelAndView("mindmapPublish", "mindmap", mindmap);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapPublish";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/publishf")
|
||||
public ModelAndView showPublishPageFull(@PathVariable int id) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
return new ModelAndView("mindmapPublishFull", "mindmap", mindmap);
|
||||
public String showPublishPageFull(@PathVariable int id, @NotNull Model model) {
|
||||
showPublishPage(id, model);
|
||||
return "mindmapPublishFull";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/history", method = RequestMethod.GET)
|
||||
public String showHistoryPage(@PathVariable int id, @NotNull Model model) {
|
||||
model.addAttribute("mindmapId", id);
|
||||
return "mindmapHistory";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/historyf", method = RequestMethod.GET)
|
||||
public String showHistoryPageFull(@PathVariable int id, @NotNull Model model) {
|
||||
showHistoryPage(id, model);
|
||||
return "mindmapHistoryFull";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/")
|
||||
public String showListPage() {
|
||||
return "mindmapList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/edit")
|
||||
@ -114,7 +133,7 @@ public class MindmapController {
|
||||
// view.addObject(MINDMAP_ID_PARAMETER, mindmapId);
|
||||
} else {
|
||||
|
||||
final MindMap mindmap = mindmapService.getMindmapById(id);
|
||||
final MindMapBean mindmap = findMindmapBean(id);
|
||||
view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
||||
view.addObject("editorTryMode", false);
|
||||
final boolean showHelp = isWelcomeMap(mindmap);
|
||||
@ -125,9 +144,8 @@ public class MindmapController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/{id}/embed")
|
||||
public ModelAndView embeddedView(@PathVariable int id, @RequestParam(required = false) Float zoom, @NotNull HttpServletRequest request) {
|
||||
public ModelAndView embeddedView(@PathVariable int id, @RequestParam(required = false) Float zoom) {
|
||||
ModelAndView view;
|
||||
final UserAgent userAgent = UserAgent.create(request);
|
||||
final MindMap mindmap = mindmapService.getMindmapById(id);
|
||||
view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap);
|
||||
view.addObject("user", Utils.getUser());
|
||||
@ -135,64 +153,6 @@ public class MindmapController {
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "collaborator")
|
||||
public ModelAndView showCollaborator(@RequestParam(required = true) long mapId) {
|
||||
final MindMapBean modelObject = findMindmapBean(mapId);
|
||||
return new ModelAndView("mindmapCollaborator", "mindmap", modelObject);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "viewer")
|
||||
public ModelAndView viewer(@RequestParam(required = true) long mapId) {
|
||||
final MindMapBean modelObject = findMindmapBean(mapId);
|
||||
return new ModelAndView("mindmapViewer", "wisemapsList", modelObject);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "changeStatus")
|
||||
public ModelAndView changeStatus(@RequestParam(required = true) long mapId) throws WiseMappingException {
|
||||
final MindMap mindmap = findMindmap(mapId);
|
||||
boolean isPublic = !mindmap.isPublic();
|
||||
mindmap.setPublic(isPublic);
|
||||
mindmapService.updateMindmap(mindmap, false);
|
||||
return new ModelAndView("mindmapDetail", "wisemapDetail", new MindMapBean(mindmap));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "maps/")
|
||||
public ModelAndView list(@NotNull HttpServletRequest request) {
|
||||
final HttpSession session = request.getSession(false);
|
||||
|
||||
// Try to loaded from the request ...
|
||||
UserAgent userAgent = null;
|
||||
if (session != null) {
|
||||
userAgent = (UserAgent) session.getAttribute(USER_AGENT);
|
||||
}
|
||||
|
||||
// I could not loaded. I will create a new one...
|
||||
if (userAgent == null) {
|
||||
userAgent = UserAgent.create(request);
|
||||
if (session != null) {
|
||||
session.setAttribute(USER_AGENT, userAgent);
|
||||
}
|
||||
}
|
||||
|
||||
// It's a supported browser ?.
|
||||
final UserAgent.OS os = userAgent.getOs();
|
||||
|
||||
final User user = Utils.getUser();
|
||||
final ModelAndView view = new ModelAndView("mindmapList", "wisemapsList", findMindMapBeanList(user));
|
||||
view.addObject("isMAC", os == UserAgent.OS.MAC);
|
||||
view.addObject("user", user);
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateMindmap")
|
||||
public ModelAndView updateMindmap(@RequestParam(required = true) long mapId, @RequestParam(required = true) String title, @RequestParam(required = true) String description, @NotNull HttpServletRequest request) throws WiseMappingException {
|
||||
final MindMap mindmap = findMindmap(mapId);
|
||||
mindmap.setTitle(title);
|
||||
mindmap.setDescription(description);
|
||||
|
||||
mindmapService.updateMindmap(mindmap, false);
|
||||
return list(request);
|
||||
}
|
||||
|
||||
private MindMap findMindmap(long mapId) {
|
||||
final MindMap mindmap = mindmapService.getMindmapById((int) mapId);
|
||||
@ -202,24 +162,11 @@ public class MindmapController {
|
||||
return mindmap;
|
||||
}
|
||||
|
||||
private List<MindMapBean> findMindMapBeanList(@NotNull User user) {
|
||||
final List<Collaboration> userMindmaps = mindmapService.getCollaborationsBy(user);
|
||||
|
||||
final List<MindMapBean> mindMapBeans = new ArrayList<MindMapBean>(userMindmaps.size());
|
||||
for (Collaboration mindmap : userMindmaps) {
|
||||
mindMapBeans.add(new MindMapBean(mindmap.getMindMap()));
|
||||
}
|
||||
return mindMapBeans;
|
||||
}
|
||||
|
||||
private MindMapBean findMindmapBean(long mapId) {
|
||||
return new MindMapBean(findMindmap(mapId));
|
||||
}
|
||||
|
||||
private boolean isWelcomeMap(MindMap map) {
|
||||
private boolean isWelcomeMap(MindMapBean map) {
|
||||
return map.getTitle().startsWith("Welcome ");
|
||||
}
|
||||
|
||||
|
||||
private static final String USER_AGENT = "wisemapping.userAgent";
|
||||
}
|
||||
|
@ -105,13 +105,12 @@ public class MindmapController extends BaseController {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/history", produces = {"application/json", "text/html", "application/xml"})
|
||||
public ModelAndView retrieveHistory(@PathVariable int id) throws IOException {
|
||||
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||
final RestCollaborationList result = new RestCollaborationList();
|
||||
for (Collaboration collaboration : collaborations) {
|
||||
result.addCollaboration(new RestCollaboration(collaboration));
|
||||
final List<MindMapHistory> histories = mindmapService.getMindMapHistory(id);
|
||||
final RestMindmapHistoryList result = new RestMindmapHistoryList();
|
||||
for (MindMapHistory history : histories) {
|
||||
result.addHistory(new RestMindmapHistory(history));
|
||||
}
|
||||
return new ModelAndView("collabView", "list", result);
|
||||
return new ModelAndView("historyView", "list", result);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/document", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ -410,7 +409,7 @@ public class MindmapController extends BaseController {
|
||||
final Calendar now = Calendar.getInstance();
|
||||
mindMap.setLastModificationTime(now);
|
||||
mindMap.setLastModifierUser(user.getUsername());
|
||||
mindmapService.updateMindmap(mindMap, minor);
|
||||
mindmapService.updateMindmap(mindMap, !minor);
|
||||
}
|
||||
|
||||
private ValidationException buildValidationException(@NotNull String fieldName, @NotNull String message) throws ValidationException {
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.MindMapHistory;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@XmlRootElement(name = "history")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
@JsonAutoDetect(
|
||||
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
|
||||
isGetterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY
|
||||
)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class RestMindmapHistory {
|
||||
|
||||
static private SimpleDateFormat sdf;
|
||||
private int id;
|
||||
private Calendar creation;
|
||||
private String creator;
|
||||
|
||||
static {
|
||||
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
public RestMindmapHistory(@NotNull MindMapHistory history) {
|
||||
this.id = history.getId();
|
||||
this.creation = history.getCreationTime();
|
||||
this.creator = history.getCreator();
|
||||
}
|
||||
|
||||
public String getCreationTime() {
|
||||
return this.toISO8601(creation.getTime());
|
||||
}
|
||||
|
||||
public void setCreationTime() {
|
||||
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator() {
|
||||
// Do nothing ...
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
}
|
||||
|
||||
private String toISO8601(@NotNull Date date) {
|
||||
return sdf.format(date) + "Z";
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "history")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
@JsonAutoDetect(
|
||||
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
|
||||
isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
|
||||
public class RestMindmapHistoryList {
|
||||
|
||||
private List<RestMindmapHistory> changes;
|
||||
|
||||
public RestMindmapHistoryList() {
|
||||
changes = new ArrayList<RestMindmapHistory>();
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.changes.size();
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
|
||||
}
|
||||
|
||||
@XmlElement(name = "changes")
|
||||
public List<RestMindmapHistory> getChanges() {
|
||||
return changes;
|
||||
}
|
||||
|
||||
public void addHistory(@NotNull RestMindmapHistory history) {
|
||||
changes.add(history);
|
||||
}
|
||||
}
|
@ -88,7 +88,6 @@ public class MindmapServiceImpl
|
||||
if (mindMap.getTitle() == null || mindMap.getTitle().length() == 0) {
|
||||
throw new WiseMappingException("The tile can not be empty");
|
||||
}
|
||||
|
||||
mindmapManager.updateMindmap(mindMap, saveHistory);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import java.util.regex.Matcher;
|
||||
|
||||
import com.wisemapping.controller.Messages;
|
||||
|
||||
public class Utils {
|
||||
final public class Utils {
|
||||
//Set the email emailPattern string
|
||||
|
||||
static private Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
|
||||
|
@ -24,6 +24,7 @@ import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@ -34,12 +35,8 @@ public class MindMapBean {
|
||||
|
||||
public MindMapBean(final MindMap mindmap) {
|
||||
this.mindMap = mindmap;
|
||||
this.colaborators = getColaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
||||
this.viewers = getColaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER);
|
||||
}
|
||||
|
||||
public MindMap getMindMap() {
|
||||
return mindMap;
|
||||
this.colaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
||||
this.viewers = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER);
|
||||
}
|
||||
|
||||
public boolean getPublic() {
|
||||
@ -86,7 +83,7 @@ public class MindMapBean {
|
||||
return mindMap.getTags();
|
||||
}
|
||||
|
||||
private List<CollaboratorBean> getColaboratorBy(Set<Collaboration> source, CollaborationRole role) {
|
||||
private List<CollaboratorBean> filterCollaboratorBy(Set<Collaboration> source, CollaborationRole role) {
|
||||
List<CollaboratorBean> col = new ArrayList<CollaboratorBean>();
|
||||
if (source != null) {
|
||||
for (Collaboration mu : source) {
|
||||
@ -98,7 +95,7 @@ public class MindMapBean {
|
||||
return col;
|
||||
}
|
||||
|
||||
public int getCountColaborators() {
|
||||
public int getCountCollaborators() {
|
||||
return colaborators != null ? colaborators.size() : 0;
|
||||
}
|
||||
|
||||
@ -107,7 +104,7 @@ public class MindMapBean {
|
||||
}
|
||||
|
||||
public int getCountShared() {
|
||||
return getCountColaborators() + getCountViewers();
|
||||
return getCountCollaborators() + getCountViewers();
|
||||
}
|
||||
|
||||
public boolean isShared() {
|
||||
@ -122,7 +119,20 @@ public class MindMapBean {
|
||||
mindMap.setDescription(d);
|
||||
}
|
||||
|
||||
public String getXmlAsJsLiteral() throws IOException {
|
||||
return this.mindMap.getXmlAsJsLiteral();
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
return this.mindMap.getProperties();
|
||||
}
|
||||
|
||||
public User getCreator() {
|
||||
return mindMap.getCreator();
|
||||
}
|
||||
|
||||
public boolean isOwner() {
|
||||
return mindMap.hasPermissions(Utils.getUser(), CollaborationRole.OWNER);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -106,12 +106,6 @@
|
||||
<put-attribute name="body" value="/jsp/editProfile.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="changePassword" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="CHANGE_PASSWORD"/>
|
||||
<put-attribute name="details" value="FIELD_REQUIRED_MSG"/>
|
||||
<put-attribute name="body" value="/jsp/changePassword.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="mindmapExport" extends="dialogTemplate">
|
||||
<put-attribute name="title" value=""/>
|
||||
<put-attribute name="details" value=""/>
|
||||
@ -148,16 +142,22 @@
|
||||
<put-attribute name="body" value="/jsp/mindmapShare.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="keyboard" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="KEYBOARD"/>
|
||||
<put-attribute name="details" value="KEYBOARD_MSG"/>
|
||||
<put-attribute name="body" value="/jsp/keyboard.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="mindmapImport" extends="dialogTemplate">
|
||||
<put-attribute name="body" value="/jsp/mindmapImport.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="mindmapHistory" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="HISTORY"/>
|
||||
<put-attribute name="details" value="HISTORY_INFO"/>
|
||||
<put-attribute name="body" value="/jsp/mindmapHistory.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="mindmapHistoryFull" extends="dialogFullTemplate">
|
||||
<put-attribute name="title" value="HISTORY"/>
|
||||
<put-attribute name="details" value="HISTORY_INFO"/>
|
||||
<put-attribute name="body" value="/jsp/mindmapHistory.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="activationAccountConfirmation" extends="pageTemplate">
|
||||
<put-attribute name="title" value="ACCOUNT_ACTIVED"/>
|
||||
<put-attribute name="body" value="/jsp/activationAccountConfirmation.jsp"/>
|
||||
@ -168,9 +168,16 @@
|
||||
<put-attribute name="body" value="/jsp/activationAccountConfirmationFail.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="mindmapHistory" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="HISTORY"/>
|
||||
<put-attribute name="details" value="HISTORY_INFO"/>
|
||||
<put-attribute name="body" value="/jsp/mindmapHistory.jsp"/>
|
||||
<definition name="keyboard" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="KEYBOARD"/>
|
||||
<put-attribute name="details" value="KEYBOARD_MSG"/>
|
||||
<put-attribute name="body" value="/jsp/keyboard.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="changePassword" extends="dialogTemplate">
|
||||
<put-attribute name="title" value="CHANGE_PASSWORD"/>
|
||||
<put-attribute name="details" value="FIELD_REQUIRED_MSG"/>
|
||||
<put-attribute name="body" value="/jsp/changePassword.jsp"/>
|
||||
</definition>
|
||||
|
||||
</tiles-definitions>
|
||||
|
@ -3,6 +3,11 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="userValidator" class="com.wisemapping.validator.UserValidator">
|
||||
<property name="userService" ref="userService"/>
|
||||
<property name="captchaService" ref="reCaptcha"/>
|
||||
</bean>
|
||||
|
||||
<bean id="settingResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
|
||||
<property name="mappings">
|
||||
<props>
|
||||
|
@ -433,6 +433,10 @@ $(function() {
|
||||
showEmbeddedDialog("c/maps/{mapId}/details", 'info-dialog-modal');
|
||||
});
|
||||
|
||||
$("#historyBtn").click(function() {
|
||||
showEmbeddedDialog("c/maps/{mapId}/history", 'history-dialog-modal');
|
||||
});
|
||||
|
||||
$("#publishBtn").click(function() {
|
||||
showEmbeddedDialog("c/maps/{mapId}/publish", "publish-dialog-modal");
|
||||
});
|
||||
|
@ -13,6 +13,7 @@
|
||||
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-responsive.min.css"/>
|
||||
<script type="text/javascript" language="javascript" src="js/jquery.timeago.js"></script>
|
||||
<body>
|
||||
<div style="padding-top:20px">
|
||||
<tiles:insertAttribute name="body"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<div class="loginNews">
|
||||
<h1>What is New: </h1>
|
||||
<ul>
|
||||
<li>Complerly new UI</li>
|
||||
<li>New User Interface</li>
|
||||
<li>FreeMind 0.9 Update</li>
|
||||
<li>Improved HTML 5.0 Support</li>
|
||||
<li>Firefox 12 officially supported</li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%@ include file="/jsp/init.jsp" %>
|
||||
<%--@elvariable id="wisemapDetail" type="com.wisemapping.view.MindMapBean"--%>
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.view.MindMapBean"--%>
|
||||
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
@ -11,25 +11,25 @@
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="general">
|
||||
<ul class="unstyled">
|
||||
<li><strong><spring:message code="NAME"/>:</strong> ${wisemapDetail.title}</li>
|
||||
<li><strong><spring:message code="DESCRIPTION"/>:</strong> ${wisemapDetail.description}</li>
|
||||
<li><strong><spring:message code="CREATOR"/>:</strong> ${wisemapDetail.creator.username}</li>
|
||||
<li><strong><spring:message code="CREATION_TIME"/>:</strong> ${wisemapDetail.creationTime}</li>
|
||||
<li><strong><spring:message code="LAST_UPDATE"/>:</strong> ${wisemapDetail.lastEditTime}</li>
|
||||
<li><strong><spring:message code="LAST_UPDATE_BY"/>:</strong> ${wisemapDetail.lastEditor}</li>
|
||||
<li><strong> <spring:message code="STARRED"/>:</strong> ${wisemapDetail.starred}</li>
|
||||
<li><strong><spring:message code="NAME"/>:</strong> ${mindmap.title}</li>
|
||||
<li><strong><spring:message code="DESCRIPTION"/>:</strong> ${mindmap.description}</li>
|
||||
<li><strong><spring:message code="CREATOR"/>:</strong> ${mindmap.creator.username}</li>
|
||||
<li><strong><spring:message code="CREATION_TIME"/>:</strong> ${mindmap.creationTime}</li>
|
||||
<li><strong><spring:message code="LAST_UPDATE"/>:</strong> ${mindmap.lastEditTime}</li>
|
||||
<li><strong><spring:message code="LAST_UPDATE_BY"/>:</strong> ${mindmap.lastEditor}</li>
|
||||
<li><strong> <spring:message code="STARRED"/>:</strong> ${mindmap.starred}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="collaborators">
|
||||
<ul class="unstyled">
|
||||
<li><strong><spring:message
|
||||
code="EDITORS"/>(${wisemapDetail.countColaborators}): </strong>
|
||||
<c:forEach items="${wisemapDetail.collaborators}" var="mindmapCollaborator">
|
||||
code="EDITORS"/>(${mindmap.countCollaborators}): </strong>
|
||||
<c:forEach items="${mindmap.collaborators}" var="mindmapCollaborator">
|
||||
${mindmapCollaborator.username}
|
||||
</c:forEach>
|
||||
</li>
|
||||
<li><strong><spring:message code="VIEWERS"/>(${wisemapDetail.countViewers}): </strong>
|
||||
<c:forEach items="${wisemapDetail.viewers}" var="mindmapViewer">
|
||||
<li><strong><spring:message code="VIEWERS"/>(${mindmap.countViewers}): </strong>
|
||||
<c:forEach items="${mindmap.viewers}" var="mindmapViewer">
|
||||
${mindmapViewer.username}
|
||||
</c:forEach>
|
||||
</li>
|
||||
@ -38,17 +38,17 @@
|
||||
|
||||
<div class="tab-pane fade" id="publish">
|
||||
<c:choose>
|
||||
<c:when test="${wisemapDetail.public}">
|
||||
<c:when test="${mindmap.public}">
|
||||
<ul class="unstyled">
|
||||
<p><spring:message code="ALL_VIEW_PUBLIC"/></p>
|
||||
|
||||
<li><strong><spring:message code="URL"/>:</strong>
|
||||
<li><input name="url"
|
||||
value="http://www.wisemapping.com/c/publicView?mapId=${wisemapDetail.id}"
|
||||
value="http://www.wisemapping.com/c/publicView?mapId=${mindmap.id}"
|
||||
style="width:400px" readonly="readonly"/>
|
||||
</li>
|
||||
<li><strong><spring:message code="BLOG_SNIPPET"/></strong>
|
||||
<pre><iframe style="border:0;width:600px;height:400px;border: 1px solid black" src="http://www.wisemapping.com/c/embeddedView?mapId=${wisemapDetail.id}&amzoom=1"></iframe></pre>
|
||||
<pre><iframe style="border:0;width:600px;height:400px;border: 1px solid black" src="http://www.wisemapping.com/c/embeddedView?mapId=${mindmap.id}&amzoom=1"></iframe></pre>
|
||||
</li>
|
||||
<li><spring:message code="EMBEDDED_MAP_SIZE"/></li>
|
||||
</ul>
|
||||
|
@ -75,7 +75,7 @@
|
||||
|
||||
<div id="headerMapTitle">Title: <span>${mindmap.title}</span></div>
|
||||
</div>
|
||||
<%@ include file="/jsp/toolbar.jsf" %>
|
||||
<%@ include file="/jsp/mindmapEditorToolbar.jsf" %>
|
||||
</div>
|
||||
|
||||
<div id="mindplot"></div>
|
||||
|
@ -1,3 +1,5 @@
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
|
||||
|
||||
<div id="toolbar">
|
||||
<div id="persist" class="buttonContainer">
|
||||
<div id="save" class="buttonOn">
|
||||
@ -75,13 +77,16 @@
|
||||
<img src="../images/font-color.png"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collaboration" class="buttonContainer">
|
||||
<div id="shareIt" class="buttonOn">
|
||||
<img src="../images/share.png"/>
|
||||
</div>
|
||||
<div id="publishIt" class="buttonOn">
|
||||
<img src="../images/public.png"/>
|
||||
</div>
|
||||
<c:if test="${mindmap.owner}">
|
||||
<div id="shareIt" class="buttonOn">
|
||||
<img src="../images/share.png"/>
|
||||
</div>
|
||||
<div id="publishIt" class="buttonOn">
|
||||
<img src="../images/public.png"/>
|
||||
</div>
|
||||
</c:if>
|
||||
<div id="history" class="buttonOn">
|
||||
<img src="../images/history.png"/>
|
||||
</div>
|
@ -1,74 +1,62 @@
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="com.wisemapping.view.HistoryBean" %>
|
||||
<%@ include file="/jsp/init.jsp" %>
|
||||
<script type="text/javascript">
|
||||
function revertHistory(mapId, historyId)
|
||||
{
|
||||
document.revertForm.mapId.value = mapId;
|
||||
document.revertForm.historyId.value = historyId;
|
||||
document.revertForm.submit();
|
||||
return false;
|
||||
|
||||
<style type="text/css">
|
||||
#historyContainer {
|
||||
overflow-y: scroll;
|
||||
max-height: 400px;
|
||||
}
|
||||
</script>
|
||||
<table style="border:1px gray dashed;width:100%;margin-top:10px;">
|
||||
<thead>
|
||||
<tr style="border:1px gray dashed;color:white;background:black;">
|
||||
<td>
|
||||
<spring:message code="MODIFIED"/>
|
||||
</td>
|
||||
<td>
|
||||
<spring:message code="BY"/>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
final List<HistoryBean> list = (List<HistoryBean>) request.getAttribute("historyBeanList");
|
||||
if (list != null && !list.isEmpty()) {
|
||||
%>
|
||||
<%
|
||||
for (HistoryBean history : list) {
|
||||
|
||||
%>
|
||||
#historyContainer table {
|
||||
font-size: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<%=history.getCreation(request.getLocale())%>
|
||||
</td>
|
||||
<td>
|
||||
<%=history.getAuthor()%>
|
||||
</td>
|
||||
<td>
|
||||
<a onclick="return revertHistory('<%=history.getMindMapId()%>',<%=history.getHistoryId()%>)" href=""><spring:message code="REVERT"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
|
||||
<td colspan="3">
|
||||
<spring:message code="NO_HISTORY_RESULTS"/>
|
||||
</td>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
<form name="revertForm" action="<c:url value="history"/>">
|
||||
<input type="hidden" name="action" value="revert"/>
|
||||
<%
|
||||
if (request.getAttribute("goToMindmapList") != null)
|
||||
{
|
||||
%>
|
||||
<input type="hidden" name="goToMindmapList"/>
|
||||
<%
|
||||
<div id="historyContainer">
|
||||
<table class="table table-condensed" id="historyTable">
|
||||
<colgroup>
|
||||
<col width="50%"/>
|
||||
<col width="30%"/>
|
||||
<col width="10%"/>
|
||||
<col width="10%"/>
|
||||
</colgroup>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var tableElem = $('#historyTable');
|
||||
jQuery.ajax("service/maps/${mindmapId}/history", {
|
||||
async:false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
contentType:"text/plain",
|
||||
success : function(data, textStatus, jqXHR) {
|
||||
$(data.changes).each(function() {
|
||||
tableElem.append('\
|
||||
<tr data-history-id="' + this.id + '">\
|
||||
<td>' + this.creator + '</td>\
|
||||
<td><abbr class="timeago" title="' + this.creationTime + '">' + jQuery.timeago(this.creationTime) + '</abbr></td>\
|
||||
<td><a class="view" href="#">view</a></td>\
|
||||
<td><a class="revert" href="#">revert</a></td>\
|
||||
</tr>');
|
||||
});
|
||||
|
||||
tableElem.find('tr a.view').each(function() {
|
||||
$(this).click(function(event) {
|
||||
window.open("/c/maps/${mindmapId}/view");
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
tableElem.find('tr a.revert').each(function() {
|
||||
$(this).click(function(event) {
|
||||
window.location = "/c/maps/${mindmapId}/edit";
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
error:function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
}
|
||||
%>
|
||||
<input type="hidden" name="mapId"/>
|
||||
<input type="hidden" name="historyId"/>
|
||||
</form>
|
||||
|
||||
});
|
||||
</script>
|
||||
|
@ -295,6 +295,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- History Dialog Config -->
|
||||
<div id="history-dialog-modal" class="modal fade" style="display: none">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">x</button>
|
||||
<h3>History</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-cancel" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -5,10 +5,6 @@
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
|
||||
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
|
||||
|
||||
<%@ page import="java.text.DateFormat" %>
|
||||
<%@ page import="java.text.SimpleDateFormat" %>
|
||||
<%@ page import="java.util.Calendar" %>
|
||||
|
||||
|
||||
<%@ include file="/jsp/init.jsp" %>
|
||||
|
||||
|
@ -231,8 +231,6 @@ $("#addBtn").click(function(event) {
|
||||
email = emails[i];
|
||||
addCollaboration(email, role, 'New');
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user