Package com.liusoft.dlog4j.beans

Examples of com.liusoft.dlog4j.beans.SiteBean


            "error.object_not_found", String.valueOf(photo1
                .getAlbum())));
        break;
      }

      SiteBean site = super.getSiteBean(request);
      UserBean loginUser = super.getLoginUserAfterValidateSiteOwner(request);

      String photo_desc;
      if(StringUtils.isNotEmpty(photo1.getDesc())){
        photo_desc = StringUtils.abbreviate(super.autoFiltrate(
            site, photo1.getDesc()), MAX_PHOTO_DESC_LENGTH);
        photo_desc = super.filterScriptAndStyle(photo_desc);
      }
      else
        photo_desc = " ";
     
      for(int i=0;i<files.length;i++){
        if(files[i]==null || files[i].getFileSize()<=0 || StringUtils.isEmpty(files[i].getFileName()))
          continue;
        //�жϵ���ͼƬ�Ĵ�С
        /*
        if(files[i].getFileSize()>4194304){//4*1024*1024
          msgs.add(ERROR_KEY, new ActionMessage("error.file_too_large"));
          break;
        }*/
        if(!accept(files[i])){
          msgs.add(ERROR_KEY, new ActionMessage("error.upload_file_not_supported"));
          break;
        }
        //����ϴ��ռ�����
        int photo_size = DLOG4JUtils.sizeInKbytes(files[i].getFileSize());
        int max_photo_size = site.getCapacity().getPhotoTotal();
        if(max_photo_size >= 0){       
          int current_size = site.getCapacity().getPhotoUsed();
          if((current_size + photo_size) > max_photo_size){
            msgs.add(ERROR_KEY, new ActionMessage("error.photo_space_full"));
            break;
          }
        }
        //������Ƭ����������ͼ
        Photo img = null;
        try{
          img = getPhotoSaver().save(
              getHttpContext(mapping, form, request, response),
              files[i], photo1.getAutoRotate() == 1);
          if(img == null){
            msgs.add(ERROR_KEY, new ActionMessage("error.upload_failed"));
            break;       
          }
          //д�뵽���ݿ�
          PhotoBean pbean = new PhotoBean();
          pbean.setSite(site);
          pbean.setUser(loginUser);
          if(StringUtils.isNotEmpty(photo1.getName())){
            pbean.setName(super.autoFiltrate(site, photo1.getName()));
          }
          else
            pbean.setName(img.getName());
          pbean.setDesc(photo_desc);
          if(StringUtils.isNotEmpty(photo1.getKeyword())){
            if(site.isFlagSet(SiteBean.Flag.ILLEGAL_GLOSSARY_IGNORE))
              pbean.setKeyword(photo1.getKeyword());
            else
              pbean.setKeyword(DLOGSecurityManager.IllegalGlossary
                  .deleteIllegalWord(photo1.getKeyword()));
          }
View Full Code Here


    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());
View Full Code Here

    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());
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

      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;
      }
      //��������
View Full Code Here

      }
      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);
View Full Code Here

  public SiteBean auto_create_site() throws Exception{
    String username = "admin";
    //�����û�
    UserBean ubean = auto_create_user(username);
    //������վ
    SiteBean sbean = auto_create_site(ubean);
    //ִ�е�¼����
    UserLoginManager.loginUser(request, response, ubean, -1);
    return sbean;
  }
View Full Code Here

   * �Զ���ͨ���˿ռ�
   * @param ubean
   * @return
   */
  private SiteBean auto_create_site(UserBean ubean){
    SiteBean sbean = new SiteBean();
    sbean.setCreateTime(new Date());
    sbean.setUniqueName(ubean.getName());
    sbean.setFriendlyName("DLOG of "+ubean.getNickname());
    sbean.setOwner(ubean);
    SiteDAO.createSite(sbean);
    return sbean;
  }
View Full Code Here

  {
    SiteForm f_site = (SiteForm)form;
    super.validateClientId(request, f_site);
    ActionMessages msgs = new ActionMessages();
   
    SiteBean site = super.getSiteBean(request);
    if(site!=null){
      if(StringUtils.isNotEmpty(f_site.getLayoutFile()) &&
          !StringUtils.equals(f_site.getLayoutFile(), site.getStyle().getLayout()))
        site.getStyle().setLayout(f_site.getLayoutFile());
      else
        site.getStyle().setLayout("1");
     
      if(StringUtils.isNotEmpty(f_site.getCssFile()) &&
          !StringUtils.equals(f_site.getCssFile(), site.getStyle().getCss()))
        site.getStyle().setCss(f_site.getCssFile());
      else
        site.getStyle().setCss("main.css");
     
      //TODO: ����LOGO
     
      site.setLastTime(new Date());
      try{
        SiteDAO.updateSite(site);
      }catch(Exception e){
        context().log("Update site's style failed.", e);
        msgs.add("site", new ActionMessage("error.database", e.getMessage()));
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.beans.SiteBean

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.