public String editSave() throws Exception {
    if (cologo != null) {
      String logo = UploadUtil.upload(cologo, cologoFileName, "user");
      eopSite.setLogofile(logo);
    }

    if (ico != null) {
      String icoPath = UploadUtil.upload(ico, icoFileName, "user");
      eopSite.setIcofile(icoPath);
    }

    if (bklogo != null) {
      String logo = UploadUtil.upload(bklogo, bklogoFileName, "user");
      eopSite.setBklogofile(logo);
    }

    if (bkloginpic != null) {
      String loginpic = UploadUtil.upload(bkloginpic, bkloginpicFileName, "user");
      eopSite.setBkloginpicfile(loginpic);
    }

    eopSite.setQq(eopSite.getQq() == null ? 0 : eopSite.getQq());
    eopSite.setMsn(eopSite.getMsn() == null ? 0 : eopSite.getMsn());
    eopSite.setWw(eopSite.getWw() == null ? 0 : eopSite.getWw());
    eopSite.setTel(eopSite.getTel() == null ? 0 : eopSite.getTel());
    eopSite.setWt(eopSite.getWt() == null ? 0 : eopSite.getWt());

    siteManager.edit(eopSite);

    this.msgs.add("修改成功");
    this.urls.put("我的站点", "userSite!edit.do");

    return this.MESSAGE;
  }
 public String delete() throws Exception {
   try {
     siteManager.delete(id);
     this.msgs.add("删除成功");
   } catch (RuntimeException e) {
     e.printStackTrace();
     this.msgs.add(e.getMessage());
   }
   this.urls.put("站点列表", "userSite.do");
   return this.MESSAGE;
 }
Exemple #3
0
  @Transactional(propagation = Propagation.REQUIRED)
  public void add(MultiSite site) {

    /** 读取父* */
    MultiSite parent = this.get(site.getParentid());

    /** 读取本级最大code* */
    String sql = "select max(code) code from site where parentid=? ";
    int maxcode = this.baseDaoSupport.queryForInt(sql, site.getParentid()); // cat code
    maxcode = maxcode == 0 ? maxcode = parent.getCode() : maxcode;
    int level = parent.getLevel() + 1; // 级别
    site.setCode(this.createCode(maxcode, level));
    site.setLevel(level);

    this.baseDaoSupport.insert("site", site);
    int siteid = this.baseDaoSupport.getLastId("site");

    Integer userid = EopContext.getContext().getCurrentSite().getUserid();
    EopSiteDomain eopSiteDomain = new EopSiteDomain();
    eopSiteDomain.setUserid(userid);
    eopSiteDomain.setDomain(site.getDomain());
    eopSiteDomain.setSiteid(EopContext.getContext().getCurrentSite().getId());
    siteManager.addDomain(eopSiteDomain);
    try {
      /**
       * 此处逻辑:先取出所指定的theme信息,取得其对应的文件目录,<br>
       * 然后修改theme.path并插入theme,取得插入的themeid并写回到site
       */
      site.setSiteid(siteid);
      Theme theme = this.themeManager.getTheme(site.getThemeid());
      String contextPath = EopContext.getContext().getContextPath();

      // 复制资源到静态资源服务器
      String basePath = EopSetting.IMG_SERVER_PATH + contextPath + "/themes/" + theme.getPath();
      String targetPath =
          EopSetting.IMG_SERVER_PATH + contextPath + "/themes/" + theme.getPath() + "_" + siteid;
      FileUtil.copyFolder(basePath, targetPath);
      // 复制theme
      basePath = EopSetting.EOP_PATH + contextPath + "/themes/" + theme.getPath();
      targetPath = EopSetting.EOP_PATH + contextPath + "/themes/" + theme.getPath() + "_" + siteid;
      FileUtil.copyFolder(basePath, targetPath);

      theme.setPath(theme.getPath() + "_" + siteid);
      theme.setSiteid(siteid);
      theme.setId(null);
      this.baseDaoSupport.insert("theme", theme);
      int themeid = this.baseDaoSupport.getLastId("theme");
      site.setThemeid(themeid);
      this.update(site);
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("创建主题出错");
    }
  }
  /**
   * 初始化为出厂设置
   *
   * @return
   */
  public String initData() {
    try {
      // 校验验证码
      WebSessionContext<UserContext> sessonContext = ThreadContextHolder.getSessionContext();
      Object realCode =
          sessonContext.getAttribute(ValidCodeServlet.SESSION_VALID_CODE + "initdata");

      if (!vcode.equals(realCode)) {
        this.json = "{result:0,message:'验证码输入错误'}";
        return this.JSON_MESSAGE;
      }
      siteManager.initData();
      this.json = "{result:1}";
    } catch (RuntimeException e) {
      this.json = "{result:0,message:'" + e.getMessage() + "'}";
    }
    return this.JSON_MESSAGE;
  }
  public String addDomainSave() throws Exception {
    Integer userid = EopContext.getContext().getCurrentSite().getUserid();
    eopSiteDomain = new EopSiteDomain();
    eopSiteDomain.setUserid(userid);
    eopSiteDomain.setDomain(sitedomain);
    eopSiteDomain.setSiteid(siteid);
    int result = -1;
    try {
      result = siteManager.addDomain(eopSiteDomain);
    } catch (RuntimeException e) {
      this.json = "{result:0,message:'" + e.getMessage() + "'}";
      return this.JSON_MESSAGE;
    }

    if (result > 0) {
      this.json = "{result:1,message:'增加成功'}";
    } else {
      this.json = "{result:0,message:'新增域名失败'}";
    }
    return JSON_MESSAGE;
  }
 public String domain() {
   IUserService userService = UserServiceFactory.getUserService();
   eopSite = siteManager.get(userService.getCurrentSiteId());
   siteDomainList = domainManager.listSiteDomain();
   return "domain";
 }
 public String edit_multi() {
   IUserService userService = UserServiceFactory.getUserService();
   eopSite = siteManager.get(userService.getCurrentSiteId());
   return "edit_multi";
 }
 public String execute() {
   this.webpage = siteManager.list(this.getPage(), this.getPageSize(), order, search);
   return SUCCESS;
 }