Change some navigation URLs

Keep removing old controller model.
This commit is contained in:
Paulo Gustavo Veiga
2012-04-14 18:46:07 -03:00
parent 583b2723d3
commit eb2efd2db0
11 changed files with 55 additions and 155 deletions

View File

@@ -66,7 +66,7 @@ public class PublicPagesController extends BaseMultiActionController {
ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
final String xmlMap = mindmap.getXmlAsJsLiteral();
view.addObject(MindmapEditorController.MAP_XML_PARAM, xmlMap);
view.addObject(MAP_XML_PARAM, xmlMap);
view.addObject("editorTryMode", true);
view.addObject("showHelp", true);
return view;
@@ -77,5 +77,6 @@ public class PublicPagesController extends BaseMultiActionController {
}
public static final int TRY_EXAMPLE_MINDMAP_ID = 3;
public static final String MAP_XML_PARAM = "mapXml";
}

View File

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,12 +28,48 @@ public class MindmapController {
@Autowired
private MindmapService mindmapService;
@RequestMapping(value = "export")
public ModelAndView export(@RequestParam(required = true) long mapId) throws IOException {
final MindMapBean modelObject = findMindmapBean(mapId);
@RequestMapping(value = "map/{id}/export")
public ModelAndView export(@PathVariable int id) throws IOException {
final MindMapBean modelObject = findMindmapBean(id);
return new ModelAndView("mindmapExport", "mindmap", modelObject);
}
@RequestMapping(value = "map/{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;
}
@RequestMapping(value = "map/{id}/print")
public ModelAndView showPrintPage(@PathVariable int id) {
final MindMap mindmap = findMindmap(id);
final ModelAndView view = new ModelAndView("mindmapPrint", "mindmap", mindmap);
view.addObject("user", Utils.getUser());
return view;
}
@RequestMapping(value = "map/{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 {
final MindMap mindmap = mindmapService.getMindmapById(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());
}
return view;
}
@RequestMapping(value = "collaborator")
public ModelAndView showCollaborator(@RequestParam(required = true) long mapId) {
final MindMapBean modelObject = findMindmapBean(mapId);
@@ -45,22 +82,6 @@ public class MindmapController {
return new ModelAndView("mindmapViewer", "wisemapsList", modelObject);
}
@RequestMapping(value = "detail")
public ModelAndView showDetails(@RequestParam(required = true) long mapId) {
final MindMapBean modelObject = findMindmapBean(mapId);
final ModelAndView view = new ModelAndView("mindmapDetail", "wisemapDetail", modelObject);
view.addObject("user", Utils.getUser());
return view;
}
@RequestMapping(value = "print")
public ModelAndView showPrintPage(@RequestParam(required = true) long mapId) {
final MindMap mindmap = findMindmap(mapId);
final ModelAndView view = new ModelAndView("mindmapPrint", "mindmap", mindmap);
view.addObject("user", Utils.getUser());
return view;
}
@RequestMapping(value = "changeStatus")
public ModelAndView changeStatus(@RequestParam(required = true) long mapId) throws WiseMappingException {
final MindMap mindmap = findMindmap(mapId);
@@ -130,5 +151,10 @@ public class MindmapController {
return new MindMapBean(findMindmap(mapId));
}
private boolean isWelcomeMap(MindMap map) {
return map.getTitle().startsWith("Welcome ");
}
private static final String USER_AGENT = "wisemapping.userAgent";
}

View File

@@ -210,7 +210,6 @@ public class MindmapController extends BaseController {
// Return the new created map ...
response.setHeader("Location", "/service/maps/" + clonedMap.getId());
response.setHeader("ResourceId", Integer.toString(clonedMap.getId()));
}
}