directoryview.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 1,085 行 · 第 1/4 页

JAVA
1,085
字号
            } else {                 if (childcount > 0)                    out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_plus2-1.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>");                else                    out.println("<img src='images/i_plus-2-2.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>");            }        }                if (leaf.getType()==Leaf.TYPE_COLUMN) {            out.print(                    "<a target='" + target + "' href='" + link +                    StrUtil.UrlEncode(code) + "' class='column'>" + name + "</a>");        }        else if (leaf.getType() == Leaf.TYPE_SUB_SITE) {            out.print("<a target='" + target + "' href='" + link +                      StrUtil.UrlEncode(code) + "' class='subsite'>" + name +                      "</a>");        }        else {            out.print(                    "<a target='" + target + "' href='" + link +                    StrUtil.UrlEncode(code) + "'>" + name + "</a>");        }        out.print("     </td>");        out.println("  </tr></tbody></table>");        LeafPriv lp = new LeafPriv(leaf.getCode());        if (!lp.canUserSeeWithAncestorNode(privilege.getUser(request))) {            if (!leaf.getCode().equals("root")) {                out.println("<script>\n");                out.println("tableid.style.display='none';\n");                out.println("</script>\n");            }        }    }    public void listAjax(HttpServletRequest request, JspWriter out, boolean isShowRoot) throws Exception {        Privilege privilege = new Privilege();        ListTreeAjax(request, privilege, out, rootLeaf, true, isShowRoot);    }        void ListTreeAjax(HttpServletRequest request, Privilege privilege, JspWriter out, Leaf leaf,                  boolean isLastChild, boolean isShowRoot) throws Exception {        if (isShowRoot)            ShowLeafAjax(request, privilege, out, leaf, isLastChild, isShowRoot);        Directory dir = new Directory();        Vector children = dir.getChildren(leaf.getCode());        int size = children.size();        if (size == 0)            return;        int i = 0;        if (size > 0) {            LeafPriv lp = new LeafPriv(leaf.getCode());            String style = "";            if (!lp.canUserSeeWithAncestorNode(privilege.getUser(request))) {                if (!leaf.getCode().equals("root")) {                    style = "style='display:'";                }            }            out.print("<table id='childof" + leaf.getCode() +                      "' " + style + " cellspacing=0 cellpadding=0 width='100%' align=center><tr><td>");        }        Iterator ri = children.iterator();        while (ri.hasNext()) {            i++;            Leaf childlf = (Leaf) ri.next();            boolean isLastChild1 = true;            if (size != i)                isLastChild1 = false;            ShowLeafAjax(request, privilege, out, childlf, isLastChild1, isShowRoot);        }        if (size > 0)            out.print("</td></tr></table>");    }        void ShowLeafSimpleAjax(Privilege privilege, JspWriter out, Leaf leaf,                  boolean isLastChild, String target, String link, String tableClass, String tableClassMouseOn) throws Exception {        String code = leaf.getCode();        String name = leaf.getName();        int layer = leaf.getLayer();        int childcount = leaf.getChildCount();        String tableid = leaf.getCode();        out.println("<table id=" + tableid + " name=" + tableid + " class='" + tableClass + "' cellspacing=0 cellpadding=0 width='100%' align=center onMouseOver=\"this.className='" + tableClassMouseOn + "'\" onMouseOut=\"this.className='" + tableClass + "'\" border=0>");        out.println("    <tbody><tr>");        out.println("        <td height='20' align=left nowrap>");        int padWidth = 0;        for (int k = 1; k <= layer - 1; k++) {            padWidth += 21;        }        if (childcount==0)            padWidth += 16;        out.print("<img src='' width=" + padWidth + " height=1>");        if (leaf.getCode().equals(rootLeaf.getCode())) {             out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_puls-root.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>");        } else {            if (childcount > 0)                out.println("<img onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_plus.gif' align='absmiddle'><img src='' width=3px height=1><img src='images/folder_01.gif' align='absmiddle'>");            else                out.println("<img src='images/folder_01.gif' align='absmiddle'>");        }                if (leaf.getType()==Leaf.TYPE_COLUMN) {            out.print(                    "<a target='" + target + "' href='" + link +                    StrUtil.UrlEncode(code) + "' class='column'>" + name + "</a>");        }        else if (leaf.getType() == Leaf.TYPE_SUB_SITE) {            out.print("<a target='" + target + "' href='" + link +                      StrUtil.UrlEncode(code) + "' class='subsite'>" + name +                      "</a>");        }        else {            out.print(                    "<a target='" + target + "' href='" + link +                    StrUtil.UrlEncode(code) + "'>" + name + "</a>");        }        out.print("     </td>");        out.println("  </tr></tbody></table>");        LeafPriv lp = new LeafPriv(leaf.getCode());        if (!lp.canUserSeeWithAncestorNode(privilege.getUser(request))) {            if (!leaf.getCode().equals("root")) {                out.println("<script>\n");                out.println(tableid + ".style.display='none';\n");                out.println("</script>\n");            }        }    }        void ShowLeafAjax(HttpServletRequest request, Privilege privilege, JspWriter out, Leaf leaf,                  boolean isLastChild, boolean isShowRoot) throws Exception {        String code = leaf.getCode();        String name = leaf.getName();        int layer = leaf.getLayer();        String description = leaf.getDescription();        int childcount = leaf.getChildCount();                String tableid = leaf.getCode();        LeafPriv lp = new LeafPriv(leaf.getCode());        String style = "";        if (!lp.canUserSeeWithAncestorNode(privilege.getUser(request))) {            if (!leaf.getCode().equals("root")) {                style = "style='display:none'";            }        }        out.println("<table id=" + tableid + " name=" + tableid + " " + style + " class='tbg1' cellspacing=0 cellpadding=0 width='100%' align=center onMouseOver=\"this.className='tbg1sel'\" onMouseOut=\"this.className='tbg1'\" border=0>");        out.println("    <tbody><tr>");        out.println("        <td height='13' align=left nowrap>");        out.print("<span style='float:right'>");        if (lp.canUserSeeWithAncestorNode(privilege.getUser(request))) {            if (!leaf.getCode().equals("root")) {                String root_code = (String)request.getAttribute("root_code");                if (root_code==null)                    root_code = rootLeaf.getCode();                if (leaf.getIsHome())                    out.print(SkinUtil.LoadString(request,                                                  "res.cms.DirectoryView",                                                  "info_home") + "&nbsp;");                                                if (leaf.getType() == 1)                    out.print(SkinUtil.LoadString(request,                                                  "res.cms.DirectoryView",                                                  "info_type_doc") + "&nbsp;");                else if (leaf.getType() == 2)                    out.print(SkinUtil.LoadString(request,                                                  "res.cms.DirectoryView",                                                  "info_type_list") + "&nbsp;");                else if (leaf.getType()==3) {                    out.print(SkinUtil.LoadString(request,                                                  "res.cms.DirectoryView",                                                  "info_type_column") + "&nbsp;");                }                else if (leaf.getType()==Leaf.TYPE_SUB_SITE) {                    out.print(SkinUtil.LoadString(request,                                                  "res.label.cms.dir",                                                  "sub_site") + "&nbsp;");                }                else                    out.print(SkinUtil.LoadString(request,                                                  "res.cms.DirectoryView",                                                  "info_type_none") + "&nbsp;");                                if (privilege.isUserPrivValid(request, "admin") || !Leaf.isLeafOfSubsite(code)) {                    out.print(                            "<a target=_parent href='dir_priv_m.jsp?dirCode=" +                            StrUtil.UrlEncode(code, "utf-8") + "'>" +                            SkinUtil.                            LoadString(request, "res.cms.DirectoryView",                                       "link_pvg") +                            "</a>&nbsp;");                }                out.print(                        "<a target=dirbottomFrame href='dir_bottom.jsp?parent_code=" +                        StrUtil.UrlEncode(code, "utf-8") + "&parent_name=" +                        StrUtil.UrlEncode(name, "utf-8") +                        "&op=AddChild'>" +                        SkinUtil.LoadString(request, "res.cms.DirectoryView",                                            "link_addchild") + "</a>&nbsp;");                out.print(                        "<a target='dirbottomFrame' href='dir_bottom.jsp?op=modify&code=" +                        StrUtil.UrlEncode(code, "utf-8") + "&name=" +                        StrUtil.UrlEncode(name, "utf-8") + "&description=" +                        StrUtil.UrlEncode(description, "utf-8") + "'>" +                        SkinUtil.LoadString(request, "res.cms.DirectoryView",                                            "link_modify") + "</a>&nbsp;");                    out.print(                            "<a target=_self href=# onClick=\"if (window.confirm('" +                            SkinUtil.LoadString(request, "res.cms.DirectoryView",                                                "confirm_del") +                            "')) window.location.href='dir_top_ajax.jsp?op=del&root_code=" +                            StrUtil.UrlEncode(root_code) + "&delcode=" +                            StrUtil.UrlEncode(code, "utf-8") + "'\">" +                            SkinUtil.                            LoadString(request, "res.cms.DirectoryView", "link_del") +                            "</a>&nbsp;");                out.print(                        "<a href='dir_top_ajax.jsp?op=move&direction=up&root_code=" +                        StrUtil.UrlEncode(root_code) + "&code=" +                        StrUtil.UrlEncode(code) + "'>" +                        SkinUtil.                        LoadString(request, "res.cms.DirectoryView", "link_move_up") +                        "</a>&nbsp;");                out.print(                        "<a href='dir_top_ajax.jsp?op=move&direction=down&root_code=" +                        StrUtil.UrlEncode(root_code) + "&code=" +                        StrUtil.UrlEncode(code, "utf-8") + "'>" +                        SkinUtil.                        LoadString(request, "res.cms.DirectoryView", "link_move_down") +                        "</a>&nbsp;");                                            }        }        out.print("</span>");        int padWidth = 0;        for (int k = 1; k <= layer - 1; k++) {            padWidth += 21;        }        if (childcount==0)            padWidth += 16;        out.print("<img src='" + request.getContextPath() + "/images/spacer.gif' width=" + padWidth + " height=1>");        if (leaf.getCode().equals(rootLeaf.getCode())) {             out.println("<img tableRelate='' onClick=\"ShowChild(this, '" + tableid + "')\" src='images/i_puls-root.gif' align='absmiddle'><img src='images/folder_01.gif' align='absmiddle'>");        } else {            if (childcount > 0)                out.println("<img tableRelate='" + tableid +

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?