Exemplo n.º 1
0
  public void editSave() {
    Transaction trans = new Transaction();
    ZCAdminGroupSchema manageGroup = new ZCAdminGroupSchema();
    manageGroup.setGroupID($V("GroupID"));
    manageGroup.fill();
    manageGroup.setValue(this.Request);
    manageGroup.setAllowEditUser($V("AllowEditUser"));

    trans.add(manageGroup, 2);
    if (trans.commit()) this.Response.setLogInfo(1, "设置成功!");
    else this.Response.setLogInfo(0, "操作失败!");
  }
Exemplo n.º 2
0
 public void del() {
   String ids = $V("IDs");
   String[] arr = ids.split("\\,");
   Transaction tran = new Transaction();
   for (int i = 0; i < arr.length; ++i) {
     tran.add(
         new QueryBuilder(
             "delete from ZCDatabase where SiteID=? and ID=?",
             Application.getCurrentSiteID(),
             arr[i]));
   }
   if (tran.commit()) this.Response.setMessage("删除数据库连接成功");
   else this.Response.setError("发生错误,删除数据库连接失败");
 }
Exemplo n.º 3
0
  public void del() {
    String ids = $V("IDs");
    if (!StringUtil.checkID(ids)) {
      this.Response.setLogInfo(0, "传入ID时发生错误");
      return;
    }
    Transaction trans = new Transaction();

    ZCMessageSchema message = new ZCMessageSchema();
    ZCMessageSet set = message.query(new QueryBuilder("where id in (" + ids + ")"));
    trans.add(set, 5);

    if (trans.commit()) {
      MessageCache.removeIDs(set);
      QueryBuilder qb =
          new QueryBuilder(
              "select count(1) from ZCMessage where ReadFlag=0 and ToUser=?", User.getUserName());
      CacheManager.set("Message", "Count", User.getUserName(), qb.executeInt());
      this.Response.setLogInfo(1, "删除成功");
    } else {
      this.Response.setLogInfo(0, "删除失败");
    }
  }
Exemplo n.º 4
0
  public void dealZCSite(DataRow dr) {
    if (this.isNewSite) {
      if ((LicenseInfo.getName().equals("TrailUser"))
          && (new QueryBuilder("select count(*) from ZCSite").executeInt() >= 1)) {
        throw new RuntimeException("站点数超出限制,请联系泽元软件更换License!");
      }
      this.newSiteID = NoUtil.getMaxID("SiteID");
      ZCSiteSchema site = new ZCSiteSchema();
      site.setValue(dr);
      site.setID(this.newSiteID);
      site.setName(this.map.getString("Name"));
      site.setAlias(this.map.getString("Alias"));
      site.setURL(this.map.getString("URL"));
      site.setHitCount(0L);
      site.setChannelCount(0L);
      site.setSpecialCount(0L);
      site.setMagzineCount(0L);
      site.setArticleCount(0L);
      site.setImageLibCount(1L);
      site.setVideoLibCount(1L);
      site.setAudioLibCount(1L);
      site.setAttachmentLibCount(1L);
      site.setBranchInnerCode(User.getBranchInnerCode());
      site.setAddTime(new Date());
      site.setAddUser(User.getUserName());
      site.setConfigXML(ConfigImageLib.imageLibConfigDefault);
      this.da.insert(site);
      Transaction trans = new Transaction();
      Site.addDefaultPriv(this.newSiteID, trans);
      trans.setDataAccess(this.da);
      trans.commit(false);
      addIDMapping("ZCSite", String.valueOf(this.siteID), String.valueOf(this.newSiteID));
    } else {
      ZCSiteSchema site = new ZCSiteSchema();
      site.setID(this.map.getString("ID"));
      this.newSiteID = site.getID();
      site.fill();

      this.task.setCurrentInfo("正在备份数据,可能需要较长时间,请耐心等待");

      SiteExporter se = new SiteExporter(site.getID());
      se.exportSite(
          Config.getContextRealPath()
              + "WEB-INF/data/backup/"
              + site.getAlias()
              + "_"
              + System.currentTimeMillis()
              + ".dat");

      addIDMapping("ZCSite", dr.getString("ID"), String.valueOf(site.getID()));
      this.da.deleteAndBackup(site);
      BlockingTransaction tran = new BlockingTransaction(this.da);
      Site.delSiteRela(site.getID(), tran);

      String sitePath =
          Config.getContextRealPath()
              + Config.getValue("Statical.TemplateDir")
              + "/"
              + site.getAlias();
      FileUtil.delete(sitePath);

      site = new ZCSiteSchema();
      site.setValue(dr);

      this.da.insert(site);
    }
  }