<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    Inherits="PowerEasy.Module.General.WebSite.Admin.User.UserGroupPermissions" Title="会员组权限设置"
    CodeBehind="UserGroupPermissions.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">
        var LastTab = 0;
        function ShowTabs(ID) {
            if (ID != LastTab) {
                document.getElementById("TabTitle" + ID).className = "titlemouseover";
                document.getElementById("Tabs" + ID).style.display = "";

                document.getElementById("TabTitle" + LastTab).className = "tabtitle";
                document.getElementById("Tabs" + LastTab).style.display = "none";

                LastTab = ID;
            }
        }
    </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 id="TabTitle3" class="tabtitle" onclick="ShowTabs(3)">
                其他权限
            </td>
           <%-- <td id="TabTitle4" class="tabtitle" onclick="ShowTabs(4)">
                微博权限
            </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 class="tdbgleft" style="width: 300px;">
                                <strong>会员组名称：</strong>
                            </td>
                            <td>
                                <asp:Label ID="LblGroupName" runat="server" Text="" />
                            </td>
                        </tr>
                        <tr class="tdbg">
                            <td class="tdbgleft" style="width: 300px;">
                                <strong>会员组类型：</strong>
                            </td>
                            <td>
                                <asp:Label ID="LblGropType" runat="server" Text="" />
                            </td>
                        </tr>
                        <tr class="tdbg">
                            <td class="tdbgleft" style="width: 300px;">
                                <strong>会员组说明：</strong>
                            </td>
                            <td>
                                <asp:Label ID="LblDescription" runat="server" Text="" />
                            </td>
                        </tr>
                    </tbody>
                    <%-- 菜单控制--%>
                    <tbody id="Tabs1" style="display: none">
                        <tr class="tdbg">
                            <td colspan="2">
                                <pec:UserPermissionModify ID="UserPermissionModify" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                    <%--字段权限--%>
                    <tbody id="Tabs2" 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="Tabs3" style="display: none">
                        <tr class="tdbg">
                            <td colspan="2">
                                <pec:UserIndividuation ID="UserIndividuation" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                    <%-- 微博权限设置 --%>
                    <tbody id="Tabs4" style="display: none">
                        <tr class="tdbg">
                            <td colspan="2">
                                <pec:UserMicroBlogPermission ID="UserMicroBlogPermission" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </table>
    <center>
        <br />
        <asp:Button ID="BtnSubmit" runat="server" Text="保存" OnClick="ButtonSubmit_Click" />&nbsp;&nbsp;&nbsp;
        <asp:Button ID="BtnCancel" CausesValidation="false" runat="server" Text="取消" OnClick="ButtonCancel_Click" />
    </center>
    <br />
    <asp:HiddenField ID="HdnGroupName" runat="server" />
    <asp:HiddenField ID="HdnAction" runat="server" />
    <asp:HiddenField ID="HdnGroupId" 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["GroupID"]%>&IdType=1";
            strOpt = "modal=yes,width=860px,height=540px,resizable=yes,scrollbars=yes";
        }
        else
        {
            strUrl = "User/UserPurview.aspx?GroupID=<%=Request["GroupID"]%>&UserType=Group&TypeID=" + type;
            strOpt = "modal=yes,width=800px,height=240px,resizable=yes,scrollbars=yes";
        }
        var pe=new parent.PE_FrameTab.AddNew(strUrl);
        if(pe==null)
        {
          alert("AddNewTab Error!");
        }
//        var arr= window.open(strUrl,'newWin',strOpt); 
//        
//        if (arr != null) {

//        }

   }


    </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>
