<%
Class CCAPI_ExternalProgram
	
	Private p_boardid,p_username,p_pwd,p_topic,p_body
	
	Public Function playerStr(sid)
		playerStr="[ccapi sid='"&sid&"'][/ccapi]"
	End Function
	
	Public Function checkIsExistSpecial(specialid)
		dim dvbbs_rs,currenttable
		currenttable=conn.execute("select  Forum_NowUseBBS from dv_setup")(0)
		set dvbbs_rs=Dvbbs.iCreateObject("adodb.recordset")
		dvbbs_rs.open "select announceid,body from "&currenttable&" where boardid<>444",conn,1,1
		do while not dvbbs_rs.eof
			if instr(dvbbs_rs("body"),specialid)>1 then
				checkIsExistSpecial=dvbbs_rs("announceid")
				Exit Function
			end if
			dvbbs_rs.movenext
		loop
		dvbbs_rs.close
		set dvbbs_rs=nothing
		checkIsExistSpecial=false
	End Function
	
	Public Sub setFormValue(boardid,username,pwd,topic,body)
		p_boardid=boardid
		p_username=username
		p_pwd=pwd
		p_topic=topic
		p_body=body
	End Sub
	
	Public Function writeFormStr(formnumber)
		dim str
		str="<form action=""../SavePost.asp?Action=snew&boardid="&p_boardid&""" method=""post"" name=""postform"&formnumber&""" target=""stafrm"" id=""postform"&formnumber&""">"&vbcrlf&_
				"<input name=""username"" type=hidden value="""&p_username&""" /><input name=""passwd"" type=hidden  value="""&p_pwd&"""/>"&vbcrlf&_
				"<input name=""topic"" type=hidden id=""topic""  value="""&p_topic&""" />"&vbcrlf& _
				"<textarea id=""body"" style=""display:none"" name=""body"" >"&p_body&"</textarea>"&vbcrlf& _
			"</form>"
		echo str
	End Function
	
	
	Public Function writeEditFormStr(formnumber)
		dim str
		str="<form action=""../SavePost.asp?Action=sedit&boardid="&p_boardid&""" method=""post"" name=""postform"&formnumber&""" target=""stafrm"" id=""postform"&formnumber&""">"&vbcrlf&_
				"<input name=""username"" type=hidden value="""&p_username&""" /><input name=""passwd"" type=hidden  value="""&p_pwd&"""/>"&vbcrlf&_
				"<input name=""topic"" type=hidden id=""topic""  value="""&p_topic&""" />"&vbcrlf& _
				"<textarea id=""body""style=""display:none"" name=""body"" >"&p_body&"</textarea>"&vbcrlf& _
			"</form>"
		echo str
	End Function
	
	
	Public Sub writeLoadingBar()
		dim str
		str="<style type=""text/css"">"&vbcrlf&_
				"#loading{"&vbcrlf&_
					"width:300px;"&vbcrlf&_
					"background-color:#FF6600;"&vbcrlf&_
					"border:2px solid FF0000;"&vbcrlf&_
				"}"&vbcrlf&_
				"#loadcss {"&vbcrlf&_
					"display:block ; "&vbcrlf&_
					"background-color:#FFCC00;"&vbcrlf&_
					"text-align:center;"&vbcrlf&_
				"}"&vbcrlf&_
			"</style>"&vbcrlf&_
			"<div id=""loading""><strong id=""loadcss""> </strong></div>完成(没有绑定的分类将会忽略):<br /><span id='str'></span>"
		echo str
	End Sub
	
	
	Public Function  writeIfraStr()
		echo "<iframe name=""stafrm"" frameborder=""0"" id=""stafrm"" width=""0"" height=""0""></iframe>"
	End Function


	Public Sub writeJsFun
		dim jsstr
		jsstr="<script>"&vbcrlf&_
		"function start(num,allnum,backurl){"&vbcrlf&_
			"num = parseInt(num);"&vbcrlf&_	
			"var sfrom = document.getElementById('postform'+num);"&vbcrlf&_
			"sfrom.submit();"&vbcrlf&_
			"document.getElementById(""loadcss"").style.width=parseInt(num/allnum*100)+'%';"&vbcrlf&_
			"document.getElementById(""loadcss"").innerHTML='&nbsp';"&vbcrlf&_
			"document.getElementById(""str"").innerHTML=parseInt(num/allnum*100)+'%';"&vbcrlf&_
			"num = num + 1;"&vbcrlf&_
			"if(num > allnum){"&vbcrlf&_
				"alert('全部搞定');"&vbcrlf&_
				"location.href=backurl;"&vbcrlf&_
			"}else{"&vbcrlf&_
				"setTimeout(""start(""+num+"",""+allnum+"",'""+backurl+""')"", 500);"&vbcrlf&_
			"}"&vbcrlf&_
		"}"&vbcrlf&_
		"function start_type(num,allnum,backurl){"&vbcrlf&_
			"num = parseInt(num);"&vbcrlf&_	
			"var sfrom = document.getElementById('postform'+num);"&vbcrlf&_
			"sfrom.submit();"&vbcrlf&_
			"document.getElementById(""loadcss"").style.width=parseInt(num/allnum*100)+'%';"&vbcrlf&_
			"document.getElementById(""loadcss"").innerHTML='&nbsp';"&vbcrlf&_
			"document.getElementById(""str"").innerHTML=parseInt(num/allnum*100)+'%';"&vbcrlf&_
			"num = num + 1;"&vbcrlf&_
			"if(num > allnum){"&vbcrlf&_
				"document.write(""正在读取分页"");"&vbcrlf&_	
				"location.href=backurl;"&vbcrlf&_
			"}else{"&vbcrlf&_
				"setTimeout(""start_type(""+num+"",""+allnum+"",'""+backurl+""')"", 500);"&vbcrlf&_
			"}"&vbcrlf&_
		"}"&vbcrlf&_
		"</script>"
		echo jsstr
	End Sub
	
	
	Public Sub writeJsSubmit(formNumber,backurl)
		echo "<script>start('1','"&formNumber&"','"&backurl&"');</script>"
	End Sub
	
	Public Sub writeTypeJsSubmit(formNumber,backurl)
		echo "<script>start_type('1','"&formNumber&"','"&backurl&"');</script>"
	End Sub
	
End Class

%>