Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.SiteForm


   * @wml_only mgr/modify_name.vm
   */
  protected ActionForward doUpdateFriendlyName(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    while (StringUtils.isNotEmpty(sform.getFriendlyName())) {
      SiteBean site = super.getSiteBean(request);
      String fn = super.autoFiltrate(site, sform.getFriendlyName());
      if(!StringUtils.equals(site.getFriendlyName(), fn)){
        //�����վ���Ƿ��Ѿ�����
        if(SiteDAO.getSiteByFriendlyName(fn) != null){
          msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_exists"));
          break;
        }
        try {
          site.setFriendlyName(fn);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("modify_name");
    }

    return makeForward(mapping.findForward("editsite"), sform.getSid());
  }
View Full Code Here


   * @wml_only mgr/modify_detail.vm
   */
  protected ActionForward doUpdateDetail(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    do{
      SiteBean site = super.getSiteBean(request);
      String detail = super.autoFiltrate(site, StringUtils.extractText(sform.getDetail()));
      if(!StringUtils.equals(site.getDetail(), detail)){
        try {
          site.setDetail(detail);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
      break;
    }while(true);

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("modify_detail");
    }

    return makeForward(mapping.findForward("editsite"), sform.getSid());
  }
View Full Code Here

   * @wml_only mgr/modify_title.vm
   */
  protected ActionForward doUpdateTitle(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    SiteForm sform = (SiteForm) form;
    super.validateClientId(request, sform);
    ActionMessages msgs = new ActionMessages();
   
    do{
      SiteBean site = super.getSiteBean(request);
      String title = super.autoFiltrate(site, sform.getTitle());
      if(!StringUtils.equals(site.getTitle(), title)){
        try {
          site.setTitle(title);
          SiteDAO.flush();
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e.getMessage()));
        }
      }
      break;
    }while(true);

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("modify_title");
    }

    return makeForward(mapping.findForward("editsite"), sform.getSid());
  }
View Full Code Here

   */
  protected ActionForward doUpdateSite(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    SiteForm f_site = (SiteForm)form;
    super.validateClientId(request, f_site);
    ActionMessages msgs = new ActionMessages();
    //��֤�����
    String friendlyName = super.autoFiltrate(null, f_site.getFriendlyName());
    do{
      if(StringUtils.isEmpty(friendlyName)){
        msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_empty"));
        break;
      }
      //�ж���վ���Ƿ����
      SiteBean site = super.getSiteBean(request);
      if (!StringUtils.equals(site.getFriendlyName(), friendlyName)
          && SiteDAO.getSiteByFriendlyName(friendlyName) != null) {       
        msgs.add("friendlyName", new ActionMessage("error.site_friendlyName_exists"));
        break;
      }
      if(site!=null){
        if(StringUtils.isNotEmpty(f_site.getDetail())){
          String dt = super.autoFiltrate(site, StringUtils.extractText(f_site.getDetail()));
          site.setDetail(StringUtils.abbreviate(dt,250));
        }
        else
          site.setDetail(null);
       
        if(!StringUtils.equals(site.getFriendlyName(), friendlyName))
          site.setFriendlyName(friendlyName);
       
        if(StringUtils.isNotEmpty(f_site.getIcpNumber())){
          site.setIcpNumber(DLOGSecurityManager.IllegalGlossary
              .deleteIllegalWord(f_site.getIcpNumber()));
        }
        else
          site.setIcpNumber(null);
        site.setLastTime(new Date());
        if(StringUtils.isNotEmpty(f_site.getTitle()))
          site.setTitle(super.autoFiltrate(site, f_site.getTitle()));
        else
          site.setTitle(site.getFriendlyName());
       
        if(StringUtils.isNotEmpty(f_site.getUrl()))
          if(f_site.getUrl().toLowerCase().startsWith("http://"))
            site.setUrl(f_site.getUrl().substring(7));
          else
            site.setUrl(f_site.getUrl());
        else
          site.setUrl(null);
       
        try{
          SiteDAO.updateSite(site);
View Full Code Here

   */
  protected ActionForward doUpdateStyle(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    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()));
      }
    }
   
    if(!msgs.isEmpty()){
      saveMessages(request, msgs);
      return mapping.findForward("style-setting");
    }
   
    return makeForward(mapping.findForward("settings"), f_site.getSid());
  }
View Full Code Here

   */
  protected ActionForward doUpdateFuncs(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    SiteForm f_site = (SiteForm)form;
    super.validateClientId(request, f_site);
    ActionMessages msgs = new ActionMessages();
   
    SiteBean site = super.getSiteBean(request);
    if(site!=null){
      //TODO: ���Ƴ���
      // Diary
      if (StringUtils.isEmpty(f_site.getDiaryName()))
        site.setDiary(null);
      else
        site.setDiary(super.autoFiltrate(site, f_site.getDiaryName()));
      site
          .getFunctionStatus()
          .setDiary(
              (f_site.getStatusDiary() == 1) ? FunctionStatus.STATUS_NORMAL
                  : FunctionStatus.STATUS_CLOSED);
      // Photo
      if (StringUtils.isEmpty(f_site.getPhotoName()))
        site.setPhoto(null);
      else
        site.setPhoto(super.autoFiltrate(site, f_site.getPhotoName()));
      site
          .getFunctionStatus()
          .setPhoto(
              (f_site.getStatusPhoto() == 1) ? FunctionStatus.STATUS_NORMAL
                  : FunctionStatus.STATUS_CLOSED);
      // Music
      if (StringUtils.isEmpty(f_site.getMusicName()))
        site.setMusic(null);
      else
        site.setMusic(super.autoFiltrate(site, f_site.getMusicName()));
      site
          .getFunctionStatus()
          .setMusic(
              (f_site.getStatusMusic() == 1) ? FunctionStatus.STATUS_NORMAL
                  : FunctionStatus.STATUS_CLOSED);
      // BBS
      if (StringUtils.isEmpty(f_site.getForumName()))
        site.setForum(null);
      else
        site.setForum(super.autoFiltrate(site, f_site.getForumName()));
      site
          .getFunctionStatus()
          .setForum(
              (f_site.getStatusForum() == 1) ? FunctionStatus.STATUS_NORMAL
                  : FunctionStatus.STATUS_CLOSED);
      // Guestbook
      if (StringUtils.isEmpty(f_site.getGuestbookName()))
        site.setGuestbook(null);
      else
        site.setGuestbook(super.autoFiltrate(site, f_site
            .getGuestbookName()));
      site
          .getFunctionStatus()
          .setGuestbook(
              (f_site.getStatusGuestbook() == 1) ? FunctionStatus.STATUS_NORMAL
                  : FunctionStatus.STATUS_CLOSED);
     
      site.setLastTime(new Date());
      try{
        SiteDAO.updateSite(site);
      }catch(Exception e){
        context().log("Update site's functions failed.", e);
        msgs.add("site", new ActionMessage("error.database", e.getMessage()));
      }
    }
   
    if(!msgs.isEmpty()){
      saveMessages(request, msgs);
      return mapping.findForward("funcs-setting");
    }
   
    return makeForward(mapping.findForward("settings"), f_site.getSid());
  }
View Full Code Here

TOP

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

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.