示例#1
0
 public static void dg1DataBind(DataGridAction dga) {
   DataTable dt =
       new QueryBuilder("select * from ZDMemberField order by AddTime desc")
           .executePagedDataTable(dga.getPageSize(), dga.getPageIndex());
   dt.decodeColumn("InputType", InputTypeMap);
   dt.decodeColumn("VerifyType", VerifyTypeMap);
   dga.bindData(dt);
 }
示例#2
0
 public static String getColumns(String SiteID) {
   DataTable dt =
       new QueryBuilder(
               "select * from ZDMemberField where SiteID = ? order by AddTime asc", SiteID)
           .executeDataTable();
   String Columns = "";
   for (int i = 0; i < dt.getRowCount(); i++) {
     Columns = Columns + getColumn(dt.getDataRow(i));
   }
   return Columns;
 }
示例#3
0
 public static String getColumnAndValue(ZDMemberSchema member) {
   DataTable dt =
       new QueryBuilder(
               "select * from ZDMemberField where SiteID = ? order by AddTime asc",
               member.getSiteID())
           .executeDataTable();
   String Columns = "";
   for (int i = 0; i < dt.getRowCount(); i++) {
     Columns = Columns + getColumn(dt.getDataRow(i), member, dt.getString(i, "RealField"));
   }
   return Columns;
 }
示例#4
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);
 }
示例#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");
     }
   }
 }
示例#6
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");
       }
     }
   }
 }
示例#7
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);
  }
示例#8
0
  public static Mapx init(Mapx params) {
    DataTable dt = null;
    dt = new QueryBuilder("select name,id from zcsite order by orderflag").executeDataTable();
    dt =
        dt.filter(
            new Filter() {
              public boolean filter(Object obj) {
                DataRow dr = (DataRow) obj;
                return Priv.getPriv(User.getUserName(), "site", dr.getString("ID"), "site_browse");
              }
            });
    if ((getCurrentSiteID() == 0L) && (dt.getRowCount() > 0)) {
      setCurrentSiteID(dt.getString(0, "ID"));
    }
    params.put("Sites", HtmlUtil.dataTableToOptions(dt, getCurrentSiteID()));
    DataTable dtsite =
        new QueryBuilder("select ID,Name from zcsite order by orderflag").executeDataTable();
    StringBuffer sitestb = new StringBuffer();
    for (int i = 0; i < dtsite.getRowCount(); i++) {
      if (dtsite.getString(i, "ID").equals(getCurrentSiteID())) {
        sitestb.append(
            "<a value=\""
                + dtsite.getString(i, "ID")
                + "\" class=\"ahover\" hidefocus href=\"javascript:void(0);\">"
                + dtsite.getString(i, "Name")
                + "</a>");
        params.put("CurrentSiteName", dtsite.getString(i, "Name"));
        params.put("CurrentSiteId", dtsite.getString(i, "ID"));
      } else {
        sitestb.append(
            "<a value=\""
                + dtsite.getString(i, "ID")
                + "\" hidefocus href=\"javascript:void(0);\">"
                + dtsite.getString(i, "Name")
                + "</a>");
      }
    }
    params.put("ZCSites", sitestb.toString());

    dt =
        new QueryBuilder(
                "select name,id from zdmenu where  visiable='Y' and parentID=0 order by OrderFlag")
            .executeDataTable();
    dt =
        dt.filter(
            new Filter() {
              public boolean filter(Object obj) {
                DataRow dr = (DataRow) obj;
                return Priv.getPriv(
                    User.getUserName(),
                    "menu",
                    ApplicationPage.getCurrentSiteID() + "-" + dr.getString("id"),
                    "menu_browse");
              }
            });
    boolean hasMenu = false;
    String template =
        "<a id='_Menu_${ID}' onclick='Application.onMainMenuClick(this);return false;' hidefocus='true'><b>${Name}</b></a>";
    String menuHtml = HtmlUtil.replaceWithDataTable(dt, template);
    if (dt.getRowCount() > 0) {
      hasMenu = true;
    }

    StringBuffer sb = new StringBuffer();

    template = "arr.push([${ID},\"${Name}\",\"${URL}\",\"${Icon}\"]);";
    sb.append("var arr;");
    for (int i = 0; i < dt.getRowCount(); i++) {
      String id = dt.getString(i, "ID");
      sb.append("arr = [];");
      DataTable dt2 =
          new QueryBuilder(
                  "select name,id,url,icon from zdmenu where visiable='Y' and parentID=? order by OrderFlag",
                  id)
              .executeDataTable();
      dt2 =
          dt2.filter(
              new Filter() {
                public boolean filter(Object obj) {
                  DataRow dr = (DataRow) obj;
                  return Priv.getPriv(
                      User.getUserName(),
                      "menu",
                      ApplicationPage.getCurrentSiteID() + "-" + dr.getString("id"),
                      "menu_browse");
                }
              });
      sb.append(HtmlUtil.replaceWithDataTable(dt2, template));
      sb.append("$('_Menu_" + id + "').ChildArray = arr;");
      if (dt2.getRowCount() > 0) {
        hasMenu = true;
      }
    }

    HtmlScript script = new HtmlScript();
    script.setInnerHTML(sb.toString());
    if (hasMenu) params.put("Menu", menuHtml + script.getOuterHtml());
    else {
      params.put("Menu", "<font color='yellow'>对不起,你没有任何菜单权限,请联系'管理员'分配菜单权限后再登陆!</font>");
    }

    DataCollection privDC = LoginPage.getAllPriv(new DataCollection());
    String priv = XString.htmlEncode(privDC.toXML().replaceAll("\\s+", " "));
    params.put("Privileges", priv);
    return params;
  }