Ejemplo n.º 1
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");
     }
   }
 }
Ejemplo n.º 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");
       }
     }
   }
 }