<%@ Page Title="会员前台权限设置" Language="C#" MasterPageFile="~/Admin/MasterPage.master"
    AutoEventWireup="true" CodeBehind="UserFrontPermissions.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Admin.User.UserFrontPermissions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CphNavigation" runat="server">
    <pe:ExtendedSiteMapPath ID="SmpNavigator" SiteMapProvider="AdminMapProvider" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphContent" runat="server">
    <table width="100%" border="0" cellpadding="5" cellspacing="1">
        <tr>
            <td style="width: 100%;" colspan="2" id="NodeList">
                <!-- 显示栏目树开始 -->
                <pe:ExtendedGridView ID="EgvNodes" runat="server" DataSourceID="OdsEgvNodes" GridLines="None"
                    Width="100%" AutoGenerateColumns="false" EnableViewState="false" DataKeyNames="NodeID"
                    OnRowDataBound="EgvNodes_RowDataBound">
                    <HeaderStyle BackColor="#449AE8" HorizontalAlign="Center" Font-Bold="True" ForeColor="White" />
                    <RowStyle CssClass="tdbg" />
                    <Columns>
                        <pe:BoundField DataField="NodeID" HeaderText="ID">
                            <ItemStyle Width="10%" />
                        </pe:BoundField>
                        <pe:TemplateField HeaderText="节点名" SortExpression="NodeName">
                            <HeaderStyle Width="30%" />
                            <ItemTemplate>
                              <pe:ExtendedLabel ID="LabNodeShowTree" runat="server"></pe:ExtendedLabel>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </pe:TemplateField>
                        <pe:TemplateField HeaderText="浏览">
                            <HeaderStyle Width="10%" />
                            <ItemTemplate>
                                <asp:CheckBox ID="ChkNodeSkim" runat="server"></asp:CheckBox>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </pe:TemplateField>
                        <pe:TemplateField HeaderText="查看">
                            <HeaderStyle Width="10%" />
                            <ItemTemplate>
                                <asp:CheckBox ID="ChkNodePreview" runat="server"></asp:CheckBox>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </pe:TemplateField>
                    </Columns>
                </pe:ExtendedGridView>
                <asp:ObjectDataSource ID="OdsEgvNodes" runat="server" DataObjectTypeName="PowerEasy.Module.General.Model.Contents.NodeInfo"
                    DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetNodeListExecptLinkType"
                    TypeName="PowerEasy.Module.General.BusinessLogic.Contents.Nodes" UpdateMethod="Update"></asp:ObjectDataSource>
                <!-- 显示栏目树结束 -->
            </td>
        </tr>
    </table>
    <br />
    <center>
        <br />
        <asp:Button ID="BtnSubmit" runat="server" Text="保存前台权限" OnClick="BtnSubmit_Click" />&nbsp;&nbsp;
        <asp:Button ID="BtnCancel" runat="server" Text="取消" OnClick="BtnCancel_Click" />
    </center>

    <script language="JavaScript" type="text/javascript">
    <!--
        function ChkNodeAll(form, nodeItem, clientId) {
            if (clientId.checked) {
                var oSpanArr = document.getElementsByTagName('table');
                var j = oSpanArr.length;
                for (var i = 0; i < j; i++) {
                    if (oSpanArr[i].id != "") {
                        //在这里给TD中的控件进行选择处理
                        var inputArr = oSpanArr[i].getElementsByTagName('input');
                        var m = inputArr.length
                        for (var r = 0; r < m; r++) {
                            var t = inputArr[r];
                            if (t.name) {
                                if (t.name.indexOf(nodeItem) != -1 && t.disabled == false) {
                                    t.checked = false;
                                }
                            }
                        }
                    }
                }
                clientId.checked = true;
            }
        }

        function ChkWipeOffNodeAll(nodeItem, clientId, nodeId) {
            clientId.checked = false;

            //选中所有的子节点
            $("span[parentid='" + nodeId + "']>input").each(
                function(i) {
                    var thisId = $(this).attr("id");
                    if (thisId.lastIndexOf(clientId.id.substring(clientId.id.lastIndexOf("_") + 1, clientId.id.length)) > 0) {
                        this.checked = nodeItem.checked && !this.disabled;
                        ChkWipeOffNodeAll(this, clientId, $(this).parent().parent().parent().children().eq(0).text());
                    }
                }
            );
        } 
    
  //-->
    </script>

</asp:Content>
