Example #1
0
  @RequestMapping(value = "/admin/event/updateeventform", method = RequestMethod.GET)
  public ModelAndView eventUpdateForm(
      HttpSession session,
      @RequestParam(value = "eventNum") int eventNum,
      @RequestParam(value = "pageNum") String pageNum)
      throws Exception {
    SessionInfo info = (SessionInfo) session.getAttribute("member");
    if (info == null) {
      return new ModelAndView("redirect:/member/login");
    }

    Event dto = (Event) service.readEvent(eventNum);
    if (dto == null) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }

    if (!info.getUserId().equals(dto.getUserId())) {
      return new ModelAndView("redirct:/event/eventlist?pageNum=" + pageNum);
    }

    ModelAndView mav = new ModelAndView(".four.admin.adminevent.main");

    mav.addObject("active", "created");
    mav.addObject("eventNum", eventNum);
    mav.addObject("mode", "update");

    return mav;
  }
Example #2
0
  // 이벤트 추가 서브밋
  @RequestMapping(value = "/admin/eventcreated", method = RequestMethod.POST)
  public String eventCreatedSubmit(HttpSession session, Event dto) throws Exception {
    String root = session.getServletContext().getRealPath("/");
    String path = root + File.separator + "uploads" + File.separator + "event";

    SessionInfo info = (SessionInfo) session.getAttribute("member");
    if (info == null) {
      return "redirect:/memeber/login";
    }

    dto.setUserId(info.getUserId());
    service.insertEvent(dto, path);

    return "redirect:/admin/event";
  }
Example #3
0
  @RequestMapping(value = "/event/delete")
  public ModelAndView deleteEvent(
      HttpSession session,
      @RequestParam(value = "eventNum") int eventNum,
      @RequestParam(value = "pageNum") String pageNum)
      throws Exception {
    SessionInfo info = (SessionInfo) session.getAttribute("member");
    if (info == null) {
      return new ModelAndView("redirect:/member/login");
    }

    Event dto = service.readEvent(eventNum);
    if (dto == null) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }
    if (!info.getUserId().equals(dto.getUserId()) && !info.getUserId().equals("admin")) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }
    service.deleteEvent(eventNum);
    return new ModelAndView("redirect:/event/event");
  }