<%@ Page Language="C#" AutoEventWireup="true" Inherits="PowerEasy.Module.General.WebSite.Admin.User.ModifyPurview"
    MasterPageFile="~/Admin/MasterPage.master" EnableEventValidation="false" ViewStateEncryptionMode="never"
    Title="会员权限修改" CodeBehind="ModifyPurview.aspx.cs" %>

<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">
    <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 = "";
                }
                else {
                    document.getElementById("TabTitle" + i).className = "tabtitle";
                    document.getElementById("Tabs" + i).style.display = "none";
                }
            }
        }
    </script>
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr align="center">
            <td colspan="2" class="spacingtitle">
                <asp:Label ID="LblTitle" runat="server" Text="会员权限修改" Font-Bold="True"></asp:Label>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>会 员 名：</strong>
            </td>
            <td align="left">
                <asp:Label ID="LblUserName" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>指定会员会员组：</strong>
            </td>
            <td align="left">
                <asp:Label ID="LblGroupName" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>会员权限：</strong>
            </td>
            <td align="left">
                <asp:RadioButtonList ID="RadlIsInheritGroupRole" runat="server" RepeatDirection="Horizontal"
                    AutoPostBack="true" RepeatLayout="Flow" OnSelectedIndexChanged="RadlIsInheritGroupRole_SelectedIndexChanged">
                    <asp:ListItem Selected="True" Value="True">会员组默认</asp:ListItem>
                    <asp:ListItem Value="False">单独设置具体权限</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
    </table>
    <br />
    <asp:Panel ID="PnlPermission" runat="server" Visible="false">
        <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 id="TabTitle3" class="tabtitle" onclick="ShowTabs(3)">
                    微博权限
                </td>--%>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellpadding="5" cellspacing="1" class="border">
            <tr class="tdbg">
                <td valign="top" style="margin-top: 0px; margin-left: 0px;">
                    <table width="100%" cellpadding="2" cellspacing="1" style="background-color: white;">
                        <%-- 菜单控制--%>
                        <tbody id="Tabs0">
                            <tr class="tdbg">
                                <td colspan="2">
                                    <pec:UserPermissionModify ID="UserPermissionModify" runat="server" />
                                </td>
                            </tr>
                        </tbody>
                        <%--字段权限--%>
                        <tbody id="Tabs1" style="display: none">
                            <tr class="tdbg">
                                <td colspan="2" style="vertical-align: top;">
                                    <table width="100%" border="0" cellpadding="5" cellspacing="1">
                                        <!-- 显示模型树开始 -->
                                        <asp:Repeater ID="RptModelList" runat="server" DataSourceID="OdsModelList" OnItemDataBound="RptModelList1_ItemDataBound">
                                            <HeaderTemplate>
                                                <tr class="title">
                                                    <td align="center">
                                                        模型名
                                                    </td>
                                                </tr>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr id="ModelTr" runat="server">
                                                    <td align="center">
                                                        <pe:ExtendedLabel ID="modellist" runat="server"></pe:ExtendedLabel>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                            </FooterTemplate>
                                        </asp:Repeater>
                                    </table>
                                    <asp:ObjectDataSource ID="OdsModelList" runat="server" SelectMethod="GetModelList"
                                        TypeName="PowerEasy.Module.General.BusinessLogic.CommonModel.ModelManager">
                                        <SelectParameters>
                                            <asp:Parameter DefaultValue="1" Name="modelType" Type="Int32" />
                                            <asp:Parameter DefaultValue="1" Name="showType" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                </td>
                                <td class="tdbg" valign="top">
                                    <!-- 显示模型树开始 -->
                                    <asp:Repeater ID="RptModelList2" runat="server" DataSourceID="OdsModelList" OnItemDataBound="RptModelList2_ItemDataBound">
                                        <HeaderTemplate>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <table width="100%" border="0" cellpadding="5" cellspacing="1" id="model" runat="server">
                                                <tr>
                                                    <td align="center">
                                                        <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border" style="background-color: white;">
                                                            <tr class="title">
                                                                <td align="center" style="width: 20%; height: 18px">
                                                                    字段名称
                                                                </td>
                                                                <td align="center" style="width: 20%;">
                                                                    字段别名
                                                                </td>
                                                                <td align="center" style="width: 20%">
                                                                    字段类型
                                                                </td>
                                                                <td align="center" style="width: 20%">
                                                                    字段级别
                                                                </td>
                                                                <td align="center" style="width: 20%">
                                                                    禁止设置值
                                                                </td>
                                                            </tr>
                                                            <asp:HiddenField ID="HdnModelId" runat="server" Value='<%# Eval("ModelId") %>' />
                                                            <asp:Repeater ID="RptFieldList" runat="server">
                                                                <ItemTemplate>
                                                                    <tr class="tdbg" align="center">
                                                                        <td align="center" style="width: 20%; height: 22px">
                                                                            <%# Eval("FieldName") %>
                                                                        </td>
                                                                        <td align="center" style="width: 20%; height: 22px">
                                                                            <%# Eval("FieldAlias") %>
                                                                        </td>
                                                                        <td align="center" style="width: 20%">
                                                                            <%# PowerEasy.Module.General.BusinessLogic.CommonModel.Field.GetFieldTypeName((int)Eval("FieldType"))%>
                                                                        </td>
                                                                        <td align="center" style="width: 20%">
                                                                            <%# (int)Eval("FieldLevel") == 0 ? "<span style=\"color:Green\">系统</span>" : "自定义"%>
                                                                        </td>
                                                                        <td align="center" style="width: 20%">
                                                                            <asp:CheckBox ID="ChkFieldPurview" runat="server"></asp:CheckBox><asp:HiddenField
                                                                                ID="HdnFieldName" runat="server" Value='<%# Eval("FieldName") %>' />
                                                                        </td>
                                                                    </tr>
                                                                </ItemTemplate>
                                                            </asp:Repeater>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                    <br />
                                </td>
                            </tr>
                        </tbody>
                        <%-- 其他权限--%>
                        <tbody id="Tabs2" style="display: none">
                            <tr class="tdbg">
                                <td colspan="2">
                                    <pec:UserIndividuation ID="UserIndividuation" runat="server" />
                                </td>
                            </tr>
                        </tbody>
                          <%-- 微博权限设置 --%>
                    <tbody id="Tabs3" style="display: none">
                        <tr class="tdbg">
                            <td colspan="2">
                                <pec:UserMicroBlogPermission ID="UserMicroBlogPermission" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                    </table>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <br />
    <center>
        <asp:Button ID="btnGo" runat="server" Text="修改会员组权限" OnClick="btnGo_Click" />
        <asp:Button ID="BtnSubmit" runat="server" Text="保存修改结果" OnClick="BtnSubmit_Click" /></center>
    <asp:HiddenField ID="HdnUsersId" runat="server" />
    <script language="javascript" id="check" type="text/javascript"> 
    function ShowWindow(type){
        var strUrl = "";
        var strOpt = "";
        if(1 == type)
        {
            strUrl = "User/PublishPermissions.aspx?Id=<%=Request["UserID"]%>&IdType=0";
            strOpt = "modal=yes,width=860px,height=540px,resizable=yes,scrollbars=yes";
        }
        else
        {
            strUrl = "User/UserPurview.aspx?GroupID=<%=Request["UserID"]%>&UserType=User&TypeID=" + type;
            strOpt = "modal=yes,width=800px,height=240px,resizable=yes,scrollbars=yes";
        }
        parent.PE_FrameTab.AddNew(strUrl);       
    }
    </script>
    <%--字段权限--%>
    <script language="JavaScript" type="text/javascript">
    <!--
    var arrTable = new Array(<%= m_ArrTable.ToString() %>);
    var arrModelTr = new Array(<%= m_ArrModelTr.ToString() %>);

    var tID=0;
    function Hidd(ID)
    {
        if(ID!=tID)
        {
           document.getElementById(arrTable[tID].toString()).style.display = "none";
           document.getElementById(arrTable[ID].toString()).style.display = "";
           document.getElementById(arrModelTr[tID].toString()).className = "tdbg";
           document.getElementById(arrModelTr[ID].toString()).className = "title";                   
           tID=ID;
        }
    }
    //-->
    </script>
</asp:Content>
