<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<TITLE>网站生成管理</TITLE>
<link href="skins/css/jaja_main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h1{font-size:14px; color:#FF0000;}
td{text-align:left}
form{padding:0;margin:0}
</style>
<script language="JavaScript" type="text/javascript">
<!--
function CheckForm()
{
	if(document.formSv.frompath.value==""||document.formSv.frompath.value=="请选择删除的来源")
	{
		alert("请选择删除的来源！");
		return false;
	}	
}
//-->
</script>
</head>
<body> 
<%Dim Action
Dim data_name,page,data_playurl,data_playpath,playpath,frompath
Action=Trim(Request.QueryString("action"))
playpath=Trim(Request("frompath"))
Call OpenConn()
Select  Case Lcase(Action)
	Case "delsource" : DelDataSource : CloseObj
	Case Else : main
End Select

Sub	DelDataSource
  Set rs = Server.CreateObject("adodb.recordset")
  Sql="Select Top 25 data_name,data_playpath,data_playurl from QvodCms_Name where data_playpath like '%"&playpath&"%' order by data_lastdate desc"
  rs.Open sql, Conn, 1, 3
  If not(rs.bof And rs.eof) Then
	m=rs.recordcount     '总记录
	Do while not rs.eof
	data_name=rs("data_name"):data_playurl=rs("data_playurl"):data_playpath=rs("data_playpath"):DeleteSourceById:Rs.Update
	rs.movenext:Loop
	DivWrite "<p style='font-size:14px; color:#FF0000'>正在删除来源："&playpath&"--还剩"&m&"部正在删除！</p><meta http-equiv='refresh' content=3;url='?action=delsource&Page="&page+1&"&frompath="&playpath&"'>"
  Else
	DivWrite "<Br>"&playpath&"来源：已经全部删除完毕！":Response.End()
  End If	
End Sub

Sub	DeleteSourceById
	Dim ly,paths,urls,ii
	ly=Split(data_playpath,"$$") 
	For ii=0 to Ubound(ly)
	  If ly(ii)<>playpath Then
	    paths=paths&"$$"&Trim(ly(ii))
		urls=urls&"$$$"&Trim(Split(data_playurl,"$$$")(ii))
	  End If
	Next
	data_playpath=trimOuterStr(paths,"$$"):data_playurl=trimOuterStr(urls,"$$$")
	rs("data_playpath")=data_playpath:rs("data_playurl")=data_playurl
	DivWrite "<font color=red>影片："&data_name&"------"&playpath&"来源： 删除成功！</font><br>"
End Sub


Sub DivWrite(str)
	response.Flush()
	response.write(str)
End Sub

Sub CloseObj
	rs.Close:Set rs = Nothing
End Sub

Sub SvSelect '作用:处理循环影片的服务器组
   for i=1 to From_Count
	Response.Write "<option value='"&playfrom(i)&"' >"&playfrom(i)&"</option>"
   next	
End Sub

Sub Main()
randomize
Dim rndmsg:rndmsg="msg"&int(2100*rnd)
%>

<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
  <th colspan=2 background="Skins/images/tdbg.gif" class="title">&nbsp;删除指定[播放器]来源</th>
</tr>
<tr><td height="151" class="td2">
<table width="100%" height="29" border="0 "align="center" cellpadding="5" cellspacing="1" style="background: #cad9ea;">	
<tr bgcolor="#FFFFFF" >
<form action="?action=DelSource" name="formSv" method="post" target="<%=rndmsg%>" onSubmit="return CheckForm();">
<td width="23%" height="27" >&nbsp;选择来源：
  <select id='frompath' name='frompath' style="width:150px">
	 <option value='请选择删除的来源'>请选择删除的来源</option><%Call SvSelect%>
</select></td>
<td width="77%" > <input type="submit" onClick="return confirm('删除后将不能恢复,确定删除选择播放器来源吗?');" name="button" id="button" value="确定删除" > <font color="red">注意：为了防止意外、请操作前务必先备份数据库</font></td>
</form>
</tr>
</table></td></tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
</form>
</tr>

<tr bgcolor="#FFFFFF">
	<td colspan="2" ><iframe style="z-index:1;visibility:inherit;width:100%;height:500px;" name="<%=rndmsg%>" frameborder=0 scrolling=yes ></iframe></td>
</tr>

</table>
<%End Sub%> 
<%Call CloseConn()%>

</body>
</html>