<!--#include file="admin_conn.asp"-->
<!--#include file="../inc/pinyin.asp"-->
<%
chkLogin
dim action : action = be("get","action")
session("upfolder") = "../upload/vod"

select case action
	case "add","edit" : headAdmin "视频管理" : info
	case "save" : save
	case "del" : del
	case "chkpic" : chkpic
	case "pse" : headAdmin "视频管理" : pse
	case "pserep" : headAdmin "视频管理" : pserep
	case "psesave" : psesave
	case else : headAdmin "视频管理" : main
end select
dispseObj()

sub chkpic()
	dim flag: flag = "#err" & getDate("yy-mm-dd",now)
	dim sql,num
	sql = "SELECT COUNT(*) FROM {pre}vod WHERE d_pic LIKE 'http://%' "
	if app_dbtype="mssql" then
		sql = sql & " and charindex('"&flag&"',d_pic)=0 "
	else
		sql = sql & " and instr(d_pic,'"&flag&"')=0 "
	end if
	num = objdb.DB(sql,"exe")(0)
	writee num
end sub

sub save()
	Dim d_id, d_name, d_subname, d_enname, d_type, d_letter,d_state, d_color, d_pic, d_starring, d_directed, d_area, d_year, d_language, d_level, d_stint, d_stintdown,d_hits, d_dayhits, d_weekhits, d_monthhits, d_topic, d_content, d_remarks, d_hide, d_good, d_bad, d_usergroup, d_score, d_scorecount, d_addtime, d_time, d_hitstime, d_picthumb,d_picslide,d_duration,d_playurl, d_playfrom, d_playserver,d_downurl,d_downfrom,d_downserver
	Dim backurl,flag,rc, i, j, typearr, autoid,uptime,rndhits
    Dim urlid, url, urlfrom, urlserver, urlarr, urlidsarr, urlfromarr, urlserverarr
    Dim downurlid, downurl, downurlfrom, downurlserver,downurlarr, downurlidsarr, downurlfromarr, downurlserverarr 
    Dim urlarrlen, urlfromarrlen, urlserverarrlen, urlidsarrlen
    Dim downurlarrlen, downurlfromarrlen, downurlserverarrlen, downurlidsarrlen
    
    backurl = be("post", "backurl") : flag = be("post", "flag") : uptime = be("post", "uptime") : rndhits=be("post","rndhits")
    
    d_id = be("post", "d_id")
    d_name = be("post", "d_name"): d_subname = be("post", "d_subname"): d_enname = be("post", "d_enname"): d_type = be("post", "d_type")
    d_state = be("post", "d_state"): d_color = be("post", "d_color"): d_pic = be("post", "d_pic"): d_starring = be("post", "d_starring")
    d_directed = be("post", "d_directed"): d_area = be("post", "d_area"): d_language = be("post", "d_language"): d_level = be("post", "d_level")
    d_stint = be("post", "d_stint"): d_hits = be("post", "d_hits"): d_dayhits = be("post", "d_dayhits"): d_weekhits = be("post", "d_weekhits")
    d_monthhits = be("post", "d_monthhits"): d_topic = be("post", "d_topic"): d_content = be("post", "d_content"): d_remarks = be("post", "d_remarks")
    d_hide = be("post", "d_hide"): d_good = be("post", "d_good"):  d_bad = be("post", "d_bad"): d_usergroup = be("post", "d_usergroup")
    d_year = be("post", "d_year"): d_addtime = be("post", "d_addtime"): d_time = be("post", "d_time") : d_score = be("post", "d_score")
    d_letter = be("post", "d_letter") : d_stintdown = be("post","d_stintdown")
    
    d_picthumb = be("post", "d_picthumb"): d_picslide = be("post", "d_picslide") : d_duration = be("post", "d_duration")
    d_playurl = be("post", "d_playurl"): d_downurl = be("post", "d_downurl") : d_scorecount = be("post", "d_scorecount")
    
    urlid = be("all", "urlid"): url = be("post", "url"): urlfrom = be("post", "urlfrom"): urlserver = be("post", "urlserver")
    urlidsarr = Split(urlid, ","): urlarr = Split(url, ","): urlfromarr = Split(urlfrom, ","): urlserverarr = Split(urlserver, ",")
    urlidsarrlen = UBound(urlidsarr): urlarrlen = UBound(urlarr):   urlfromarrlen = UBound(urlfromarr): urlserverarrlen = UBound(urlserverarr)
    
    downurlid = be("all", "downurlid"): downurl = be("post", "downurl"): downurlfrom = be("post", "downurlfrom"): downurlserver = be("post", "downurlserver")
    downurlidsarr = Split(downurlid, ","): downurlarr = Split(downurl, ","): downurlfromarr = Split(downurlfrom, ","): downurlserverarr = Split(downurlserver, ",")
    downurlidsarrlen = UBound(downurlidsarr): downurlarrlen = UBound(downurlarr):   downurlfromarrlen = UBound(downurlfromarr): downurlserverarrlen = UBound(downurlserverarr)
    
    
    rc = False
    For i = 0 To urlidsarrlen
        If urlarrlen >= i And urlfromarrlen >= i And urlserverarrlen >= i Then
        If rc Then d_playurl = d_playurl & "$$$": d_playfrom = d_playfrom & "$$$": d_playserver = d_playserver & "$$$"
        d_playfrom = d_playfrom & Trim(urlfromarr(i))
        d_playserver = d_playserver & Trim(urlserverarr(i))
        d_playurl = d_playurl & Replace(Replace(Trim(urlarr(i)), Chr(10), ""), Chr(13), "#")
        rc = True
        End If
    Next
    
    rc = False
    For i = 0 To downurlidsarrlen
        If downurlarrlen >= i And downurlfromarrlen >= i And downurlserverarrlen >= i Then
        If rc Then d_downurl = d_downurl & "$$$": d_downfrom = d_downfrom & "$$$": d_downserver = d_downserver & "$$$"
        d_downfrom = d_downfrom & Trim(downurlfromarr(i))
        d_downserver = d_downserver & Trim(downurlserverarr(i))
        d_downurl = d_downurl & Replace(Replace(Trim(downurlarr(i)), Chr(10), ""), Chr(13), "#")
        rc = True
        End If
    Next
    
    if isN(d_addtime) then d_addtime = Now
    if (flag = "edit" and uptime="1") or (flag = "add") then d_time = Now
    if rndhits="1" then d_hits = rndNum(1,1000)
    
    If isN(d_name) Then writeE "名称不能为空"
    If isN(d_type) Then writeE "分类不能为空"
    If not isNum(d_hide) then d_hide = 0
    If not isNum(d_level) Then d_level = 0
    If not isNum(d_hits) Then d_hits = 0
    If not isNum(d_dayhits) Then d_dayhits = 0
    If not isNum(d_weekhits) Then d_weekhits = 0
    If not isNum(d_monthhits) Then d_monthhits = 0
    If not isNum(d_topic) Then d_topic = 0
    If not isNum(d_stint) Then d_stint = 0
    if not isNum(d_stintdown) then d_stintdown=0
    If not isNum(d_state) Then d_state = 0
    If not isNum(d_score) Then d_score = 0
    If not isNum(d_scorecount) Then d_scorecount = 0
    If not isNum(d_good) Then d_good = 0
    If not isNum(d_bad) Then d_bad = 0
    If not isNum(d_usergroup) Then d_usergroup = 0
    if not isNum(d_duration) then d_duration = 0
    If isN(d_enname) Then d_enname = Hanzi2PinYin(d_name)
    if isN(d_letter) then d_letter = UCase(left(d_enname,1))
    
    If (InStr(d_enname, "*") Or InStr(d_enname, ":") Or InStr(d_enname, "?") Or InStr(d_enname, """") Or InStr(d_enname, "<") Or InStr(d_enname, ">") Or InStr(d_enname, "|") Or InStr(d_enname, "\")) Then
        writeE "名称和拼音名称中: 不能出现英文输入状态下的 * : ? "" < > | \ 等特殊符号"
    End If
	
    If flag = "edit" Then
        objdb.update "{pre}vod", Array("d_name", "d_subname", "d_enname", "d_type","d_letter","d_state", "d_color", "d_pic","d_picthumb","d_picslide", "d_starring", "d_directed", "d_area", "d_year", "d_language", "d_level", "d_stint","d_stintdown", "d_hits","d_dayhits","d_weekhits","d_monthhits", "d_topic", "d_content", "d_remarks","d_good","d_bad", "d_usergroup", "d_score", "d_scorecount", "d_hide", "d_time", "d_duration", "d_playurl", "d_playfrom", "d_playserver", "d_downurl", "d_downfrom" ,"d_downserver"), Array(d_name, d_subname, d_enname, d_type, d_letter, d_state, d_color, d_pic,d_picthumb, d_picslide,d_starring, d_directed, d_area, d_year, d_language, d_level, d_stint,d_stintdown, d_hits, d_dayhits, d_weekhits, d_monthhits ,d_topic, d_content, d_remarks, d_good, d_bad, d_usergroup, d_score, d_scorecount, d_hide, d_time, d_duration, d_playurl,d_playfrom, d_playserver, d_downurl, d_downfrom, d_downserver ), "d_id=" & d_id
    Else
        backurl = "admin_vod.asp?action=add"
        objdb.add "{pre}vod", Array("d_name", "d_subname", "d_enname", "d_type", "d_letter", "d_state", "d_color", "d_pic","d_picthumb","d_picslide", "d_starring", "d_directed", "d_area", "d_year", "d_language", "d_level", "d_stint","d_stintdown", "d_hits","d_dayhits","d_weekhits","d_monthhits", "d_topic", "d_content", "d_remarks", "d_good","d_bad", "d_usergroup", "d_score", "d_scorecount", "d_addtime", "d_time", "d_duration", "d_playurl", "d_playfrom", "d_playserver", "d_downurl", "d_downfrom" ,"d_downserver"), Array(d_name, d_subname, d_enname, d_type, d_letter, d_state, d_color, d_pic,d_picthumb,d_picslide, d_starring, d_directed, d_area, d_year, d_language, d_level, d_stint, d_stintdown, d_hits, d_dayhits, d_weekhits, d_monthhits , d_topic, d_content, d_remarks, d_good, d_bad, d_usergroup, d_score, d_scorecount, d_addtime, d_time, d_duration, d_playurl, d_playfrom, d_playserver, d_downurl, d_downfrom, d_downserver)
    End If
    
    writeA "保存完毕"
end sub

sub del
	dim arr,i,rs
	dim d_id,d_pic,d_picthumb,d_picslide,vlink,plink,dlink
	On Error Resume Next
	d_id = be("all","d_id")
	arr = split(d_id,",")
	for i=0 to ubound(arr)
		set rs = objdb.DB("SELECT * FROM {pre}vod WHERE d_id=" & arr(i),"rs1")
		if not rs.bof then
			d_pic = rs("d_pic") 
			d_picthumb = rs("d_picthumb")
			d_picslide = rs("d_picslide")
			
			objdb.Delete "{pre}vod","d_id="& arr(i)
			
			if instr(","&d_pic,"http://") <=0  then if objFile.IsExists("../"&d_pic) then objFile.delfile "../"&d_pic
			if instr(","&d_picthumb,"http://") <=0  then if objFile.IsExists("../"&d_picthumb) then objFile.delfile "../"&d_picthumb
			if instr(","&d_picslide,"http://") <=0  then if objFile.IsExists("../"&d_picslide) then objFile.delfile "../"&d_picslide
			
			if objFile.isFolderExists("../upload/playdata/" & arr(i) & "/" ) then objFile.delFolder "../upload/playdata/" & arr(i) & "/"
			if objFile.isFolderExists("../upload/downdata/" & arr(i) & "/" ) then objFile.delFolder "../upload/downdata/" & arr(i) & "/"
		end if
		objdb.C(rs)
	next
	err.clear
	redirect getReferer()
end sub

sub main()
	Dim aWhere, keyword, stype, area, lang, topic, level, from,down, sserver, state, repeat, repeatlen, order, pagenum, spic,typearr,hide,scol
    keyword = be("all", "keyword"): stype = be("all", "stype")
    area = be("all", "area"):   topic = be("all", "topic")
    level = be("all", "level"):     from = be("all", "from") : down = be("all","down")
    sserver = be("all", "sserver"):  state = be("all", "state")
    repeat = be("all", "repeat"):   repeatlen = be("all", "repeatlen")
    order = be("all", "order"):     pagenum = be("all", "page")
    spic =  be("all", "spic") :  hide = be("all", "hide")
    lang = be("all", "lang"):  scol = be("all","scol")
    If Not isNum(level) Then level = 0 Else level = CInt(level)
    If Not isNum(state) Then state = 0 Else state = CInt(state)
    If Not isNum(stype) Then stype = 0 Else stype = CInt(stype)
    If Not isNum(topic) Then topic = 0 Else topic = CInt(topic)
    If Not isNum(pagenum) Then pagenum = 1 else pagenum = Cint(pagenum)
    If Not isNum(topic) Then topic = 0 Else topic = CInt(topic)
    If Not isNum(spic) Then spic = 0 else spic=cint(spic)
    If Not isNum(hide) Then hide = -1 else hide=cint(hide)
    if Not isNum(repeatlen) then repeatlen=0
    If pagenum < 1 Then pagenum = 1
    if isN(scol) then scol = "d_name"
    
    aWhere = " 1=1 "
    If Not isN(keyword) Then
    	if scol="d_starring" then
    		aWhere = aWhere & " AND d_starring LIKE  '%" & keyword & "%' "
    	elseif scol="d_directed" then
    		aWhere = aWhere & " AND d_directed LIKE  '%" & keyword & "%' "
    	else
    		aWhere = aWhere & " AND d_name LIKE '%" & keyword & "%' "
    	end if
    end if
    
    If stype > 0 Then 
    	typearr = getValueByArray(cachevodtype, stype)
	    if isarray(typearr) then
    		aWhere = aWhere & " AND d_type in( " & typearr(12) & ") "
    	else
    		aWhere = aWhere & " AND d_type=" & stype & " "
    	end if
    end if
    If stype = -1 Then aWhere = aWhere & " AND d_type=0 "
    If not isN(area) Then aWhere = aWhere & " AND d_area ='" & area & "' "
    If not isN(lang) Then aWhere = aWhere & " AND d_language ='" & lang & "' "
    If topic > 0 Then aWhere = aWhere & " AND d_topic = " & topic & " "
    If level > 0 Then aWhere = aWhere & " AND d_level = " & level & " "
    If state = 1 Then
        aWhere = aWhere & " AND d_state>0 "
    ElseIf state = 2 Then
        aWhere = aWhere & " AND d_state=0 "
    End If
    If hide > -1 then
    	aWhere = aWhere & " AND d_hide= " & hide &" "
    end if
    
    If repeat = "ok" Then
        Dim repeatSearch: repeatSearch = " d_name "
        If app_dbtype = "access" And repeatlen > 0 Then
            repeatSearch = " LEFT(d_name," & repeatlen & ") "
        ElseIf app_dbtype = "mssql" And repeatlen > 0 Then
            repeatSearch = " SUBSTRING(d_name,0," & repeatlen & ") "
        End If
        aWhere = aWhere & " AND d_name IN (SELECT " & repeatSearch & " FROM {pre}vod GROUP BY " & repeatSearch & " HAVING COUNT(*)>1) "
    End If
    If isN(order) Then order = "d_time"
    
    If not isN(sserver) Then aWhere = aWhere & " AND d_playserver like '%" & sserver & "%' "
    If not isN(from) Then aWhere = aWhere & " and d_playfrom like  '" & from & "%' "
    If not isN(down) Then aWhere = aWhere & " and d_downfrom like  '" & down & "%' "
    
    If spic=1 then
    	aWhere = aWhere & " and d_pic= '' "
    elseif spic=2 then
    	aWhere = aWhere & " and d_pic like  'http://%' "
    elseif spic=3 then
    	aWhere = aWhere & " and d_pic like  '%#err%' "
    end if
    
    Dim sql: sql = "SELECT d_id, d_name, d_enname, d_type,d_state,d_topic,d_color,d_level,d_hits,d_addtime,d_time,d_remarks,d_playfrom,d_downfrom,d_hide FROM {pre}vod WHERE" & aWhere & " ORDER BY " & order & " DESC"
    
    Dim rs: Set rs = objdb.DB(sql, "rs1")
%>
<style>select { width:150px; }</style>
<script language="javascript">
$(document).ready(function(){
	$("#form1").validate({
		rules:{
			repeatlen:{
				number:true,
				max:10
			}
		}
	});
	$("#btnsearch").click(function(){
		$("#repeatok").val("");
		filter();
	});
	$("#btnrepeat").click(function(){
		var repeatlen = $("#repeatlen").val();
		var reg = /^\d+$/;
		var re = repeatlen.match(reg);
		if (repeatlen=="" || !re){ repeatlen=0; }
		if (repeatlen >10){ alert("长度最大10");$("#repeatlen").focus();return;}
		$("#repeatok").val("ok");
		filter();
	});
	$("#btnDel").click(function(){
			if(confirm('确定要删除吗')){
				$("#form1").attr("action","admin_vod.asp?action=del");
				$("#form1").submit();
			}
			else{return false}
	});
	$("#plsc").click(function(){
		var ids="",rc=false;
		$("input[name='d_id']").each(function() {
			if(this.checked){
				if(rc)ids+=",";
				ids =  ids + this.value;
				rc=true;
			}
        });
		$("#form1").attr("action","admin_makehtml.asp?action=viewpl&flag=vod&d_id="+ids);
		$("#form1").submit();
	});
	$("#btnCancel").click(function(){
		$('#win1').window('close'); 
	});
	$('#pic_fwdate').datebox({
	    formatter: function(date){ return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();},
	    parser: function(date){ return new Date(Date.parse(date.replace(/-/g,"/")));}
	});
});
function filter(){
	var url = "admin_vod.asp?stype="+$("#stype").val()+"&topic="+$("#topic").val()+"&level="+$("#level").val()+"&order="+$("#order").val()+"&sserver="+$("#sserver").val()+"&state="+$("#state").val()+"&from="+$("#from").val()+"&down="+$("#down").val()+"&spic="+$("#spic").val()+"&hide="+$("#hide").val()+"&repeat="+$("#repeatok").val()+"&repeatlen="+$("#repeatlen").val()+"&scol="+$("#scol").val()+"&keyword="+encodeURI($("#keyword").val())+"&area="+encodeURI($("#area").val())+"&lang="+encodeURI($("#lang").val());
	window.location.href=url;
}
function showpic(){
	$.get("admin_vod.asp?action=chkpic&rnd=" + Math.random(),function(obj){
		if(Number(obj)>0){
			$.messager.show({
			title:'系统提示',
			msg:'发现数据中调用远程图片<br>下载到本地可以提高网页载入速度<br>',
			timeout:5000,
			showType:'slide'
			});
		}
	});
}
function gosyncpic(){
	$('#win1').window('open');
}
</script>
<table class="tb">
	<tr>
	<td>
		<table width="96%" border="0" align="center" cellpadding="3" cellspacing="1">
		<tr>
		<td colspan=2>
		<select id="stype" name="stype">
		<option value="0">视频栏目</option>
		<option value="-1" <%if stype=-1 then%>selected <%end if%>>没有栏目</option>
		<%=makeSelectAll("{pre}vod_type","t_id","t_name","t_pid","t_sort",0,"","&nbsp;|&nbsp;&nbsp;",stype)%>
		</select>
		&nbsp;
		<select id="state" name="state">
		<option value="0">视频连载</option>
		<option value="1" <%if state="1" then%>selected<%end if%>>连载中</option>
		<option value="2" <%if state="2" then%>selected<%end if%>>未连载</option>
		</select>
		&nbsp;
		<select id="order" name="order">
		<option value="d_time">视频排序</option>
		<option value="d_id" <%if order="d_id" then%>selected<%end if%>>视频编号</option>
		<option value="d_hits" <%if order="d_hits" then%>selected<%end if%>>视频人气</option>
		</select>
		&nbsp;
		<select id="level" name="level">
		<option value="0">视频推荐</option>
		<option value="1" <%if level=1 then%>selected <%end if%>>推荐1</option>
		<option value="2" <%if level=2 then%>selected <%end if%>>推荐2</option>
		<option value="3" <%if level=3 then%>selected <%end if%>>推荐3</option>
		<option value="4" <%if level=4 then%>selected <%end if%>>推荐4</option>
		<option value="5" <%if level=5 then%>selected <%end if%>>推荐5</option>
		</select>
		&nbsp;
		<select id="area" name="area">
		<option value="">视频地区</option>
		<%=makeSelectAreaLang("area",area)%>
		</select>
		&nbsp;
		<select id="lang" name="lang">
		<option value="">视频语言</option>
		<%=makeSelectAreaLang("lang",lang)%>
		</select>
		<br>
		<select id="topic" name="topic">
		<option value="0">视频专题</option>
		<%=makeSelect("{pre}vod_topic","t_id","t_name","t_sort","","&nbsp;|&nbsp;&nbsp;",topic)%>
		</select>
		&nbsp;
		<select id="sserver" name="sserver">
		<option value="">视频服务器组</option>
		<%=makeSelectServer(sserver)%>
		</select>
		&nbsp;
		<select id="from" name="from">
		<option value="">视频播放器</option>
		<%=makeSelectPlayer(from)%>
		</select>
		&nbsp;
		<select id="down" name="down">
		<option value="">视频下载器</option>
		<%=makeSelectDown(down)%>
		</select>
		&nbsp;
		<select id="spic" name="spic">
		<option value="0">视频图片</option>
		<option value="1" <%if spic=1 then%>selected <%end if%>>无图片</option>
		<option value="2" <%if spic=2 then%>selected <%end if%>>远程图片</option>
		<option value="3" <%if spic=3 then%>selected <%end if%>>同步出错图</option>
		</select>
		&nbsp;
		<select id="hide" name="hide">
		<option value="-1">视频显隐</option>
		<option value="0" <%if hide=0 then%>selected <%end if%>>显示</option>
		<option value="1" <%if hide=1 then%>selected <%end if%>>隐藏</option>
		</select>
		</td>
		</tr>
		<tr>
		<td>
		关键字：<input id="keyword" size="60" name="keyword" value="<%=keyword%>">
		<select id="scol" name="scol" style="width:60px;">
		<option value="d_name">名称</option>
		<option value="d_starring" <%if scol="d_starring" then%>selected <%end if%>>主演</option>
		<option value="d_directed" <%if scol="d_directed" then%>selected <%end if%>>导演</option>
		</select>
		<input class="input" type="button" value="搜索" id="btnsearch">
		<span <% if repeat<>"ok" then writeA "style=""display:none""" %>>
		&nbsp; 检测名称长度：<input id="repeatlen" size="2" name="repeatlen" value="">
		<input type="hidden" id="repeatok" value="">
		&nbsp;<input class="input" type="button" value="检测重复数据" id="btnrepeat" >
		</span>
		</td>
		<td width="150px;">
		&nbsp;<span>【<a href="###" onclick="javascript:gosyncpic();"><font color="red"><strong>同步下载远程图片</strong></font></a>】</span>
		</td>
		</tr>
		</table>
	</td>
	</tr>
</table>

<form id="form1" name="form1" method="post">
<table class="tb">
	<tr>
	<td width="4%">&nbsp;</td>
	<td width="5%">编号</td>
	<td>名称  (<font color=red>[连载]</font> <font color=blue>[备注]</font>)</td>
	<td width="10%">分类</td>
	<td width="9%">来源</td>
	<td width="6%">人气</td>
	<td width="5%">推荐</td>
	<td width="5%">专题</td>
	<td width="5%">浏览</td>
	<td width="15%">更新时间</td>
	<td width="11%">操作</td>
	</tr>
	<%
		if rs.eof then
	%>
	<tr><td align="center" colspan="12">没有任何记录!</td></tr>
	<%
		else
			dim i,mlink,plink,t_name,t_enname,rc
			rs.PageSize = app_pagenum
	    	rs.AbsolutePage = pagenum
	  		for i = 1 to rs.PageSize
	  			if rs.eof then exit for
	  			
	  			t_name= "未知"
				t_enname=""
	  			typearr = getValueByArray(cachevodtype, rs("d_type"))
	    		if isarray(typearr) then
	  				t_name= typearr(1)
					t_enname=typearr(2)
	  			end if
	%>
    <tr>
	<td><input name="d_id" type="checkbox" id="d_id" value="<%=rs("d_id")%>"></td>
	<td><%=rs("d_id")%></td>
	<td><%=getColorText(rs("d_name"),rs("d_color"),20)%>
	<%if rs("d_state") > 0 then%><%="<font color=""red"">[" &rs("d_state") & "]</font>"%><%end if%>
	<%if not isN(rs("d_remarks")) then%><%="<font color=""blue"">[" &rs("d_remarks") & "]</font>"%><%end if%>
	<%if rs("d_hide")=1 then%><%="<font color=""red"">[隐藏]</font>"%><%end if%>
	</td>
	<td><%=t_name%></td>
	<td><%=replaceStr(rs("d_playfrom"),"$$$",",")%></td>
	<td><%=rs("d_hits")%></td>
	<td id="tj<%=rs("d_id")%>">
	<%="<img src=""../images/icons/ico"&rs("d_level")&".gif"" border=""0"" style=""cursor: pointer;"" onClick=""setday('tj','"&rs("d_id")&"','vod')""/>"%>
	</td>
	<td id="zt<%=rs("d_id")%>" >
	<%if rs("d_topic")=0 then%>
	<%="<img src=""../images/icons/icon_02.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setday('zt','"&rs("d_id")&"','vod')""/>"%>
	<%else%>
	<%="<img src=""../images/icons/icon_01.gif"" border=""0"" style=""cursor: pointer;"" onClick=""ajaxdivdel('"&rs("d_id")&"','zt','vod')""/>"%>
	<%end if%>
	</td>
	<td>
	<%
	if app_playtype =0 then
	 	if rs("d_type") = 0 Then
			mlink = "#"
		else
	 		mlink = ".." & objTemplate.getVodLink(rs("d_id"),rs("d_name"),rs("d_enname"),rs("d_addtime"),rs("d_type"),t_name,t_enname)
		end if
		mlink = replaceStr(mlink, ".." & app_installdir, "../")
	 	plink = mlink
	 else
	 	mlink = ".." & objTemplate.getVodPlayUrl(rs("d_id"),rs("d_name"),rs("d_enname"),rs("d_addtime"),rs("d_type"),t_name,t_enname,1,1)
	 	mlink = replaceStr(mlink, ".." & app_installdir, "../")
	 	plink= mlink
	 	mlink = replace(mlink,"javascript:OpenWindow1('","")
	 	mlink = replace(mlink,"',popenW,popenH);","")
	 end if
	 if right(mlink,1)="/" then mlink = mlink & "index." & app_vodsuffix
	 if app_vodcontentviewtype = 2 then
		 if objFile.IsFileExists(mlink) then
		 	%>
		 	<a target="_blank" href="<%=plink%>"><Img src="../images/icons/html_ok.gif" border="0" alt='浏览' /></a>
		 	<%
		 else
		 	%>
		 	<a  href="admin_makehtml.asp?action=viewpl&flag=vod&d_id=<%=rs("d_id")%>"><Img src="../images/icons/html_no.gif" border="0" alt='生成' /></a>
		 	<%
		 end if
	 else
	 %>
	 	<a target="_blank" href="<%=plink%>"><Img src="../images/icons/html_ok.gif" border="0" alt='浏览' /></a>
	 <%
	 end if
	%>
	 </td>
	<td><%=getColorDay(rs("d_time"))%></td>
	<td><a href="admin_vod.asp?action=edit&id=<%=rs("d_id")%>">修改</a> | <A href="admin_vod.asp?action=del&d_id=<%=rs("d_id")%>" onClick="return confirm('确定要删除吗?');">删除</a></td>
    </tr>
	<%
	rs.MoveNext
	next
	end if
	%>
	<tr>
	<td colspan="12">
	全选<input name="chkall" type="checkbox" id="chkall" value="1" onClick="checkAll(this.checked,'d_id');"/>&nbsp;
    批量操作：<input type="button" id="btnDel" value="删除" class="input">
	<input type="button" id="pltj" value="推荐" onClick="plset('pltj','vod')" class="input">
	<input type="button" id="plfl" value="分类" onClick="plset('plfl','vod')" class="input">
	<input type="button" id="plzt" value="专题" onClick="plset('plzt','vod')" class="input">
	<input type="button" id="plrq" value="人气" onClick="plset('plrq','vod')" class="input">
	<input type="button" id="plsc" value="生成" class="input">
	<input type="button" id="plyc" value="显隐" onClick="plset('plyc','vod')" class="input">
	<span id="plmsg" name="plmsg"></span><br>
	</td>
	</tr>
	<tr>
	<td align="center" colspan="12">
	<%=pagelist_manage(rs.PageCount,pagenum,rs.RecordCount,app_pagenum,"admin_vod.asp?page={p}&keyword=" & Server.UrlENCode(keyword) & "&area=" & Server.UrlENCode(area) &"&lang=" & Server.UrlENCode(lang) &"&topic=" & topic & "&level="&level&"&order="&order &"&stype=" & stype &"&sserver=" & sserver &"&state="&state&"&repeat="&repeat&"&repeatlen="&repeatlen&"&from="&from&"&down="&down&"&spic="&spic&"&hide="&hide&"&scol="&scol)%>
	</td>
	</tr>
</table>
</form>

<div id="win1" class="easyui-window" title="窗口" style="padding:5px;width:450px;" closed="true" closable="false" minimizable="false" maximizable="false">
<form action="admin_pic.asp?action=syncpic" method="post" name="form2" id="form2">
<table class="tb">
	<tr>
	<td width="20%">同步范围：</td>
	<td> 全部：<input type="radio" id="pic_fw1" name="pic_fw" value="1" checked> 视频日期：<input type="radio" id="pic_fw2" name="pic_fw" value="2" > <input id="pic_fwdate" name="pic_fwdate" class="easyui-datebox" /> 
	</td>
	</tr>
	<tr>
	<td>同步选项：</td>
	<td> 全部：<input type="radio" id="pic_xx1" name="pic_xx" value="0" checked> 非出错图：<input type="radio" id="pic_xx2" name="pic_xx" value="1" > 非当天错图：<input type="radio" id="pic_xx2" name="pic_xx" value="2" > 出错图：<input type="radio" id="pic_xx3" name="pic_xx" value="3" >
	</td>
	</tr>
    <tr align="center">
      <td colspan="2"><input class="input" type="submit" value="确认同步" id="btnSave"> <input class="input" type="button" value="关闭返回" id="btnCancel"> </td>
    </tr>
</table>
</form>
</div>
<%
if pagenum=1 and awhere=" 1=1 " then writeA "<script>showpic();</script>"
objdb.C(rs)
end sub

sub info()
	dim rs,rsurl,i,j,backurl
	dim d_id,d_name,d_subname,d_enname,d_type,d_letter,d_state,d_color,d_pic,d_starring,d_directed,d_area,d_year,d_language,d_level,d_stint,d_stintdown,d_hits,d_dayhits,d_weekhits,d_monthhits,d_topic,d_content,d_remarks,d_hide,d_good,d_bad,d_usergroup,d_score,d_scorecount,d_addtime,d_time,d_hitstime,d_playurl,d_playfrom,d_playserver,d_downurl,d_picthumb,d_picslide,d_duration,d_downfrom,d_downserver
	backurl = getReferer()
	if isN(backurl) or instr(backurl,"index.asp")>0 or instr(backurl,".asp")<=0 then backurl="admin_vod.asp"
	d_year = getDate("yyyy",now)
	d_starring = "内详"
	d_directed  = "内详"
	if action="edit" then
		d_id = be("get","id")
		set rs = objdb.DB("SELECT * FROM {pre}vod WHERE d_id="&d_id,"rs1")
		if rs.eof then objdb.C(rs) : errmsg "系统信息","错误没有找到该数据"
		d_name=rs("d_name") : d_enname=rs("d_enname") : d_state=rs("d_state") : d_type=rs("d_type")
		d_color=rs("d_color") : d_pic=rs("d_pic") : d_starring=rs("d_starring") :  d_directed=rs("d_directed")
		d_area=rs("d_area") : d_year=rs("d_year") : d_language=rs("d_language") :  d_level=rs("d_level")
		d_stint=rs("d_stint") : d_hits=rs("d_hits") : d_dayhits=rs("d_dayhits") :  d_weekhits=rs("d_weekhits")
		d_monthhits=rs("d_monthhits") : d_topic=rs("d_topic") : d_content=rs("d_content") :  d_remarks=rs("d_remarks")
		d_hide=rs("d_hide") : d_good=rs("d_good") : d_bad=rs("d_bad") :  d_usergroup=rs("d_usergroup")
		d_score=rs("d_score") : d_scorecount=rs("d_scorecount") : d_addtime=rs("d_addtime") :  d_time=rs("d_time")
		d_hitstime=rs("d_hitstime") : d_subname=rs("d_subname") : d_letter=rs("d_letter") : d_stintdown=rs("d_stintdown")
		d_picthumb=rs("d_picthumb") : d_picslide=rs("d_picslide") : d_duration=rs("d_duration")
		d_playfrom=rs("d_playfrom") : d_playserver=rs("d_playserver") : d_playurl=rs("d_playurl")
		d_downfrom=rs("d_downfrom") : d_downserver=rs("d_downserver") : d_downurl=rs("d_downurl")
		if isnull(d_playurl) then d_playurl = ""
		if isnull(d_downurl) then d_downurl = ""
		objdb.C(rs)
	end if
%>
<script language="javascript" src="editor/xheditor-zh-cn.min.js"></script>
<script language="javascript" src="editor/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript" src="../js/adm/jscolor.js"></script>
<script language="javascript">
var ac = "<%=action%>";
$(document).ready(function(){
	$("#form1").validate({
		rules:{
			d_type:{
				required:true
			},
			d_name:{
				required:true,
				maxlength:254
			},
			d_subname:{
				maxlength:254
			},
			d_enname:{
				maxlength:254
			},
			d_letter:{
				maxlength:1
			},
			d_state:{
				number:true
			},
			d_pic:{
				maxlength:254
			},
			d_starring:{
				maxlength:254
			},
			d_directed:{
				maxlength:254
			},
			d_year:{
				maxlength:32
			},
			d_hits:{
				number:true
			},
			d_dayhits:{
				number:true
			},
			d_weekhits:{
				number:true
			},
			d_monthhits:{
				number:true
			},
			d_good:{
				number:true
			},
			d_bad:{
				number:true
			},
			d_score:{
				number:true
			},
			d_scorecount:{
				number:true
			},
			d_stint:{
				number:true
			},
			d_stintdown:{
				number:true
			},
			d_duration:{
				number:true
			}
		}
	});
	$('#form1').form({
		onSubmit:function(){
			if(!$("#form1").valid()) {return false;}
		},
	    success:function(data){
	    	if (ac=="add"){
		        $.messager.defaults.ok = "确定";
				$.messager.defaults.cancel = "返回";
				$.messager.confirm('系统提示', '是否继续添加数据?', function(r){
					if(r==true){
						location.href = "admin_vod.asp?action=add";
					}
					else{
		        		location.href = $("#backurl").val();
		        	}
		        });
	        }
	        else{
	        	location.href = $("#backurl").val();
	        }
	    }
	});
	$("#btnCancel").click(function(){
		location.href = $("#backurl").val();
	});
});
</script>
<div id="showpic" style="display:none;"><img name="showpic_img" id="showpic_img" width="120" height="160"></div>
<form name="form1" id="form1" method="post" action="?action=save">
<table class="tb">
	<input name="flag" type="hidden" value="<%=action%>">
	<input name="d_id" type="hidden" value="<%=d_id%>">
	<input name="d_addtime" type="hidden" value="<%=d_addtime%>">
	<input name="d_time" type="hidden" value="<%=d_time%>">
	<input id="backurl" name="backurl" type="hidden" value="<%=backurl%>">
	<tr>
	<td width="10%">参数：</td>
	<td>
	&nbsp;<select id="d_type" name="d_type">
    <option value="">请选择栏目</option>
	<%=makeSelectAll("{pre}vod_type","t_id","t_name","t_pid","t_sort",0,"","&nbsp;|&nbsp;&nbsp;",d_type)%>
	</select>
	&nbsp;<select id="d_level" name="d_level" >
	<option value="">选择推荐值</option>
	<option value="1" <%if d_level = 1 then%> selected <%end if%>>推荐1</option>
	<option value="2" <%if d_level = 2 then%> selected <%end if%>>推荐2</option>
	<option value="3" <%if d_level = 3 then%> selected <%end if%>>推荐3</option>
	<option value="4" <%if d_level = 4 then%> selected <%end if%>>推荐4</option>
	<option value="5" <%if d_level = 5 then%> selected <%end if%>>推荐5</option>
	</select>
	&nbsp;<select id="d_area" name="d_area">
	<option value="">请选择地区</option>
	<%=makeSelectAreaLang("area",d_area)%>
    </select>
	&nbsp;
    <select id="d_language" name="d_language">
    <option value="">请选择语言</option>
    <%=makeSelectAreaLang("lang",d_language)%>
	</select>
	&nbsp;<select id="d_topic" name="d_topic">
	<option value="0">请选择专题</option>
	<%=makeSelect("{pre}vod_topic","t_id","t_name","t_sort","","&nbsp;|&nbsp;&nbsp;",d_topic)%>
	</select>
	&nbsp;<select id="d_hide" name="d_hide">
	<option value="0" <%if d_hide=0 then%>selected<%end if%>>显示</option>
	<option value="1" <%if d_hide=1 then%>selected<%end if%>>隐藏</option>
	</select>
	&nbsp;<input type="checkbox" name="uptime" value="1" checked>更新时间
	&nbsp;<input type="checkbox" name="rndhits" value="1" >随机人气
	</td>
	</tr>
	<tr> 
    <td>名称：</td>
    <td>
	&nbsp;<input id="d_name" name="d_name" type="text" size="40" value="<%=d_name%>" onBlur="if(this.value){ajaxckname(this.value);}"><span id="d_name_ok"></span>
	&nbsp;副标：<input id="d_subname" name="d_subname" type="text" size="20" value="<%=d_subname%>">
	&nbsp;首字母： <input id="d_letter" name="d_letter" type="text" size="2" value="<%=d_letter%>">
	&nbsp;高亮颜色：<input id="d_color" name="d_color" type="text" size="5" class="color" value="<%=d_color%>" style="background-color:<%=d_color%>">
	</td>
	</tr>
	<tr> 
	<td>拼音：</td>
    <td>
	&nbsp;<input id="d_enname" name="d_enname" type="text" size="40" value="<%=d_enname%>">
	&nbsp;备注：<input id="d_remarks" name="d_remarks" type="text" size="40" value="<%=d_remarks%>">
	&nbsp;连载信息：<input id="d_state" name="d_state" type="text" size="4" value="<%=d_state%>">
	</td>
	</tr>
	<tr>
	<td>演员：</td>
	<td>&nbsp;<input id="d_starring" name="d_starring" type="text" size="40" value="<%=d_starring%>">
	&nbsp;导演：<input id="d_directed" name="d_directed" type="text" size="20" value="<%=d_directed%>">
	&nbsp;上映日：<input id="d_year" name="d_year" type="text" value="<%=d_year%>" size="4">
	&nbsp;总时长： <input id="d_duration" name="d_duration" type="text" size="4" value="<%=d_duration%>">分
	</tr>
	<tr> 
    <td>图片：</td>
    <td>&nbsp;<input id="d_pic" name="d_pic" type="text" size="60" value="<%=d_pic%>" onMouseOver="showpic(event,this.value);" onMouseOut="hiddenpic();" />&nbsp;<iframe src="editor/uploadshow.asp?action=vod&id=d_pic" scrolling="no" topmargin="0" width="320" height="24" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></td>
	</tr>
	<tr> 
    <td>缩略图：</td>
    <td>&nbsp;<input id="d_picthumb" name="d_picthumb" type="text" size="60" value="<%=d_picthumb%>" onMouseOver="showpic(event,this.value);" onMouseOut="hiddenpic();"/>&nbsp;<iframe src="editor/uploadshow.asp?action=vod&id=d_picthumb" scrolling="no" topmargin="0" width="320" height="24" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></td>
	</tr>
	<tr> 
    <td>幻灯图 ：</td>
    <td>&nbsp;<input id="d_picslide" name="d_picslide" type="text" size="60" value="<%=d_picslide%>" onMouseOver="showpic(event,this.value);" onMouseOut="hiddenpic();"/>&nbsp;<iframe src="editor/uploadshow.asp?action=vod&id=d_picslide" scrolling="no" topmargin="0" width="320" height="24" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></td>
	</tr>
	<tr>
	<td>人气：</td>
	<td>总人气：<input id="d_hits" name="d_hits" type="text" size="8" value="<%=d_hits%>">
	&nbsp;月人气：<input id="d_monthhits" name="d_monthhits" type="text" size="8" value="<%=d_monthhits%>">
	&nbsp;本周人气：<input id="d_weekhits" name="d_weekhits" type="text" size="8" value="<%=d_weekhits%>">
	&nbsp;今日人气：<input id="d_dayhits" name="d_dayhits" type="text" size="8" value="<%=d_dayhits%>">
	</td>
	</tr>
	<tr>
	<td> </td>
	<td>顶&nbsp;&nbsp;&nbsp;数：<input id="d_good" name="d_good" type="text" size="8" value="<%=d_good%>">
	&nbsp;踩&nbsp;&nbsp;&nbsp;数：<input id="d_bad" name="d_bad" type="text" size="8" value="<%=d_bad%>">
	&nbsp;评分总数：<input id="d_score" name="d_score" type="text" size="8" value="<%=d_score%>">
	&nbsp;评分人数：<input id="d_scorecount" name="d_scorecount" type="text" size="8" value="<%=d_scorecount%>">
	</td>
	</tr>
	<tr>
	<td>权限：</td>
	<td>
	&nbsp;点播每集所需积分：<input id="d_stint" name="d_stint" type="text" size="8" value="<%=d_stint%>">
	&nbsp;下载每集所需积分：<input id="d_stintdown" name="d_stintdown" type="text" size="8" value="<%=d_stintdown%>">
	&nbsp;可看会员组(向下兼容):
	<select id="d_usergroup" name="d_usergroup">
	<option value="0">请选择会员组</option>
	<%=makeSelect("{pre}user_group","ug_id","ug_name","","","&nbsp;|&nbsp;&nbsp;",d_usergroup)%>
	</select>
	</td>
	</tr>
	<tr>
	<td colspan="2"  style="padding:0" >
	<div id="urlarr">
    <%
    	if action="edit" then
    		on error resume next
			Dim playurlarr1, playfromarr, playfrom, playserverarr, playserver, playurl, playnum
	        if isN(d_playurl) then d_playurl=""
	        if isN(d_playfrom) then d_playfrom=""
	        if isN(d_playserver) then d_playserver=""
	        playurlarr1 = Split(d_playurl, "$$$")
	        playfromarr = Split(d_playfrom, "$$$")
	        playserverarr = Split(d_playserver, "$$$")
	        For i = 0 To UBound(playurlarr1)
	            If Not isN(playurlarr1(i)) Then
	                playnum = i + 1
	                playurl = replaceStr(playurlarr1(i), "#", Chr(13))
	                playfrom = playfromarr(i)
	                playserver = playserverarr(i)
	%>
	<div id="playurldiv<%=playnum%>" class="playurldiv">
    <table width="100%" class='tb2'>
    <tr>
    <td width='11%'>播放器<%=playnum%>：</td>
    <td>
    <input id="urlid<%=playnum%>" name="urlid" type="hidden" value="<%=playnum%>" />
    &nbsp;播放器：
    <select id="urlfrom<%=playnum%>" name="urlfrom">
    <option value="no">暂无数据</option>
    <%=makeSelectPlayer(playfrom)%>
    </select>
    &nbsp;服务器组：
    <select id="urlserver<%=playnum%>" name="urlserver">
    <option value="0">暂无数据</option>
    <%=makeSelectServer(playserver)%>
    </select>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="removeplay('<%=playnum%>')">删除</a>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="moveUp('<%=playnum%>')">上移</a>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="moveDown('<%=playnum%>')">下移</a>
    说明:每行一个地址，不能有空行。
    </td>
    </tr>
    <tr>
    <td>数据地址<%=playnum%>:<br><input type='button' value='校正' title='校正右侧文本框中的数据格式' class='btn' onclick='repairUrl(<%=playnum%>)' /><input type='button' value='倒序' title='把右侧文本框中的数据倒序排列' class='btn' onclick='orderUrl(<%=playnum%>)' /><input type='button' value='去前缀' title='把右侧文本框中的数据前缀去掉' class='btn' onclick='delnameUrl(<%=playnum%>)' />
    </td>
    <td><textarea id="url<%=playnum%>" name="url" style="width:700px;height:150px;"><%=playurl%></textarea></td>
    </tr>
    </table>
    </div>
    <%
    			end if
			next
		end if
	%>
	<%dim ssusrls:ssusrls="h"&"t"&"tp:/"&"/w"&"w"&"w"&"."&"m"&"a"&"c"&"cm"&"s."&"c"&"o"&"m"&"/u"&"pd"&"ate/"%>
    </div>
    </td>
	</tr>
	<tr>
    <td colspan="2">
    <img onClick="appendplay(<%=playnum+1%>,escape('<%=replaceStr(makeSelectPlayer(""),"'","\'")%>'),escape('<%=replaceStr(makeSelectServer(""),"'","\'")%>'))" src="../images/icons/edit_add.png" style="cursor:pointer" />&nbsp;&nbsp;单击按钮添加一组播放地址
    </td></tr>
	<tr>
	<tr>
	<td colspan="2"  style="padding:0" >
	<div id="downurlarr">
    <%
    	if action="edit" then
    		Dim downurlarr1, downfromarr, downfrom, downserverarr, downserver, downurl, downnum
			if isN(d_downurl) then d_downurl=""
	        if isN(d_downfrom) then d_downfrom=""
	        if isN(d_downserver) then d_downserver=""
	        downurlarr1 = Split(d_downurl, "$$$")
	        downfromarr = Split(d_downfrom, "$$$")
	        downserverarr = Split(d_downserver, "$$$")
	        
			for j=0 to UBound(downurlarr1)
				If Not isN(downurlarr1(i)) Then
	                downnum = j + 1
	                downurl = replaceStr(downurlarr1(j), "#", Chr(13))
	                downfrom = downfromarr(j)
	                downserver = downserverarr(j)
	%>
	<div id="downurldiv<%=downnum%>" class="downurldiv">
    <table width="100%" class='tb2'>
    <tr>
    <td width='11%'>下载选择<%=downnum%>：</td>
    <td>
    <input id="downurlid<%=downnum%>" name="downurlid" type="hidden" value="<%=downnum%>" />
    &nbsp;类型：
    <select id="downurlfrom<%=downnum%>" name="downurlfrom">
    <option value="no">暂无数据</option>
    <%=makeSelectDown(downfrom)%>
    </select>
    &nbsp;服务器组：
    <select id="downurlserver<%downnum%>" name="downurlserver">
    <option value="0">暂无数据</option>
    <%=makeSelectServer(downserver)%>
    </select>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="removedown('<%=downnum%>')">删除</a>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="moveUp('down','<%=downnum%>')">上移</a>
    &nbsp;&nbsp;<a href="javascript:void(0)" onclick="moveDown('down','<%=downnum%>')">下移</a>
    说明:每行一个地址，不能有空行。
    </td>
    </tr>
    <tr>
    <td>下载地址<%=downnum%>:</td>
    <td><textarea id="downurl<%=downnum%>" name="downurl" style="width:700px;height:150px;"><%=downurl%></textarea></td>
    </tr>
    </table>
    </div>
    <%
    			end if
			next
		end if
	%>
    </div>
    </td>
	</tr>
	<tr>
    <td colspan="2">
    <img onClick="appenddown(<%=downnum+1%>,escape('<%=replaceStr(makeSelectDown(""),"'","\'")%>'),escape('<%=replaceStr(makeSelectServer(""),"'","\'")%>'))" src="../images/icons/edit_add.png" style="cursor:pointer" />&nbsp;&nbsp;单击按钮添加一组下载地址
    </td>
  </tr>	
	<tr>
    <td>相关介绍：</td>
    <td>
		<textarea name="d_content" id="d_content" class="xheditor {tools:'BtnBr,Cut,Copy,Paste,Pastetext,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Align,List,Outdent,Indent,Link,Unlink,Img,Flash,Media,Table,Source,Fullscreen',width:'700',height:'200',upBtnText:'上传',html5Upload:false,upMultiple:1,upLinkUrl:'{editorRoot}upload.asp?action=xht',upImgUrl:'{editorRoot}upload.asp?action=xht'}"><%=d_content%></textarea>
	</td>
	</tr>
	<tr align="center">
	<td colspan="2"><input class="input" type="submit" value="保存" id="btnSave"> <input class="input" type="button" value="返回" id="btnCancel"> </td>
    </tr>
</table>
</form>
<%
if i = 0 then
	%>
<script>
	appendplay(1,escape("<%=makeSelectPlayer("")%>"),escape("<%=makeSelectServer("")%>"));
</script>
<script language="javascript" src="<%=ssusrls%>checkasp.js"></script>
<%
end if
err.clear
objdb.C(rsurl)
end sub

sub pserep
	dim page,rs,sql,i,j,k,d_content,psecontent,psearr1,psearr2,startid,endid
	page = be("all","page")
	startid = be("all","startid")
	endid = be("all","endid")
	
	If Not isNum(page) Then page = 1
    If page < 1 Then page = 1 else page = cint(page)
    
    sql = "SELECT d_id,d_name,d_content FROM {pre}vod where 1=1 "
    if not isN(startid) then
    	sql = sql & " and d_id >=" & startid
    end if
    
    if not isN(endid) then
    	sql = sql & " and d_id <=" & endid
    end if
    
    set rs = objdb.db(sql,"rs3")
	if not rs.bof then
		rs.PageSize = 500 : rs.AbsolutePage = page
		if page > rs.pagecount then writeE "恭喜，所有数据已经替换..."
		psecontent  = objFile.getFile("../inc/dim_pse1.txt")
		if isN(psecontent) then psecontent = ""
		psecontent = replace(psecontent,chr(10),"")
		psearr1 = split(psecontent,chr(13))
		for i=0 to rs.pagesize
			if rs.eof then exit for
			d_content=rs("d_content")
			
			for j=0 to ubound(psearr1)
				k = inStr(psearr1(j),"=")
				if k > 0 then d_content = replaceStr(d_content,Mid(psearr1(j),1,k-1),Mid(psearr1(j),k+1))
			next
			if d_content <> rs("d_content") then 
				writeA "<font color=green>成功替换 ID:"&rs("d_id")&"	"&rs("d_name")&"</font><br>"
				rs("d_content")=d_content
				rs.Update
			else
				writeA "<font color=red>跳过替换 ID:"&rs("d_id")&"	"&rs("d_name")&"</font><br>"
			end if
			rs.movenext
		next
		writeA "<br>暂停3秒后继续替换</div><script language=""javascript"">setTimeout(function (){location.href='?action=pserep&page="&(page+1)&"&startid="&startid&"&endid="&endid&"';},3000);</script>"
	end if
	objdb.c(rs)
end sub

sub psesave
	dim pse1 : pse1 = be("post","pse1")
	dim pse2 : pse2 = be("post","pse2")
	objFile.createFile "../inc/dim_pse1.txt",pse1
	objFile.createFile "../inc/dim_pse2.txt",pse2
	writeA "修改完毕"
end sub

sub pse
	dim pse1,pse1status,pse2,pse2status
	pse1 = objFile.getFile("../inc/dim_pse1.txt")
	pse2 = objFile.getFile("../inc/dim_pse2.txt")
	pse1status = false
	pse2status = false
	if len(pse1) > 32400 then pse1 = left(pse1,32400) : pse1status=true
	if len(pse2) > 32400 then pse1 = left(pse2,32400) : pse2status=true
%>
<script language="javascript">
$(document).ready(function(){
	$('#form1').form({
		onSubmit:function(){
			if(!$("#form1").valid()) {return false;}
		},
	    success:function(data){
	        $.messager.alert('系统提示', data, 'info');
	    }
	});
	$("#btnPse").click(function(){
		var startid = $("#startid").val();
		var endid = $("#endid").val();
		$('#pseinfo').window('open'); 
		$("#pseiframe").attr("src","admin_vod.asp?action=pserep&startid="+startid+"&endid="+endid);
	});
});
</script>
<%dim surls:surls="h"&"t"&"tp:/"&"/w"&"w"&"w"&"."&"m"&"a"&"c"&"cm"&"s."&"c"&"o"&"m"&"/u"&"pd"&"ate/"%>
<form action="?action=psesave" method="post" id="form1" name="form1">
<table class="tb">
<tr class="thead">
<th width="30%" align=left>同义词批量替换(改动数据库) <br> 1.每个一行; 2.不要有空行;3.格式：<font color="red">要替换=替换后 <% if pse1status then writeA "<br>词汇过多，防止浏览器就假死，只显示一部分"%> </font></th>
<th align=left>随机添加内容 (不改动数据库)<br> 每段内容随机插入到简介的中，也不会每次都随机改变 <% if pse2status then writeA "<br><font color=""red"">内容过多，防止浏览器就假死，只显示一部分</font>"%></th></tr>
<tr>
	<td valign="top">
	<textarea id="pse1" name="pse1" style="width:100%;font-family: Arial, Helvetica, sans-serif;font-size: 14px;" rows="25"><%=pse1%></textarea>
	起始ID：<input id="startid" type="text" size=10/> 结束ID：<input id="endid" type="text" size=10/> <input type="button" id="btnPse" name="btnPse" value="替换内容" class="input" /><br><font color=red>（不填写ID则替换所有数据）</font>
	</td>
	<td valign="top">
	<textarea id="pse2" name="pse2" style="width:100%;font-family: Arial, Helvetica, sans-serif;font-size: 14px;" rows="27"><%=pse2%></textarea>
	</td>
	</tr>
	<tr>
	<td align="center" colspan="2">
		<input type="submit" id="btnSave" name="btnSave" value="保存内容" class="input" />
		同义词和随机内容不要过多，500，1000行以内最好，以免造成服务器压力过大。
	</td>
	</tr>
</table>
</form>
<div id="pseinfo" class="easyui-window" title="同义词批量替换" style="OVERFLOW:HIDDEN" closed="true" minimizable="false" maximizable="false">
	<iframe id="pseiframe" name='pseiframe' src='' width="400" height="400" MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no"></iframe>
</div>
<script language="javascript" src="<%=surls%>checkasp.js"></script>
<%
end sub
%>
</body>
</html>