<%@ Page Language="C#" AutoEventWireup="true" Inherits="System_User_UserGroup, QianboCMS" EnableEventValidation="false" %>
<!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>
    <link href="../Css/layout.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="../../Js/jquery.js"></script>
    <script type="text/javascript" src="../../Js/lhgdialog/lhgdialog.min.js?self=true"></script>
    <script language="javascript" src="../../Js/SystemUserPowerSelect.js"></script>
    <script language="javascript" src="../../Js/Common.js"></script>
    <script language="javascript">
        function ShowTabs(id) {
            for (var i = 0; i < 3; i++) {
                var Div = eval("Tabs" + i);
                var Div_Tab = eval("Td" + i);
                if (id == i) {
                    Div_Tab.className = 'title6';
                    Div.style.display = '';
                }
                else {
                    Div.style.display = 'none';
                    Div_Tab.className = 'title5';
                }
            }
        }
        function isok() {
            if ($("UserGroupName").value == "") {
                alert("用户组名称不能为空！")
                return false;
            }
            if (!AllUserGroup("Contribute_0")) {
                return false;
            }
            if (!AllUserGroup("Collection")) {
                return false;
            }
            if (!AllUserGroup("Invite")) {
                return false;
            }
            if (!AllUserGroup("IssueManuscript")) {
                return false;
            }
            if (!AllUserGroup("SmashMoney")) {
                return false;
            }
            return true;
        }
        function CheckChannel() {
            if ($("CheckCh").checked) {
                $("allowChannel").innerHTML = "无权限频道";
                $("RepallowChannel").innerHTML = "添加无权限频道";
                $("title_channel").innerHTML = "默认勾选：该组拥有所有频道所有权限，点击【添加无权限频道】连接，设置该组无权限访问的频道。";
            }
            else {
                $("allowChannel").innerHTML = "有权限频道";
                $("RepallowChannel").innerHTML = "添加有权限频道";
                $("title_channel").innerHTML = "取消勾选：即该组无所有频道所有权限，点击【添加有权限频道】连接，设置该组有权限访问的频道。";
            }
        }
        function CheckColumn() {
            if ($("CheckCol").checked) {
                $("allowColumn").innerHTML = "无权限栏目";
                $("RepallowColumn").innerHTML = "添加无权限栏目";
                $("title_column").innerHTML = "默认勾选：该组拥有所有栏目所有权限，点击【添加无权限栏目】连接，设置该组无权限访问的栏目。";
            }
            else {
                $("allowColumn").innerHTML = "有权限栏目";
                $("RepallowColumn").innerHTML = "添加有权限栏目";
                $("title_column").innerHTML = "取消勾选：即该组无所有栏目所有权限，点击【添加有权限栏目】连接，设置该组有权限访问的栏目。";
            }
        }
    </script>
</head>

<body>
    <form id="form1" runat="server">
        <table cellspacing="1" cellpadding="0" class="wzdh" align="center">
            <tr>
                <td style="padding-left: 10px;">
                    <img src="../Images/Skin/Default/you.gif" align="absmiddle" />
                    您现在的位置：<a href="../SystemInfo.aspx">后台管理</a> &gt;&gt; 用户管理 &gt;&gt; 用户组管理
				</td>
            </tr>
        </table>
        <table cellspacing="1" cellpadding="0" class="border" align="center">
            <tr>
                <td class="wzlist">
                    <table cellpadding="2" cellspacing="0" border="0">
                        <tr>
                            <td><a href="GroupList.aspx">用户组管理首页</a></td>
                            <asp:Repeater ID="RepUserGroupModel" runat="server">
                                <ItemTemplate>
                                    <td>| <a href='UserGroup.aspx?TypeId=<%# Eval("Id") %>'>新增<%# Eval("Name") %>组</a></td>
                                </ItemTemplate>
                            </asp:Repeater>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <table cellspacing="0" cellpadding="0" align="center" border="0" class="cd">
            <tr align="center">
                <td class="title6" id="Td0" onclick="ShowTabs(0)">基本权限</td>
                <td class="title5" id="Td1" onclick="ShowTabs(1)">财富空间</td>
                <td class="title5" id="Td2" onclick="ShowTabs(2)">栏目权限</td>
                <td>&nbsp;</td>
            </tr>
        </table>
        <table border="0" cellpadding="2" cellspacing="1" class="editborder" align="center">
            <tbody id="Tabs0">
                <tr>
                    <td class="bqleft"><strong>用户组名称：</strong></td>
                    <td class="bqright">
                        <asp:TextBox ID="UserGroupName" runat="server"></asp:TextBox>
                        <span style="color: red;">*</span>
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>用户组说明：</strong></td>
                    <td class="bqright">
                        <asp:TextBox ID="UserGroupContent" runat="server" Columns="40" Rows="6" TextMode="MultiLine"></asp:TextBox>
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>投稿权限：</strong></td>
                    <td class="bqright">
						投稿时获取积分为栏目设置的
						<asp:TextBox ID="Contribute_0" runat="server" Columns="4" MaxLength="4" onkeyup="value=value.replace(/[^\d]/g,'')">2</asp:TextBox>
                        倍
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>注册认证：</strong></td>
                    <td class="bqright">
                        <asp:RadioButtonList ID="Status" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="True" Value="1">开放</asp:ListItem>
                            <asp:ListItem Value="0">认证</asp:ListItem>
                        </asp:RadioButtonList>
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>收藏夹权限：</strong></td>
                    <td class="bqright">
						用户最多可收藏
						<asp:TextBox ID="Collection" runat="server" Columns="4" MaxLength="4" onkeyup="value=value.replace(/[^\d]/g,'')">0</asp:TextBox>
                        条信息（为0则没有收藏权限）
					</td>
                </tr>
            </tbody>
            <tbody id="Tabs1" style="display: none;">
                <tr>
                    <td class="bqleft"><strong>有效邀请：</strong></td>
                    <td class="bqright">
						启用邀请机制后，一个有效邀请获取
						<asp:TextBox ID="Invite" runat="server" Columns="4" MaxLength="4" onkeyup="value=value.replace(/[^\d]/g,'')">5</asp:TextBox>
                        个积分。
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>发布稿件：</strong></td>
                    <td class="bqright">
						启用用户投稿后，采纳一篇稿件获取
						<asp:TextBox ID="IssueManuscript" runat="server" Columns="4" MaxLength="4" onkeyup="value=value.replace(/[^\d]/g,'')">5</asp:TextBox>
                        个积分。
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>计费方式：</strong></td>
                    <td class="bqright">
                        <asp:RadioButtonList ID="ChargingType" runat="server">
                            <asp:ListItem Value="0" Selected="True">只判断金币</asp:ListItem>
                            <asp:ListItem Value="1">只判断有效期</asp:ListItem>
                            <asp:ListItem Value="2">条件判断金币和有效期</asp:ListItem>
                            <asp:ListItem Value="3">同时判断金币和有效期</asp:ListItem>
                        </asp:RadioButtonList>
					</td>
                </tr>
                <tr>
                    <td class="bqleft"><strong>扣金币方式：</strong></td>
                    <td class="bqright">
						有效期内，每天最多可以浏览
						<asp:TextBox ID="SmashMoney" runat="server" Columns="4" MaxLength="4" onkeyup="value=value.replace(/[^\d]/g,'')">0</asp:TextBox>
                        条收费信息（为0则不限制）。
					</td>
                </tr>
            </tbody>
            <tbody id="Tabs2" style="display: none;">
                <tr>
                    <td class="bqleft"><strong>权限管理：</strong></td>
                    <td class="qxright">
                        <table width="100%" cellpadding="0" cellspacing="1" border="0">
                            <tr>
                                <td colspan="2">
                                    <asp:CheckBox ID="CheckCh" runat="server" Text="允许所有频道" onclick="CheckChannel()" Checked="true" />
								</td>
                            </tr>
                            <tr>
                                <td colspan="3"><span id="title_channel">默认勾选：该组拥有所有频道所有权限，点击【添加无权限频道】连接，设置该组无权限访问的频道。</span></td>
                            </tr>
                            <tr>
                                <td class="bqleft">
									<span id="allowChannel">无权限频道</span>
                                    <asp:TextBox ID="ChannelInfoString" runat="server" Style="display: none;"></asp:TextBox>
								</td>
                                <td width="90%">
                                    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border" align="center">
                                        <tr class="title">
                                            <td>频道Id</td>
                                            <td>频道名称</td>
                                            <td>浏览</td>
                                            <td>查看</td>
                                            <td>录入</td>
                                            <td>修改</td>
                                            <td>删除</td>
                                            <td>操作</td>
                                        </tr>
                                        <asp:Repeater ID="ChannelInfoPower" runat="server" OnItemCommand="ChannelInfoPower_ItemCommand">
                                            <ItemTemplate>
                                                <tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
                                                    <td><asp:Label ID="LabelChId" runat="server" Text='<%#Eval("ChId") %>'></asp:Label></td>
                                                    <td><%#Eval("ChName") %></td>
                                                    <td><asp:CheckBox ID="CheckBox4" runat="server" Checked='<%#getCheck(Eval("browse","{0}")) %>' onclick=<%#"SelectChannelInfoString('"+Eval("ChId","{0}")+"','0',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#getCheck(Eval("show","{0}")) %>' onclick=<%#"SelectChannelInfoString('"+Eval("ChId","{0}")+"','1',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox5" runat="server" Checked='<%#getCheck(Eval("insert","{0}")) %>' onclick=<%#"SelectChannelInfoString('"+Eval("ChId","{0}")+"','2',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox6" runat="server" Checked='<%#getCheck(Eval("update","{0}")) %>' onclick=<%#"SelectChannelInfoString('"+Eval("ChId","{0}")+"','3',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox7" runat="server" Checked='<%#getCheck(Eval("delete","{0}")) %>' onclick=<%#"SelectChannelInfoString('"+Eval("ChId","{0}")+"','4',this.checked)" %> /></td>
                                                    <td><asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" CommandArgument='<%# Eval("ChId") %>'>删除</asp:LinkButton></td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                        <script type="text/javascript">
                                            var jq = jQuery.noConflict();
                                            jQuery(function () {
                                                jQuery('#RepallowChannel').click(function () {
                                                    jQuery.dialog({
                                                        id: 'txtRepallowChannel',
                                                        lock: true,
                                                        title: '添加无权限频道',
                                                        content: "url:../Common/SelChannel.aspx?ControlId=ChannelInfoString&ControlId2=ChannelBnt&ControlId3=user",
                                                        width: 800,
                                                        height: 500
                                                    });
                                                });
                                                jQuery('#RepallowColumn').click(function () {
                                                    jQuery.dialog({
                                                        id: 'txtRepallowColumn',
                                                        lock: true,
                                                        title: '添加无权限栏目',
                                                        content: "url:../Common/SelColumn.aspx?ControlId=ColumnInfoString&ControlId2=ColumnBnt&ControlId3=user",
                                                        width: 800,
                                                        height: 500
                                                    });
                                                });
                                            });
                                        </script>
                                        <tr>
                                            <td colspan="9" class="qxright">
                                                <asp:ImageButton ID="ChannelBnt" runat="server" ImageUrl="~/Images/but.gif" OnClick="ImageButton1_Click" />
                                                <a id="RepallowChannel" class="mouseStyle">添加无权限频道</a>
											</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:CheckBox ID="CheckCol" runat="server" Text="允许所有栏目" onclick="CheckColumn()" Checked="true" />
								</td>
                            </tr>
                            <tr>
                                <td colspan="2"><span id="title_column">默认勾选：该组拥有所有栏目所有权限，点击【添加无权限栏目】连接，设置该组无权限访问的栏目。</span></td>
                            </tr>
                            <tr>
                                <td class="bqleft"><span id="allowColumn">无权限栏目</span>
                                    <asp:TextBox ID="ColumnInfoString" runat="server" Style="display: none;"></asp:TextBox>
								</td>
                                <td>
                                    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border" align="center">
                                        <tr class="title">
                                            <td>栏目Id</td>
                                            <td>栏目名称</td>
                                            <td>浏览</td>
                                            <td>查看</td>
                                            <td>录入</td>
                                            <td>修改</td>
                                            <td>删除</td>
                                            <td>操作</td>
                                        </tr>
                                        <asp:Repeater ID="ColumnInfoPower" runat="server" OnItemCommand="ColumnInfoPower_ItemCommand">
                                            <ItemTemplate>
                                                <tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
                                                    <td><%#Eval("ColId") %></td>
                                                    <td><%#Eval("ColName") %></td>
                                                    <td><asp:CheckBox ID="CheckBox8" runat="server" Checked='<%#getCheck(Eval("browse","{0}")) %>' onclick=<%#"SelectColumnInfoString('"+Eval("ColId","{0}")+"','0',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox2" runat="server" Checked='<%#getCheck(Eval("show","{0}")) %>' onclick=<%#"SelectColumnInfoString('"+Eval("ColId","{0}")+"','1',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox5" runat="server" Checked='<%#getCheck(Eval("insert","{0}")) %>' onclick=<%#"SelectColumnInfoString('"+Eval("ColId","{0}")+"','2',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox6" runat="server" Checked='<%#getCheck(Eval("update","{0}")) %>' onclick=<%#"SelectColumnInfoString('"+Eval("ColId","{0}")+"','3',this.checked)" %> /></td>
                                                    <td><asp:CheckBox ID="CheckBox7" runat="server" Checked='<%#getCheck(Eval("delete","{0}")) %>' onclick=<%#"SelectColumnInfoString('"+Eval("ColId","{0}")+"','4',this.checked)" %> /></td>
                                                    <td><asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" CommandArgument='<%# Eval("ColId") %>'>删除</asp:LinkButton></td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                        <tr>
                                            <td class="qxright" colspan="9">
                                                <asp:ImageButton ID="ColumnBnt" runat="server" ImageUrl="~/Images/but.gif" OnClick="ColumnBnt_Click" />
                                                <a id="RepallowColumn" class="mouseStyle">添加无权限栏目</a>
											</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tbody>
            <tr>
                <td class="bqleft"></td>
                <td class="bqright">
                    <asp:Button ID="Button1" runat="server" CssClass="btn" Text="保存设置" OnClick="Button1_Click" OnClientClick="return isok();" />
				</td>
            </tr>
        </table>
    </form>
    <asp:Literal ID="LitMsg" runat="server"></asp:Literal>
</body>
</html>