<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    EnableEventValidation="false" Inherits="PowerEasy.Module.General.WebSite.Admin.Contents.CreateHtmlContent"
    ValidateRequest="false" Title="生成内容" Codebehind="CreateHtmlContent.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">
<style>
/*搜索*/
.Create_Search
{
    margin-bottom:2px;
    position:relative;
    width:200px;
}
.Create_Searchb, .Create_Searcha
{
    background-image: url(../../Admin/Images/SearchN.gif);
    background-repeat: no-repeat;
    cursor: pointer;
    width: 15px;
    height: 15px;
    z-index: 9999;
    position:absolute;
    right:1px;
    top:3px;
}
.Create_Searcha
{
    background-image: url(../../Admin/Images/SearchX.gif);
}
.Create_Search_UpAndDown
{
    position:absolute;
    top:-24px;
    left:10px;
    z-index:999;
    display:none;
}
</style>
<script language="javascript">
    var oldvalue;
    var selectobj;
    var index = 0;
    var count = 0;

    function beginsearch(obj) {
        if ($(obj).prop("value") == "快速搜索") {
            $("#Searchb").attr("className", "Create_Searcha")
            $("#Searchb").bind("click", offsearch);
            $(obj).prop("value", "");
        }
        return true;
    }
    function outsearch(obj) {
        if ($(obj).prop("value") == "") {
            $("#Searchb").attr("className", "Create_Searchb")
            $(obj).prop("value", "快速搜索");
            $("#Create_Search_UpAndDown").hide();
            index = 0;
            count = 0;
        }
        return true;
    }
    function offsearch(obj) {
        $("#Searchb").attr("className", "Create_Searchb")
        $("#Create_Search").prop("value", "快速搜索");
        $("#Searchb").unbind();
        index = 0;
        count = 0;
        $("#Create_Search_UpAndDown").hide();
        return true;
    }
    function Gosearch(obj, event) {
        var searchtext = $("#Create_Search").val();
        if (searchtext != "") {
            if (searchtext != oldvalue) {
                var sobj = $("select option[value*='" + searchtext + "']");
                if (sobj.length == 0) {
                    sobj = $("select option:contains('" + searchtext + "')");
                }
                selectobj = sobj;
                count = sobj.length;
                if (count > 0) {
                    sobj.parent().val(sobj.eq(0).val());
                }
                if (count > 1) {
                    $("#Create_Search_UpAndDown").show();
                } else {
                    $("#Create_Search_UpAndDown").hide();
                }
                oldvalue = searchtext;
            }
        } else {
            oldvalue = "";
            $("#Create_Search_UpAndDown").hide();
        }
        return true;
    }

    function searchpre() {
        if (count > 1) {
            index--;
            if (index < 0) {
                index = count - 1;
            }
            selectobj.parent().val(selectobj.eq(index).val());
        }
    }

    function searchnext() {
        if (count > 1) {
            index++;
            if (index >= count) {
                index = 0;
            }
            selectobj.parent().val(selectobj.eq(index).val());
        }
    }

    $(document).ready(function() {
        var o = $("#Create_Search");
        o.bind("keyup", function(event) { Gosearch(this, event); });
        o.bind("blur", function() { outsearch(this); });
        o.bind("focus", function() { beginsearch(this); });
        o.bind("mouseover", function() { $(this).attr("className", 'inputtext_hover'); });
        o.bind("mouseout", function() { $(this).attr("className", 'inputtext'); });
        o.bind("focus", function() { $(this).attr("className", 'inputtext_focus'); });
    });
</script>
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr align="center">
            <td class="spacingtitle" colspan="2" align="center">
                生成内容页
            </td>
        </tr>
        <tr>
            <td rowspan="6" class="tdbg" align="left" valign="top">
                <table>
                    <tr>
                        <td align="right">
                            是否同时生成子栏目下的信息：</td>
                        <td>
                            <asp:RadioButtonList ID="RdlIsCreateChild" RepeatDirection="horizontal" RepeatLayout="flow"
                                runat="server">
                                <asp:ListItem Selected="true" Text="是" Value="true"></asp:ListItem>
                                <asp:ListItem Text="否" Value="false"></asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                        
        </tr>
        <tr>
            <td align="right">
                请选择所属栏目：<br />
                <span style="color: Blue">（如未选择则指定为所有栏目）</span>
                </td><td>
        <div class="Create_Search">
        <input ID="Create_Search" value="快速搜索" class="inputtext"  style="width:198px;"/>
        <a id="Searchb" class="Create_Searchb" ></a>
        <div id="Create_Search_UpAndDown" class="Create_Search_UpAndDown">
          <input ID="Button4" value="上一个" type="button" onclick="searchpre()" />
          <input ID="Button3" value="下一个" type="button" onclick="searchnext()" />
        </div>
        </div> 
                <asp:ListBox ID="LstNodes" runat="server" Height="275px" Width="200px" SelectionMode="Multiple"
                    DataTextField="NodeName" DataValueField="NodeId" ToolTip="按住“Ctrl”或“Shift”键可以多选，按住“Ctrl”可取消选择">
                </asp:ListBox>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="2">
                
            </td>
        </tr>
    </table>
    </td>
    <td class="tdbg">
        生成<span class="HtmlContentViewTips"></span>最新
        <asp:TextBox ID="TxtTopNew" runat="server" Width="58px" ValidationGroup="TopNew" MaxLength="10" />个项目&nbsp;&nbsp;
        <asp:Button ID="EBtnTopNew" Text="开始生成 >> " OnClick="EBtnTopNew_Click" runat="server"
            ValidationGroup="TopNew" />
        <pe:RequiredFieldValidator ID="ValrTopNew" ControlToValidate="TxtTopNew" ValidationGroup="TopNew"
            runat="server" ErrorMessage="生成最新不能为空" ShowRequiredText="false"></pe:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegTopNew" runat="server" ControlToValidate="TxtTopNew" ValidationGroup="TopNew"
            ErrorMessage="只能输入大于0的正整数" ValidationExpression="^[1-9]\d*$" Display="Dynamic" />
    </td>
    </tr>
    <tr>
        <td class="tdbg">
            生成<span class="HtmlContentViewTips"></span>更新时间从
            <pe:DatePicker ID="DpkBeginDate" runat="server" Width="80px" ValidationGroup="Date"></pe:DatePicker>
            到
            <pe:DatePicker ID="DpkEndDate" runat="server" Width="80px" ValidationGroup="Date"></pe:DatePicker>
            的项目
            <asp:Button ID="EBtnDate" Text="开始生成 >> " OnClick="EBtnDate_Click" runat="server"
                ValidationGroup="Date" />
            <pe:RequiredFieldValidator ID="ValrBeginDate" ControlToValidate="DpkBeginDate" ValidationGroup="Date"
                Display="Dynamic" runat="server" ErrorMessage="开始时间不能为空" ShowRequiredText="false" />
            <pe:RequiredFieldValidator ID="ValrEndDate" ControlToValidate="DpkEndDate" ValidationGroup="Date"
                Display="Dynamic" runat="server" ErrorMessage="结束时间不能为空" ShowRequiredText="false" />
            <asp:CompareValidator ID="CompareValidator1" Operator="GreaterThan" ValidationGroup="Date"
                Type="Date" ControlToValidate="DpkEndDate" ControlToCompare="DpkBeginDate" Display="Dynamic"
                runat="server" ErrorMessage="开始时间不能小于结束时间！" />
        </td>
    </tr>
    <tr>
        <td class="tdbg">
            生成<span class="HtmlContentViewTips"></span>ID号从
            <asp:TextBox ID="TxtBeginId" runat="server" Width="59px" ValidationGroup="BeginId" />
            到
            <asp:TextBox ID="TxtEndId" runat="server" Width="60px" ValidationGroup="BeginId" />
            的项目
            <asp:Button ID="EBtnBoundId" Text="开始生成 >> " OnClick="EBtnBoundId_Click" runat="server"
                ValidationGroup="BeginId" />
            <pe:RequiredFieldValidator ID="ValrBeginId" ControlToValidate="TxtBeginId" ValidationGroup="BeginId"
                Display="Dynamic" runat="server" ErrorMessage="起始ID不能为空" ShowRequiredText="false"></pe:RequiredFieldValidator>
            <pe:RequiredFieldValidator ID="ValrEndId" ControlToValidate="TxtEndId" ValidationGroup="BeginId"
                Display="Dynamic" runat="server" ErrorMessage="结束ID不能为空" ShowRequiredText="false"></pe:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator2" Operator="GreaterThanEqual" Type="Integer"
                ControlToValidate="TxtEndId" ControlToCompare="TxtBeginId" runat="server" ErrorMessage="开始ID不能小于结束ID！"></asp:CompareValidator>
        </td>
    </tr>
    <tr>
        <td class="tdbg">
            生成<span class="HtmlContentViewTips"></span>指定ID的项目（多个ID可以用逗号隔开）
            <asp:TextBox ID="TxtAppointId" runat="server" ValidationGroup="AppointId" />
            <asp:Button ID="EBtnAppointId" Text="开始生成 >> " OnClick="EBtnAppointId_Click" runat="server"
                ValidationGroup="AppointId" />
            <pe:RequiredFieldValidator ID="ValrAppointId" ControlToValidate="TxtAppointId" ValidationGroup="AppointId"
                Display="Dynamic" runat="server" ErrorMessage="指定ID不能为空" ShowRequiredText="false"></pe:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="tdbg">
            生成<span class="HtmlContentViewTips"></span>所有未生成的项目
            <asp:Button ID="EBtnNotCreate" Text="开始生成 >> " OnClick="EBtnNotCreate_Click" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="tdbg">
            生成<span class="HtmlContentViewTips"></span>所有项目
            <asp:Button ID="EBtnAll" Text="开始生成 >> " OnClick="EBtnAll_Click" runat="server" />
        </td>
    </tr>
    </table>
    <br />
    <div id="prompt-note">
        <dl>
        <dt class="prompt-note-tit">
        <span>提示说明</span>
        </dt>
            <dd class="prompt-note-con">
                    <span style="color: Blue"><strong>注意：</strong></span>如果选择了栏目，则只生成选择栏目下的内容；如果不选择直接生成的，则生成全站的内容。
            </dd>  
        </dl>
    </div>
    <script language="javascript" type="text/javascript">
        function ChangeView()
        {
            var tips="指定栏目下的";
            var nodeList=document.getElementById("<%=LstNodes.ClientID %>");
            
            if(nodeList.selectedIndex>-1)
            {
                $(".HtmlContentViewTips").html(tips);
            }else
            {
                 $(".HtmlContentViewTips").html("");
            }
            
        }
    </script>
</asp:Content>
