<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p05")
'''''''''''''''''''''''''''''''''''''''''''''''
dim act,s_id
act=request.QueryString("act")
s_id=Cint(request.QueryString("s_id"))
if(s_id>0) then
	dim catalogid,nums,rowtemp,pic,links,texts,i
	set rs=server.createobject("adodb.recordset")
	sql="select * from t_slide where id="&s_id&" order by id desc "
	rs.open sql,conn,3,1
	if not rs.eof then
		catalogid=rs("catalog_id")
		ischild=rs("ischilds")
		nums=rs("s_num")
		s_w=rs("s_width")
		s_h=rs("s_height")
	end if
	rs.close
	set rs=nothing

	'''''''''''''''''''''''''''''''''添加到库''''''''''''''''''''''''''''
	set rs=server.createobject("adodb.recordset")
	sql="select top "&nums&" photo,linkurl,title from news where isslide=1"
	if(catalogid<>0) then
	 sql=sql&" and (classid="&catalogid
	 if(ischild<>0) then
			sql=sql&" or parentid="&catalogid
		end if
		sql=sql&")"
	end if
	
	sql=sql&" order by id desc"
	rs.open sql,conn,3,1
	if not rs.eof then
		rowtemp=rs.GetRows()
	end if
	rs.close
	set rs=nothing
	if(isarray(rowtemp)) then
		for i=0 to ubound(rowtemp,2)
			pic=pic&rowtemp(0,i)
			links=links&rowtemp(1,i)
			texts=texts&rowtemp(2,i)
			if(i<ubound(rowtemp,2)) then
				pic=pic&"|"
				links=links&"|"
				texts=texts&"|"
			end if
		next
	end if
	''''''''''''''''''''''''''''''''''''''''''''
	dim adcont,adfile
	adcont=adcont&"document.write('<div id=""slide_div"&catalogid&"""></div>');"&Chr(10)
	adcont=adcont&"var imgs='"&pic&"';   "&Chr(10) 
	adcont=adcont&"var urls='"&links&"';   "&Chr(10) 
	adcont=adcont&"var titles = '"&texts&"';"&Chr(10)
	adcont=adcont&"var pw = "&s_w&";"&Chr(10)
	adcont=adcont&"var ph = "&s_h&";"&Chr(10)
	adcont=adcont&"var sizes = 12;"&Chr(10)
	adcont=adcont&"var Times = 5000;"&Chr(10)
	adcont=adcont&"var umcolor = 0xFFFFFF;"&Chr(10)
	adcont=adcont&"var btnbg =0xff6600;"&Chr(10)
	adcont=adcont&"var txtcolor =0xFFFFFF;"&Chr(10)
	adcont=adcont&"var txtoutcolor = 0x000000;"&Chr(10)
	adcont=adcont&"var flash = new SWFObject('/flash/slide.swf', 'mymovie', pw, ph, '7', '');"&Chr(10)
	adcont=adcont&"flash.addParam('allowFullScreen', 'true');"&Chr(10)
	adcont=adcont&"flash.addParam('allowScriptAccess', 'always');"&Chr(10)
	adcont=adcont&"flash.addParam('quality', 'high');"&Chr(10)
	adcont=adcont&"flash.addParam('wmode', 'Transparent');"&Chr(10)
	adcont=adcont&"flash.addVariable('pw', pw);"&Chr(10)
	adcont=adcont&"flash.addVariable('ph', ph);"&Chr(10)
	adcont=adcont&"flash.addVariable('sizes', sizes);"&Chr(10)
	adcont=adcont&"flash.addVariable('umcolor', umcolor);"&Chr(10)
	adcont=adcont&"flash.addVariable('btnbg', btnbg);"&Chr(10)
	adcont=adcont&"flash.addVariable('txtcolor', txtcolor);"&Chr(10)
	adcont=adcont&"flash.addVariable('txtoutcolor', txtoutcolor);"&Chr(10)
	adcont=adcont&"flash.addVariable('urls', urls);"&Chr(10)
	adcont=adcont&"flash.addVariable('Times', Times);"&Chr(10)
	adcont=adcont&"flash.addVariable('titles', titles);"&Chr(10)
	adcont=adcont&"flash.addVariable('imgs', imgs);"&Chr(10)
	adcont=adcont&"flash.write('slide_div"&catalogid&"');"&Chr(10)
		
	adfile="slide/"&catalogid&".js"
	Set fs=Server.CreateObject("Scripting.FileSystemObject")
	Set file_w = fs.CreateTextFile(server.mappath("../js/"&adfile),true)		
	file_w.WriteLine(adcont)
	file_w.close
	set file_w=nothing
	set fs=nothing
	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	response.Write("成功发布幻灯片~!")
	response.Write("<br><a href="""&request.ServerVariables("HTTP_REFERER")&""">返回-></a><br>")
	response.Write("以下是获取的幻灯片代码，将其加入到模板相应的位置即可。<br>")
	response.Write("<textarea name=""quote"" rows=""6"" id=""quote"" style=""width:100%;"">&lt;script src="""&SiteUrl&"/js/"&adfile&"""&gt;&lt;/script&gt;</textarea>")
else

end if
call connclose()
%>