Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.GuestBookForm


   */
  protected ActionForward doReply(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    GuestBookForm msgform = (GuestBookForm)form;
    super.validateClientId(request, msgform);
    if(StringUtils.isNotEmpty(msgform.getReply())){
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser!=null){
        //�ж��Ƿ�Ϊվ��
        SiteBean site = SiteDAO.getSiteByID(msgform.getSid());
        if(site!=null && site.isOwner(loginUser)){
          //�ظ�����
          GuestBookBean gbean = GuestBookDAO.getMsg(msgform.getSid(), msgform.getId());
          if(gbean!=null){
            String reply = super.autoFiltrate(site,msgform.getReply());           
            if(reply.length()>MAX_GB_REPLY_LENGTH)
              reply = reply.substring(0, MAX_GB_REPLY_LENGTH);
            gbean.setReply(super.filterScriptAndStyle(reply));
            gbean.setReplyTime(new Date());
            GuestBookDAO.flush();
          }
        }
      }
    }
    String ext = null;
    if(msgform.getPage()>1){
      ext = "page="+msgform.getPage();
    }
    return makeForward(mapping.findForward("list"), msgform.getSid(), ext);
  }
View Full Code Here


  protected ActionForward doDelete(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_msg_id)
      throws Exception
  {
    int msg_id = Integer.parseInt(s_msg_id);
    GuestBookForm msgform = (GuestBookForm)form;
    UserBean loginUser = super.getLoginUser(request, response);
    if(loginUser!=null && loginUser.getOwnSiteId()==msgform.getSid()){
      GuestBookDAO.deleteMsg(msgform.getSid(),msg_id);
    }
    String ext = null;
    if(msgform.getPage()>1)
      ext = "page=" + msgform.getPage();
    //System.out.println("ext="+ext+",page="+msgform.getPage());
    return makeForward(mapping.findForward("list"), msgform.getSid(), ext);
  }
View Full Code Here

   */
  protected ActionForward doCreate(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    GuestBookForm msgform = (GuestBookForm)form;
    super.validateClientId(request, msgform);
    ActionMessages msgs = new ActionMessages();
    while(true){
      if(StringUtils.isEmpty(msgform.getContent())){
        msgs.add("content", new ActionMessage("error.empty_content"));
        break;
      }
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser==null){
        msgs.add("message", new ActionMessage("error.user_not_login"));
        break;
      }
      else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
        msgs.add("message", new ActionMessage("error.user_not_available"));
        break;
      }
      SiteBean site = super.getSiteByID(msgform.getSid());
      if(site==null){
        msgs.add("message", new ActionMessage("error.site_not_available"));
        break;
      }
      //��������
      if(isUserInBlackList(site, loginUser)){
        msgs.add("message", new ActionMessage("error.user_in_blacklist"));
        break;
      }
      GuestBookBean msgbean = new GuestBookBean();
      String content = super.autoFiltrate(site,msgform.getContent());
      if(content.length()>MAX_GB_COUNT_LENGTH)
        content = content.substring(0, MAX_GB_COUNT_LENGTH);
      msgbean.setContent(super.filterScriptAndStyle(content));
      msgbean.setClient(new ClientInfo(request, 0));
      msgbean.setUser(loginUser);
      msgbean.setSiteId(site.getId());
      try{
        GuestBookDAO.createMsg(msgbean);
      }catch(HibernateException e){
        context().log("undelete diary failed.", e);
        msgs.add("message", new ActionMessage("error.database", e.getMessage()));
      }
      break;
    }
   
    if(!msgs.isEmpty()){
      saveMessages(request, msgs);
      return mapping.findForward("pub");
    }
   
    return makeForward(mapping.findForward("list"), msgform.getSid());
  }
View Full Code Here

TOP

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

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.