@RequestMapping(value = "/{siteId}/{pageId}/createLinkURL.form", method = RequestMethod.POST)
  protected ModelAndView createLinkURL(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = getLoggedInAuthRequest(request, response, "message.can.not.create.link.url");
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);
      ar.assertNotFrozen(ngp);

      String visibility = ar.reqParam("visibility");

      String comment = ar.reqParam("comment");
      String taskUrl = ar.reqParam("taskUrl");
      String ftype = ar.reqParam("ftype");

      AttachmentRecord attachment = ngp.createAttachment();
      String proposedName = taskUrl;

      if (taskUrl.contains("/")) {
        proposedName = taskUrl.substring(taskUrl.lastIndexOf("/") + 1);
      }

      AttachmentHelper.setDisplayName(ngp, attachment, proposedName);

      attachment.setComment(comment);
      attachment.setModifiedBy(ar.getBestUserId());
      attachment.setModifiedDate(ar.nowTime);
      attachment.setType(ftype);
      if (visibility.equals("PUB")) {
        attachment.setVisibility(1);
      } else {
        attachment.setVisibility(2);
      }

      HistoryRecord.createHistoryRecord(
          ngp,
          attachment.getId(),
          HistoryRecord.CONTEXT_TYPE_DOCUMENT,
          ar.nowTime,
          HistoryRecord.EVENT_DOC_ADDED,
          ar,
          "Created Link URL");

      attachment.setStorageFileName(taskUrl);
      ngp.saveFile(ar, "Created Link URL");
      modelAndView = createRedirectView(ar, "attachment.htm");
    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.create.link.url.to.project",
          new Object[] {pageId, siteId},
          ex);
    }
    return modelAndView;
  }
  @RequestMapping(
      value = "/{siteId}/{pageId}/remoteAttachmentAction.form",
      method = RequestMethod.POST)
  protected void remoteAttachmentAction(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    try {
      AuthRequest ar =
          getLoggedInAuthRequest(request, response, "message.can.not.create.attachment");
      ar.req = request;
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);
      ar.assertNotFrozen(ngp);
      ar.assertMember("Unable to create attachments.");

      String action = ar.reqParam("action");
      String symbol = ar.reqParam("symbol");
      String visibility = ar.defParam("visibility", "*MEM*");
      String comment = ar.defParam("comment", "");
      String attachmentDisplayName = ar.defParam("name", "");
      String isNewUpload = ar.defParam("isNewUpload", "yes");
      String readonly = ar.defParam("readOnly", "off");

      UserPage uPage = ar.getUserPage();
      ResourceEntity ent = uPage.getResourceFromSymbol(symbol);

      if ("Link Document".equalsIgnoreCase(action)) {
        FolderAccessHelper fah = new FolderAccessHelper(ar);
        if (isNewUpload.equals("yes")) {
          fah.attachDocument(ent, ngp, comment, attachmentDisplayName, visibility, readonly);
        } else {
          AttachmentHelper.updateRemoteAttachment(
              ar,
              ngp,
              comment,
              ent.getPath(),
              ent.getFolderId(),
              attachmentDisplayName,
              visibility);
        }

      } else {
        throw new ProgramLogicError("Don't understand the operation: " + action);
      }

      ngp.saveFile(ar, "Modified attachments");
      response.sendRedirect(ar.baseURL + "t/" + siteId + "/" + pageId + "/attachment.htm");
    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.remote.attachment", new Object[] {pageId, siteId}, ex);
    }
  }
  @RequestMapping(value = "/{siteId}/{pageId}/emailReminder.form", method = RequestMethod.POST)
  protected ModelAndView submitEmailReminderForAttachment(
      @PathVariable String siteId,
      @PathVariable String pageId,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ModelAndView modelAndView = null;
    try {
      AuthRequest ar = getLoggedInAuthRequest(request, response, "message.can.not.send.email");
      NGPage ngp = registerRequiredProject(ar, siteId, pageId);
      ar.assertNotFrozen(ngp);

      String comment = ar.reqParam("comment");
      String pname = ar.defParam("pname", "");
      String assignee = ar.reqParam("assignee");
      String instruct = ar.reqParam("instruct");
      String subj = ar.reqParam("subj");
      String visibility = ar.reqParam("visibility");

      ReminderMgr rMgr = ngp.getReminderMgr();
      ReminderRecord rRec = rMgr.createReminder(ngp.getUniqueOnPage());
      rRec.setFileDesc(comment);
      rRec.setInstructions(instruct);
      rRec.setAssignee(assignee);
      rRec.setFileName(pname);
      rRec.setSubject(subj);
      rRec.setModifiedBy(ar.getBestUserId());
      rRec.setModifiedDate(ar.nowTime);
      rRec.setDestFolder(visibility);
      rRec.setSendNotification("yes");
      HistoryRecord.createHistoryRecord(
          ngp,
          rRec.getId(),
          HistoryRecord.CONTEXT_TYPE_DOCUMENT,
          ar.nowTime,
          HistoryRecord.EVENT_DOC_ADDED,
          ar,
          "Added Reminder for " + assignee);

      ngp.saveFile(ar, "Modified attachments");
      modelAndView = createRedirectView(ar, "reminders.htm");
    } catch (Exception ex) {
      throw new NGException(
          "nugen.operation.fail.project.email.reminder", new Object[] {pageId, siteId}, ex);
    }
    return modelAndView;
  }