<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InformationType_Manage.aspx.cs" Inherits="InformationType_Manage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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 id="Head1" runat="server">
    <title>菜单管理</title>
    <link rel="stylesheet" type="text/css" href="../css/forms.css" />
    <link href="../style/style.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery.js" type="text/javascript"></script>
    <script src="../js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
        function setinitvalue(obj) {
            if ($(obj).val() == "") { $(obj).val("1"); }
        }

        function collapse(obj) {
            if (obj.src.indexOf('open') != -1) {
                obj.src = obj.src.replace('open', 'close');
                $("img[ids]").attr("src", "../images/folder_close.gif");
                $("tr[ids]").hide();
            }
            else {
                obj.src = obj.src.replace('close', 'open');
                $("img[ids]").attr("src", "../images/folder_open.gif");
                $("tr[ids]").show();
            }
        }
        var imgid;
        function imgEvent(obj, ty, ix, ix2) {
            if (ix2 == undefined) {
                imgid = 'img_' + ix;
            } else {
                imgid = 'img_' + ix + '_' + ix2;
            }
            if (obj.src.indexOf('open') != -1) {
                obj.src = obj.src.replace('open', 'close');
//                $("img[ids^=" + obj.ids + "_]").attr("src", "../images/folder_close.gif");
                //                $("tr[ids^=" + obj.ids.replace("img_", "tr_") + "_]").hide();
                $("img[ids^=" + imgid + "_]").attr("src", "../images/folder_close.gif");
                $("tr[ids^=" + imgid.replace("img_", "tr_") + "_]").hide();
            }
            else {
                obj.src = obj.src.replace('close', 'open');
//                $("img[ids^=" + obj.ids + "_]").attr("src", "../images/folder_open.gif");
                //                $("tr[ids^=" + obj.ids.replace("img_", "tr_") + "_]").show();
                $("img[ids^=" + imgid + "_]").attr("src", "../images/folder_open.gif");
                $("tr[ids^=" + imgid.replace("img_", "tr_") + "_]").show();
            }
        }
        // 根据ID，加载子节点
        function loadSonData(curid, typeid, typegrade) {
            var oldid = curid.replace("img_", "");
            if ($("#img_" + oldid).attr("src").indexOf("_close") != -1) {
                $("#img_" + oldid).attr("src", $("#img_" + oldid).attr("src").replace("_close", "_open"));
            }
            else {
                $("#img_" + oldid).attr("src", $("#img_" + oldid).attr("src").replace("_open", "_close"));
            }
            if ($("tr[id^=tr_" + oldid + "_]").size() == 0) {
                loadSonDataInfo(oldid, typeid, typegrade);
            }
            else {
                if ($("#img_" + oldid).attr("src").indexOf("_open") != -1) {
                    /*
                    $("img[id^=img_" + oldid + "_]").each(function() {
                    $(this).attr("src",$(this).attr("src").replace("_close", "_open"));
                    });
                    */
                    $("tr[id^=tr_" + oldid + "_]").show();
                }
                else {
                    $("tr[id^=tr_" + oldid + "_]").hide();
                }
            }
        }

        // 加载数据
        function loadSonDataInfo(oldid, typeid, typegrade) {
            $.ajax({
                type: "get",
                datatype: "html",
                url: "InformationType_Manage.aspx?fatherId=<%=Request.QueryString["fatherId"] %>",
                data: "typeid=" + typeid + "&oldid=" + oldid + "&typegrade=" + typegrade + "&rand=" + new Date().getTime(),
                success: function(data) {
                    $("#tr_" + oldid).after(data);
                },
                error: function() {
                    alert("对不起，请求中出错!");
                }
            });
        }
    </script>
</head>
<body onload ="controlInputNumber()" class="_body">
    <form id="form1" runat="server">
        <div class="forms1">
		<div class="forms2">
			<span>资讯类型管理</span>
			<div class="forms4">
			    <a href="InformationType_Add.aspx" class="forms4_1">类型添加</a>
			</div>
		</div>
		
		<div style="border:1px solid #FFFFFF">
		    <table class="forms3" width="100%" height="100%" cellpadding="0" cellspacing="0">
			    <tr>
				    <td>
					    <table cellpadding="0" cellspacing="0" width="100%" style="margin-top:10px">
                        <tr>
                            <td style="text-align:left;padding-left:10px;" class="forms6_1"  nowrap>
                                <img src="../images/folder_open.gif" style="cursor:pointer" alt="" onclick="collapse(this);" />
                                <span style=" color:Black">资讯类型名称</span>
                            </td>
                            <td class="forms6_1" align="center" style="width:300px" nowrap >
                                <span style=" color:Black">排序值</span>
                            </td>
                            <td class="forms6_2" align="left" style="width:300px" nowrap>
                                <span style=" color:Black">操作</span>
                            </td>
                        </tr>
                        <asp:Repeater runat="server" ID="rptInformationType" >
                            <ItemTemplate>
                                <tr id='<%#"tr_"+Eval("Fid")+"_"+Eval("id") %>' onmouseover="this.style.background='#F3FBCA'" onmouseout="this.style.background='#ffffff';">
                                    <td style="text-align:left;padding-left:10px;" class="forms6_3" align="left" nowrap>
                                        <div>
                                            <%#getImg(Eval("id").ToString(), Eval("TypeName").ToString(),Eval("Depth").ToString(),Eval("Fid").ToString())%>
                                        </div>
                                    </td>
                                    <td class="forms6_3" align="center">
                                        <asp:TextBox ID="tb_orederid_er"  MaxLength="5" runat="server" Text='<%# Eval("Sort") %>' style="text-align:center;width:140px;height:18px;line-height:18px;" onblur="setinitvalue(this);"></asp:TextBox>
                                    </td>
                                    <td class="forms6_4" align="left" nowrap>
                                        <a href='InformationType_Update.aspx?ID=<%# Eval("ID") %>&fatherId=<%=Request.QueryString["fatherId"] %>'><span>修改</span></a>
                                        <a href='?type=del&AuthorityID=<%# Eval("ID") %>&fatherId=<%=Request.QueryString["fatherId"] %>' onclick="return confirm('确认要删除此行信息吗？')"><span>删除</span></a>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div class="_data_page_parent_div" id="tr1" runat="server">
                    <div class="_data_page_div">
                        <table cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td id="Td1" runat="server">
                                    <nobr><webdiyer:AspNetPager ID="pager" PageSize="10" runat="server" CssClass="_tab_page_div" UrlPaging="True" FirstPageText="【首页】"
                                        LastPageText="【尾页】" NextPageText="【下一页】" NumericButtonCount="5" PrevPageText="【上一页】"
                                        CustomInfoClass="_tab_pager_div1" ShowCustomInfoSection="left" EnableUrlRewriting="false" PageIndexBoxClass="page_box_ipt" SubmitButtonClass="page_btn_go" SubmitButtonText="" ShowInputBox="Never">
                                    </webdiyer:AspNetPager></nobr>
                                </td>
                            </tr>
                        </table>
                    </div>
                    </div>
				    </td>
			    </tr>
		    </table>
		</div>
	</div>
    </form>
</body>
</html>