<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dictionarygrouptree.aspx.cs" Inherits="Us.Web.admin.v3basic.dictionarygrouptree" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8,chrome=1" />
    <title>数据字典分类</title>
    <link href="../style/default/style.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="/admin/js/System.js" type="text/javascript"></script>
    <%--<link rel="StyleSheet" href="/admin/js/tree/dtree.css" type="text/css" />
<script type="text/javascript" src="/admin/js/tree/dtree.js"></script>--%>

    <%=ImportScriptStr %>
    <link rel="stylesheet" href="../mtree/css/zTreeStyle/zTreeStyle.css" type="text/css">

    <script type="text/javascript" src="../mtree/js/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript" src="../mtree/js/jquery.ztree.excheck-3.5.js"></script>
    <script type="text/javascript" src="../mtree/js/jquery.ztree.exedit-3.5.js"></script>

    <script type="text/javascript">
		<!--
    var setting = {

        view: {
            dblClickExpand: false,
            showLine: true
            , fontCss: getFontCss
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: onClick,
            onRightClick: OnRightClick
        }
    };

   <% =TreeHTML %>

        function onClick(e, treeId, treeNode) {
            if (treeNode.id != "0") {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
                zTree.expandNode(treeNode);
                //OnRightClick(e, treeId, treeNode);
            }
        }

        var rMenu, zTree;
        function OnRightClick(e, treeId, treeNode) {
            if (!treeNode && event.target.tagName.toLowerCase() != "button" && $(event.target).parents("a").length == 0) {
                zTree.cancelSelectedNode();
                showRMenu("root", event.clientX, event.clientY);
            } else if (treeNode && !treeNode.noR) {
                zTree.selectNode(treeNode);
                showRMenu("node", event.clientX, event.clientY);
            }
        }
        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
            zTree = $.fn.zTree.getZTreeObj("treeDemo");
            rMenu = $("#rMenu");
            ztreeinitsearch("treeDemo", "txtUserName");
            //$("#callbackTrigger").bind("change", {}, setTrigger);
        });



        function showRMenu(type, x, y) {
            $("#rMenu ul").show();
            if (type == "root") {
                $("#m_del").hide();
                $("#m_check").hide();
                $("#m_unCheck").hide();
            } else {
                $("#m_del").show();
                $("#m_check").show();
                $("#m_unCheck").show();
            }
            rMenu.css({ "top": y + "px", "left": x + "px", "visibility": "visible" });

            $("body").bind("mousedown", onBodyMouseDown);
        }
        function hideRMenu() {
            if (rMenu) rMenu.css({ "visibility": "hidden" });
            $("body").unbind("mousedown", onBodyMouseDown);
        }
        function onBodyMouseDown(event) {
            if (!(event.target.id == "rMenu" || $(event.target).parents("#rMenu").length > 0)) {
                rMenu.css({ "visibility": "hidden" });
            }
        }

        var addCount = 1;
        function addTreeNode() {
            hideRMenu();
            if (zTree.getSelectedNodes()[0]) {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx?parentid=" + zTree.getSelectedNodes()[0].id);
            } else {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx");
            }
        }
        function updateTreeNode() {
            hideRMenu();

            if (zTree.getSelectedNodes()[0]) {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx?codeid=" + zTree.getSelectedNodes()[0].id);
            } else {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx");
            }
        }
        function removeTreeNode() {
            hideRMenu();
            if (zTree.getSelectedNodes()[0]) {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx?codeid=" + zTree.getSelectedNodes()[0].id);
            } else {
                rightGoURL("/admin/v3basic/dictionarygroupmanager.aspx");
            }
        }


        function listTreeNode() {
            hideRMenu();
            rightGoURL("/admin/v3basic/dictionarylist.aspx?dtype=" + zTree.getSelectedNodes()[0].id + "&dtypename=" + zTree.getSelectedNodes()[0].name);
        }
        function checkTreeNode(checked) {
            var nodes = zTree.getSelectedNodes();
            if (nodes && nodes.length > 0) {
                zTree.checkNode(nodes[0], checked, true);
            }
            hideRMenu();
        }
        function resetTree() {
            hideRMenu();
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        }

        function rightGoURL(url) {
            //$("#iframe1").attr("src", url);
            CareffArtOpenA1(url);
        }

        //-->
    </script>

    <style type="text/css">
        .ztree li span.button.switch.level0 {
            visibility: hidden;
            width: 1px;
        }

        .ztree li ul.level0 {
            padding: 0;
            background: none;
        }
    </style>

    <script language="javascript" type="text/javascript">
        function AutoHeight() {
            var h = $(window).height() - 120;
            $("#ScroLeft").height(h);
            $("#iframe1").height($(window).height() - 20);
        }
        $(window).resize(function () {
            AutoHeight();
        });

        $(document).ready(function () {
            AutoHeight();
        });
        //禁止右菜单
        $(document).bind("contextmenu", function (e) {
            {
                e.preventDefault();
                return false;
            }
            return true;
        });
    </script>


    <style type="text/css">
        div#rMenu {
            position: absolute;
            visibility: hidden;
            top: 0;
            text-align: left;
            padding: 1px;
            margin: 0px;
            background-color: #fff;
            border: 1px solid #999;
            width: 120px;
        }

            div#rMenu ul li {
                color: #000;
                display: block;
                cursor: default;
                padding: 3px;
                border: 1px solid #fff;
                background-color: transparent;
            }

                div#rMenu ul li a:hover {
                    border: 1px solid #0a246a;
                    background-color: #b6bdd2;
                }

        img {
            padding-right: 5px;
            vertical-align: middle;
            width: 16px;
            height: 16px;
        }

        #rMenu li.h_nav_over {
            border: 1px solid #0a246a;
            background-color: #b6bdd2;
        }

            #rMenu li.h_nav_over a {
                color: #fff;
            }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#rMenu>ul>li").mouseover(function () {
                $("#rMenu>ul>li").each(function (i) {
                    $(this).removeClass("h_nav_over");
                });
                $(this).addClass("h_nav_over");
            }).mouseout(function () {
                $(this).addClass("h_nav_over");
            });
        });

    </script>


</head>
<body>
    <form id="Form1" method="post" runat="server">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%">
            <tr>
                <td width="220" valign="top">
                    <div class="divTbg">
                        <div class="divTbgL"></div>
                        <div class="divTbgInfo">
                            <div class="divTbgTitle">字典分类管理</div>
                        </div>
                    </div>
                    <div class="divTbgF"></div>
                    <div class="divSearchBoth">
                        <div class="divInfo" align="center">
                            <a href="dictionarygrouptreemove.aspx" class="rptlink" target="_self">[分类排序]</a>&nbsp;&nbsp;
            <a href="javascript:void(0);" class="rptlink" onclick=" CareffArtOpenA1('/admin/v3basic/dictionarygroupmanager.aspx');">[增加分类]</a>
                        </div>

                        <div class="divInfo">

                            <div class="divSearch">
                                <div id="searchBox" class="clearsearch">
                                    <p>
                                        &nbsp;<input type="text" id="txtUserName" placeholder="搜索的字典名称" />
                                    </p>
                                </div>
                            </div>


                        </div>
                        <div class="divInfo">
                            <div class="divAutoHeight" id="ScroLeft" style="height: 300px">
                                <ul id="treeDemo" class="ztree"></ul>


                            </div>
                        </div>

                    </div>
                </td>
                <td valign="top" height="100%">
                    <iframe id="iframe1" src="<%=sOneURL %>" width="100%" height="100%" id="frameright" name="frameright" frameborder="0"
                        scrolling="auto"></iframe>
                </td>
            </tr>
        </table>

        <div id="rMenu">
            <ul>
                <li id="m_add" onclick="addTreeNode();">
                    <img src="../style/rimages/add.png" />增加字典分类</li>
                <li id="m_del" onclick="updateTreeNode();">
                    <img src="../style/rimages/update.png" />修改字典分类</li>
                <li id="m_check" onclick="removeTreeNode();">
                    <img src="../style/rimages/del.png" />删除字典分类</li>
                <%--	<li id="m_unCheck" onclick="listTreeNode();"><img src="../style/rimages/list.png" />字典值列表</li>--%>
            </ul>
        </div>
    </form>
</body>
</html>

