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

<!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 runat="server">
    <title>管理员权限设置</title>
    <link href="../InClude/StyleSheet.css" rel="stylesheet" type="text/css" />
    <script src="/js/jquery.min.js" type="text/javascript"></script>
    <script src="/js/all.js" type="text/javascript"></script>
    <style type="text/css">
    <!--
    body {
	    margin:8px;
    }
    -->
    </style>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {            
            $("#newsCheck").click(function () {
                if ($("#newsCheck").attr("checked")) {
                    $("input[name^='newsTree']").attr("checked", true);
                }
                else {
                    $("input[name^='newsTree']").attr("checked", false);
                }
            });

            $("#helpCheck").click(function () {
                if ($("#helpCheck").attr("checked")) {
                    $("input[name^='helpTree']").attr("checked", true);
                }
                else {
                    $("input[name^='helpTree']").attr("checked", false);
                }
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="divWidth">
        <div class="titleBg">
            管理员权限设置</div>
    </div>
    <div class="height10px">
    </div>
    <div class="divWidth">        
        <table class="tableLine" style="width:100%;">
            <tr>
                <td class="trTitleBG" style="text-align:left;">
                    管理员
                    <asp:Label ID="uid" runat="server" ForeColor="#FF3300"></asp:Label>
                    &nbsp;管理权限分配：
                </td>
                <td class="trTitleBG" style="text-align:left;">
                    新闻分类权限分配： 全选 
                    <input id="newsCheck" class="inputTextIME" type="checkbox" /></td>
                <td class="trTitleBG" style="text-align:left;">
                    帮助分类权限分配： 全选<input id="helpCheck" class="inputTextIME" type="checkbox" /></td>
            </tr>
            <tr>
                <td valign="top" style="text-align: left; background-color: #E9F8FC;">
                    <asp:Literal ID="selectPopedomHtm" runat="server"></asp:Literal>
                </td>
                <td valign="top" style="text-align: left; background-color: #E9F8FC;">
                    <asp:TreeView ID="newsTree" runat="server" ImageSet="Arrows" CssClass="hideTable"></asp:TreeView>
                </td>
                <td valign="top" style="text-align: left; background-color: #E9F8FC;">
                    <asp:TreeView ID="helpTree" runat="server" ImageSet="Arrows" CssClass="hideTable"></asp:TreeView>
                </td>
            </tr>
            <tr>
                <td class="tdTitle" style="text-align:left;" colspan="3">
                    <asp:Button ID="setAdmin" runat="server" Text="设置权限" CssClass="inputBottom" OnClick="setAdmin_Click" />
                </td>
            </tr>
        </table>
    </div>
    <script language="javascript" type="text/javascript">
        function OnTreeNodeChecked() {
            var ele = event.srcElement;
            if (ele.type == 'checkbox') {
                var childrenDivID = ele.id.replace('CheckBox', 'Nodes');
                var div = document.getElementById(childrenDivID);
                if (div == null) {
                }
                else {
                    var checkBoxs = div.getElementsByTagName('INPUT');
                    for (var i = 0; i < checkBoxs.length; i++) {
                        if (checkBoxs[i].type == 'checkbox')
                            checkBoxs[i].checked = ele.checked;
                    }
                }
                var parentDiv = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement;
                var parentParentDiv = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
                if (parentDiv != null && parentDiv != undefined) {
                    var parentCheckBoxID = parentDiv.id.replace('Nodes', 'CheckBox');
                    var checkBoxs = parentDiv.getElementsByTagName('INPUT');
                    var childNodeChecked = false;
                    for (var i = 0; i < checkBoxs.length; i++) {
                        if (checkBoxs[i].type == 'checkbox' && checkBoxs[i].checked)
                            childNodeChecked = true;
                    }
                    if (document.getElementById(parentCheckBoxID) != null) {
                        document.getElementById(parentCheckBoxID).checked = childNodeChecked;
                    }
                }
                if (parentParentDiv != null && parentParentDiv != undefined) {
                    var parentParentCheckBoxID = parentParentDiv.id.replace('Nodes', 'CheckBox');
                    var checkBoxs = parentParentDiv.getElementsByTagName('INPUT');
                    var childNodeChecked = false;
                    for (var i = 0; i < checkBoxs.length; i++) {
                        if (checkBoxs[i].type == 'checkbox' && checkBoxs[i].checked)
                            childNodeChecked = true;
                    }
                    if (document.getElementById(parentParentCheckBoxID) != null) {
                        document.getElementById(parentParentCheckBoxID).checked = childNodeChecked;
                    }
                }
            }
        }
    </script>
    </form>
</body>
</html>
