<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_NewsList.aspx.vb" Inherits="TourEx.Web.Admin_NewsList" %>
<%@ Import Namespace="TourEx.BLL" %>
<%@ 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>
<title>无标题页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script type="text/javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/jquery.contextmenu.r2.packed.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="4"><span><a href="Admin_News.aspx">添加</a></span></li>
	<li class="save" p="5"><span><a href="javascript:void(0);" onclick="Save(0);return false;">保存</a></span></li>
	<li class="del"><span><a href="javascript:void(0);" onclick="Del(0);return false;" p="7">删除</a></span></li>
	<li class="search">分类：<b id="CategoryList"><asp:HiddenField ID="CategoryId" runat="server"/></b>
        关键词：<asp:TextBox ID="Key" runat="server" CssClass="searchTitle"></asp:TextBox>
        推荐：<asp:CheckBox ID="TJ" runat="server" />
        固顶：<asp:CheckBox ID="Top" runat="server" />
        <input type="button" value="" onclick="location='?TID='+$('#CategoryId').val()+'&TJ='+$('#TJ:checked').length+'&Top='+$('#Top:checked').length+'&Key='+$('#Key').val();" class="searchInput"/></li>
</ul>
</form>
    <form id="BatchSubmit" name="BatchSubmit" method="post" action="?act=edit" style="display: none">
    </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=\'N_ID\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));">全选</a></td>
                <td width="50">编号</td>
                <td>标题</td>
                <td width="80">排序</td>
                <td width="140">操作</td>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr id="From_<%#Eval("N_ID")%>" class="tabTextMain" id="Form_<%#Eval("N_ID")%>" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#F4F7FA';">
            <td><input name="N_ID" id="N_ID_<%#Eval("N_ID")%>" type="checkbox" value="<%#Eval("N_ID")%>" /></td>
            <td><%#Eval("N_ID")%></td>
            <td><a href="../News/Show.aspx?id=<%#Eval("N_ID")%>" target="_blank"><%#Eval("N_Title")%></a></td>
            <td>
                <input id="N_OrderID_<%#Eval("N_ID")%>" name="N_OrderID_<%#Eval("N_ID")%>" type="text" value="<%#Eval("N_OrderID")%>" ovalue="<%#Eval("N_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("N_ID")%>);return false;" p="5">保存</a>
                <a href="Admin_News.aspx?id=<%#Eval("N_ID")%>" p="5">编辑</a> 
                <a href="javascript:void(0);" onclick="Del(<%#Eval("N_ID")%>);return false;" p="6">删除</a>
                <a href="Admin_NewsReviewsList.aspx?nid=<%#Eval("N_ID")%>" p="7">查看点评</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>
<script type="text/javascript">
<!--//
 var AP='<%=TourEx.BLL.GetSession("AdminPermissions") %>';
 var showmenu=true;
 if(AP!='')
 {
    if(AP.indexOf(',4,')==-1)$('*[p="4"]').remove();
    if(AP.indexOf(',5,')==-1)$('*[p="5"]').remove();
    if(AP.indexOf(',6,')==-1)$('*[p="6"]').remove();
    if(AP.indexOf(',7,')==-1)$('*[p="7"]').remove();
    if(AP.indexOf(',5,')+AP.indexOf(',6,')+AP.indexOf(',7,')==-3)showmenu=false;
}
function Save(ID) {
    var N_IDs = ID == 0 ? $('input[name="N_ID"]') : $('#N_ID_' + ID);
    var N_O;
    $('#BatchSubmit').html('');
    for (var i = 0; i < N_IDs.length; i++) {
        N_O = $('#N_OrderID_' + N_IDs[i].value).val();
        if (N_O != $('#N_OrderID_' + N_IDs[i].value).attr('ovalue')) {
            N_IDs[i].checked = true;
            $('#From_' + N_IDs[i].value).clone().prependTo("#BatchSubmit");
            $('#N_OrderID_' + N_IDs[i].value, '#BatchSubmit').val(N_O);
        }
    }
    if ($('#BatchSubmit').html() == '') { alert('数据没有改动过，无需保存！'); return; }
    $('input[name="N_ID"]', '#BatchSubmit').attr('checked', true);
    $('#BatchSubmit').submit();
}
 function Del(ID)
 {
 	var Url='?Act=del&';
	var IDs;
	if(ID>0)
	{
	    Url += 'N_ID=' + ID;
	}else{
    IDs = $("input[name='N_ID']").serialize().replace(/&N_ID=/g, ',');
		if(IDs==''){alert('请选择您要删除的新闻！');return;}
		Url +=IDs;
	}
	if(confirm('您确定删除吗！')){location=Url;}
 }
 
$(function(){
CreateSelect("CategoryList","CategoryId",$('#CategoryId').val() ,0,"选择分类","","NewsCategory","../");
});
//-->
</script>
</body>
</html>