<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_TextLinkList.aspx.vb" Inherits="TourEx.Web.Admin_TextLinkList" %>
<%@ 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script language="javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/CreateSelect.js"></script>
</head>
<body>
<form runat="server" id="TourExForm">
<ul class="tools">
	<li class="add" p="36"><span><a href="Admin_Link.aspx">添加</a></span></li>
    <li class="add" p="37"><span><a href="javascript:void(0);" onclick="Save(0);return false;">保存</a></span></li>
	<li class="del" p="38"><span><a href="javascript:void(0);" onclick="Del(0);return false;">删除</a></span></li>
	<li class="search">关键词：<asp:TextBox ID="Key" runat="server" CssClass="searchTitle"></asp:TextBox><input type="button" value="" onclick="location='?Key='+$('#Key').val();" class="searchInput"/></li>
</ul>
</form>
<asp:Repeater ID="Repeater" runat="server">
    <HeaderTemplate>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabBox">
            <tr class="tabTitleMain">
                <td width="35" class="selectAll">
                    <a href="javascript:void(0);" onclick="$('input[name=\'ID\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));">全选</a>
                </td>
                <td width="200">名称</td>
                <td>链接</td>
                <td width="80">排序</td>
                <td width="100">操作</td>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr class="tabTextMain" id="From_<%#Eval("L_ID")%>" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#F4F7FA';">
            <td><input name="L_ID" id="L_ID_<%#Eval("L_ID")%>" type="checkbox" value="<%#Eval("L_ID")%>" /></td>
            <td>
                <input id="L_Name_<%#Eval("L_ID")%>" name="L_Name_<%#Eval("L_ID")%>" type="text" value="<%#Eval("L_Name")%>" ovalue="<%#Eval("L_Name")%>" class="formTitle"/>
            </td>
            <td>
                <input id="L_Url_<%#Eval("L_ID")%>" name="L_Url_<%#Eval("L_ID")%>" type="text" value="<%#Eval("L_Url")%>" ovalue="<%#Eval("L_Url")%>" class="formTitle" style="width:200px;"/>
            </td>
            <td>
                <input id="L_OrderID_<%#Eval("L_ID")%>" name="L_OrderID_<%#Eval("L_ID")%>" type="text" value="<%#Eval("L_OrderID")%>" ovalue="<%#Eval("L_OrderID")%>" onkeyup="this.value=this.value.replace(/\D/g,'');" size="6" maxlength="6" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="formTitle"/>
            </td>
            <td>
                <a href="javascript:void(0);" onclick="Save(<%#Eval("L_ID")%>);return false;" p="37">保存</a>
                <a href="Admin_Link.aspx?id=<%#Eval("L_ID")%>" p="37">编辑</a> 
                <a href="javascript:void(0);" onclick="Del(<%#Eval("L_ID")%>);return false;" p="38">删除</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
        <asp:Label ID="lblEmpty" Text="暂无" runat="server" Visible="<%#Boolean.Parse((Repeater.Items.Count = 0).ToString())%>"
            Width="100%" Style="text-align: center">     
        </asp:Label>
    </FooterTemplate>
</asp:Repeater>
<webdiyer:AspNetPager ID="TourExPage" runat="server" UrlPaging="true" ShowPageIndexBox="Never"
    PageIndexBoxType="DropDownList" TextBeforePageIndexBox=""
    PageSize="20" OnPageChanged="BindData" EnableTheming="true" FirstPageText="首页"
    LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" CssClass="page" 
        PagingButtonSpacing="" CurrentPageButtonClass="current" 
    CurrentPageButtonStyle="">
</webdiyer:AspNetPager>
    <form id="BatchSubmit" name="BatchSubmit" method="post" action="?act=edit" style="display: none">
    </form>
<script type="text/javascript">
 <!--//
 var AP='<%=TourEx.BLL.GetSession("AdminPermissions") %>';
 if(AP!='')
 {
    if(AP.indexOf(',36,')==-1)$('*[p="36"]').remove();
    if(AP.indexOf(',37,')==-1)$('*[p="37"]').remove();
    if(AP.indexOf(',38,')==-1)$('*[p="38"]').remove();
 }
 function Save(ID)
 {
 	var L_IDs=ID==0?$('input[name="L_ID"]'):$('#L_ID_'+ID);
	var L_N,L_O,L_U;
	$('#BatchSubmit').html('');
	for(var i=0;i<L_IDs.length;i++)
	{
		L_N = $.trim($('#L_Name_'+L_IDs[i].value).val());
		$('#L_Name_'+L_IDs[i].value).val(L_N);
		if(L_N==''){alert('请填写名称！');return;}
		L_U = $.trim($('#L_Url_'+L_IDs[i].value).val());
		$('#L_Url_'+L_IDs[i].value).val(L_U);
		if(L_U==''){alert('请填写链接！');return;}
		L_O=$('#L_OrderID_'+L_IDs[i].value).val();
		if(L_N!=$('#L_Name_'+L_IDs[i].value).attr('ovalue') || L_U!=$('#L_Url_'+L_IDs[i].value).attr('ovalue') || L_O!=$('#L_OrderID_'+L_IDs[i].value).attr('ovalue'))
		{
			L_IDs[i].checked=true;
			$('#From_'+L_IDs[i].value).clone().prependTo("#BatchSubmit");
			$('#L_Name_'+L_IDs[i].value,'#BatchSubmit').val(L_N);
			$('#L_Url_'+L_IDs[i].value,'#BatchSubmit').val(L_U);
			$('#L_OrderID_'+L_IDs[i].value,'#BatchSubmit').val(L_O);
		}
	}
 	if($('#BatchSubmit').html()==''){alert('数据没有改动过，无需保存！');return;}
	$('input[name="L_ID"]','#BatchSubmit').attr('checked',true);
	$('#BatchSubmit').submit();
 }
 function Del(ID)
 {
 	var Url='?Act=del&';
	var IDs;
	if(ID>0)
	{
		Url +='L_ID='+ID;
	}else{
 		IDs = $("input[name='L_ID']").serialize().replace(/&L_ID=/g,',');
		if(IDs==''){alert('请选择您要删除的友情链接！');return;}
		Url +=IDs;
	}
	if(confirm('您确定删除吗！')){location=Url;}
 }
    //-->
</script>

</body>
</html>
