
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
ClassID=Trim(request("ClassID"))
dim strFileName
const MaxPerPage=15
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs

'StrTitle=SelectStyle(style)
StrTitle="信息"
tj=Trim(request("tj"))
itj=Trim(request("itj"))
ntj=Trim(request("ntj"))
Title=Trim(request("Title"))
ID=Request("ID")

if tj="true" then
Conn.execute "Update Dream_Banner set Dream_Elite=true,Dream_EliteTime='"&now()&"' where ID="&ID
end if

if tj="false" then
Conn.execute "Update Dream_Banner set Dream_Elite=false where ID="&ID
end if


if itj="true" then
Conn.execute "Update Dream_Banner set Dream_Hot=true where ID="&ID
end if

if itj="false" then
Conn.execute "Update Dream_Banner set Dream_Hot=false where ID="&ID
end if

if ntj="true" then
Conn.execute "Update Dream_Banner set Dream_New=true where ID="&ID
end if

if ntj="false" then
Conn.execute "Update Dream_Banner set Dream_New=false where ID="&ID
end if

if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if

if classurl="" then
classurl="<a href=""?"">所有"&StrTitle&"</a>"
end if

sql="select * from Dream_Banner where ID>0"
if Title<>"" then
	sql=sql & " and Dream_Title like '%" & Title & "%' "
end if

sql=sql & " order by id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=StrTitle%>管理</title>
<script language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }

function ConfirmDel()
{
   if(confirm("确定要删除选中的<%=StrTitle%>吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}

</script>
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
  <div class="local">
    <h3>您现在的位置：<a href="admin_Index_Main.asp">管理首页</a> >> <a href="Banner_Manage.asp"><%=StrTitle%>管理</a> >> <%=classurl%></h3>
  </div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:10px;">
    <tr>
      <td valign="top"><table  border="0" cellpadding="0" cellspacing="10"  width="100%" align="center" class="border" >
          <tr>
            <td><div class="page_content">
                <div class="r_title">
                  <h3><img src="images/xiao.jpg" /> <%=classurl%></h3>
                  <div style="float:right; padding-right:10px;">
                    <input name="" onclick="javascript:location.href='Banner_Add.asp?classid=<%=ClassID%>&style=<%=Style%>';" type="button" value="添加<%=StrTitle%>" />
                  </div>
                </div>
                <div class="contents">
                  <form name="del" method="Post" action="Banner_Del.asp?mkid=<%=mkid%>" onsubmit="return ConfirmDel();">
                    <table  border="0" cellpadding="0" cellspacing="1"  width="100%" align="center">
                      <tr>
                        <td height="40" class="Title" width="40%"></td>
                        <td width="60%" align="right" class="Title">&nbsp;
                          <%
						if rs.eof and rs.bof then
							response.write "共找到 0 篇"&StrTitle&"</td></tr></table>"
						else
							totalPut=rs.recordcount
							if currentpage<1 then
								currentpage=1
							end if
							if (currentpage-1)*MaxPerPage>totalput then
								if (totalPut mod MaxPerPage)=0 then
									currentpage= totalPut \ MaxPerPage
								else
									currentpage= totalPut \ MaxPerPage + 1
								end if
					
							end if
							response.Write "共找到 " & totalPut & " 篇"&StrTitle
							%></td>
                      </tr>
                    </table>
                    <%		
							if currentPage=1 then
								showContent
								showpages strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,classid,Title,mkid
							else
								if (currentPage-1)*MaxPerPage<totalPut then
									rs.move  (currentPage-1)*MaxPerPage
									dim bookmark
									bookmark=rs.bookmark
									showContent
									showpages strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,classid,Title,mkid
								else
									currentPage=1
									showContent
									showpages strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,classid,Title,mkid
								end if
							end if
						end if
						%>
                  </form>
                  <%  
					sub showContent
						dim i
						i=0
					%>
                  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#F8E9EA">
                    <tr>
                      <th width="50">选择</th>
                      <th width="50">ID</th>
                      <th><%=StrTitle%>名称</th>
					  <th width="120">链接</th>
					  <th width="150">图片</th>
                      <th width="100">加入时间</th>
                      <th width="80">操作</th>
                    </tr>
                    <%do while not rs.eof%>
                    <tr>
                      <td height="25" align="center" bgcolor="#FFFFFF"><input name='ID' type='checkbox' onclick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'></td>
                      <td align="center" bgcolor="#FFFFFF"><%=rs("id")%></td>
                      <td bgcolor="#FFFFFF">&nbsp;<%=rs("Dream_Title")%></td>
					  <td align="center" bgcolor="#FFFFFF"><%=rs("Dream_DownUrl")%></td>
					  <td align="center" bgcolor="#FFFFFF"><%if rs("Dream_DefaultPicUrl")<>"" then%><img src="../<%=rs("Dream_DefaultPicUrl")%>" width="150" /><%end if%></td>
                      <td align="center" bgcolor="#FFFFFF"><%= year(rs("Dream_UpdateTime"))%>-<%= month(rs("Dream_UpdateTime"))%>-<%= day(rs("Dream_UpdateTime"))%></td>
                      <td align="center" bgcolor="#FFFFFF"><a href="Banner_Modify.asp?mkid=<%=mkid%>&ID=<%=rs("ID")%>">修改</a> <a href="Banner_Del.asp?mkid=<%=mkid%>&ID=<%=rs("ID")%>&Action=Del" onclick="return ConfirmDel();">删除</a> </td>
                    </tr>
                    <%
						i=i+1
						if i>=MaxPerPage then exit do
						rs.movenext
						loop
						%>
                  </table>
                  <table  border="0" cellpadding="2" cellspacing="1" width="100%" align="center">
                    <tr>
                      <td width="50" height="40" align="center"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox"></td>
                      <td>选中本页显示的所有信息&nbsp;&nbsp;<input name="submit" type='submit' value='删除选定的信息' /><input name="Action" type="hidden" id="Action" value="Del" /></td>
                    </tr>
                  </table>
                  <%
					end sub 
					%>
                  <table  border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
                    <tr>
                      <form name="searchsoft" method="post" action="Banner_Manage.asp?mkid=<%=mkid%>&ClassID=<%=ClassID%>">
                        <td height="30" align="center" class="Title">&nbsp;&nbsp;<strong>查找<%=StrTitle%>：</strong>
                          <input name="Title" type="text" class=smallInput id="Title" size="20" maxlength="50">
                          <input name="Query" type="submit" id="Query" value="查 询">
                          &nbsp;&nbsp;请输入<%=StrTitle%>名称。如果为空，则查找所有<%=StrTitle%>。</td>
                      </form>
                    </tr>
                  </table>
                </div>
              </div></td>
          </tr>
        </table></td>
    </tr>
  </table>
</div>
<%
	rs.close
	set rs=nothing	
	
%>
</body>
</html>
