示例#1
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);
  }
示例#2
0
 public static void treeDataBind(TreeAction ta) {
   String id = ta.getParam("ID");
   ZCFullTextSchema ft = new ZCFullTextSchema();
   ft.setID(id);
   if (XString.isEmpty(id)) {
     ta.getParams().put("CatalogType", OperateType.INSERT);
     Catalog.treeDataBind(ta);
   } else {
     ft.fill();
     if (!ft.getRelaText().equalsIgnoreCase("-1")) {
       ta.getParams().put("IDs", ft.getRelaText());
     }
   }
   if ("Article".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", OperateType.INSERT);
     Catalog.treeDataBind(ta);
   }
   if ("Image".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", 4);
     ImageLib.treeDataBind(ta);
   }
   if ("Video".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", OperateType.DELETE_AND_BACKUP);
     VideoLib.treeDataBind(ta);
   }
   if ("Audio".equals(ta.getParam("Type"))) {
     ta.getParams().put("CatalogType", 6);
     AudioLib.treeDataBind(ta);
   }
   if ((ta.getDataSource() != null) && (XString.isEmpty(ta.getParam("ParentID")))) {
     DataTable dt = ta.getDataSource();
     dt.insertRow(new Object[dt.getColCount()], 0);
     dt.set(0, 0, "-1");
     dt.set(0, 1, "0");
     dt.set(0, 2, "1");
     dt.set(0, 3, "<font class='red'>全部</font>");
     DataRow dr = dt.getDataRow(0);
     TreeItem root = ta.getItem(0);
     TreeItem item = new TreeItem();
     item.setData(dr);
     item.setAction(ta);
     item.setID(dr.getString(ta.getIdentifierColumnName()));
     item.setParentID(root.getID());
     item.setLevel(root.getLevel() + 1);
     item.setParent(root);
     item.setIcon("Icons/treeicon09.gif");
     item.setLast(false);
     try {
       item.parseHtml(ta.getItemInnerHtml(dr));
     } catch (Exception e) {
       e.printStackTrace();
     }
     ta.getItemList().add(1, item);
     if ("Article".equals(ta.getParam("Type"))) {
       List items = ta.getItemList();
       for (int i = 1; i < items.size(); i++) {
         item = (TreeItem) items.get(i);
         if ("Y".equals(item.getData().getString("SingleFlag")))
           item.setIcon("Icons/treeicon11.gif");
       }
     }
   }
 }