<%@ Page Title="发布信息权限设置" Language="C#" MasterPageFile="~/Admin/MasterPage.master"
    AutoEventWireup="true" CodeBehind="PublishPermissions.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Admin.User.PublishPermissions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CphNavigation" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphContent" runat="Server">

    <script language="JavaScript" type="text/JavaScript">
        function ShowTabs(ID) {
            for (i = 0; i < 3; i++) {
                if (i == ID) {
                    document.getElementById("TabTitle" + i).className = "titlemouseover";
                    document.getElementById("Tabs" + i).style.display = "";
                    if (i == 0) {
                        document.getElementById("tableIntro").style.display = "";
                    }
                }
                else {
                    document.getElementById("TabTitle" + i).className = "tabtitle";
                    document.getElementById("Tabs" + i).style.display = "none";
                    if (i == 0) {
                        document.getElementById("tableIntro").style.display = "none";
                    }
                }
            }
        }
    </script>

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr align="center">
            <td id="TabTitle0" class="titlemouseover" onclick="ShowTabs(0)">
                节点权限
            </td>
            <td id="TabTitle1" class="tabtitle" onclick="ShowTabs(1)">
                专题权限
            </td>
            <td id="TabTitle2" class="tabtitle" onclick="ShowTabs(2)">
                其他权限
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <table width="99%" border="0" cellpadding="5" cellspacing="1" class="border">
        <%--节点权限--%>
        <tbody id="Tabs0">
            <tr id="TrNodePermissions" class="tdbg">
                <td colspan="2">
                    <!-- 显示栏目树开始 -->
                    <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="ChkNodeInput" runat="server"></asp:CheckBox>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </pe:TemplateField>
                            <pe:TemplateField HeaderText="投稿终审通过">
                                <HeaderStyle Width="10%" />
                                <ItemTemplate>
                                    <asp:CheckBox ID="ChkNodeNoNeedCheck" runat="server"></asp:CheckBox>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </pe:TemplateField>
                            <pe:TemplateField HeaderText="修改和删除终审通过的信息" Visible="false">
                                <HeaderStyle Width="10%" />
                                <ItemTemplate>
                                    <asp:CheckBox ID="ChkNodeManageSelfInfo" 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>
                    <!-- 显示栏目树结束 -->
                    <br />
                    <asp:Literal runat="server" Visible="false" ID="LtrShoweShopExplain">注意：如果节点中只包含商品信息，审核权限设置无效，会员中心添加商品无需审核。
商品发布权限与节点权限设置有关，这里设置了商品的节点权限，可不勾选信息管理，也是可以发表商品信息。
                    </asp:Literal>
                </td>
            </tr>
        </tbody>
        <%--专题权限--%>
        <tbody id="Tabs1" style="display: none">
            <tr class="tdbg">
                <td colspan="2">
                    <!-- 显示专题类别 -->
                    <pe:ExtendedGridView ID="EgvSpecial" DataSourceID="OdsSpecial" GridLines="None" runat="server"
                        Width="100%" AutoGenerateColumns="False" OnRowDataBound="EgvSpecial_RowDataBound"
                        CheckBoxFieldHeaderWidth="3%" SerialText="">
                        <HeaderStyle BackColor="#449AE8" HorizontalAlign="Center" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <pe:BoundField DataField="Id" HeaderText="序号" SortExpression="Id" />
                            <pe:TemplateField HeaderText="专题名" SortExpression="Name">
                                <ItemTemplate>
                                    <pe:ExtendedLabel HtmlEncode="false" runat="server" ID="LabName"></pe:ExtendedLabel>
                                    <asp:HiddenField ID="HdnSpecialId" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" />
                            </pe:TemplateField>
                            <pe:TemplateField HeaderText="添加内容到专题" SortExpression="TreeLineType">
                                <ItemTemplate>
                                    <asp:CheckBox ID="ChkSpecialInput" runat="server"></asp:CheckBox>
                                </ItemTemplate>
                            </pe:TemplateField>
                        </Columns>
                    </pe:ExtendedGridView>
                    <asp:ObjectDataSource ID="OdsSpecial" runat="server" SelectMethod="GetSpecialTree"
                        TypeName="PowerEasy.Module.General.BusinessLogic.Contents.Special"></asp:ObjectDataSource>
                    <br />
                </td>
            </tr>
        </tbody>
        <%--其它权限--%>
        <tbody id="Tabs2" style="display: none">
            <tr class="tdbg" id="PnlPublicInfo" runat="server">
                <td class="tdbgleft">
                    <strong>发布权限：</strong>
                </td>
                <td>
                    <asp:CheckBox ID="ChkSetEditor" runat="server" /><pe:ExtendedLabel HtmlEncode="false"
                        ID="LblSetEditor" runat="server" Text="发表信息时HTML编辑器为高级模式（默认为简洁模式）<br />" />
                    <asp:Label ID="LblMaxPublicInfoOneDay" runat="server" Text="每天最多发布" /><asp:TextBox
                        ID="TxtMaxPublicInfoOneDay" MaxLength="5" Columns="5" runat="server" Text="0" />
                    <asp:RangeValidator ID="VallgMaxPublicInfoOneDay" ControlToValidate="TxtMaxPublicInfoOneDay"
                        runat="server" ErrorMessage="范围在0—10000之间" Type="Integer" Display="Dynamic" MaximumValue="10000"
                        MinimumValue="0"></asp:RangeValidator>
                    <pe:ExtendedLabel HtmlEncode="false" ID="LblMaxPublicInfoOneDay2" runat="server"
                        Text="条信息（不想限制请设置为<b>0</b>）。<br /> " />
                    <asp:Label ID="LblGetExp" runat="server" Text="发布信息时获取积分为栏目设置的" /><asp:TextBox ID="TxtGetExp"
                        MaxLength="5" Columns="5" runat="server" />
                    <asp:RangeValidator ID="ValgGetExp" ControlToValidate="TxtGetExp" runat="server"
                        ErrorMessage="范围在0—100之间" Type="Double" Display="Dynamic" MaximumValue="100"
                        MinimumValue="0"></asp:RangeValidator>
                    <pe:ExtendedLabel HtmlEncode="false" ID="LblGetExp2" runat="server" Text="倍<br />" />
                    <asp:Label ID="LblGetPoint" runat="server" Text="发布信息时获取点券为栏目设置的" /><asp:TextBox
                        ID="TxtGetPoint" MaxLength="5" Columns="5" runat="server" />
                    <asp:RangeValidator ID="ValgGetPoint" ControlToValidate="TxtGetPoint" runat="server"
                        ErrorMessage="范围在0—100之间" Type="Double" Display="Dynamic" MaximumValue="100"
                        MinimumValue="0"></asp:RangeValidator>
                    <pe:ExtendedLabel HtmlEncode="false" ID="LblGetPoint2" runat="server" Text="倍<br />" />
                    <asp:CheckBox ID="ChkIsXssFilter" runat="server" />
                    <pe:ExtendedLabel HtmlEncode="false" ID="LblIsXssFilter" runat="server" Text="会员发表信息时是否启用XSS（跨站攻击）<br />（如果启用，可能导致会员添加的图片/Flash/视频等不能正常显示，如果禁用，则有跨站攻击漏洞。<br />如果您信任此用户组的用户，可以禁用此功能，否则建议您启用此功能）" />
                </td>
            </tr>
        </tbody>
    </table>
    <br />
    <center>
        <br />
        <asp:Button ID="BtnSubmit" runat="server" Text="保存返回权限设置" OnClick="BtnSubmit_Click" />&nbsp;&nbsp;
        <input type="button" value="取消返回权限设置" onclick="parent.PE_FrameTab.CloseCurrentTab();" />
    </center>
    <br />
    <table id="tableIntro" width="99%" border="0" cellpadding="5" cellspacing="1" class="border">
        <tr class="gridtitle" align="center">
            <td style="width: 10%;">
                录入
            </td>
            <td style="width: 15%;">
                投稿终审通过
            </td>
            <td style="width: 15%;">
                修改和删除终审通过的信息
            </td>
            <td style="width: 60%;">
                备注
            </td>
        </tr>
        <tr class="tdbg" align="center">
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td align="left">
                只有选中录入才允许选择投稿终审通过、修改和删除终审通过的信息
            </td>
        </tr>
        <tr class="tdbg" align="center">
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td align="left">
                所有投稿都是待审核状态，投稿终审通过、修改和删除终审通过的信息选项变成可选状态
            </td>
        </tr>
        <tr class="tdbg" align="center">
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
            </td>
            <td align="left">
                所有投稿的信息都是终审通过，但是不能修改和删除终审通过的信息
            </td>
        </tr>
        <tr class="tdbg" align="center">
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
            </td>
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td align="left">
                录入和修改投稿信息都是待审核状态，可以删除终审通过的信息
            </td>
        </tr>
        <tr class="tdbg" align="center">
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td>
                <span style="color: Red"><b>√</b></span>
            </td>
            <td align="left">
                投稿信息时是终审通过，修改信息时也是终审通过；并且用户可以删除终审通过的信息。
            </td>
        </tr>
    </table>
    <%--节点权限js--%>

    <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 != "" && oSpanArr[i].id.indexOf("Node", 0) > 0) {
                        //在这里给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());
                    }
                }
            );
        }

        function ChkNodeInputAll(clientId, nodeItem, nodeNoNeedCheckId, nodeManageSelfInfo) {
            var oSpanArr = document.getElementsByTagName("table");
            var j = oSpanArr.length;
            var isCheck = clientId.checked;
            for (var i = 0; i < j; i++) {
                if (oSpanArr[i].id != "" && oSpanArr[i].id.indexOf("Node", 0) > 0) {
                    //在这里给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;
                            }
                            else if (t.name.indexOf(nodeNoNeedCheckId) != -1 || t.name.indexOf(nodeManageSelfInfo) != -1) {
                                if (isCheck) {
                                    t.disabled = false;
                                    t.parentNode.disabled = false;
                                }
                                else {
                                    t.checked = false;
                                    t.disabled = true;
                                }
                            }
                        }
                    }
                }
            }
            clientId.checked = isCheck;
        }

        function ChkWipeOffNodeInput(clientId, nodeItem, nodeNoNeedCheckId, nodeManageSelfInfo, nodeId) {
            var isChecked = clientId.checked;
            clientId.checked = false;



            if (nodeItem == "" || nodeItem.indexOf("_") == 0) {
                return;
            }
            var oCell = document.getElementById(nodeItem);
            //选中所有的子节点
            $("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 = oCell.checked;
                                   ChkWipeOffNodeInput(clientId, this.id, nodeNoNeedCheckId, nodeManageSelfInfo, $(this).parent().parent().parent().children().eq(0).text());
                               }
                           }
                        );
            var isCurrentChecked = oCell.checked;
            var nodeNoNeedCheckIdKey;
            var nodeManageSelfInfoKey;


            if (nodeNoNeedCheckId) {
                nodeNoNeedCheckIdKey = nodeNoNeedCheckId.id.substring(nodeNoNeedCheckId.id.lastIndexOf("_"), nodeNoNeedCheckId.id.length - 1);
            }
            if (nodeManageSelfInfo) {
                nodeManageSelfInfoKey = nodeManageSelfInfo.id.substring(nodeManageSelfInfo.id.lastIndexOf("_"), nodeManageSelfInfo.id.length - 1);
            }
            var snodeItem = nodeItem.substring(nodeItem.indexOf("_"), nodeItem.lastIndexOf("_"));
            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.id) {
                            if (t.id.indexOf(snodeItem) != -1) {
                                if (t.id.indexOf(nodeNoNeedCheckIdKey) != -1 || t.id.indexOf(nodeManageSelfInfoKey) != -1) {
                                    if (isCurrentChecked) {
                                        t.disabled = false;
                                        t.parentNode.disabled = false;
                                    }
                                    else {
                                        t.checked = false;
                                        t.disabled = true;
                                    }
                                }
                            } else if (t.id.indexOf(nodeNoNeedCheckIdKey) != -1 || t.id.indexOf(nodeManageSelfInfoKey) != -1) {
                                var id = t.id.substring(0, t.id.lastIndexOf("_") + 1) + "ChkNodeInput";
                                var inputNode = document.getElementById(id);
                                if (inputNode.checked) {
                                    t.disabled = false;
                                }
                                else {
                                    t.disabled = true;
                                    t.checked = false;
                                }
                            }
                        }
                    }
                }
            }
        }
       
  //-->
    </script>

    <%--专题权限js--%>

    <script language="JavaScript" type="text/javascript">
    <!--
        function ChkSpecialAll(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 != "") {
                        if (oSpanArr[i].id == "<%=EgvSpecial.ClientID%>") {
                            //在这里给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 ChkWipeOffSpecialAll(clientId) {
            clientId.checked = false;
        }
  //-->
    </script>

</asp:Content>
