<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<%
Dim action,server_id,server_playerid,server_orderid,server_name,server_info,server_typeid,i,html,PlayHtml
action=Trim(Request.QueryString("action"))
server_id=Replace(Trim(Request.Form("server_id")),", ",",")'批量ID
server_typeid=QvodCms_CLng(Request.QueryString("server_typeid"))
server_playerid=QvodCms_CLng(Request.QueryString("server_id"))
'打开数据库连接
Call OpenConn()
if action="edit" Then
    Call server_edit
Else
%><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" />
<script language = "javaScript" src = "QvodCms_All.js" type="text/javascript"></script>
<style type="text/css">input{color: #555}</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name="myform" method="Post" action="?action=edit">
<tr>
<th colspan=5 background="Skins/images/tdbg.gif" class="title">&nbsp;服务器组管理</th>
</tr>
<tr style="text-align:center;">
<td width="42" class="td3">ID</td>
<td width="120" class="td2">来源名称</td>
<td width="75" class="td2">排序</td>
<td width="566" class="td1">来源简介</td>
<td width="172" class="td2">相关操作</td>
</tr><%
	Set rs = Server.CreateObject("adodb.recordset")
	sql = "select * from qvodcms_server order by server_orderid asc"
	rs.Open sql, Conn, 1, 1
	If Not(rs.bof And rs.eof) Then
		Do while not rs.eof
	%>

<tr bgcolor="#FFFFFF" onMouseOver="javascript:this.bgColor='#f1f7f9'" onMouseOut="javascript:this.bgColor='#FFFFFF'">
  <td  class="td3" style="text-align:center;height:28px;"><input name='server_id' type='checkbox' value='<%=rs("server_id")%>' checked="checked" style="border:none"></td>
  <td >&nbsp;<%=rs("server_name")%><input type="hidden" name="playfrom<%=rs("server_id")%>" value="<%=rs("server_name")%>"><input type="hidden" name="playurl<%=rs("server_id")%>" value="<%=rs("server_Url")%>"></td>
  <td  align="center"><input size=5 type="text" name="server_orderid<%=rs("server_id")%>" value="<%=rs("server_orderid")%>"></td>
  <td ><textarea id="server_info<%=rs("server_id")%>" name="server_info<%=rs("server_id")%>" cols="80" rows="2"><%=rs("server_info")%></textarea></td>
  <td class="td1" align="center"><a href="?svinfo=ok&action=edit&server_id=<%=rs("server_id")%>&server_typeid=<%if rs("server_typeid")="0" then:Response.Write "1":else:Response.Write "0":end if%>" title="隐藏或显示&#13;所有数据中的 “<%=rs("server_name")%>” 播放地址"><%if rs("server_typeid")="1" then:Response.Write "<font color=red >来源显示</font>":else:Response.Write "<font color=#008000>来源隐藏</font>":end if%></a></td>
  </tr>
<%
		rs.movenext  
		loop
	Else
		Response.Write("暂未添加任何服务组,请在下方添加！")	 
	End If
	rs.Close
	Set rs=nothing
	%>

<tr>
<th colspan=5><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox' style="border:none">全选</td> <input type="submit" name="submit" value="修改选中项"/></th>
</tr></form>
</table>
</body>
</html>
<%End If
'关闭数据库连接
Call CloseConn()
Sub server_edit
    On Error Resume Next
    Dim svid
	if Request.QueryString("svinfo")="" Then
	  svid=Split(server_id,",")
	  For Each id In svid
	   i=i+1
	   Sql="Update qvodcms_server set server_orderid='"&QvodCms_CLng(Request.Form("server_orderid"&id))&"',server_info='"&Request.Form("server_info"&id)&"' where server_id="&id&""
	   Conn.Execute Sql
	   '''生成配置文件
	       'PlayHtml=""'初始化变量
	       playfrom(id)=QvodCms_Replace(Request.Form("playfrom"&id))
		   playInfo(id)=QvodCms_Replace(Request.Form("server_info"&id))
		   playUrl(id)=QvodCms_Replace(Request.Form("playUrl"&id))
	       PlayHtml=PlayHtml&"PlayFrom("&i&")="""&playfrom(id)&""":PlayInfo("&i&")="""&playInfo(id)&""":PlayUrl("&i&")="""&playUrl(id)&""""&vbcrlf
	   next
	       Call play_edit(PlayHtml,i)
	else
	   Sql="Update qvodcms_server set server_typeid='"&server_typeid&"' where server_id="&server_playerid&""
	   Conn.Execute Sql
	End if    
	Response.Redirect "QvodCms_Player.asp" 	
End Sub

Function play_edit(PlayHtml,i)
	html="<%"&vbcrlf
	html=html&"Dim PlayFrom("&i&"),PlayInfo("&i&"),PlayUrl("&i&"),From_Count:From_Count="&i&""&vbcrlf
	html=html&PlayHtml
	html=html&"%"&">"
	Call MakeHtml("../Cache/QvodCms.Player.asp",html)'生成网站配置文件
End Function
%>
