示例#1
0
 public void getCheckedMenu() {
   String UserName = $V("UserName");
   if (XString.isEmpty(UserName)) {
     this.response.put("checkedMenu", "");
     return;
   }
   String SiteID = $V("SiteID");
   List list = new LinkedList();
   String sql =
       "select ID ,Name,Icon,Type,'' as TreeLevel  from ZDMenu where (parentid in (select id from ZDMenu where parentid=0 and visiable='Y') or parentid=0) and visiable='Y' order by OrderFlag";
   DataTable dt = new QueryBuilder(sql).executeDataTable();
   for (int i = 0; i < dt.getRowCount(); i++) {
     if (Priv.getPriv(UserName, "menu", SiteID + "-" + dt.getString(i, "ID"), "menu_browse")) {
       list.add(dt.getString(i, "ID"));
     }
   }
   this.response.put("checkedMenu", XString.join(list.toArray()));
 }
示例#2
0
 /**
  * 重建InnerTable
  *
  * @param html
  * @return
  */
 public String restoreInnerTable(String html) {
   if ((this.pList == null) || (this.pList.size() == 0)) {
     return html;
   }
   String[] arr = XString.splitEx(html, "<!--_SKY_INNERTABLE_PROTECTED_");
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < arr.length; i++) {
     if (XString.isNotEmpty(arr[i])) {
       if (i != 0) {
         int index = Integer.parseInt(arr[i].substring(0, arr[i].indexOf("-")));
         sb.append(this.pList.get(index).toString());
         arr[i] = arr[i].substring(arr[i].indexOf(">") + 1);
       }
       sb.append(arr[i]);
     }
   }
   return sb.toString();
 }
示例#3
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;
 }
示例#4
0
  /** 解析html */
  public void parseHtml(String html) throws Exception {
    Matcher m = HtmlTable.PTR.matcher(html);
    if (!m.find()) {
      throw new Exception("TR解析html时发生错误");
    }
    String attrs = m.group(1);
    String tds = m.group(2).trim();

    this.Attributes.clear();
    this.Children.clear();

    m = HtmlTable.PInnerTable.matcher(tds);
    int lastEndIndex = 0;
    while (m.find(lastEndIndex)) {
      if (this.pList == null) {
        this.pList = new ArrayList<String>();
      }
      this.pList.add(m.group(0));
      lastEndIndex = m.end();
    }
    if (this.pList != null) {
      for (int i = 0; i < this.pList.size(); i++) {
        tds =
            XString.replaceEx(
                tds, this.pList.get(i).toString(), "<!--_SKY_INNERTABLE_PROTECTED_" + i + "-->");
      }
    }

    this.Attributes = parseAttr(attrs);

    m = HtmlTable.PTDPre.matcher(tds);
    lastEndIndex = 0;
    while (m.find(lastEndIndex)) {
      String t = tds.substring(m.start(), m.end());
      HtmlTD td = new HtmlTD(this);
      td.parseHtml(t);
      addTD(td);
      lastEndIndex = m.end();
    }
  }