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

<%@ Register Assembly="TopWinCMS.WebControls" Namespace="TopWinCMS.WebControls" TagPrefix="cc1" %>
<!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>
    <meta http-equiv="Pragma" content="No-cach" />
    <link href="../Style.css" type="text/css" rel="stylesheet" />

    <script language="javascript" type="text/javascript" src="../../Images/skysoft.js"></script>

</head>
<body>
    <form id="Form1" runat="server">
    <table width="98%" border="0" cellpadding="4" cellspacing="0" id="NavigationPath">
        <tr>
            <td>
                &nbsp;<img src='../../Images/arrow.gif' alt="" />
                您现在的位置：&nbsp;
                <asp:Label ID="LB_Path" runat="server"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    <asp:GridView ID="GV_List" runat="server" AutoGenerateColumns="False" OnPageIndexChanging="GV_List_PageIndexChanging"
        OnRowDataBound="GV_List_RowDataBound" OnRowDeleting="GV_List_RowDeleting" DataKeyNames="ID">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID">
                <ItemStyle HorizontalAlign="Center" Width="40px" />
            </asp:BoundField>
            <asp:BoundField DataField="RoleName" HeaderText="角色">
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="Member_Role.aspx?Action=ReadOnly&amp;ID={0}"
                HeaderText="角色权力" Text="查看">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:BoundField DataField="Rank" HeaderText="权限等级标识">
                <HeaderStyle Width="100" />
                <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:BoundField DataField="MemberCountForRole" HeaderText="用户数量">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="Member_Role.aspx?Action=Edit&amp;ID={0}"
                HeaderText="修改" Text="修改">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:CommandField HeaderText="删除" ShowDeleteButton="True">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:CommandField>
        </Columns>
        <HeaderStyle CssClass="HeaderStyle" />
    </asp:GridView>
    <asp:Panel ID="panel1" runat="server" Width="99%">
        <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="99%">
            <tr class="HeaderStyle">
                <td>
                    会 员 角 色
                </td>
            </tr>
            <tr>
                <td class="border" colspan="3">
                    <br />
                    &nbsp; &nbsp; &nbsp; &nbsp; 角色名称：
                    <asp:TextBox ID="TB_RoleName" runat="server"></asp:TextBox>
                    &nbsp;&nbsp;
                    <asp:Button ID="BT_Add" runat="server" Text="添加" OnClick="BT_Add_Click" CssClass="btn" />
                    &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
                    <br />
                    权限等级标识 ：<cc1:NumericTextBox ID="NTB_Rank" runat="server" Width="60px">
                    &nbsp;
                    </cc1:NumericTextBox>
                    &nbsp;“权限等级标识”是标识会员角色的权力大小的，高级的角色可以浏览下、载低级别的权限文章、软件。
                    <br />
                    <hr />
                    <asp:CheckBox ID="CB_ALL" onclick="javascript:SelectAll(this);" runat="server" Text="全选所有权限："
                        TextAlign="Left"></asp:CheckBox><table id="Table2" border="0" cellpadding="0" cellspacing="0"
                            width="100%">
                        </table>
                    <br />
                    <asp:DataList ID="DataList1" runat="server" BorderWidth="0" CellPadding="8" HorizontalAlign="Center"
                        RepeatColumns="2" RepeatDirection="Horizontal" Width="98%">
                        <ItemStyle BorderColor="ActiveBorder" Width="50%" />
                        <ItemTemplate>
                            <fieldset>
                                <legend>
                                    <%# Container.ItemIndex + 1%>
                                    、<%# Eval("Name")%></legend>
                                <asp:DataList ID="Datalist2" runat="server" DataSource='<%# BindMemberPower(Eval("RootID"))%>'
                                    RepeatColumns="4" RepeatDirection="Horizontal" Width="100%">
                                    <ItemStyle VerticalAlign="Top" />
                                    <ItemTemplate>
                                        <input name="chkOperation" type="checkbox" value='<%# Eval("Code")%>'><%# Eval("Name")%></input>
                                    </ItemTemplate>
                                </asp:DataList>
                            </fieldset>
                        </ItemTemplate>
                    </asp:DataList>

                    <script language="javascript" type="text/javascript">                        //复选框选择值
                        function CheckValues(objSelectList, strValue) {
                            if (strValue == "") return;

                            if (objSelectList == null) return;

                            //如果只有一项
                            if (objSelectList.type == "checkbox") {
                                if (strValue.indexOf("," + objSelectList.value + ",") >= 0) {
                                    objSelectList.checked = true;
                                }
                            }

                            for (i = 0; i < objSelectList.length; i++) {

                                if (strValue.indexOf("," + objSelectList[i].value + ",") >= 0) {
                                    objSelectList[i].checked = true;
                                }
                            }
                        }
                        //初始化权限
                        CheckValues(Form1.chkOperation, ",<%=strOperation%>,");
                    </script>

                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>
