Beispiel #1
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    HttpSession session = request.getSession();
    EasyDelegate del = (EasyDelegate) session.getAttribute(Constantes.DELEGATE);

    Integer mapid = SigarUtils.parseInt(request.getParameter("mapid"));
    if (mapid == null) mapid = (Integer) request.getAttribute("mapid");

    Integer hsId = SigarUtils.parseInt(request.getParameter("hsId"));
    if (hsId != null) {
      request.setAttribute("hsId", hsId);
      Hotspot h = del.getHotspot(hsId);
      Layer la = del.getLayer(h.getHsLayer());
      mapid = la.getMapId();
    } else {
      NewHotspotForm.setNewHsStatus(request, 6);
    }

    Map m = del.getMap(mapid);
    Project p = del.getProject(m.getProjectId());

    request.setAttribute("mapid", mapid);
    request.setAttribute("map", m);
    request.setAttribute("project", p);

    return mapping.findForward("add_new_text");
  }
Beispiel #2
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    EasyDelegate del = (EasyDelegate) session.getAttribute(Constantes.DELEGATE);
    User principal = (User) session.getAttribute(Constantes.USER);

    Integer mapid = SigarUtils.parseInt(request.getParameter("mapid"));
    if (mapid == null) mapid = (Integer) request.getAttribute("mapid");
    request.setAttribute("mapid", mapid);

    Map m = del.getMap(mapid);
    Project p = del.getProject(m.getProjectId());

    // Check for consistency BEFORE checking for permissions
    del.checkProjectConsistency(p);

    ReturnMessage r =
        del.hasPermission(principal, "map-creator-owner", mapid, com.bnmi.ourmap.Constantes.MAP);
    if (!r.isSuccess()) throw new SecurityIssue(r.getMessage());

    request.setAttribute("map", m);
    request.setAttribute("project", p);

    // Get map members
    List<String> membersList = del.getMapMembers(mapid);
    List<String> ownersList = del.getMapOwners(mapid);
    List<User> members = del.getUsers(membersList);
    List<User> owners = del.getUsers(ownersList);

    CriteriosUser findAdminStudent = new CriteriosUser();
    findAdminStudent.setNotOverlord(true);
    List<User> potentialUsers = del.getProjectMembers(p.getId());
    // del.get

    request.setAttribute("members", members);
    request.setAttribute("owners", owners);
    request.setAttribute("allUsers", potentialUsers);

    return mapping.findForward("mapmembers");
  }
Beispiel #3
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    EasyDelegate del = (EasyDelegate) session.getAttribute(Constantes.DELEGATE);

    Integer hsId = SigarUtils.parseInt(request.getParameter("hsId"));
    Hotspot hs = del.getHotspot(hsId);

    ////
    User user = (User) session.getAttribute(Constantes.USER);
    int offset = 0;
    // Checks if the user can edit the hotspot, to show the edit tab, otherwise
    // move tabs to the right in order to indent them to the right
    ReturnMessage r =
        del.hasPermission(user, "edit-media", hsId, com.bnmi.ourmap.Constantes.HOTSPOT);
    boolean canEditHs = r.isSuccess();
    boolean hasDescription =
        (hs.getHsDescription() != null && hs.getHsDescription().length() > 0) ? true : false;

    if (!canEditHs) offset += Constantes.EDIT_OFFSET;
    if (!hasDescription) offset += Constantes.DESCRIPTION_OFFSET;

    Integer baseOffset = (Integer) session.getAttribute("baseOffset");
    request.setAttribute("offset", baseOffset.intValue() + offset);

    System.out.println("Show edit tab? " + canEditHs + " Show Summary tab? " + hasDescription);
    System.out.println(
        "Offset:"
            + offset
            + " Base Offset:"
            + baseOffset
            + " Total offset:"
            + (baseOffset + offset));
    //

    request.setAttribute("hs", hs);

    return mapping.findForward("viewhsdescription");
  }
Beispiel #4
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    HttpSession session = request.getSession();
    EasyDelegate del = (EasyDelegate) session.getAttribute(Constantes.DELEGATE);

    Integer pid = SigarUtils.parseInt(request.getParameter("pid"));
    if (pid == null) pid = (Integer) request.getAttribute("pid");

    Project p = del.getProject(pid);
    CriteriosMap criteria = new CriteriosMap();
    criteria.setProjectId(pid);
    List<Map> maps = del.findMaps(criteria);

    request.setAttribute("project", p);
    request.setAttribute("maps", maps);

    return mapping.findForward("view_project_jsp");
  }