<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    EnableEventValidation="false" Inherits="PowerEasy.Module.General.WebSite.Admin.Contents.CreateHtmlNodes"
    ValidateRequest="false" Title="生成栏目" CodeBehind="CreateHtmlNodes.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 style="width: 100%; margin: 0 auto;" cellpadding="2" cellspacing="1" class="border">
        <tr align="center">
            <td class="spacingtitle" colspan="2">
                生成栏目列表页
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>选择栏目：</strong>
            </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" Width="500px" Height="350px" SelectionMode="Multiple"
                    DataTextField="NodeName" DataValueField="NodeId" ToolTip="按住“Ctrl”或“Shift”键可以多选，按住“Ctrl”可取消选择">
                </asp:ListBox>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>是否同时生成子栏目页：</strong>
            </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 class="tdbg">
            <td class="tdbgleft">
                <strong>是否为增量生成：</strong>
                <br />
                <font style="color:blue">提示：当此选项为否时为全部生成。</font>
            </td>
            <td>
                <asp:RadioButtonList ID="RdlIsIsIncrementalUpdate" RepeatDirection="horizontal" RepeatLayout="flow"
                    runat="server">
                    <asp:ListItem Text="是" Value="true"></asp:ListItem>
                    <asp:ListItem Selected="true" Text="否" Value="false"></asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr class="tdbgbottom">
            <td colspan="2" align="center">
                <asp:Button ID="CreateCategoryListById" runat="server" Text="生成选定栏目的列表页" OnClick="CreateCategoryListById_Click" />
                &nbsp;&nbsp;
                <asp:Button ID="CreateNeedCreateHtmlList" runat="server" Text="生成所有待发布栏目的列表页" OnClick="CreateNeedCreateHtmlList_Click" />
                &nbsp;&nbsp;
                <asp:Button ID="CreateAllCategoryList" runat="server" Text="生成所有栏目的列表页" OnClick="CreateAllCategoryList_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
