<%@ codepage ="936" %>
  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="22"
	dir="../err.asp" 
 %>
 <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/FileSystem.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../rolecheck.asp"-->

<LINK href="../css/style.css" rel=stylesheet type=text/css> 
            <script>
var checkflag="false";
function check(field){
if(checkflag=="false"){
for(i=0;i<field.length;i++){
field[i].checked=true;}
checkflag="true";
return "解除全选"; }
else {
for(i=0;i<field.length;i++) {
field[i].checked=false;}
checkflag="false";
return "选择全部";}}
</script>
<title>专项商机管理</title>
<%
if not isempty(request("selAnnounce")) then
	idlist=request("selAnnounce")
	if instr(idlist,",")>0 then
		dim idarr
		idArr=split(idlist)
		dim log_id
		for i = 0 to ubound(idarr)
			log_id=clng(idarr(i))
			AdminContent=GetLogValue(102)
			EndLogin=102
			Call SendAdminLog(username,EndLogin,AdminContent)
				Set RsVip=Conn.Execute("Select vipinfo_id,viptype,picture from yixiang_vipinfo Where vipinfo_id="&log_id&"")
				
				    ttid=RsVip("vipinfo_id")
					 typeid=RsVip("viptype")
					 picture=RsVip("picture")
					 RsVip.Close
					 Set RsVip=Nothing
					
				PicFile=HOPE_InstallDir&"UploadFile/"&picture
				if instr(picture,"nopicture.gif")<=0 then 
				call FileDel(PicFile)'删除相应图片
				end if
				
				VipFile=HOPE_InstallDir&"vipinfo/offerdetail/"&typeid&"-"&ttid&".html"
				call FileDel(VipFile)'删除相应的生成文件
				Response.Write("<iframe src='../../manage/makehtml/vipinfo/makelist.asp?all=all&other=SendTo&TypeId="&typeid&"' widht=0 height=0></iframe>")
			call deleteannounce(log_id)
						Response.write ("<script>window.location.href='index.asp'</script>")
						
		next
	else
			Set RsVip=Conn.Execute("Select vipinfo_id,viptype,picture from yixiang_vipinfo Where vipinfo_id="&idlist&"")
				    ttid=RsVip("vipinfo_id")
					 typeid=RsVip("viptype")
					  picture=RsVip("picture")
					 RsVip.Close
					 Set RsVip=Nothing
				PicFile=HOPE_InstallDir&"UploadFile/"&picture
				if instr(picture,"nopicture.gif")<=0 then
				call FileDel(PicFile)'删除相应图片
				end if
				VipFile=HOPE_InstallDir&"vipinfo/offerdetail/"&typeid&"-"&ttid&".html"
				call FileDel(VipFile)
							Response.Write("<iframe src='../../manage/makehtml/vipinfo/makelist.asp?all=all&other=SendTo&TypeId="&typeid&"' widht=0 height=0></iframe>")
			call deleteannounce(clng(idlist))
			Response.write ("<script>window.location.href='index.asp'</script>")

	end if
end if

keywords=replace_text(request("keywords"))
action=replace_text(request("action"))
if request("typeid")>"" then
if Chkrequest(request("typeid")) then
typeid=request("typeid")
else
Response.Redirect ("/login/chklogin.asp?login=4")
end if
end if
set rs=server.createobject("adodb.recordset") 
sql="select * from Yixiang_vipinfo"
if typeid>"" then sql=sql&" where viptype="&typeid&""
if action=1  then 
  if  typeid>"" then 
  sql=sql&" flag=1 "
  else
  sql=sql&" where  flag=1 "
  end if 
else
   if  typeid>"" then 
  sql=sql&" flag=0 "
  else
  sql=sql&" where  flag=0 "
  end if 
end if 

if keywords>"" then sql=sql&" and vipshowname like '%"&keywords&"%'"

sql=sql&" order by vipinfo_ID desc"


Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1 

msg_per_page=20 '定义每页显示记录条数
%>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align=center class="tableBorder"> 
  <tr> 
     <th height=25 colspan="2" class="tableHeaderText">专项商机管理 </th> 
  </tr> 
  <tr> 
     <td colspan="2"  height="20"><font color="#666666">温馨提示：
         ①类别直接与发布的信息相关联，删除类别可能会影响到以前发布的专项商机信息。 </font> </td> 
   </tr> 
  <tr> 
     <td width="10%" height=25 class="forumRowHighlight"> <B>操作选项</B></td> 
         <FORM name=searchForm action="index.asp" method=post onsubmit="javascript:if(doSearch()==false) return false;"><td class="forumRowHighlight">
       关键字：<input name="keywords" type="text" value="<%=keywords%>">
&nbsp;商机类别：
<select name="typeid" size="1">  
<%
set rs1=conn.execute("select * from Yixiang_vipinfo_class")
do while not rs1.eof
response.write "<option value='"&rs1("typeid")&"'>"&rs1("type")&"</option>"&chr(13)+chr(10)
rs1.movenext
loop
rs1.close
%>
</select> <input type="submit" value="立刻查找" id=submit name=submit>
         </td></form>
  </tr>
  <tr><td colspan="2" height="1"  bgcolor="#DAD6D7"></td>
  </tr>
  <tr>
    <td height=25 class="forumRowHighlight">&nbsp;</td>
	 <td class="forumRowHighlight"><a href="index.asp">管理专项商机</a> | <a href="?action=1"><span class="STYLE1">已审商机</span></a>| <a href="?action=0"><span class="STYLE1">待审商机</span></a>|<a href="type.asp">管理商机类别</a> | <a href="class_ok.asp?action=add_class_1">添加专项类别</a> | [<a href="javascript:location.reload()">刷新页面</a>] </td> 
  </tr> 
</table>
<SCRIPT LANGUAGE='JavaScript' SRC='/js/search.js' TYPE='text/javascript'></script>
<!--#include file="../../inc/headpage.asp"-->

  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
 <Form name="search" method="POST" action="index.asp">  
		<tr><td colspan="5">			<%
if rs.eof then
response.Write"<br><br><div align='center'>暂无数据信息</div><br><br>"
else
%> </td></tr>
    <TR height=25 class=bodytitle>
<TD width="351" align="left" class=bodytitle><font color="ff6600"><b>信息标题</b></font></td>
<TD width="155" align="left" class=bodytitle><font color="ff6600"><b>所属类别</b></font></td>
<TD width="90" align="center" class=bodytitle><font color="ff6600"><b>发布日期</b></font></td>
<TD width="288" align="center" class=bodytitle><font color="ff6600"><b>操作</b></font></td>
<TD width="44" align="center" class=bodytitle><input type='submit' value='删除' onclick="return sureok() "></td>
</TR>
<%
do while not rs.eof and rowcount > 0%>
<TR height="20"> 
<TD align="left" class=forumRow><a href="../../vipinfo/InfoHtml.asp?vipinfo_id=<%=rs("vipinfo_id")%>" target="_blank"><% Set re = New RegExp
re.Pattern ="("&keywords&")"
re.IgnoreCase = True
re.Global=True
result = re.Replace(rs("vipshowname"), "<font color=red>$1</font>")%><%=result%></a></td>
<TD align="left" class=forumRow><%
if rs("viptype")<>"" then
set rs3=conn.execute("select typeid,type from Yixiang_vipinfo_class where typeid="&rs("viptype")&"")

response.write"<a href='index.asp?typeid="&rs3("typeid")&"'>"&rs3("type")&"</a>"
rs3.close
set rs3=nothing
end if 
%></td>
<TD width="90" align="center" class=forumRow><%=FormatDate(rs("dateandtime"),2)%>　</td>
<TD align="center" class=forumRow><%if rs("flag")=1 then %><a href="approve.asp?action=1&id=<%=rs("vipinfo_ID")%>&typeid=<%=rs("viptype")%>">审核 </a><%else%><a href="approve.asp?action=2&id=<%=rs("vipinfo_ID")%>&typeid=<%=rs("viptype")%>">待审 </a><%end if %><a href="edit.asp?vipinfo_id=<%=rs("vipinfo_id")%>">修改</a>/
<%if request("action")=0 and  rs("flag")=0 then%>
生成页面(
		  <%if rs("html_pass")=0 then response.write("未生成") else response.write("已生成") end if%>)
<%else%>
生成页面(
		  <a href="../../manage/makehtml/vipinfo/makedetail.asp?all=vipinfo&selAnnounce=<%=rs(0)%>" title="点击生成" target="_blank"><%if rs("html_pass")=0 then response.write("未生成") else response.write("已生成") end if%></a>)
<%end if%>
		  <%if rs("flag")=1 then%><%if rs("tjhome")=1 then%><a href="approve.asp?action=3&id=<%=rs("vipinfo_ID")%>&tjhome=0&page=<%=CurrentPage%>"> <span class="STYLE1">已推荐</span></a><%else%><a href="approve.asp?action=3&id=<%=rs("vipinfo_ID")%>&tjhome=1&page=<%=CurrentPage%>"> 未推荐</a> <%end if %><%end if%></td>
<TD width="44" align="center" class=forumRow><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("vipinfo_ID"))%>'></td>
</TR>
<%
icolor=icolor+1
if icolor>1 then icolor=0
rowcount=rowcount-1
rs.movenext
loop
end if

%>
<TR height="20" bgcolor="#ffffff">
  <TD colspan="5" align="left" class=forumRow><div align="right"><input type="submit" name="mobanbtn" value=" 批量默认模版页生成 " onclick="javascript:document.getElementById('search').action='../../manage/makehtml/vipinfo/makedetail.asp?all=vipinfo';"> 
      <input type=button value=" 全部选定 " onClick="this.value=check(this.form)"></div></td>
  </TR>
<TR height="20" bgcolor="#ffffff">
  <td class=forumrowHighLight align="center" colspan="5">
  <b><%=listPages("index.asp?action="&action&"&keywords="&keywords&"&type="&request("type")&"")%></b>
</td>
</TR>
</form>
 </TABLE>
  <%
sub deleteannounce(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="delete from [Yixiang_vipinfo] where vipinfo_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>
<!--#include file="../copy.asp" -->