<%@ Page Title="批量删除节点" Language="C#" MasterPageFile="~/Admin/MasterPage.master"
    AutoEventWireup="true" CodeBehind="DeleteNodes.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Admin.Contents.DeleteNodes" %>

<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">
    <asp:HiddenField ID="HdnNodeIds" runat="server" />
    <table width="100%" cellpadding="2" class="border" cellspacing="1">
        <tr align="center">
            <td colspan="2" class="spacingtitle">
                <b>批量删除节点 </b>
            </td>
        </tr>
        <tr class="tdbg">
            <td align="left" class="tdbg" colspan="2" valign="top" style="padding-left: 2px;">
                <table width="100%" border="0" cellpadding="0" cellspacing="1">
                    <pe:ExtendedLabel HtmlEncode="false" ID="LblNodes" Text="" runat="server">
                    </pe:ExtendedLabel>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" style="width: 100%;" class="tdbg">
                <asp:Button ID="btnSubmit" Text="删除" runat="server" OnClick="btnSubmit_Click" OnClientClick="javascript:return getCheckNodeIds();" />&nbsp;&nbsp;
                <asp:Button ID="BtnCancle" runat="server" Text="返回节点管理" ValidationGroup="BtnCancleValidationGroup"
                    OnClick="BtnCancle_Click" />
            </td>
        </tr>
    </table>
    <pec:ShowWait ID="ShowWait" runat="server" />

    <script language="javascript">
        var nodesId = document.getElementById("<%= HdnNodeIds.ClientID %>");
        function CheckModel(obj) {
            if (obj.checked) {
                jQuery("input[parentid='" + obj.id + "']").each(
                    function() {
                        jQuery(this).attr("checked", "checked");
                        CheckModel(this);
                    }
                )
            }
            else {
                jQuery("input[id='" + $(obj).attr("parentid") + "']").each(
                    function() {
                        this.checked = false;
                        CheckModel(this);
                    }
                )
            }
        }

        function getCheckNodeIds() {
            var HdnNodesId = document.getElementById("<%= HdnNodeIds.ClientID %>");
            var nodeIds = "";
            jQuery("input[type='checkbox']").each(
                function() {
                    if (this.checked) {
                        nodeIds += this.id + ",";
                    }
                }
            )
            if (nodeIds != "") {
                if (confirm('批量删除节点后会关联删除节点下的所有模型、内容、评论、权限等信息。确定删除选中的节点吗？')) {
                    HdnNodesId.value = nodeIds;
                    BOX_show('RegUser');
                    return true;
                }
                return false;
            }
            else {
                alert("请选择要删除的节点！");
                return false;
            }

        }
    </script>

</asp:Content>
