www.gusucode.com > 中网景企业网站源码时尚版 2009.73码程序 > admin/ggtv.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="opendb.asp" -->
<%
'Call CheckUserLogin(username)
Call CheckAdmin()
Call CnkAdminRight(5)

Dim ShowLang
ShowLang=Trim(Request("ShowLang"))
if ShowLang<>"" then ShowLang=Clng(ShowLang)else ShowLang=Lang

Dim action
action=Trim(Request.Form("action"))

If action="add" Then
	rs.open "select * from cnk_hometv",conn,1,3
	rs.addnew
	rs("image")=Trim(Request.Form("image"))
	rs("url")=Trim(Request.Form("url"))
	rs("title")=Trim(Request.Form("title"))
	rs("Lang")=Trim(Request.Form("Language"))
	rs.update
	rs.close
	'conn.execute("insert into cnk_hometv (image,url,title,Lang) values ('"&Trim(Request.Form("image"))&"','"&Trim(Request.Form("url"))&"','"&Trim(Request.Form("title"))&"',"&Trim(Request.Form("Language"))&")")
End If


If action="createtv" Then
	Call createtv()
End If

If Request.QueryString("del")<>"" Then
conn.execute("delete from cnk_hometv where tvid="&Request.QueryString("del"))
End If
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="inc/cnkgl.js"></script>
<script>
<!--
function validata_form() {
validity=true;
//clipboardData.setData('Text',document.form1.wjcontent.value);
//document.form1.content.value=editor.HtmlEdit.document.body.innerHTML; 

 if (!check_empty(document.form1.username.value))
{ validity=false;
 alert('请输入用户名!');
document.form1.username.focus();
 return validity; } 
 /*
 if (!check_empty(document.form1.url.value))
{ validity=false;
 alert('请填上链接地址');
document.form1.url.focus();
 return validity; }
*/
}

//-->
</script>
</head>
<body>
<form method="post" action="" name="form1" onSubmit="return validata_form();">
  <div class="cnkbox">
    <div class="title">添加首页轮换图片</div>
    <div class="content">
      <div id="list">
        <ul>
          <li class="t1">选择语言:</li>
          <li class="t2">
            <% If Lang=0 or Lang=2 Then %>
            <input type="radio" name="Language" value="0" id="Lang1" checked="checked" />
            <label for="Lang1">中文</label>
            <% End If %>
            <% If Lang=1 or Lang=2 Then %>
            <input type="radio" name="Language" value="1" id="Lang2" <% If Lang=1  Then Response.Write("checked=""checked""")%> />
            <label for="Lang2">EngLish</label>
            <% End If %>
          </li>
        </ul>
        <ul>
          <li class="t1">图片地址:</li>
          <li class="t2">
            <input name="image" class="input" id="image" value="http://" size=40 maxlength="100">  <input type="button" name="Submit2" class="button" value="上传" onClick="window.open('upload_flash.asp?formname=form1&editname=image&uppath=upfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
            图片显示尺寸为<%= tvwidth %>x<%= tvheight %>像素,请控制好图片比例
          </li>
        </ul>
        <ul>
          <li class="t1">链接地址:</li>
          <li class="t2">
            <input name="url" class="input" id="url" value="http://" size=40 maxlength="100">
            &lt; 100个字符 </li>
        </ul>
        <ul>
          <li class="t1">标题文字:</li>
          <li class="t2">
            <input name="title" class="input" id="title" size=40 maxlength="50">
            &lt; 50 个字符 </li>
        </ul>
        <br />
        <ul>
          <li class="t1">
            <input name="Action" type="hidden" id="Action" value="add" />
            <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
          </li>
          <li class="t2">
            <input name="提交" type="submit" class="button" value="提交" />
          </li>
        </ul>
        <ul>
          <li class="t1">说明:</li>
          <li class="t2">1. 图片可上传或直接从其他网页取得图片地址,从http://开始的网址必须是完整的网址 <br>
          2. 取图片地址方法: 在图片上点右键-属性,就看到地址了,复制过来就行了。链接地址请直接复制浏览器地址栏的网址<br>
		  3. 必须加够五幅图才会有显示,而且总是显示最新的五幅图<br>
		  </li>
        </ul>
        <div class="clearboth"></div>
      </div>
    </div>
  </div>
</form>
<div class="cnkbox">
  <div class="title">已添加的图片 </div>
  <div class="content" align="center">
  <% if ShowLang=2 then  %>
  <a href="ggtv.asp">显示全部</a> | <a href="?ShowLang=0">只显示中文</a> | <a href="?ShowLang=1">只显示英文</a>
  <% end if %>
    <% sql="select * from cnk_hometv"
	if ShowLang<>2 then sql=sql&" where Lang="&ShowLang
	sql=sql&" order by tvid desc"
	rs.open sql,conn,1,1
	do while not rs.eof %>
    <div class="starbox">
      <div class="tv_img"> <a href="<%= rs("url") %>" target="_blank"><img src="<%= GetImgUrl(rs("image")) %>" width="216" border="0" alt="<%= rs("title") %>"></a></div>
      <br />
	  <%= rs("title") %>
	  <br />
      <a href="?del=<%= rs("tvid") %>" onClick="return cfdel();">[删除]</a> <br />
      <%= rs("updatetime") %></div>
    <% rs.movenext
	loop %>
    <div class="clearboth"></div>
  </div>
</div>
<form method="post" action="" name="form2">
  <div class="cnkbox">
    <div class="title">生成动画文件</div>
    <div class="content">
      <div id="list">
        <ul>
          <li class="t1">选择语言:</li>
          <li class="t2">
            <% If Lang=0 or Lang=2 Then %>
            <input type="radio" name="Language" value="0" id="Lang1" checked="checked" />
            <label for="Lang1">中文</label>
            <% End If %>
            <% If Lang=1 or Lang=2 Then %>
            <input type="radio" name="Language" value="1" id="Lang2" <% If Lang=1  Then Response.Write("checked=""checked""")%> />
            <label for="Lang2">EngLish</label>
            <% End If %>
          </li>
        </ul>
        <ul>
          <li class="t1">画面大小:</li>
          <li class="t2">
            <input name="thistvwidth" class="input" id="thistvwidth" value="<%= tvwidth %>" size=8 maxlength="4">  
            x
            <input name="thistvheight" class="input" id="thistvheight" value="<%= tvheight %>" size=8 maxlength="3">
             像素,建议保留原尺寸</li>
        </ul>
        <ul>
          <li class="t1">显示方式:</li>
          <li class="t2">
            <label for="disptype1"><input name="disptype" type="radio" id="disptype1" value="1" checked>
              轮换显示全部已经添加的图片,换图转场方式:随机。(不显示标题文字)</label><br>
			  <label for="disptype2"><input type="radio" name="disptype" value="2" id="disptype2">
              轮换显示全部已经添加的图片,换图转场方式:马赛克。(不显示标题文字,不适用于带参数的链接地址)</label><br>
			  <label for="disptype3"><input type="radio" name="disptype" value="3" id="disptype3">
              轮换显示最新五图片,换图转场方式:随机。(不适用于带参数的链接地址)</label><br>
           </li>
        </ul>
        <br />
        <ul>
          <li class="t1">
            <input name="Action" type="hidden" id="Action" value="createtv" />
            <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
          </li>
          <li class="t2">
            <input name="submit" type="submit" class="button" id="生成" value="生成新动画" />
          </li>
        </ul>
        <div class="clearboth"></div>
      </div>
    </div>
  </div>
</form>
</body>
</html>
<% rs.close
	set rs=nothing
conn.close 
set conn=nothing 

Sub createtv()
	dim fso,hf,ObjInstalled,yuyan
	ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
	If ObjInstalled=false Then
		Response.Write("<br><li>你的服务器不支持 FSO(Scripting.FileSystemObject)! </li>")
		Response.End()
		exit sub
	End If
	
	Dim Language,thistvwidth,thistvheight,disptype,xh,recordnum
	Language=Trim(Request.Form("Language"))
	thistvwidth=Trim(Request.Form("thistvwidth"))
	thistvheight=Trim(Request.Form("thistvheight"))
	disptype=Trim(Request.Form("disptype"))
	
	if Updir="" then
		yuyan="../tv.js"
	else
		if Language=0 then yuyan="../chinese/tv.js"
		if Language=1 then yuyan="../english/tv.js"
	end if
	
	set fso=Server.CreateObject("Scripting.FileSystemObject")
	set hf=fso.CreateTextFile(Server.mappath(yuyan),true)
	
	Select Case disptype
	
	Case "1"'全部
	hf.write "var bannerAD=new Array();" & vbcrlf
	hf.write "var bannerADlink=new Array();" & vbcrlf
	hf.write "var adNum=0;" & vbcrlf
	
	xh=0
	rs.open "select image,url from cnk_hometv where Lang="&Language&" order by tvid desc",conn,1,1
	recordnum=rs.recordcount
	do while not rs.eof
	hf.write "bannerAD["&xh&"]="""&GetImgUrl(rs("image"))&""";" & vbcrlf
	hf.write "bannerADlink["&xh&"]="""&rs("url")&""";" & vbcrlf
	rs.movenext
	xh=xh+1
	loop
	rs.close
	
	hf.write "var preloadedimages=new Array();" & vbcrlf
	hf.write "for (i=0;i<"&recordnum&";i++){" & vbcrlf
	hf.write "preloadedimages[i]=new Image();" & vbcrlf
	hf.write "   preloadedimages[i].src=bannerAD[i];" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "function setTransition(){" & vbcrlf
	hf.write " if (document.all){" & vbcrlf
	hf.write "   bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);" & vbcrlf
	hf.write "   bannerADrotator.filters.revealTrans.apply();" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "function playTransition(){" & vbcrlf
	hf.write "  if (document.all)" & vbcrlf
	hf.write "    bannerADrotator.filters.revealTrans.play()" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "function nextAd(){" & vbcrlf
	hf.write " if(adNum<bannerAD.length-1)adNum++ ;" & vbcrlf
	hf.write "  else adNum=0;" & vbcrlf
	hf.write "setTransition();" & vbcrlf
	hf.write " document.images.bannerADrotator.src=bannerAD[adNum];" & vbcrlf
	hf.write "playTransition();" & vbcrlf
	hf.write "theTimer=setTimeout(""nextAd()"", 4000);" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "function jump2url(){" & vbcrlf
	hf.write "jumpUrl=bannerADlink[adNum];" & vbcrlf
	hf.write "jumpTarget=""_blank"";" & vbcrlf
	hf.write "if (jumpUrl != ''){" & vbcrlf
	hf.write "  if (jumpTarget != '')window.open(jumpUrl,jumpTarget);" & vbcrlf
	hf.write "  else location.href=jumpUrl;" & vbcrlf
	hf.write " }" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "function displayStatusMsg() { " & vbcrlf
	hf.write " status=bannerADlink[adNum];" & vbcrlf
	hf.write " document.returnValue = true;" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "document.write('<a onMouseOver=""displayStatusMsg();return document.returnValue"" href=""javascript:jump2url()""><img style=""filter: revealTrans(duration=2,transition=20)"" width="""&thistvwidth&""" height="""&thistvheight&""" src=""javascript:nextAd()"" border=""0"" name=""bannerADrotator""></a>');" & vbcrlf
	
	Case "2"'全部,马赛克
	dim mskimg,mskurl,msktitle
	xh=0
	rs.open "select image,url,title from cnk_hometv where Lang="&Language&" order by tvid desc",conn,1,1
	recordnum=rs.recordcount
	do while not rs.eof
	if xh=0 then
	mskimg="'"&GetImgUrl(rs("image"))&"'"
	mskurl="'"&rs("url")&"'"
	msktitle="'"&rs("title")&"'"
	else
	mskimg=mskimg&",'"&GetImgUrl(rs("image"))&"'"
	mskurl=mskurl&",'"&rs("url")&"'"
	msktitle=msktitle&",'"&rs("title")&"'"
	end if
	rs.movenext
	xh=xh+1
	loop
	rs.close
	hf.write "var slideimages=["&mskimg&"];" & vbcrlf
	hf.write "//n个链接" & vbcrlf
	hf.write "var slidelinks=["&mskurl&"];" & vbcrlf
	hf.write "//alt内容" & vbcrlf
	hf.write " var slidetitle=["&msktitle&"];" & vbcrlf

	hf.write "var slidespeed=3000;" & vbcrlf
	hf.write "var imageholder=new Array();" & vbcrlf
	hf.write "var ie55=window.createPopup;" & vbcrlf
	hf.write "for (i=0;i<slideimages.length;i++){" & vbcrlf
	hf.write "	imageholder[i]=new Image();" & vbcrlf
	hf.write "	imageholder[i].src=slideimages[i];" & vbcrlf
	hf.write "	imageholder[i].title=slidetitle[i];" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "function gotoshow(){" & vbcrlf
	hf.write "	if(slidelinks[whichlink]!=""""){" & vbcrlf
	hf.write "		window.open(slidelinks[whichlink],""_blank"");" & vbcrlf
	hf.write "		//ppspic.style.cursor=""hand"";" & vbcrlf
	hf.write "	}" & vbcrlf
	hf.write "	else{" & vbcrlf
	hf.write "		//ppspic.style.cursor=""default"";" & vbcrlf
	hf.write "	}" & vbcrlf
	hf.write "}" & vbcrlf

	hf.write "document.write('<a href=""javascript:gotoshow()""><img src=""'+slideimages[0]+'"" name=""slide"" border=""0"" style=""filter:progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=15,Duration=1)"" width="""&thistvwidth&""" height="""&thistvheight&"""></a>');" & vbcrlf

	hf.write "var whichlink=0" & vbcrlf
	hf.write "var whichimage=0" & vbcrlf
	hf.write "var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0" & vbcrlf
	hf.write "function slideit(){" & vbcrlf
	hf.write "try{" & vbcrlf
	hf.write "if (!document.images) return" & vbcrlf
	hf.write "if (ie55) document.images.slide.filters[0].apply()" & vbcrlf
	hf.write "{document.images.slide.src=imageholder[whichimage].src" & vbcrlf
	hf.write "document.images.slide.title=imageholder[whichimage].title}" & vbcrlf
	hf.write "if (ie55) document.images.slide.filters[0].play()" & vbcrlf
	hf.write "whichlink=whichimage" & vbcrlf
	hf.write "whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0" & vbcrlf
	hf.write "setTimeout(""slideit()"",slidespeed+pixeldelay)" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "catch(e)" & vbcrlf
	hf.write "{" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "}" & vbcrlf
	hf.write "slideit();" & vbcrlf
	
	
	Case "3"'前五幅
	hf.write "var focus_width="&thistvwidth&";" & vbcrlf
	hf.write "var focus_height="&thistvheight&";" & vbcrlf
	hf.write "var text_height=18;" & vbcrlf
	hf.write "var swf_height = focus_height+text_height;" & vbcrlf
	rs.open "select top 5 * from cnk_hometv where Lang="&Language&" order by tvid desc",conn,1,1
	xh=1
	do while not rs.eof
		hf.write "var imgUrl"&xh&"="""&GetImgUrl(rs("image"))&""";" & vbcrlf
		hf.write "var imgLink"&xh&"="""&rs("url")&""";" & vbcrlf
		hf.write "var imgtext"&xh&"="""&rs("title")&""";" & vbcrlf
	rs.movenext
	xh=xh+1
	loop
	rs.close
	hf.write "var pics=imgUrl1+""|""+imgUrl2+""|""+imgUrl3+""|""+imgUrl4+""|""+imgUrl5" & vbcrlf
	hf.write "var links=imgLink1+""|""+imgLink2+""|""+imgLink3+""|""+imgLink4+""|""+imgLink5" & vbcrlf
	hf.write "var texts=imgtext1+""|""+imgtext2+""|""+imgtext3+""|""+imgtext4+""|""+imgtext5" & vbcrlf
	hf.write "document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"" width=""'+ focus_width +'"" height=""'+ swf_height +'"">');" & vbcrlf
	hf.write "document.write('<param name=""allowScriptAccess"" value=""sameDomain""><param name=""movie"" value="""&UpDir&"common/playswf.swf""><param name=wmode value=transparent><param name=""quality"" value=""high"">');" & vbcrlf
	hf.write "document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');" & vbcrlf
	hf.write "document.write('<param name=""FlashVars"" value=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"">');" & vbcrlf
	hf.write "document.write('<embed src="""&UpDir&"common/playswf.swf"" wmode=""opaque"" FlashVars=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"" menu=""false"" bgcolor=""#DADADA"" quality=""high"" width=""'+ focus_width +'"" height=""'+ swf_height +'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');  document.write('</object>');" & vbcrlf
	
	End Select
	
	hf.close
	set hf=nothing
	set fso=nothing
	call alertmsg("生成完成!")
End Sub
%>