<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GiveDepAuth.aspx.cs" Inherits="System_GiveDepAuth_GiveDepAuth" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../../Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../Scripts/asyncbox/asyncbox.v1.5.beta.min.js"></script>
    <script type="text/javascript" src="../../Scripts/WebSite.js"></script>
    <link href="../../Styles/WebSite.css" rel="stylesheet" type="text/css" />
</head>
<body onload="search()">
    <script type="text/javascript">
        var category = "";
        var id = '<%=xview["id"]%>';
        var type = '<%=xview["type"]%>';
        function select_all_auth() {
            var fb = document.getElementById("frame_tree");
            var cw = fb.contentWindow;
            cw.select_all_checkbox();
        }
        function save() {
            var fb = document.getElementById("frame_tree");
            var cw = fb.contentWindow;
            var s = cw.document.getElementsByName("tree_check");
            var val="";
            for(var i=0;i<s.length;i++){
                if (s[i].checked) {
                    val += s[i].value + ",";
                }
            }
            if(val != ""){
                val = val.substring(0,val.length-1);
            }
            
            ShowLoadingMask(); //显示遮罩
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: "../GiveDepAuth/GiveDepAuth_Service.asmx/Save",
                data: "{id:" + id + ",val:'" + val + "'}",
                dataType: 'json',
                success: function (result) {
                    var r = result.d;
                    if (r == "success") {
                        AlertOK('保存成功!');
                        //search();
                    } else {
                        AlertNO(r);
                    }
                    HideLoadingMask(); //关闭遮罩
                }
            });
        }
    </script>
    <div style="width:500px;height:400px;">
        <iframe id="frame_tree" frameborder="0" style="width:100%;height:97%" src="GiveDepAuth_Tree.aspx?id=<%=xview["id"]%>"></iframe>
        <div style="height:30px;text-align:center">
            <input type="button" class="SiteButton" value="全选" onclick='select_all_auth()'/>
            <input type="button" class="SiteButton" value="保存" onclick='save()'/>
            <input type="button" class="SiteButton" value="取消" onclick='CloseDivWin()'/>
        </div>
    </div>
</body>
</html>
