Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.ReplyForm


   * @throws Exception
   */
  protected ActionForward doUpdatePhotoReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    ReplyForm reply = (ReplyForm) form;
    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      if (StringUtils.isEmpty(reply.getContent())) {
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      _ReplyBean rbean = ReplyDAO.getReply(PhotoReplyBean.class, reply
          .getReply_id());
      if (rbean!=null && rbean.getSite().getId() == site.getId()) {
        String content = StringUtils.abbreviate(super.autoFiltrate(
          null, reply.getContent()), MAX_REPLY_LENGTH);
        rbean.setContent(super.filterScriptAndStyle(content));
        rbean.setAuthor(reply.getAuthor());       
        rbean.setOwnerOnly(reply.getOwnerOnly());
        if (StringUtils.isNotEmpty(reply.getAuthorURL()))
          rbean.setAuthorURL(reply.getAuthorURL());
        if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
          rbean.setAuthorEmail(reply.getAuthorEmail());
        ReplyDAO.updateReply(rbean);
      }
      break;
    }
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("showphoto");
    }
    StringBuffer ext = new StringBuffer("pid=");
    ext.append(reply.getParentId());
    ext.append('#');
    ext.append(reply.getReply_id());
    return makeForward(mapping.findForward("showphoto"), reply.getSid(),
        ext.toString());
  }
View Full Code Here


   * @throws Exception
   */
  protected ActionForward doUpdateDiaryReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    ReplyForm reply = (ReplyForm) form;
    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      if (StringUtils.isEmpty(reply.getContent())) {
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      _ReplyBean rbean = ReplyDAO.getReply(DiaryReplyBean.class, reply.getReply_id());
      if (rbean!=null && rbean.getSite().getId() == site.getId()) {
        String content = StringUtils.abbreviate(super.autoFiltrate(
            null, reply.getContent()), MAX_REPLY_LENGTH);
        rbean.setContent(super.filterScriptAndStyle(content));
        rbean.setAuthor(reply.getAuthor());       
        rbean.setOwnerOnly(reply.getOwnerOnly());
        if (StringUtils.isNotEmpty(reply.getAuthorURL()))
          rbean.setAuthorURL(reply.getAuthorURL());
        if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
          rbean.setAuthorEmail(reply.getAuthorEmail());
        ReplyDAO.updateReply(rbean);
      }
      break;
    }
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("showlog");
    }
    return makeForward(mapping.findForward("showlog"), reply.getSid(),
        "log_id", reply.getParentId());
  }
View Full Code Here

   */
  protected ActionForward doDeletePhotoReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_reply_id) throws Exception {
    String msg = null;
    ReplyForm reply = (ReplyForm) form;
    int reply_id = Integer.parseInt(s_reply_id);
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msg = getMessage(request, null, "error.site_not_available");
        break;
      }
      PhotoReplyBean rbean = (PhotoReplyBean) ReplyDAO.getReply(
          PhotoReplyBean.class, reply_id);
      if (rbean == null)
        break;
      if (rbean.getSite().getId() != reply.getSid()) {
        msg = getMessage(request, null, "error.param");
        break;
      }
      if (!site.isOwner(loginUser)
          && !isReplyBelongToUser(rbean, loginUser.getId())) {
        msg = getMessage(request, null, "error.access_deny");
        break;
      }
      PhotoDAO.deletePhotoReply(rbean);
      break;
    }
   
    String fromPage = reply.getFromPage();
   
    if (StringUtils.isNotEmpty(fromPage))
      return msgbox(mapping, form, request, response, msg, fromPage);
    return makeForward(mapping.findForward("photo"), reply.getSid());
  }
View Full Code Here

   */
  protected ActionForward doDeleteDiaryReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response, String s_reply_id) throws Exception {
    String msg = null;
    ReplyForm reply = (ReplyForm) form;
    int reply_id = Integer.parseInt(s_reply_id);
    UserBean loginUser = super.getLoginUser(request, response);
    while (loginUser != null) {
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msg = getMessage(request, null, "error.site_not_available");
        break;
      }
      DiaryReplyBean rbean = (DiaryReplyBean) ReplyDAO.getReply(
          DiaryReplyBean.class, reply_id);
      if (rbean == null)
        break;
      if (rbean.getSite().getId() != reply.getSid()) {
        msg = getMessage(request, null, "error.param");
        break;
      }
      if (!site.isOwner(loginUser)
          && !isReplyBelongToUser(rbean, loginUser.getId())) {
        msg = getMessage(request, null, "error.access_deny");
        break;
      }
      DiaryDAO.deleteDiaryReply(rbean);
      break;
    }
   
    String fromPage = reply.getFromPage();
   
    if (StringUtils.isNotEmpty(fromPage))
      return msgbox(mapping, form, request, response, msg, fromPage);
    return makeForward(mapping.findForward("diary"), reply.getSid());
  }
View Full Code Here

   * @throws Exception
   */
  protected ActionForward doAddDiaryReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    ReplyForm reply = (ReplyForm) form;
    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    do{
      if (StringUtils.isEmpty(reply.getContent())){
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if(reply.getContent().getBytes().length >= 3000){
        msgs.add("reply", new ActionMessage("error.reply_too_long"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      //��������
      if(loginUser!=null && isUserInBlackList(site, loginUser)){
        msgs.add("topic", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      DiaryOutlineBean diary = DiaryDAO.getDiaryOutlineByID(reply.getParentId());
      if (diary == null || diary.getSite().getId() != reply.getSid()) {
        msgs.add("reply", new ActionMessage("error.param"));
        break;
      }      
      if(diary.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.diary.locked"));
        break;
      }
      // ���������д������
      DiaryReplyBean rbean = new DiaryReplyBean();
      rbean.setUser(loginUser);     
      rbean.setAuthor(super.autoFiltrate(site,reply.getAuthor()));
      if (StringUtils.isNotEmpty(reply.getAuthorURL()))
        rbean.setAuthorURL(reply.getAuthorURL());
      if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
        rbean.setAuthorEmail(reply.getAuthorEmail());
      rbean.setClient(new ClientInfo(request, reply
          .getClientType()));
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          reply.getContent()), MAX_REPLY_LENGTH);
      rbean.setContent(super.filterScriptAndStyle(content));
      rbean.setDiary(diary);
      rbean.setReplyTime(new Date());
      rbean.setSite(site);
      rbean.setStatus(DiaryReplyBean.STATUS_NORMAL);
      rbean.setOwnerOnly(reply.getOwnerOnly());
      DiaryDAO.createDiaryReply(rbean);
      // �ж��Ƿ���Ҫ�ʼ�����
      if (diary.getReplyNotify() == 1) {
        String email = diary.getOwner().getContactInfo()
            .getEmail();
        if (StringUtils.isEmail(email)) {
          this.sendReplyNotify(request, rbean.getSite().getId(), rbean);
        }
      }
      break;
    }while(true);
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("diary-enter-reply");
    }
    return makeForward(mapping.findForward("showlog"), reply.getSid(),
        "log_id", reply.getParentId());
  }
View Full Code Here

   * @throws Exception
   */
  protected ActionForward doAddPhotoReply(ActionMapping mapping,
      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    ReplyForm reply = (ReplyForm) form;
    //��֤�ͻ��˰�ȫʶ����
    validateClientId(request, reply);
    ActionMessages msgs = new ActionMessages();
    PhotoReplyBean rbean = new PhotoReplyBean();
    do{
      if (StringUtils.isEmpty(reply.getContent())){
        msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
        break;
      }
      if(reply.getContent().getBytes().length >= 3000){
        msgs.add("reply", new ActionMessage("error.reply_too_long"));
        break;
      }
      SiteBean site = super.getSiteByID(reply.getSid());
      if (site == null) {
        msgs.add("reply", new ActionMessage("error.site_not_available"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      //��������
      if(loginUser!=null && isUserInBlackList(site, loginUser)){
        msgs.add("photo", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      PhotoOutlineBean photo = PhotoDAO.getPhotoOutlineByID(reply.getParentId());
      if (photo == null || photo.getSite().getId() != reply.getSid()) {
        msgs.add("reply", new ActionMessage("error.param"));
        break;
      }
      if(photo.getLock()==1) {
        msgs.add("reply", new ActionMessage("error.photo.locked"));
        break;
      }
      // ���������д������
      rbean.setUser(loginUser);
      rbean.setAuthor(super.autoFiltrate(site,reply.getAuthor()));
      if (StringUtils.isNotEmpty(reply.getAuthorURL()))
        rbean.setAuthorURL(reply.getAuthorURL());
      if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
        rbean.setAuthorEmail(reply.getAuthorEmail());
      rbean.setClient(new ClientInfo(request, reply
          .getClientType()));
      String content = StringUtils.abbreviate(super.autoFiltrate(null,
          reply.getContent()), MAX_REPLY_LENGTH);
      rbean.setContent(super.filterScriptAndStyle(content));
      rbean.setPhoto(photo);
      rbean.setReplyTime(new Date());
      rbean.setSite(site);
      rbean.setStatus(DiaryReplyBean.STATUS_NORMAL);
      rbean.setOwnerOnly(reply.getOwnerOnly());
      PhotoDAO.createPhotoReply(rbean);
      break;
    }while(true);
    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("showphoto");
    }
    StringBuffer ext = new StringBuffer("pid=");
    ext.append(reply.getParentId());
    //ext.append('#');
    //ext.append(rbean.getId());
    return makeForward(mapping.findForward("showphoto"), reply.getSid(),
        ext.toString());
  }
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.formbean.ReplyForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.