www.gusucode.com > 共享世纪内容管理系统 2.1 build 080704 全站开源版 > admin/NewsAddJSSave.asp
<!--#include file="top.asp"--> <!--#include file="check.asp"--> <!--#include file="mdb_path_info.asp"--> <% '========================================== ' ' 晓宇听幽新闻文章管理系统 2004 ' ' 主页地址:http://www.xoYu.com ' '========================================== '程序名称:晓宇听幽新闻文章管理系统 '英文名称:xoYu News 2004 Professional '程序创建时间:2003-7-10 '程序完成时间:2003-9-11 '最后修改时间:2003-10-10 '========================================== Domain=Request.ServerVariables("SERVER_NAME") gFilePath=Request.ServerVariables("PATH_INFO") gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/"))) CountN=len(gFilePath) gFilePath=lcase(left(gFilePath,CountN-1)) gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/"))) AllPath="http://"+Domain&gfilepath filename=request("filename1") filenamex=request("filename2") if request.form("WordNews")<>"" then set rs1=Server.CreateObject("adodb.recordset") sql1="select * from JSFile where FileName='"&request.form("FileName1")&"' and JSName='"&request.form("WordNewsName")&"'" rs1.open sql1,conn,3,3 session("errormsg")="" if not rs1.eof then session("errormsg")="JS列表已存在此条新闻,请另选其它的JS列表" if session("errormsg")="" then set rs3=Server.CreateObject("adodb.recordset") sql3="Select IndexCount from JS where Type='文字新闻' and JSNameCN='"&request.form("WordNewsName")&"'" rs3.open sql3,conn,1,1 IndexCount=rs3("IndexCount") rs3.close set rs3=nothing set rs2=Server.CreateObject("adodb.recordset") sql2="select * from JSFile where JSType='文字新闻' and JSName='"&request.form("WordNewsName")&"'" rs2.open sql2,conn,3,3 if not rs2.eof then rs2.movefirst if rs2.recordcount>=IndexCount then rs2.delete:rs2.update set rs=Server.CreateObject("adodb.recordset") rs.open"select * from info Where id="&filename,conn,1,1 rs1.addnew rs1("Title")=rs("title") rs1("tid")=rs("tid") rs1("FileName")=rs("id") rs1("Date")=rs("Date") rs1("JSType")="文字新闻" rs1("JSName")=request.form("WordNewsName") rs1.update rs.close set rs=nothing end if rs1.close set rs1=nothing Call WordNews Call result elseif request.form("PhotoNews")<>"" then set rs1=Server.CreateObject("adodb.recordset") sql1="select * from JSFile where FileName='"&request.form("FileName2")&"' and JSName='"&request.form("PhotoNewsName")&"'" rs1.open sql1,conn,3,3 session("errormsg")="" if not rs1.eof then session("errormsg")="JS列表已存在此条新闻,请另选其它的JS列表" if request.form("PhotoPath")="" then session("errormsg")="图片新闻必须填写图片的路径" if session("errormsg")="" then set rs3=Server.CreateObject("adodb.recordset") sql3="Select PhotoCSS,IndexCount from JS where Type='图片新闻' and JSNameCN='"&request.form("PhotoNewsName")&"'" rs3.open sql3,conn,1,1 IndexCount=rs3("IndexCount") PhotoCSS=rs3("PhotoCSS") rs3.close set rs3=nothing set rs2=Server.CreateObject("adodb.recordset") sql2="select * from JSFile where JSType='图片新闻' and JSName='"&request.form("PhotoNewsName")&"'" rs2.open sql2,conn,3,3 if not rs2.eof then rs2.movefirst if rs2.recordcount>=IndexCount then rs2.delete:rs2.update set rs=Server.CreateObject("adodb.recordset") rs.open"select * from info Where id="&filenamex,conn,1,1 rs1.addnew rs1("Title")=rs("title") rs1("tid")=rs("tid") rs1("FileName")=rs("id") rs1("Date")=rs("Date") rs1("JSType")="图片新闻" rs1("JSName")=request.form("PhotoNewsName") rs1("PhotoPath")=request.form("PhotoPath") rs1.update rs.close set rs=nothing end if rs1.close set rs1=nothing select case PhotoCSS case "CSS1" Call CSS1 case "CSS2" Call CSS2 case "CSS3" Call CSS3 end select Call result End if Sub WordNews() set rs=Server.CreateObject("adodb.recordset") sql="select * from JSFile where JSType='文字新闻' and JSName='"&request.form("WordNewsName")&"'" rs.open sql,conn,1,1 set rs3=Server.CreateObject("adodb.recordset") sql3="Select IndexCount,JSNameEN,NewsTP,sort from JS where Type='文字新闻' and JSNameCN='"&request.form("WordNewsName")&"'" rs3.open sql3,conn,1,1 Set MyFile=Server.CreateObject("Scripting.FileSystemObject") set CrHNJS=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".js") set CrHNHt=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".html") CrHNHt.WriteLine("<script src="&rs3("JSNameEN")&".js></script>") if rs3("sort")="2" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs_type=server.CreateObject("ADODB.RecordSet") rs_type.open "select * from infotype where id="&rs("tid"),conn,1,1 if not rs_type.EOF then TN=split(rs_type("tname"),"|") Content=""&rs3("NewsTP")&"[<a href=../List/List_"&rs("tid")&"_1.html>"&TN(ubound(TN)-1)&"</a>]<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br>" CrHNJS.WriteLine("document.write("""&Content&""")") rs_type.close end if rs.movenext next end if if rs3("sort")="1" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if Content=""&rs3("NewsTP")&"<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br>" CrHNJS.WriteLine("document.write("""&Content&""")") rs.movenext next end if rs.close set rs=nothing End Sub Sub CSS1() set rs=Server.CreateObject("adodb.recordset") sql="select * from JSFile where JSType='图片新闻' and JSName='"&request.form("PhotoNewsName")&"' order by ID desc" rs.open sql,conn,1,1 set rs3=Server.CreateObject("adodb.recordset") sql3="Select IndexCount,JSNameEN,PicWi,PicHi,NewsTP,sort from JS where Type='图片新闻' and JSNameCN='"&request.form("PhotoNewsName")&"'" rs3.open sql3,conn,1,1 Set MyFile=Server.CreateObject("Scripting.FileSystemObject") set CrHNJS=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".js") set CrHNHt=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".html") CrHNHt.WriteLine("<script src="&rs3("JSNameEN")&".js></script>") Table="<table whidth=100% ><tr>" CrHNJS.WriteLine("document.write("""&Table&""")") for i=1 to rs3("IndexCount") if rs.eof then exit for Content="<td><a href="&AllPath&"Html/"&filejs&"-1.html target=_blank><img src="&rs("PhotoPath")&" width="&rs3("PicWi")&" height="&rs3("PicHi")&" border=1 style='border-color:#000000'></a></td>" CrHNJS.WriteLine("document.write("""&Content&""")") rs.movenext next Table="</tr><tr>" CrHNJS.WriteLine("document.write("""&Table&""")") rs.movefirst if rs3("sort")="2" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs_type=server.CreateObject("ADODB.RecordSet") rs_type.open "select * from infotype where id="&rs("tid"),conn,1,1 if not rs_type.EOF then TN=split(rs_type("tname"),"|") Content="<td>"&rs3("NewsTP")&"[<a href=../List/List_"&rs("tid")&"_1.html>"&TN(ubound(TN)-1)&"</a>]<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br></td>" CrHNJS.WriteLine("document.write("""&Content&""")") rs_type.close end if rs.movenext next end if if rs3("sort")="1" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if Content="<td>"&rs3("NewsTP")&"<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br></td>" CrHNJS.WriteLine("document.write("""&Content&""")") rs.movenext next end if Table="</tr></table>" CrHNJS.WriteLine("document.write("""&Table&""")") rs.close set rs=nothing End Sub Sub CSS2() set rs=Server.CreateObject("adodb.recordset") sql="select * from JSFile where JSType='图片新闻' and JSName='"&request.form("PhotoNewsName")&"' order by ID desc" rs.open sql,conn,1,1 set rs3=Server.CreateObject("adodb.recordset") sql3="Select Depict,IndexCount,JSNameEN,PicWi,PicHi,NewsTP,sort from JS where Type='图片新闻' and JSNameCN='"&request.form("PhotoNewsName")&"'" rs3.open sql3,conn,1,1 Set MyFile=Server.CreateObject("Scripting.FileSystemObject") set CrHNJS=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".js") set CrHNHt=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".html") CrHNHt.WriteLine("<script src="&rs3("JSNameEN")&".js></script>") Table="<table width=100% >" CrHNJS.WriteLine("document.write("""&Table&""")") if rs3("sort")="2" then for i=1 to rs3("IndexCount") if rs.eof then exit for filenamey=rs("filename") filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs_type=server.CreateObject("ADODB.RecordSet") rs_type.open "select * from infotype where id="&rs("tid"),conn,1,1 if not rs_type.EOF then TN=split(rs_type("tname"),"|") set rs4=Server.CreateObject("adodb.recordset") rs4.open"select * from info Where id="&filenamey,conn,1,1 depict=left(replace(rs4("info"),"'","''"),rs3("Depict")) if instr(depict,chr(13))>0 then depict=replace(depict,chr(13),"")'去回车 if instr(depict,chr(10))>0 then depict=replace(depict,chr(10),"")'去满行 depict=replace(depict,chr(34),"″") Content="<tr><td><a href="&AllPath&"Html/"&filejs&"-1.html target=_blank><img src="&rs("PhotoPath")&" width="&rs3("PicWi")&" height="&rs3("PicHi")&" border=1 style='border-color:#000000'></a></td><td width=90% >"&rs3("NewsTP")&"[<a href=../List/List_"&rs("tid")&"_1.html>"&TN(ubound(TN)-1)&"</a>]<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br> "&depict&"....<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>阅读全文</a></td></tr><tr><td colspan=2><hr noshade size=1></td></tr>" CrHNJS.WriteLine("document.write("""&Content&""")") rs_type.close end if rs.movenext next end if if rs3("sort")="1" then for i=1 to rs3("IndexCount") if rs.eof then exit for filenamey=rs("filename") filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs4=Server.CreateObject("adodb.recordset") rs4.open"select * from info Where id="&filenamey,conn,1,1 depict=left(replace(rs4("info"),"'","''"),rs3("Depict")) if instr(depict,chr(13))>0 then depict=replace(depict,chr(13),"")'去回车 if instr(depict,chr(10))>0 then depict=replace(depict,chr(10),"")'去满行 depict=replace(depict,chr(34),"″") Content="<tr><td><a href="&AllPath&"Html/"&filejs&"-1.html target=_blank><img src="&rs("PhotoPath")&" width="&rs3("PicWi")&" height="&rs3("PicHi")&" border=1 style='border-color:#000000'></a></td><td width=90% >"&rs3("NewsTP")&"<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br> "&depict&"....<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>阅读全文</a></td></tr><tr><td colspan=2><hr noshade size=1></td></tr>" CrHNJS.WriteLine("document.write("""&Content&""")") rs.movenext next end if Table="</table>" CrHNJS.WriteLine("document.write("""&Table&""")") rs.close set rs=nothing End Sub Sub CSS3() set rs=Server.CreateObject("adodb.recordset") sql="select * from JSFile where JSType='图片新闻' and JSName='"&request.form("PhotoNewsName")&"' order by ID desc" rs.open sql,conn,1,1 filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs3=Server.CreateObject("adodb.recordset") sql3="Select IndexCount,JSNameEN,PicWi,PicHi,NewsTP,sort from JS where Type='图片新闻' and JSNameCN='"&request.form("PhotoNewsName")&"'" rs3.open sql3,conn,1,1 Set MyFile=Server.CreateObject("Scripting.FileSystemObject") set CrHNJS=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".js") set CrHNHt=MyFile.CreateTextFile(Server.MapPath("..")&"\JS\"&rs3("JSNameEN")&".html") CrHNHt.WriteLine("<script src="&rs3("JSNameEN")&".js></script>") if rs3("sort")="2" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if set rs_type=server.CreateObject("ADODB.RecordSet") rs_type.open "select * from infotype where id="&rs("tid"),conn,1,1 if not rs_type.EOF then TN=split(rs_type("tname"),"|") Content="<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank><img src="&rs("PhotoPath")&" width="&rs3("PicWi")&" height="&rs3("PicHi")&" border=1 style='border-color:#000000'><br></a>"&rs3("NewsTP")&"[<a href=../List/List_"&rs("tid")&"_1.html>"&TN(ubound(TN)-1)&"</a>]<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br><br>" CrHNJS.WriteLine("document.write("""&Content&""")") rs_type.close end if rs.movenext next end if if rs3("sort")="1" then for i=1 to rs3("IndexCount") if rs.eof then exit for filejs=year(rs("date"))&month(rs("date"))&day(rs("date"))&hour(rs("date"))&minute(rs("date"))&second(rs("date")) if instr(rs("Title"),"<font")>0 then titlez=rs("Title")&"</font>" else titlez=rs("Title") end if Content="<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank><img src="&rs("PhotoPath")&" width="&rs3("PicWi")&" height="&rs3("PicHi")&" border=1 style='border-color:#000000'><br></a>"&rs3("NewsTP")&"<a href="&AllPath&"Html/"&filejs&"-1.html target=_blank>"&titlez&"</a><br><br>" CrHNJS.WriteLine("document.write("""&Content&""")") rs.movenext next end if rs.close set rs=nothing End Sub Sub result() %> <html> <head> <title>管理中心 - 共享世纪新闻文章管理系统</title> <meta copy="WWW.2KY.CN 共享世纪"> <link rel="stylesheet" href="admin.css" type="text/css"> </head> <body background="images/BLogo.gif"> <form method=post action=html_list.asp> <table width="348" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder"> <tr> <th height="20"><b> <% if session("errorMsg")<>"" then %> 操作错误 <% else %> 添加到JS列表成功 <% end if%> </b></th> </tr> <tr align="center"> <td height="115" class=forumrow background="images/BLogo.gif"> <font color=red><%=session("errormsg")%></font> <% if session("errorMsg")<>"" then %> <br><br><br> <input type="button" value=" 返 回 " onclick="javascript:history.back()"> <% else %> <br>按确定键返回"文章管理"<br><br><br><br> <input type="submit" value=" 确 定 "> <% end if:session("errorMsg")="" %> </td> </tr> </table> </form> </body> </html> <% end Sub%>