
<!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=gb2312" />
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
action=request("action")
if action="Excel" then

FileName = "商家信息(未审核).xls" '表名
FilePath = "../Excel/"&FileName '下载路径
Set Fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fout = fs.Createtextfile(Server.MapPath(FilePath),true)
Sql= "Select * From Dream_Menpiao where Dream_IsOK=false Order By Id Desc"
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1		
strLine="ID号"&chr(9)&"所属地区"&chr(9)&"所属分类"&chr(9)&"信息标题"&chr(9)&"信息简要"&chr(9)&"排序ID"&chr(9)&"关键词"&chr(9)&"网页描述"&chr(9)&"电话"&chr(9)&"地址"&chr(9)&"公交"&chr(9)&"外链"&chr(9)&"地图链接"&chr(9)&"优惠信息"&chr(9)&"温馨提示"&chr(9)&"商家介绍"&chr(9)&"轮播图片"&chr(9)&"发布人"&chr(9)&"缩略图"&chr(9)&"推荐"&chr(9)&"最新"&chr(9)&"热门"&chr(9)&"精品"&chr(9)&"面子卡"&chr(9)&"录入时间"
fout.writeline Replace(strLine,chr(13)&chr(10),"")
If not rs.eof Then
	Do While Not Rs.Eof	
	strLine=Rs("id")&chr(9)&dream_flname(Rs("Dream_Area"),"Dream_Area")&"|"&Rs("Dream_Area")&chr(9)&dream_flname(Rs("Dream_Theme"),"Dream_Theme")&"|"&Rs("Dream_Theme")&chr(9)&Rs("Dream_Title")&chr(9)&Rs("Dream_TitleCon")&chr(9)&Rs("Dream_OrderID")&chr(9)&Rs("Dream_Keyword")&chr(9)&Rs("Dream_Description")&chr(9)&Rs("Dream_Phone")&chr(9)&Rs("Dream_Address")&chr(9)&Rs("Dream_Bus")&chr(9)&Rs("Dream_DownUrl")&chr(9)&Rs("Dream_MapUrl")&chr(9)&ClearHtml(Rs("Dream_Content4"),1)&chr(9)&ClearHtml(Rs("Dream_Content"),1)&chr(9)&ClearHtml(Rs("Dream_Content3"),1)&chr(9)&ClearHtml(Rs("Dream_Content2"),1)&chr(9)&Rs("Dream_User")&chr(9)&Rs("Dream_DefaultPicUrl")&chr(9)&Rs("Dream_Elite")&chr(9)&Rs("Dream_New")&chr(9)&Rs("Dream_Hot")&chr(9)&Rs("Dream_Choice")&chr(9)&Rs("Dream_Mzk")&chr(9)&Rs("Dream_UpdateTime")
	fout.writeline Replace(strLine,chr(13)&chr(10),"")
	Rs.MoveNext
	Loop
End If
rs.close
set rs=nothing
response.Write "<script type=""text/javascript"">if(confirm(""导出成功！是否下载Excel文件"")){location.href="""&FilePath&""";}else{location.href=""Menpiao_Manage_IsOK.asp"";}</script>"
end if

Area=Trim(request("Area"))
if Area="" then Area=0

if Area<>0 then
sql="select top 1 * from Dream_Area where id="&Area
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if not rs.eof then
if rs("Dream_ClassID")=0 then
BArea=Area
else
BArea=rs("Dream_ClassID")
end if
rs.close
set rs=nothing
end if
else
BArea=0
end if

Theme=Trim(request("Theme"))
if Theme="" then Theme=0

if Theme<>0 then
sql="select top 1 * from Dream_Theme where id="&Theme
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if not rs.eof then
if rs("Dream_ClassID")=0 then
BTheme=Theme
else
BTheme=rs("Dream_ClassID")
end if
rs.close
set rs=nothing
end if
else
BTheme=0
end if


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"))
jtj=Trim(request("jtj"))
sh=Trim(request("sh"))
mzk=Trim(request("mzk"))
Title=Trim(request("Title"))
ID=Request("ID")

if mzk="true" then
Conn.execute "Update Dream_Menpiao set Dream_Mzk=true where ID="&ID
end if

if mzk="false" then
Conn.execute "Update Dream_Menpiao set Dream_IsOK=false where ID="&ID
end if

if sh="true" then
Conn.execute "Update Dream_Menpiao set Dream_IsOK=true where ID="&ID
end if

if sh="false" then
Conn.execute "Update Dream_Menpiao set Dream_Mzk=false where ID="&ID
end if

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

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


if itj="true" then
Conn.execute "Update Dream_Menpiao set Dream_Hot=true,Dream_HotTime='"&now()&"' where ID="&ID
end if

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

if ntj="true" then
Conn.execute "Update Dream_Menpiao set Dream_New=true,Dream_NewTime='"&now()&"' where ID="&ID
end if

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

if jtj="true" then
Conn.execute "Update Dream_Menpiao set Dream_Choice=true,Dream_ChoiceTime='"&now()&"' where ID="&ID
end if

if jtj="false" then
Conn.execute "Update Dream_Menpiao set Dream_Choice=false where ID="&ID
end if


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

if ClassID="" then
ClassID=0
end if

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

sql="select * from Dream_Menpiao where Dream_IsOK=false "
if Title<>"" then
	sql=sql & " and Dream_Title like '%" & Title & "%' "
end if

if Area<>0 then
	sql=sql & " and Dream_Area = " & Area
end if

if Theme<>0 then
	if Theme=BTheme then
	sql=sql & " and Dream_Theme in (select id from Dream_Theme where id="&BTheme&" or Dream_ClassID="&BTheme&")"
	else
	sql=sql & " and Dream_Theme = " & Theme
	end if
end if

sql=sql & " order by Dream_OrderID desc,id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1

%>
<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="Menpiao_Manage_IsOK.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='Menpiao_Add.asp';" type="button" value="添加<%=StrTitle%>" />
                  </div>
                </div>
				<div class="area"><h3>选择地区：</h3><ul><li><a href="?area=0&theme=<%=theme%>" <%if cint(area)=0 then%>class="a"<%end if%>>全部</a>
				<%
				set rsArea=server.CreateObject("adodb.recordset")
				sqlArea="select * from Dream_Area where Dream_ClassID=0 order by Dream_Zid asc"
				rsArea.open sqlArea,conn,1,1
				if not(rsArea.eof and rsArea.bof) then
				do while not rsArea.eof
				if cint(Area)=rsArea("ID") or cint(BArea)=rsArea("ID") then
				response.Write "<a href=""?area="&rsArea("ID")&"&theme="&theme&""" class=""a"">"&rsArea("Dream_Names")&"</a>"
				else
				response.Write "<a href=""?area="&rsArea("ID")&"&theme="&theme&""">"&rsArea("Dream_Names")&"</a>"
				end if				
				rsArea.movenext
				loop
				end if
				rsArea.close
				set rsArea=nothing				
				%>
				</li>				
				<%
				if BArea<>0 then
				set rsArea=server.CreateObject("adodb.recordset")
				sqlArea="select * from Dream_Area where Dream_ClassID="&BArea&" order by Dream_Zid asc"
				rsArea.open sqlArea,conn,1,1
				if not(rsArea.eof and rsArea.bof) then
				response.Write "<li class=""sub"">"	
				do while not rsArea.eof							
				if cint(Area)=rsArea("ID") then
				response.Write "<a href=""?area="&rsArea("ID")&"&theme="&theme&""" class=""b"">"&rsArea("Dream_Names")&"</a>"
				else
				response.Write "<a href=""?area="&rsArea("ID")&"&theme="&theme&""">"&rsArea("Dream_Names")&"</a>"
				end if			
				rsArea.movenext
				loop
				response.Write "</li>"
				end if
				rsArea.close
				set rsArea=nothing
				end if
				%>				
				</ul>
				</div>
				<div class="area"><h3>选择分类：</h3><ul><li><a href="?area=<%=Area%>&theme=0" <%if cint(theme)=0 then%>class="a"<%end if%>>全部</a>
				<%
				set rsArea=server.CreateObject("adodb.recordset")
				sqlArea="select * from Dream_Theme where Dream_ClassID=0 order by Dream_Zid asc"
				rsArea.open sqlArea,conn,1,1
				if not(rsArea.eof and rsArea.bof) then
				do while not rsArea.eof
				if cint(Theme)=rsArea("ID") or cint(BTheme)=rsArea("ID") then
				response.Write "<a href=""?area="&Area&"&theme="&rsArea("ID")&""" class=""a"">"&rsArea("Dream_Names")&"</a>"
				else
				response.Write "<a href=""?area="&Area&"&theme="&rsArea("ID")&""">"&rsArea("Dream_Names")&"</a>"
				end if				
				rsArea.movenext
				loop
				end if
				rsArea.close
				set rsArea=nothing
				%>
				</li>				
				<%
				if BTheme<>0 then
				set rsArea=server.CreateObject("adodb.recordset")
				sqlArea="select * from Dream_Theme where Dream_ClassID="&BTheme&" order by Dream_Zid asc"
				rsArea.open sqlArea,conn,1,1
				if not(rsArea.eof and rsArea.bof) then
				response.Write "<li class=""sub"">"	
				do while not rsArea.eof							
				if cint(Theme)=rsArea("ID") then
				response.Write "<a href=""?area="&Area&"&theme="&rsArea("ID")&""" class=""b"">"&rsArea("Dream_Names")&"</a>"
				else
				response.Write "<a href=""?area="&Area&"&theme="&rsArea("ID")&""">"&rsArea("Dream_Names")&"</a>"
				end if	
				rsArea.movenext
				loop
				response.Write "</li>"
				end if
				rsArea.close
				set rsArea=nothing
				end if
				%>				
				</ul>
				</div>
                <div class="contents">
                  
                    <table  border="0" cellpadding="0" cellspacing="1"  width="100%" align="center">
                      <tr>
                        <td height="40" class="Title" width="40%"><form name="thisForm1" method="post" action="?action=Excel" style="float:left; margin:0px; padding:0px; margin-right:20px;"><input type="submit" name="Submit" value="导出Excel" id=Submit></form></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>
					<form name="del" method="Post" action="Menpiao_Del.asp" onsubmit="return ConfirmDel();">
                    <%		
							if currentPage=1 then
								showContent
								showpages_mp strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,Theme,Title,Area
							else
								if (currentPage-1)*MaxPerPage<totalPut then
									rs.move  (currentPage-1)*MaxPerPage
									dim bookmark
									bookmark=rs.bookmark
									showContent
									showpages_mp strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,Theme,Title,Area
								else
									currentPage=1
									showContent
									showpages_mp strFileName,totalput,MaxPerPage,true,true,"篇"&StrTitle,Theme,Title,Area
								end if
							end if
					%>
                  </form>
                  <%  		
						end if
						
					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="50">排序</th>
					  <!--<th width="100">面子卡</th>-->
					  <th width="100">状态</th>
					  <th width="50">审核</th>
                      <th width="100">加入时间</th>
                      <th width="100">操作</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;<a href="../view.asp?id=<%=rs("id")%>&cid=<%=rs("Dream_Theme")%>" target="_blank"><%=rs("Dream_Title")%></a> <%if rs("Dream_DefaultPicUrl")<>"" then%><img src="images/img.jpg"  height="15" align="middle" title="有图" /><%end if%></td>
					  <td align="center" bgcolor="#FFFFFF"><%=rs("Dream_OrderID")%></td>
					  <!--<td align="center" bgcolor="#FFFFFF"><%if rs("Dream_Mzk")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&mzk=false&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#0066FF;">显示</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&mzk=true&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#CCCCCC;">不显</a><%end if%></td>-->
					  <td align="center" bgcolor="#FFFFFF"><%if rs("Dream_Elite")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&tj=false&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#0066FF;">荐</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&tj=true&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#CCCCCC;">荐</a><%end if%>&nbsp;<%if rs("Dream_Hot")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&itj=false&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#FF0000;">热</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&itj=true&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#CCCCCC;">热</a><%end if%>&nbsp;<%if rs("Dream_New")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&ntj=false&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#009900;">新</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&ntj=true&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#CCCCCC;">新</a><%end if%>&nbsp;<%if rs("Dream_Choice")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&jtj=false&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#FF6600;">精</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&jtj=true&page=<%=currentPage%>&area=<%=area%>&theme=<%=theme%>" style="color:#CCCCCC;">精</a><%end if%></td>
					  <td align="center" bgcolor="#FFFFFF"><%if rs("Dream_IsOK")=true then%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&sh=false&page=<%=currentPage%>" style="color:#009900;">已审核</a><%else%><a href="Menpiao_Manage_IsOK.asp?id=<%=rs("id")%>&sh=true&page=<%=currentPage%>" style="color:#CCCCCC;">未审核</a><%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="Menpiao_Modify.asp?ID=<%=rs("ID")%>">修改</a> <a href="Menpiao_Del.asp?ID=<%=rs("ID")%>&Action=Del&IsOK=true" 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="Menpiao_Manage_IsOK.asp?Area=<%=Area%>&Theme=<%=Theme%>">
                        <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	
Function dream_flname(tid,fromname)
	set key=server.createobject("adodb.recordset")
	sqlkey="select * from "&fromname&" where ID="&tid&" order by id desc"	
	key.open sqlkey,conn,1,1
	if not(key.eof and key.bof) then
	dream_flname=key("Dream_Names")
	else
	dream_flname=""
	end if
	key.close
	set key=nothing
End Function	
%>
</body>
</html>
