<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jueseadd.aspx.cs" Inherits="library.jueseadd" %>

<!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="../css/table.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function Checkbox1_onclick() {
            for (var i = 0; i < document.getElementById("userid").getElementsByTagName("input").length; i++) {
                var objCheck = document.getElementById("userid_" + i);
                if (objCheck.checked)
                    objCheck.checked = false;
                else
                    objCheck.checked = true;
            }
        }
        function public_GetParentByTagName(element, tagName) {
            var parent = element.parentNode;
            var upperTagName = tagName.toUpperCase();
            //如果这个元素还不是想要的tag就继续上溯
            while (parent && (parent.tagName.toUpperCase() != upperTagName)) {
                parent = parent.parentNode ? parent.parentNode : parent.parentElement;
            }
            return parent;
        }

        //设置节点的父节点Cheched——该节点可访问，则他的父节点也必能访问 
        function setParentChecked(objNode) {
            var objParentDiv = public_GetParentByTagName(objNode, "div");
            if (objParentDiv == null || objParentDiv == "undefined") {
                return;
            }
            var objID = objParentDiv.getAttribute("ID");
            objID = objID.substring(0, objID.indexOf("Nodes"));
            objID = objID + "CheckBox";
            var objParentCheckBox = document.getElementById(objID);
            if (objParentCheckBox == null || objParentCheckBox == "undefined") {
                return;
            }
            if (objParentCheckBox.tagName != "INPUT" && objParentCheckBox.type == "checkbox")
                return;
            objParentCheckBox.checked = true;
            setParentChecked(objParentCheckBox);
        }

        //设置节点的子节点uncheched——该节点不可访问，则他的子节点也不能访问 
        function setChildUnChecked(divID) {
            var objchild = divID.children;
            var count = objchild.length;
            for (var i = 0; i < objchild.length; i++) {
                var tempObj = objchild[i];
                if (tempObj.tagName == "INPUT" && tempObj.type == "checkbox") {
                    tempObj.checked = false;
                }
                setChildUnChecked(tempObj);
            }
        }

        //设置节点的子节点cheched——该节点可以访问，则他的子节点也都能访问 
        function setChildChecked(divID) {
            var objchild = divID.children;
            var count = objchild.length;
            for (var i = 0; i < objchild.length; i++) {
                var tempObj = objchild[i];
                if (tempObj.tagName == "INPUT" && tempObj.type == "checkbox") {
                    tempObj.checked = true;
                }
                setChildChecked(tempObj);
            }
        }

        function CheckEvent() {

            var objNode = event.srcElement;

            if (objNode.tagName != "INPUT" || objNode.type != "checkbox")
                return;

            if (objNode.checked == true) {
                setParentChecked(objNode);
                var objID = objNode.getAttribute("ID");
                var objID = objID.substring(0, objID.indexOf("CheckBox"));
                var objParentDiv = document.getElementById(objID + "Nodes");
                if (objParentDiv == null || objParentDiv == "undefined") {
                    return;
                }
                setChildChecked(objParentDiv);
            }
            else {
                var objID = objNode.getAttribute("ID");
                var objID = objID.substring(0, objID.indexOf("CheckBox"));
                var objParentDiv = document.getElementById(objID + "Nodes");
                if (objParentDiv == null || objParentDiv == "undefined") {
                    return;
                }
                setChildUnChecked(objParentDiv);
            }
        }</script>
</head>
<body>
    <form id="form1" runat="server">
     <div>
        <div class="place">
        <asp:SiteMapPath ID="SiteMapPath1" runat="server" Height="27px">
        </asp:SiteMapPath>
        </div>
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate><table align="left" border="1" bordercolor="#C2E5FB" cellpadding="3" 
            cellspacing="1" style="border-collapse:collapse " width="99%">
            <tr>
                <td align="right" class="style2">
                    排序号</td>
                <td align="left" class="style3">
                    <asp:TextBox ID="txtbianhao" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" class="STYLE4">
                    角色名称</td>
                <td align="left" class="text_left" width="644">
                    <asp:TextBox ID="txtjuese" runat="server" Width="177px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="right" class="STYLE4">
                    <span lang="zh-cn">权限</span></td>
                <td align="left" class="text_left">
                    <asp:RadioButtonList ID="rblqx" runat="server" RepeatDirection="Horizontal" 
                        RepeatLayout="Flow" onselectedindexchanged="rblqx_SelectedIndexChanged" 
                        AutoPostBack="True">
                        <asp:ListItem Value="0">超级管理员</asp:ListItem>
                        <asp:ListItem Value="1">校级领导</asp:ListItem>
                        <asp:ListItem  Selected="True" Value="2">科目文员</asp:ListItem>
                        <asp:ListItem Value="3">财务人员</asp:ListItem>
                    </asp:RadioButtonList>
                    </td>
            </tr>
            <tr>
                <td align="right">
                    <span lang="zh-cn">菜单控制</span></td>
                <td align="left" class="text_left">
                    <span>
                    <asp:GridView ID="gdv" runat="server" AllowPaging="False" 
                        AutoGenerateColumns="False" CssClass="line_table" EmptyDataText="没有或没有符合条件的角色信息！" 
                        Font-Size="Small" Width="100%">
                        <HeaderStyle CssClass="sys_grid_head_cell" />
                        <Columns>
                            <asp:BoundField DataField="menuid" HeaderText="ID" />
                            <asp:BoundField DataField="menu" HeaderText="菜单名称" />
                            <asp:BoundField DataField="url" HeaderText="菜单地址" />
                            <asp:TemplateField HeaderText="查看">
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbview" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="添加">
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbadd" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="编辑">
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbedit" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="删除">
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbdel" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle CssClass="HeaderStyle" />
                        <PagerStyle CssClass="PagerStyle" />
                        <RowStyle CssClass="RowStyle" />
                        <PagerSettings Visible="false" />
                    </asp:GridView>
                    </span>
                </td>
            </tr>
            <tr>
                <td align="right" class="STYLE4" width="95">
                    说明</td>
                <td align="left" class="text_left" width="644">
                    &nbsp;<asp:TextBox ID="txtshuoming" runat="server" Height="53px" TextMode="MultiLine" Width="330px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style4"  align="center" colspan="2">
                    <asp:Button ID="Button1" runat="server" Text="添 加" onclick="Button1_Click" />
&nbsp;<input name="Submit2" type="reset" value="清 除" />
                    <input name="Submit3" onclick="javascript:history.go(-1);" type="button" 
                        value="返 回" />
                    <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
                        AssociatedUpdatePanelID="UpdatePanel1">
                        <ProgressTemplate>
                            <asp:Image ID="images1" runat="server" ImageUrl="~/images/loading.gif" />
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                </td>
            </tr>
        </table>
    </div>
        </ContentTemplate>
            </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
