<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<HTML>
<HEAD>
<TITLE>发布幻灯片</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../js/PublicJS.js"></script>
</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p05")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act
act=request.QueryString("act")
if(act="do") then
	dim catalogid,nums,rowtemp,pic,links,texts,i
	if isnumeric(request.Form("catalogid")) then
		catalogid=cint(request.Form("catalogid"))
	else
		response.Write("<script>alert('类别不能为空！');history.back();</script>")
		response.End()
	end if		
	if isnumeric(request.Form("nums")) then
		nums=Cint(request.Form("nums"))
	else
		response.Write("<script>alert('数量设置错误！');history.back();</script>")
		response.End()
	end if
	'''''''''''''''''''''''''''''''''添加到库''''''''''''''''''''''''''''
	set rs=server.createobject("adodb.recordset")
	sql="select top "&nums&" photo,pagepath,title from news where imgnews=true"
	if(catalogid<>0) then
	 sql=sql&" and classid="&catalogid
	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&SiteUrl&"/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,s_w,s_h
	s_w=Cint(request.Form("s_w"))
	s_h=Cint(request.Form("s_h"))
	adcont=adcont&"var focus_width="&s_w&";"&Chr(10)
	adcont=adcont&"var focus_height="&s_h&";"&Chr(10)
	adcont=adcont&"var text_height=15;"&Chr(10)
	adcont=adcont&"var swf_height = focus_height+text_height;"&Chr(10)
	adcont=adcont&"var pics='"&pic&"';"&Chr(10)
	adcont=adcont&"var links='"&links&"';"&Chr(10)
	adcont=adcont&"var texts='"&texts&"';"&Chr(10)
	adcont=adcont&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ focus_width +'"" height=""'+ swf_height +'"">');"&Chr(10)
	adcont=adcont&"document.write('<param name=""allowScriptAccess"" value=""sameDomain""><param name=""movie"" value="""&SiteUrl&"/js/pixviewer.swf""><param name=""quality"" value=""high""><param name=""bgcolor"" value=""#eeeeee"">');"&Chr(10)
	adcont=adcont&"document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');"&Chr(10)
	adcont=adcont&"document.write('<param name=""FlashVars"" value=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"">');"&Chr(10)
	adcont=adcont&"document.write('<embed src="""&SiteUrl&"/js/pixviewer.swf"" wmode=""opaque"" FlashVars=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"" menu=""false"" bgcolor=""#eeeeee"" quality=""high"" width=""'+ focus_width +'"" height=""'+ focus_height +'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');"&Chr(10)
	adcont=adcont&"document.write('</object>');"&Chr(10)
	adfile=catalogid&".js"
	Set fs=Server.CreateObject("Scripting.FileSystemObject")
	Set file_w = fs.CreateTextFile(server.mappath("../js/slide_"&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/slide_"&adfile&"""&gt;&lt;/script&gt;</textarea>")
else
	'获得大类
dim first,classid
classid=0

set rs=server.CreateObject("adodb.recordset")
sql="select id,title from catalogs where parentid="&classid&" order by id asc"
rs.open sql,conn,3,1
if not rs.eof then
	first=rs.GetRows()
	if(ubound(first,2)<0) then
	response.Write("暂时没有分类")
	end if
else
	response.Write("暂时没有分类,请先添加分类!")
	response.End()
end if
rs.close
set rs=nothing

Function getcatalogs(parentid,str)
	Dim Sql,rstemp,TemptempStr,tempStr	
	tempStr=str&"&nbsp;"
	sql="select id,title from catalogs where parentid="&parentid
	Set rstemp = Conn.Execute(Sql)
	do while Not rstemp.Eof
		getcatalogs = getcatalogs &"<option value="&rstemp(0)&">│"&tempStr&"└"&rstemp(1)&"</option>"&Chr(10)
		getcatalogs = getcatalogs & getcatalogs(rstemp(0),tempStr)
		rstemp.MoveNext
	loop
	rstemp.close
	Set rstemp = Nothing
End Function
Function getcatalogoption()
	dim ret
	ret=""
	for i=0 to ubound(first,2)
		ret=ret&"<option value="&first(0,i)&">├"&first(1,i)&"</option>"&Chr(10)
    	ret=ret&getcatalogs(first(0,i),"")
	next
	getcatalogoption=ret
end Function
%>
<FORM method="POST" name="form1" action="?act=do" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="22" colspan="2"><div align="center" class="style1">发布幻灯片</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="18%"><div align="right">所 属 类 别：</div></TD>
  <TD width="82%">
  <select name="catalogId" id="catalogId" style="width:20%">
  <option value="0">全部</option>
	<%
	catalogcache=application(CachePrefix&"_catalogoption_0")
	if(catalogcache="" or isempty(catalogcache) or len(catalogcache)<1) then
  		application.Lock()
		application(CachePrefix&"_catalogoption_0")=getcatalogoption()
		application.UnLock()
		response.Write(application(CachePrefix&"_catalogoption_0"))
	else
		response.Write(catalogcache)
	end if
	%>
        </select>
  <br>
  选择栏目，将发布指定栏目下最新“图文”文章并生成幻灯片，如果选择“全部”即是调用数据库中最新的“图文文章”	</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="right">数量：</div></TD>
  <TD><input name="nums" type="text" id="nums" value="4" size="10"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right><div align="right">幻灯片宽度：</div></TD>
  <TD align=right><div align="left">
    <input name="s_w" type="text" id="s_w" value="350" size="10" maxlength="10">
  </div></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right><div align="right">幻灯片高度：</div></TD>
  <TD align=right><div align="left">
    <input name="s_h" type="text" id="s_h" value="184" size="10" maxlength="10">
  </div></TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=right><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<script>
function addParentOption()
{
	var arr = showModalDialog("tree_container.asp", "", "dialogWidth:410px; dialogHeight:420px; status:0");
  	if (arr != null){  
   		document.form1.catalogid.options[0]=new Option(arr[1],arr[0]);
  	}
	
}
</script>
<%
end if
%>
</BODY>
</HTML>
<%
call connclose()
%>