public void del() {
   String Codes = $V("Codes");
   if ((Codes.indexOf("\"") >= 0) || (Codes.indexOf("'") >= 0)) {
     this.response.setStatus(0);
     this.response.setMessage("传入ID时发生错误!");
     return;
   }
   Codes = XString.replaceEx(Codes, ",", "','");
   Transaction trans = new Transaction();
   ZDMemberFieldSchema field = new ZDMemberFieldSchema();
   ZDMemberFieldSet set =
       field.query(
           new QueryBuilder(
               "where SiteID = "
                   + ApplicationPage.getCurrentSiteID()
                   + " and Code in ('"
                   + Codes
                   + "')"));
   trans.add(set, OperateType.DELETE);
   if (trans.commit()) {
     this.response.setStatus(1);
     this.response.setMessage("删除成功!");
   } else {
     this.response.setStatus(0);
     this.response.setMessage("操作数据库时发生错误!");
   }
 }
Exemple #2
0
  public static void dg1DataBind(DataListAction dla) {
    String CatalogID = dla.getParam("CatalogID");
    String CatalogType = dla.getParam("CatalogType");
    String VerifyStatus = dla.getParam("VerifyStatus");
    QueryBuilder qb =
        new QueryBuilder(
            "select ZCComment.*,(select Name from zccatalog where zccatalog.ID=ZCComment.CatalogID) as CatalogName,");

    if (XString.isEmpty(CatalogType)) {
      CatalogType = "1";
    }
    if (XString.isEmpty(VerifyStatus)) {
      VerifyStatus = "X";
    }
    if (CatalogType.equals("1"))
      qb.append("(select Title from ZCArticle where ZCArticle.ID = ZCComment.RelaID) as Name");
    else if (CatalogType.equals("4"))
      qb.append("(select Name from ZCImage where ZCImage.ID = ZCComment.RelaID) as Name");
    else if (CatalogType.equals("5"))
      qb.append("(select Name from ZCVideo where ZCVideo.ID = ZCComment.RelaID) as Name");
    else if (CatalogType.equals("6"))
      qb.append("(select Name from ZCAudio where ZCAudio.ID = ZCComment.RelaID) as Name");
    else if (CatalogType.equals("7")) {
      qb.append("(select Name from ZCAttachment where ZCAttachment.ID = ZCComment.RelaID) as Name");
    }
    qb.append(" from ZCComment where SiteID=?", ApplicationPage.getCurrentSiteID());
    qb.append(" and CatalogType=?", CatalogType);
    if (XString.isNotEmpty(CatalogID)) {
      qb.append(" and CatalogID=?", CatalogID);
    }
    if (!VerifyStatus.equals("All")) {
      qb.append(" and VerifyFlag=?", VerifyStatus);
    }
    qb.append(" order by VerifyFlag asc, ID desc");
    dla.setTotal(qb);
    DataTable dt = qb.executePagedDataTable(dla.getPageSize(), dla.getPageIndex());
    dt.insertColumn("PreLink");
    dt.insertColumn("FlagColor");
    for (int i = 0; i < dt.getRowCount(); i++) {
      if (dt.getString(i, "CatalogType").equals("1"))
        dt.set(i, "PreLink", "../Document/Preview.jsp?ArticleID=" + dt.getString(i, "RelaID"));
      else {
        dt.set(i, "PreLink", "#;");
      }
      if (dt.getString(i, "VerifyFlag").equals("Y")) dt.set(i, "FlagColor", "#00ff00");
      else if (dt.getString(i, "VerifyFlag").equals("X")) dt.set(i, "FlagColor", "#ff7700");
      else {
        dt.set(i, "FlagColor", "#ff0000");
      }
    }
    dt.decodeColumn("VerifyFlag", CacheManager.getMapx("Code", "Comment.Status"));
    if (dt.getRowCount() == 0) {
      // dt.insertRow(null);
      dt.set(0, "ID", "0");
    }
    dla.bindData(dt);
  }
Exemple #3
0
 public static void dg1DataBind(DataGridAction dga) {
   DataTable dt =
       new QueryBuilder(
               "select * from ZCFullText where siteid=?", ApplicationPage.getCurrentSiteID())
           .executeDataTable();
   Mapx map = new Mapx();
   map.put("Article", "文章检索");
   map.put("Image", "图片检索");
   map.put("Video", "视频检索");
   map.put("Radio", "音频检索");
   dt.decodeColumn("Type", map);
   dga.bindData(dt);
 }
Exemple #4
0
  public boolean addOneJob(long configID, boolean immediate) {
    ZCDeployJobSchema job = new ZCDeployJobSchema();
    ZCDeployConfigSchema config = new ZCDeployConfigSchema();
    config.setID(configID);
    if (!config.fill()) {
      return false;
    }

    String staticDir =
        Config.getContextRealPath() + Config.getValue("Statical.TargetDir").replace('\\', '/');
    String sourcePath =
        staticDir + "/" + ApplicationPage.getCurrentSiteAlias() + config.getSourceDir();
    job.setID(NoUtil.getMaxID("DeployJobID"));
    job.setConfigID(config.getID());
    job.setSource(sourcePath);
    job.setMethod(config.getMethod());

    String targetDir = config.getTargetDir();
    if (XString.isEmpty(targetDir)) {
      targetDir = "/";
    } else if (!targetDir.endsWith("/")) {
      targetDir = targetDir + "/";
    }

    job.setTarget(targetDir);
    job.setSiteID(config.getSiteID());
    job.setHost(config.getHost());
    job.setPort(config.getPort());
    job.setUserName(config.getUserName());
    job.setPassword(config.getPassword());
    job.setStatus(0L);
    job.setAddTime(new Date());
    job.setAddUser(User.getUserName());

    Transaction trans = new Transaction();
    trans.add(job, OperateType.INSERT);
    if (trans.commit()) {
      if (immediate) {
        executeJob(config, job);
      }
      return true;
    }
    LogUtil.getLogger().info("添加部署任务时,数据库操作失败");
    return false;
  }
Exemple #5
0
 public static void treeDataBind(TreeAction ta) {
   String SiteID = ApplicationPage.getCurrentSiteID() + "";
   DataTable dt = null;
   Mapx params = ta.getParams();
   String CatalogType = (String) params.get("Type");
   String parentLevel = (String) params.get("ParentLevel");
   String parentID = (String) params.get("ParentID");
   String rootText = "";
   if (CatalogType.equals("1")) rootText = "文档库";
   else if (CatalogType.equals("4")) rootText = "图片库";
   else if (CatalogType.equals("5")) rootText = "视频库";
   else if (CatalogType.equals("6")) rootText = "音频库";
   else if (CatalogType.equals("7")) {
     rootText = "附件库";
   }
   if (ta.isLazyLoad()) {
     QueryBuilder qb =
         new QueryBuilder(
             "select ID,ParentID,TreeLevel,Name,SingleFlag,prop1 from ZCCatalog Where Type =? and SiteID =? and TreeLevel>? and innerCode like ? order by orderflag");
     qb.add(CatalogType);
     qb.add(SiteID);
     qb.add(parentLevel);
     qb.add(CatalogUtil.getInnerCode(parentID) + "%");
     dt = qb.executeDataTable();
   } else {
     QueryBuilder qb =
         new QueryBuilder(
             "select ID,ParentID,TreeLevel,Name,SingleFlag,prop1 from ZCCatalog Where Type =? and SiteID=? and TreeLevel-1<=? order by orderflag");
     qb.add(CatalogType);
     qb.add(SiteID);
     qb.add(ta.getLevel());
     dt = qb.executeDataTable();
   }
   ta.setRootText(rootText);
   dt.setWebMode(false);
   ta.bindData(dt);
   if (CatalogType.equals("1")) {
     List items = ta.getItemList();
     for (int i = 1; i < items.size(); i++) {
       TreeItem item = (TreeItem) items.get(i);
       if ("Y".equals(item.getData().getString("SingleFlag")))
         item.setIcon("Icons/treeicon11.gif");
     }
   }
 }
Exemple #6
0
 public void add() {
   Transaction tran = new Transaction();
   ZCFullTextSchema ft = new ZCFullTextSchema();
   if (XString.isEmpty($V("ID"))) {
     ft.setValue(this.request);
     ft.setID(NoUtil.getMaxID("FullTextID"));
     ft.setSiteID(ApplicationPage.getCurrentSiteID());
     ft.setAddTime(new Date());
     ft.setAddUser(User.getUserName());
     tran.add(ft, OperateType.INSERT);
   } else {
     ft.setID(Long.parseLong($V("ID")));
     ft.fill();
     ft.setValue(this.request);
     ft.setModifyTime(new Date());
     ft.setModifyUser(User.getUserName());
     tran.add(ft, OperateType.UPDATE);
   }
   if (tran.commit()) this.response.setMessage("保存成功");
   else this.response.setError("发生错误,保存失败");
 }
Exemple #7
0
 public static Mapx init(Mapx params) {
   String userName = params.getString("UserName");
   DataTable dt =
       new QueryBuilder("select name,id from zcsite order by orderflag ,id").executeDataTable();
   dt =
       dt.filter(
           new Filter(userName) {
             public boolean filter(Object obj) {
               DataRow dr = (DataRow) obj;
               return Priv.getPriv((String) this.Param, "site", dr.getString("ID"), "site_browse");
             }
           });
   String SiteID = params.getString("SiteID");
   if (XString.isEmpty(SiteID)) {
     SiteID = params.getString("OldSiteID");
     if (XString.isEmpty(SiteID)) {
       SiteID = ApplicationPage.getCurrentSiteID() + "";
     }
   }
   params.put("SiteID", HtmlUtil.dataTableToOptions(dt, SiteID));
   return params;
 }
 public static Mapx initDialog(Mapx params) {
   String Code = params.getString("Code");
   if (XString.isEmpty(Code)) {
     params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap));
     params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap));
     params.put("IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", "N"));
     params.put("MaxLength", "100");
     params.put("Cols", "265");
     params.put("Rows", "90");
   } else {
     ZDMemberFieldSchema field = new ZDMemberFieldSchema();
     field.setCode(Code);
     field.setSiteID(ApplicationPage.getCurrentSiteID());
     field.fill();
     params = field.toMapx();
     params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap, field.getVerifyType()));
     params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap, field.getInputType()));
     params.put(
         "IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", field.getIsMandatory()));
   }
   return params;
 }
  public void add() {
    String hCode = $V("hCode");
    boolean update = false;
    int FieldCount =
        new QueryBuilder(
                "select count(*) from ZDMemberField where SiteID = ?",
                ApplicationPage.getCurrentSiteID())
            .executeInt();
    ZDMemberFieldSchema field = new ZDMemberFieldSchema();
    field.setCode($V("Code").trim());
    field.setSiteID(ApplicationPage.getCurrentSiteID());
    if ((XString.isEmpty(hCode)) && (field.fill())) {
      this.response.setLogInfo(0, "已有相同字段");
      return;
    }
    if ((XString.isNotEmpty(hCode)) && (field.fill())) {
      update = true;
    }
    if (!update) {
      if (FieldCount < 20) {
        int index = 1;
        for (int i = 1; i <= 20; i++) {
          if (new QueryBuilder(
                      "select count(*) from ZDMemberField where SiteID = ? and RealField = 'Prop"
                          + i
                          + "'",
                      ApplicationPage.getCurrentSiteID())
                  .executeInt()
              == 0) {
            index = i;
            break;
          }
        }
        field.setRealField("Prop" + index);
      } else {
        this.response.setLogInfo(0, "达到扩展字段上限");
        return;
      }
    }
    field.setValue(this.request);
    field.setName($V("Name"));
    field.setCode($V("Code"));
    field.setAddUser(User.getUserName());
    field.setAddTime(new Date());

    String defaultValue = field.getDefaultValue();
    defaultValue = defaultValue.replaceAll("  ", ",");
    defaultValue = defaultValue.replaceAll(" ", ",");
    defaultValue = defaultValue.replaceAll("  ", ",");
    defaultValue = defaultValue.replaceAll(" ", ",");
    defaultValue = defaultValue.replaceAll(",,", ",");
    defaultValue = defaultValue.replaceAll(",,", ",");
    defaultValue = defaultValue.replaceAll(",", ",");
    if (XString.isEmpty(defaultValue)) {
      defaultValue = "";
    }
    field.setDefaultValue(defaultValue);

    if (Input.equals(field.getInputType())) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setListOption("");
    } else if (Text.equals(field.getInputType())) {
      field.setListOption("");
    } else if (Selecter.equals(field.getInputType())) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if (Radio.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if (Checkbox.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if ((DateInput.equals(field.getInputType()))
        || (TimeInput.equals(field.getInputType()))) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setListOption("");
      field.setVerifyType(STRING);
    } else if (HTMLInput.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setListOption("");
      field.setVerifyType(STRING);
    }

    Transaction trans = new Transaction();
    if (update) trans.add(field, OperateType.UPDATE);
    else {
      trans.add(field, OperateType.INSERT);
    }
    if (trans.commit()) this.response.setLogInfo(1, "保存会员扩展字段成功!");
    else this.response.setLogInfo(0, "发生错误!");
  }