@RequestMapping(value = "/{siteId}/{pageId}/viewEmailReminder.htm", method = RequestMethod.GET)
  protected ModelAndView viewEmailReminderForAttachment(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = AuthRequest.getOrCreate(request, response);
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);

      if (!ar.isLoggedIn()) {
        return showWarningView(ar, "nugen.project.send.email.reminder.login.msg");
      }
      if (!ar.isMember()) {
        request.setAttribute("roleName", "Members");
        return showWarningView(ar, "nugen.attachment.send.email.reminder.memberlogin");
      }

      modelAndView = createNamedView(siteId, pageId, ar, "viewReminder", "Project Documents");
      request.setAttribute("isNewUpload", "yes");
      request.setAttribute("realRequestURL", ar.getRequestURL());
      request.setAttribute("title", ngp.getFullName());
    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.send.email.reminder", new Object[] {pageId, siteId}, ex);
    }
    return modelAndView;
  }
  @RequestMapping(value = "/{siteId}/{pageId}/fileVersions.htm", method = RequestMethod.GET)
  protected ModelAndView getFileVersion(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = AuthRequest.getOrCreate(request, response);
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);

      if (!ar.isLoggedIn()) {
        return showWarningView(ar, "nugen.project.file.version.login.msg");
      }
      if (!ar.isMember()) {
        request.setAttribute("roleName", "Members");
        return showWarningView(ar, "nugen.attachment.file.version.memberlogin");
      }
      String aid = ar.reqParam("aid");
      ngp.findAttachmentByIDOrFail(aid);

      modelAndView = createNamedView(siteId, pageId, ar, "fileVersions", "Project Documents");
      request.setAttribute("subTabId", "nugen.projectdocument.subtab.fileversions");
      request.setAttribute("aid", aid);
      request.setAttribute("realRequestURL", ar.getRequestURL());
      request.setAttribute("title", ngp.getFullName());

    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.file.version.page", new Object[] {pageId, siteId}, ex);
    }
    return modelAndView;
  }
  /** The first step in validating XBRL documents */
  @RequestMapping(value = "/{siteId}/{pageId}/xbrlResults.htm", method = RequestMethod.GET)
  protected ModelAndView xbrlResults(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = AuthRequest.getOrCreate(request, response);
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);

      if (!ar.isLoggedIn()) {
        return showWarningView(ar, "nugen.project.upload.doc.login.msg");
      }
      if (!ar.isMember()) {
        request.setAttribute("roleName", "Members");
        return showWarningView(ar, "nugen.attachment.uploadattachment.memberlogin");
      }
      if (ngp.isFrozen()) {
        return showWarningView(ar, "nugen.generatInfo.Frozen");
      }

      modelAndView = createNamedView(siteId, pageId, ar, "xbrlResults", "XBRL Validation Results");
      //            request.setAttribute("realRequestURL", ar.getRequestURL());
      //            request.setAttribute("title", ngp.getFullName());

    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.upload.document.page", new Object[] {pageId, siteId}, ex);
    }
    return modelAndView;
  }
  @RequestMapping(value = "/{siteId}/{pageId}/CreateCopy.htm", method = RequestMethod.GET)
  protected ModelAndView CreateCopy(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam(value = "fname", required = false) MultipartFile file)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = AuthRequest.getOrCreate(request, response);
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);

      if (!ar.isLoggedIn()) {
        return showWarningView(ar, "nugen.project.create.copy.login.msg");
      }
      if (!ar.isMember()) {
        request.setAttribute("roleName", "Members");
        return showWarningView(ar, "nugen.attachment.createcopy.memberlogin");
      }
      if (ngp.isFrozen()) {
        return showWarningView(ar, "nugen.generatInfo.Frozen");
      }

      modelAndView = createNamedView(siteId, pageId, ar, "CreateCopy", "Project Documents");
      request.setAttribute("subTabId", "nugen.projecthome.subtab.emailreminder");
      String aid = ar.reqParam("aid");

      AttachmentRecord attachment = ngp.findAttachmentByID(aid);

      if (attachment == null) {
        throw new NGException("nugen.exception.attachment.not.found", new Object[] {aid});
      }
      request.setAttribute("aid", aid);
      request.setAttribute("realRequestURL", ar.getRequestURL());
      request.setAttribute("title", ngp.getFullName());

    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.create.copy.page", new Object[] {pageId, siteId}, ex);
    }
    return modelAndView;
  }
  @RequestMapping(value = "/{siteId}/{pageId}/remindAttachment.htm", method = RequestMethod.GET)
  protected ModelAndView remindAttachment(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AuthRequest ar = AuthRequest.getOrCreate(request, response);
    try {
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);
      ar.setPageAccessLevels(ngp);

      String rid = ar.reqParam("rid");
      ReminderMgr mgr = ngp.getReminderMgr();
      ReminderRecord reminderRecord = mgr.findReminderByIDOrFail(rid);
      if (AccessControl.canAccessReminder(ar, ngp, reminderRecord)) {
        request.setAttribute("subTabId", "nugen.projecthome.subtab.upload.document");
        return createNamedView(siteId, pageId, ar, "remind_attachment", "Project Documents");
      }

      if (!ar.isLoggedIn()) {
        request.setAttribute("property_msg_key", "nugen.project.remind.doc.login.msg");
      } else if (!ar.isMember()) {
        request.setAttribute("property_msg_key", "nugen.attachment.remind.doc.memberlogin");
      } else {
        // basically, the reminder should have been display, and we have no idea now why not
        throw new Exception(
            "Program Logic Error ... something is wrong with the canAccessReminder method");
      }
      return createNamedView(siteId, pageId, ar, "Warning", "Project Documents");

    } catch (Exception ex) {
      Exception extd =
          new NGException(
              "nugen.operation.fail.project.reminder.attachment.page",
              new Object[] {pageId, siteId},
              ex);
      return displayException(request, extd);
    }
  }
  @RequestMapping(value = "/{siteId}/{pageId}/linkRepository.htm", method = RequestMethod.GET)
  protected ModelAndView linkRepository(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = AuthRequest.getOrCreate(request, response);
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);

      if (!ar.isLoggedIn()) {
        return showWarningView(ar, "nugen.project.link.doc.to.project.login.msg");
      }
      if (!ar.isMember()) {
        request.setAttribute("roleName", "Members");
        return showWarningView(ar, "nugen.attachment.linkattachmenttoproject.memberlogin");
      }
      if (ngp.isFrozen()) {
        return showWarningView(ar, "nugen.generatInfo.Frozen");
      }

      String symbol = ar.reqParam("symbol");
      ResourceEntity remoteFile = ar.getUserPage().getResourceFromSymbol(symbol);
      modelAndView =
          createNamedView(siteId, pageId, ar, "linkfromrepository_form", "Project Documents");
      request.setAttribute("subTabId", "nugen.projecthome.subtab.link.from.repository");
      request.setAttribute("isNewUpload", "yes");
      request.setAttribute("symbol", remoteFile.getSymbol());
      request.setAttribute("realRequestURL", ar.getRequestURL());
      request.setAttribute("title", ngp.getFullName());
    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.link.to.repository.page",
          new Object[] {pageId, siteId},
          ex);
    }
    return modelAndView;
  }