<html>
<head>
<META content=ywnt,云网互动影视管理系统 name=keywords>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>云网互动影视6.0--直播管理</title>
<LINK href="css/css.css" type=text/css rel=stylesheet>
</head>
<BODY leftMargin=0 topMargin=0 scroll=yes MARGINHEIGHT="0" MARGINWIDTH="0">
<!--#include file="../Conn.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Function.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Page.asp" -->
<%
'===================================================================================================================
'软件名称：云网影视管理系统
'Copyright (C) 2002-2007 ywnt.net  All rights reserved.
'产品咨询QQ：489234,2813712
'程序版权：云网互动科技有限公司
'程序开发：云网互动科技有限公司
'官方网站：http://www.ywnt.net 
'郑重声明:
'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
'    2、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    3、云网互动科技有限公司保留此软件的法律追究权利
'===================================================================================================================
Call CheckLogin("Live")
sub EditSave()
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Live where ID="&NoSqlHack(Request.Form("ID"))
		Rs.open sql,Conn,1,3
		RS("LiveName")=NoSqlHack(Request.Form("LiveName"))
		RS("LiveClass")=NoSqlHack(Request.Form("LiveClass"))
		RS("LiveType")=NoSqlHack(Request.Form("LiveType"))
		RS("LiveWith")=NoSqlHack(Request.Form("LiveWith"))
		RS("LiveUrl")=NoSqlHack(Request.Form("LiveUrl"))
		RS("LiveContent")=NoSqlHack(Request.Form("LiveContent"))
		RS("LiveDate")=Nowsql
		Rs.Update
		ID=RS("ID")
		Rs.Close
		Set Rs = Nothing
		IF Request.Form("LiveType")=2 Then
		conn.execute "delete from p2pfilm WHERE MovieID ="&ID&""
		SP2PID = split(NoSqlHack(Request.Form("LiveUrl")),"|")
		Set Rs = server.CreateObject(YWNT_TMS_RS)
		sql="Select * from p2pfilm"
		Rs.open sql,Conn,1,3
		Rs.addnew
		FileExt = LCase(Mid(Request.Form("Url"), InStrRev(Request.Form("Url"), ".") + 1))
		ptl = LCase(Left(Request.Form("Url"), InStrRev(Request.Form("Url"), "://") - 1))
		RS("ptl")=NoSqlHack(ptl)
		RS("MovieID")=ID
		RS("url")=NoSqlHack(Request.Form("Url"))
		RS("vod")=0
		RS("type")=NoSqlHack(FileExt)
		Select Case ptl 
		Case "rtsp" 
		RS("ptlimpl")="real"
		Case "mms"
		RS("ptlimpl")="ms_wms"
		Case else 
		RS("ptlimpl")="std"
		End Select
		RS("filename")=NoSqlHack(Request.Form("LiveName"))
		RS("serverid")=SP2PID(1)
		RS("opt")=0
		RS("onlineserver")=SP2PID(1)
		RS("GroupID")=SP2PID(2)
		Rs.Update
		RS.close    
		set RS=nothing
		End If
		Call AddLog("修改直播"&Request.Form("LiveName"),5)
		call Admin_ShowErr("<li>修改直播成功</li>","Admin_live.asp",1)
end sub
sub AddSave()
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Live"
		Rs.open sql,Conn,1,3
		Rs.addnew
		RS("LiveName")=NoSqlHack(Request.Form("LiveName"))
		RS("LiveClass")=NoSqlHack(Request.Form("LiveClass"))
		RS("LiveType")=NoSqlHack(Request.Form("LiveType"))
		RS("LiveUrl")=NoSqlHack(Request.Form("LiveUrl"))
		RS("LiveContent")=NoSqlHack(Request.Form("LiveContent"))
		RS("LiveDate")=Nowsql
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		set RS = Conn.execute("select top 1 ID from YWNT_TMS_Live Order by ID desc")
		ID=RS("ID")
		Rs.Close
		Set Rs = Nothing
		IF Request.Form("LiveType")=2 Then
		SP2PID = split(NoSqlHack(Request.Form("LiveUrl")),"|")
		Set Rs = server.CreateObject(YWNT_TMS_RS)
		sql="Select * from p2pfilm"
		Rs.open sql,Conn,1,3
		Rs.addnew
		FileExt = LCase(Mid(Request.Form("Url"), InStrRev(Request.Form("Url"), ".") + 1))
		ptl = LCase(Left(Request.Form("Url"), InStrRev(Request.Form("Url"), "://") - 1))
		RS("ptl")=NoSqlHack(ptl)
		RS("MovieID")=ID
		RS("url")=NoSqlHack(Request.Form("Url"))
		RS("vod")=0
		RS("type")=NoSqlHack(FileExt)
		Select Case ptl 
		Case "rtsp" 
		RS("ptlimpl")="real"
		Case "mms"
		RS("ptlimpl")="ms_wms"
		Case else 
		RS("ptlimpl")="std"
		End Select
		RS("filename")=NoSqlHack(Request.Form("LiveName"))
		RS("serverid")=SP2PID(1)
		RS("opt")=0
		RS("onlineserver")=SP2PID(1)
		RS("GroupID")=SP2PID(2)
		Rs.Update
		RS.close    
		set RS=nothing
		End If
		Call AddLog("添加直播"&Request.Form("LiveName"),5)
		call Admin_ShowErr("<li>添加直播成功</li>","Admin_live.asp",1)
end sub
sub Del()
	conn.execute "delete from YWNT_TMS_Live WHERE ID ="&NoSqlHack(Request("ID"))&""
	Call AddLog("删除直播",5)
	call Admin_ShowErr("<li>删除直播成功！</li>","Admin_live.asp",1)
end sub%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td class=xingmu>直播管理</td>
    </tr>
    <tr>
      <td class="hback"><a href="Admin_live.asp">直播管理首页</a> | <a href="Admin_Live.asp?Action=Add">添加直播</a></td>
    </tr>
  </tbody>
</table>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td class=xingmu>直播栏目管理</td>
    </tr>
    <tr>
      <td class="hback"><%Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select ID,LiveClassName from YWNT_TMS_LiveClass Order by LiveClassWith asc,ID desc"
		Rs.open sql,Conn,1,1
	  	do while Not Rs.Eof
        Response.Write"<a href=""Admin_Live.asp?LiveClass="&Rs("ID")&""">"&Rs("LiveClassName")&"</a>"
		Rs.MoveNext
		IF not Rs.eof Then
		Response.Write" | "
		End IF
		loop
		Rs.Close
		Set Rs = Nothing%></td>
    </tr>
  </tbody>
</table>
<% Action=Trim(request("Action"))
Select Case Action
Case "Add"
	call Add()
Case "AddSave"
	call AddSave()
Case "Edit"
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Live where ID="&NoSqlHack(Request.QueryString("ID"))&" Order by ID desc"
		Rs.open sql,Conn,1,1
		YWNT_TMS_ID=RS("ID")
		YWNT_TMS_LiveName=RS("LiveName")
		YWNT_TMS_LiveClass=RS("LiveClass")
		YWNT_TMS_LiveType=RS("LiveType")
		YWNT_TMS_LiveUrl=RS("LiveUrl")
		YWNT_TMS_LiveContent=RS("LiveContent")
		YWNT_TMS_LiveWith=RS("LiveWith")
		RS.close   
      	set RS=nothing
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select url from p2pfilm where MovieID="&YWNT_TMS_ID&" Order by filmid desc"
		Rs.open sql,Conn,1,1
		if not rs.eof then
		YWNT_TMS_url=RS("url")
		end if
		RS.close   
      	set RS=nothing
	call Edit()
Case "EditSave"
	call EditSave()
Case "Del"
	call Del()
Case "DelUrl"
	call DelUrl()
Case else
	call List()
End Select
sub List()
Dim int_RPP
	int_RPP=GetConfig("PageNumber") '设置每页显示数目%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
    <tr>
      <td width="10%" align="center" class=xingmu>ID</td>
      <td align="center" class=xingmu>直播名称</td>
      <td width="13%" align="center" class=xingmu>直播栏目</td>
      <td width="13%" align="center" class=xingmu>直播排序</td>
      <td width="20%" align="center" class=xingmu>操作</td>
    </tr>
	<%  Set Rs = server.CreateObject(YWNT_TMS_RS)
	if Request.QueryString("LiveClass")<>"" then
		sql="Select ID,LiveName,LiveClass,LiveWith from YWNT_TMS_Live where LiveClass="&NoSqlHack(Request.QueryString("LiveClass"))&" Order by LiveWith asc,ID desc"
	else
		sql="Select ID,LiveName,LiveClass,LiveWith from YWNT_TMS_Live Order by LiveWith asc,ID desc"
	end if
		Rs.open sql,Conn,1,1
	if Rs.eof then
	   Response.Write"<TR  class=""hback""><TD colspan=""12"" class=""hback"" height=""40"">没有记录。</TD></TR>"
	else
		Rs.PageSize=int_RPP
		cPageNo=NoSqlHack(Request.QueryString("Page"))
		If cPageNo="" Then cPageNo = 1
		If not isnumeric(cPageNo) Then cPageNo = 1
		cPageNo = Clng(cPageNo)
		If cPageNo>Rs.PageCount Then cPageNo=Rs.PageCount 
		If cPageNo<=0 Then cPageNo=1
		Rs.AbsolutePage=cPageNo 
	for i=1 to int_RPP
	 if Rs.eof Then exit For %>
    <tr>
      <td height=32 align="center" class="hback"><%=Rs("ID")%></td>
      <td height=32 class="hback"><%=Rs("LiveName")%></td>
      <td align="center" class="hback"><%=LiveClassName(Rs("LiveClass"))%></td>
      <td height=32 align="center" class="hback"><%=Rs("LiveWith")%></td>
      <td align="center" class="hback"><A href="Admin_live.asp?Action=Edit&ID=<%=Rs("ID")%>">修改</A>｜<A href="Admin_live.asp?Action=Del&ID=<%=Rs("ID")%>">删除</A></td>
    </tr>
		<%Rs.MoveNext
	next 
	end if%>
	<tr align="right">
    <td height=32 colspan="5" class="hback"><% response.Write fPageCount(Rs,cPageNo) %></td>
	</tr>
</table>
<%Rs.Close
Set Rs = Nothing
end sub
sub Add()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>添加直播</td>
    </tr>
  <form action="Admin_Live.asp?Action=AddSave" method="post" name="form">
    <tr>
      <td width="21%" height=32 align="right" class="hback">直播名称：</td>
      <td height=15 class="hback"><input name="LiveName" type="text" size="40"></td>
    </tr>
	<tr>
      <td height=32 align="right" class="hback">直播栏目：</td>
      <td class="hback"><select name="LiveClass">
	  	<%Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select ID,LiveClassName from YWNT_TMS_LiveClass Order by LiveClassWith asc,ID desc"
		Rs.open sql,Conn,1,1
	  	do while Not Rs.Eof
        Response.Write"<option value="&Rs("ID")&">"&Rs("LiveClassName")&"</option>"
		Rs.MoveNext
		loop
		Rs.Close
		Set Rs = Nothing%>
      </select></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">直播类型：</td>
      <td class="hback"><select name="LiveType" onChange="Live_Type(this.value)">
        <option value="1">普通直播</option>
        <option value="2">原力直播</option>
      </select></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback"><span id="LiveW"></span>：</td>
      <td class="hback"><input name="LiveUrl" type="text" size="40"></td>
    </tr>
    <tr id="ShowUrl" style="display:none;">
      <td height=32 align="right" class="hback">直播地址：</td>
      <td class="hback"><input name="Url" type="text" size="40"></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">直播介绍：</td>
      <td class="hback"><textarea name="LiveContent" cols="40" rows="5"></textarea></td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input type="submit" name="Submit" value="添 加"></td>
    </tr>
  </form>
  </tbody>
</table>
<%end sub
sub Edit()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>修改直播</td>
    </tr>
  <form action="Admin_Live.asp?Action=EditSave" method="post" name="form">
    <tr>
      <td width="21%" height=32 align="right" class="hback">直播名称：</td>
      <td class="hback"><input name="LiveName" type="text" value="<%=YWNT_TMS_LiveName%>" size="40"></td>
    </tr>
	<tr>
      <td height=32 align="right" class="hback">直播栏目：</td>
      <td class="hback"><select name="LiveClass">
	  	<%Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select ID,LiveClassName from YWNT_TMS_LiveClass Order by LiveClassWith asc,ID desc"
		Rs.open sql,Conn,1,1
	  	do while Not Rs.Eof
		if Rs("ID")=YWNT_TMS_LiveClass then
        Response.Write"<option value="&Rs("ID")&" selected>"&Rs("LiveClassName")&"</option>"
		else
        Response.Write"<option value="&Rs("ID")&">"&Rs("LiveClassName")&"</option>"
		end if
		Rs.MoveNext
		loop
		Rs.Close
		Set Rs = Nothing%>
      </select></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">直播类型：</td>
      <td class="hback"><select name="LiveType" onChange="Live_Type(this.value)">
        <option value="1" <%if YWNT_TMS_LiveType=1 then Response.Write("selected")%>>普通直播</option>
        <option value="2" <%if YWNT_TMS_LiveType=2 then Response.Write("selected")%>>原力直播</option>
      </select></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback"><span id="LiveW"></span>：</td>
      <td class="hback"><input name="LiveUrl" type="text" size="40" value="<%=YWNT_TMS_LiveUrl%>"></td>
    </tr>
    <tr id="ShowUrl" style="display:none;">
      <td height=32 align="right" class="hback">直播地址：</td>
      <td class="hback"><input name="Url" type="text" size="40" value="<%=YWNT_TMS_Url%>"></td>
    </tr>
	<tr>
      <td height=32 align="right" class="hback">直播排续：</td>
      <td class="hback"><input name="LiveWith" type="text" size="40" value="<%=YWNT_TMS_LiveWith%>"></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">直播介绍：</td>
      <td class="hback"><textarea name="LiveContent" cols="40" rows="5"><%=YWNT_TMS_LiveContent%></textarea></td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input name="ID" type="hidden" value="<%=YWNT_TMS_ID%>"><input type="submit" name="Submit" value="修 改"></td>
    </tr>
  </form>
  </tbody>
</table>
<%end sub%>
<script>
<%if Request("Action")="Add" then%>
Live_Type(1)
<%else%>
Live_Type(<%=YWNT_TMS_LiveType%>)
<%end if%>
function Live_Type(param)
{
	if (param==1)
	{
		document.getElementById("LiveW").innerHTML = "直播地址";
		document.getElementById("ShowUrl").style.display="none";
	}
	else if (param==2)
	{
		document.getElementById("LiveW").innerHTML = "直播服务器设置";
		document.getElementById("ShowUrl").style.display="block";
	}
}
</script>
<%call connclose()%>
</BODY></HTML>
