<%@ Register TagPrefix="cc1" Namespace="TopWinCMS.WebControls" Assembly="TopWinCMS.WebControls" %>

<%@ Page Language="c#" Inherits="TopWinCMS.WebUI.Admin.Common.Class" CodeBehind="Class.aspx.cs" %>

<%@ Register Src="../UC_AdminSelect.ascx" TagName="UC_AdminSelect" TagPrefix="uc1" %>
<%@ Register Src="../UC_AjaxLoading.ascx" TagName="UC_AjaxLoading" TagPrefix="uc2" %>
<%@ Register Assembly="ComboBox" Namespace="TopWin.WebControls.Old" TagPrefix="cc2" %>
<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Pragma" content="No-cach" />
    <script language="javascript" type="text/javascript" src="../TopWin.js"></script>
    <script language="javascript" type="text/javascript" src="../../Images/skysoft.js"></script>
    <link href="../Style.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        var HtmlSavePath = '<%= TopWinCMS.BLL.ModelManage.GetHtmlSavePath(int.Parse( Request["ModelID"])) %>';
        function ShowURL()
        {
            var a = $("TB_FilePrefix").value;
            var b = $("TB_FilePostfix").value;
            var index;
            var list = document.getElementById("RBL_URLStyle").getElementsByTagName("INPUT");

            for (var i = 0; i < list.length; i++)
            {
                if (list[i].checked)
                    index = i;
            }

            if (index == 0)
            {
                $("show1").innerHTML = "内容页.aspx?ID=内容ID&PageNo=页码";
            }
            if (index == 1)
            {
                $("show1").innerHTML = HtmlSavePath + "栏目ID/" + a + "内容ID_页码" + b;
            }
            if (index == 2)
            {
                $("show1").innerHTML = HtmlSavePath + "2007-06/" + a + "内容ID_页码" + b;
            }
            if (index == 3)
            {
                $("show1").innerHTML = HtmlSavePath + "200706/" + a + "内容ID_页码" + b;
            }
            if (index == 4)
            {
                $("show1").innerHTML = HtmlSavePath + "200706/12/" + a + "内容ID_页码" + b;
            }
        }
        function ShowClassURL()
        {
            var a = $("TB_ClassFilePrefix").value;
            var b = $("TB_ClassFilePostfix").value;

            var index;
            var list = document.getElementById("RBL_ClassURLStyle").getElementsByTagName("INPUT");

            for (var i = 0; i < list.length; i++)
            {
                if (list[i].checked)
                    index = i;
            }

            if (index == 0)
            {
                $("show2").innerHTML = "内容页.aspx?ClassID=栏目ID&PageNo=页码";
            }
            if (index == 1)
            {
                $("show2").innerHTML = HtmlSavePath + "栏目ID/" + a + "栏目ID_页码" + b;
            }
            if (index == 2)
            {
                $("show2").innerHTML = HtmlSavePath + "栏目名称拼音/" + a + "栏目ID_页码" + b;
            }
            if (index == 3)
            {
                $("show2").innerHTML = HtmlSavePath + "栏目英文名称/" + a + "栏目ID_页码" + b;
            }
        }
        function HideAndDisplay(TabIndex, o)
        {
            $("current").id = "";
            for (i = 0; i < 3; i++)
            {
                if (i == TabIndex)
                {
                    o.id = "current";
                    $("Tab" + i).style.display = "block";
                }
                else
                {
                    $("Tab" + i).style.display = "none";
                }
            }
            return false;
        }
 
    </script>
    <style type="text/css">
        #Tab1, #Tab2
        {
            display: none;
        }
    </style>
</head>
<body>
    <form id="Form1" method="post" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            <uc2:UC_AjaxLoading ID="UC_AjaxLoading1" runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <table id="NavigationPath" border="0" cellpadding="4" cellspacing="0" width="100%">
        <tr>
            <td>
                管理导航：<a href="Class.aspx?ModelID=<%= _ModelID %>">栏目管理</a>
                | <a href="Class_Add.aspx?ModelID=<%= _ModelID %>">添加栏目</a>
                | <a href="Class.aspx?ModelID=<%= _ModelID %>&Action=Move">
                    移动栏目</a> 
                | <a href="Class.aspx?ModelID=<%= _ModelID %>&Action=MergeClass">
                    合并栏目</a> | <a href="Class.aspx?ModelID=<%= _ModelID %>&Action=Attribute">
                        批量设置</a>
            </td>
        </tr>
    </table>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="GV_List" runat="server" AutoGenerateColumns="False" CssClass="GridView"
                DataKeyNames="ID" OnRowCommand="GV_List_RowCommand" OnRowDataBound="GV_List_RowDataBound">
                <Columns>
                    <asp:BoundField HeaderText="ID" DataField="ID">
                        <ItemStyle HorizontalAlign="Center" Width="36px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="栏目分类">
                        <ItemTemplate>
                            <%#  Eval("ClassName") %>
                            <%# LinkURL(Eval("LinkURL")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:ButtonField HeaderText="上移" Text="↑" CommandName="up">
                        <ItemStyle HorizontalAlign="Center" Width="36px" />
                    </asp:ButtonField>
                    <asp:ButtonField HeaderText="下移" Text="↓" CommandName="down">
                        <ItemStyle HorizontalAlign="Center" Width="36px" />
                    </asp:ButtonField>
                    <asp:BoundField DataField="URLStyle" HeaderText="内容页">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="ClassURLStyle" HeaderText="栏目页">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:BoundField>
                    <asp:HyperLinkField Text="添加栏目" DataNavigateUrlFields="ID,ModelID" DataNavigateUrlFormatString="Class_Add.aspx?Action=Add&amp;ModelID={1}&amp;ClassID={0}">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:HyperLinkField>
                    <asp:HyperLinkField Text="修改设置" DataNavigateUrlFields="ID,ModelID" DataNavigateUrlFormatString="Class_Add.aspx?Action=Edit&amp;ModelID={1}&amp;ID={0}">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:HyperLinkField>
                    <asp:ButtonField Text="删除栏目" CommandName="DelClass">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:ButtonField>
                    <asp:ButtonField Text="清空栏目" CommandName="Clear">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                    </asp:ButtonField>
                </Columns>
                <HeaderStyle CssClass="HeaderStyle" />
            </asp:GridView>
            <asp:Panel ID="Panel1" runat="server">
                <div class="WorkArea">
                    注意事项：<br />
                    本操作不可逆，请慎重操作！！！<br />
                    不能在同一个栏目内进行操作，不能将一个栏目合并到其下属栏目中。<br />
                    合并后您所指定的栏目（或者包括其下属栏目），所有数据将转移到目标栏目中。<br />
                </div>
                <div style="text-align: center; margin-top: 10px;">
                    源栏目：<asp:DropDownList ID="DDL_OldClass" runat="server">
                    </asp:DropDownList>
                    目标栏目：<asp:DropDownList ID="DDL_NewClass" runat="server">
                    </asp:DropDownList>
                    <br />
                    <br />
                    <asp:CheckBox ID="CB_ChildClass" runat="server" Checked="True" Text="包含下级栏目" AutoPostBack="True"
                        OnCheckedChanged="CB_ChildClass_CheckedChanged" />
                    &nbsp;&nbsp;
                    <asp:CheckBox ID="CB_DeleteClass" runat="server" Checked="True" Text="删除源栏目" />
                    <br />
                    <br />
                    <asp:Button ID="BT_Merge" runat="server" Text="确定合并" CssClass="btn" OnClick="BT_Merge_Click" />
                </div>
            </asp:Panel>
            <asp:Panel ID="Panel2" runat="server">
                <table style="width: 100%;">
                    <tr>
                        <td>
                            &nbsp;
                            <asp:ListBox ID="LB_Class" runat="server" Style="height: 600px;" SelectionMode="Multiple">
                            </asp:ListBox>
                        </td>
                        <td valign="top">
                            <div id="tabs">
                                <ul>
                                    <li id="current" onclick="return HideAndDisplay(0,this);"><a href="#"><span>基本属性</span></a></li>
                                    <li onclick="return HideAndDisplay(1,this);"><a href="#"><span>权限设置</span></a></li>
                                    <li onclick="return HideAndDisplay(2,this);"><a href="#"><span>URL样式</span></a></li>
                                </ul>
                            </div>
                            <table id="Tab0" class="TabelGrid" style="width: 100%">
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_TemplateFileName" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        网页模板：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_TemplateFileName" runat="server" Width="250px"></asp:TextBox>
                                        <script type="text/javascript" language="javascript">
                                            function GetTemplate()
                                            {
                                                var str = window.showModalDialog("../window/GetTemplate.aspx", "up", "dialogWidth=350px;dialogHeight=320px;status=0;scroll=auto");
                                                if (typeof (str) != "undefined")
                                                    document.getElementById('TB_TemplateFileName').value = str;
                                            }
                                        </script>
                                        <input id="Button1" class="btn" type="button" onclick="GetTemplate();" value="网页模板" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassIntro" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目介绍：<br />
                                        <span style="font-weight: normal">支持HTML</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassIntro" runat="server" Height="80px" TextMode="MultiLine"
                                            Width="99%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassPic" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目缩略图：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassPic" runat="server" Height="80px" TextMode="MultiLine" Width="99%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassDescription" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目META网页描述：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassDescription" runat="server" Height="80px" TextMode="MultiLine"
                                            Width="99%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassKeyWord" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目META关键词：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassKeyWord" runat="server" Height="80px" Width="99%" TextMode="MultiLine"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                            <table id="Tab1" class="TabelGrid" style="width: 100%">
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ContentAdmin" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        内容管理员：
                                    </td>
                                    <td>
                                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                            <ContentTemplate>
                                                <uc1:UC_AdminSelect ID="UC_AdminSelect1" runat="server" Visible="true"></uc1:UC_AdminSelect>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassAdmin" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目管理员：
                                    </td>
                                    <td>
                                        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                                            <ContentTemplate>
                                                <uc1:UC_AdminSelect ID="UC_AdminSelect2" runat="server" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_OpenGrade" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        开放栏目设置：
                                    </td>
                                    <td>
                                        <asp:RadioButtonList ID="RBL_OpenGrade" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
                                            onclick="OpenGradeRemark();">
                                            <asp:ListItem Value="1" Selected="True">开放栏目</asp:ListItem>
                                            <asp:ListItem Value="2">对游客隐藏权限内容</asp:ListItem>
                                            <asp:ListItem Value="3">认证栏目</asp:ListItem>
                                        </asp:RadioButtonList>
                                        说明：<span id="show3"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_EnableContribute" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        是否启用投稿：
                                    </td>
                                    <td>
                                        <asp:RadioButtonList ID="RBL_EnableContribute" runat="server" RepeatDirection="Horizontal">
                                            <asp:ListItem Value="1" Selected="True">开启</asp:ListItem>
                                            <asp:ListItem Value="0">关闭</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_EnableComment" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        是否启用评论：<br />
                                        <span style="font-weight: normal">用于录入内容默认值</span>
                                    </td>
                                    <td>
                                        <asp:RadioButtonList ID="RBL_EnableComment" runat="server" RepeatDirection="Horizontal">
                                            <asp:ListItem Value="1" Selected="True">开启</asp:ListItem>
                                            <asp:ListItem Value="0">关闭</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                            </table>
                            <table id="Tab2" class="TabelGrid" style="width: 100%">
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_FilePostfix" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        内容页静态文件扩展名：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_FilePostfix" runat="server">.html</asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_FilePrefix" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        内容页静态文件前缀：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_FilePrefix" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_URLStyle" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        内容页生成规则：
                                    </td>
                                    <td>
                                        <asp:RadioButtonList ID="RBL_URLStyle" runat="server" RepeatDirection="Horizontal"
                                            onclick="ShowURL();">
                                            <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:ListItem Value="4">静态规则四</asp:ListItem>
                                        </asp:RadioButtonList>
                                        样式预览：<span id="show1"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassFilePostfix" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目静态页扩展名：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassFilePostfix" runat="server" ToolTip=".html">.html</asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassFilePrefix" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目静态页前缀：
                                    </td>
                                    <td>
                                        <asp:TextBox ID="TB_ClassFilePrefix" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 30px; text-align: center">
                                        <asp:CheckBox ID="CB_ClassURLStyle" runat="server" Text=" " />
                                    </td>
                                    <td class="RowTitle">
                                        栏目页生成规则：
                                    </td>
                                    <td>
                                        <asp:RadioButtonList ID="RBL_ClassURLStyle" runat="server" RepeatDirection="Horizontal"
                                            onclick="ShowClassURL();">
                                            <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>
                                        样式预览：<span id="show2"></span>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="BT_OK" runat="server" Text="确定修改" CssClass="btn" OnClick="BT_OK_Click" /></div>
                <script type="text/javascript" language="javascript">                    ShowURL(); ShowClassURL();</script>
            </asp:Panel>
            <asp:Panel ID="Panel3" runat="server">
                <div class="WorkArea">
                    注意事项：<br />
                    本操作不可逆，请慎重操作！！！<br />
                    不能在同一个栏目内进行操作。<br />
                    移动后您所指定的栏目（或者包括其下属栏目）将转移到目标栏目下。<br />
                </div>
                <table style="width: 100%;">
                    <tr>
                        <td valign="top" align="right">
                            源栏目：<br />
                            <asp:ListBox ID="LB_OldClass" runat="server" Style="height: 600px;" SelectionMode="Multiple">
                            </asp:ListBox>
                        </td>
                        <td style="width:50px"></td>
                        <td valign="top">
                            目标栏目：<br />
                            <asp:ListBox ID="LB_NewClass" runat="server" Style="height: 600px;"></asp:ListBox>
                        </td>
                    </tr><tr>
                     <td  style="height:20px" colspan="3"> </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="3">
                            <asp:Button ID="BT_Move" runat="server" CssClass="btn" OnClick="BT_Move_Click" 
                                Text="确定修改" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
