MoveNews.asp
资源名称:eat.rar [点击查看]
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:8k
源码类别:
数据库编程
开发平台:
ASP/ASPX
- <% Option Explicit %>
- <!--#include file="../../FS_Inc/Const.asp" -->
- <!--#include file="../../FS_Inc/Function.asp"-->
- <!--#include file="../../FS_InterFace/MF_Function.asp" -->
- <%
- Dim Conn,CollectConn,p_CName,p_ID,p_Action,p_ClassID,sRootDir,str_CurrPath,p_Templet
- MF_Default_Conn
- MF_Collect_Conn
- MF_Session_TF
- p_CName = Request.QueryString("CName")
- p_ID = Request("ID")
- p_Action = Request.QueryString("Action")
- p_ClassID = Request.Form("ClassID")
- p_Templet = Request.Form("Templet")
- if G_VIRTUAL_ROOT_DIR<>"" then sRootDir="/"+G_VIRTUAL_ROOT_DIR else sRootDir=""
- if Session("Admin_Is_Super") = 1 then
- str_CurrPath = sRootDir &"/"&G_UP_FILES_DIR
- Else
- str_CurrPath = Replace(sRootDir &"/"&G_UP_FILES_DIR&"/adminfiles/"&Session("Admin_Name"),"//","/")
- End if
- %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>无标题文档</title>
- <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
- </head>
- <script language="JavaScript" src="js/PublicJS.js"></script>
- <body>
- <table height="120" width="60%" border="0" align="center">
- <tr>
- <td> </td>
- </tr>
- </table>
- <% if p_Action = "Submit" then %>
- <%
- Dim p_Return_Str,p_Delete_ID
- if NewsToSystem("FS_NS_News",p_ID) then
- p_Return_Str = "转移成功"
- p_Delete_ID = Replace(p_ID,"***",",")
- if p_ID = "all" then
- CollectConn.Execute("Update FS_News Set History=1 where 1=1")
- else
- CollectConn.Execute("Update FS_News Set History=1 where ID in (" & p_Delete_ID & ")")
- end if
- else
- p_Return_Str = "转移失败"
- end if
- %>
- <table width="60%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
- <tr class="hback">
- <td><% = p_Return_Str %></td>
- </tr>
- <tr class="hback">
- <td height="30"><div align="center">
- <input type="button" name="Submit" onClick="location='Check.asp';" value=" 返 回 ">
- </div></td>
- </tr>
- </table>
- <% else %>
- <table width="60%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
- <form name="Form1" action="?Action=Submit" method="post">
- <tr class="hback">
- <td><img src="images/Question.gif" width="39" height="37">确定要把以下新闻:
- <% = Replace(p_CName,"***",",") %>
- 入库到 <select name="ClassID" id="ObjectClassID">
- <%
- Dim obj_unite_rs,tmp_str_list
- Set obj_unite_rs = server.CreateObject(G_FS_RS)
- obj_unite_rs.Open "Select Orderid,id,ClassID,ClassName,ParentID from FS_NS_NewsClass where IsURL=0 And Parentid = '0' and ReycleTF=0 Order by Orderid desc,ID desc",Conn,1,1
- tmp_str_list = ""
- do while Not obj_unite_rs.eof
- tmp_str_list = tmp_str_list &"<option value="""& obj_unite_rs("ClassID") &""">+"& obj_unite_rs("ClassName") &"</option>"& Chr(13) & Chr(10)
- tmp_str_list = tmp_str_list &UniteChildNewsList(obj_unite_rs("ClassID"),"")
- obj_unite_rs.movenext
- Loop
- obj_unite_rs.close
- set obj_unite_rs = nothing
- Response.Write tmp_str_list
- %>
- </select>
- 栏目中吗? <input type="hidden" name="ID" value="<% = p_ID %>"></td>
- </tr>
- <tr class="hback">
- <td height="30">选择新闻模板
- <input name="Templet" type="text" id="Templet" style="width:60%" value="/Templets/NewsClass/News.htm" maxlength="255" readonly>
- <input name="Submit5" type="button" id="selNewsTemplet" value="选择模板" onClick="OpenWindowAndSetValue('../CommPages/SelectManageDir/SelectTemplet.asp?CurrPath=<%=G_VIRTUAL_ROOT_DIR %>/<% = G_TEMPLETS_DIR %>',400,300,window,document.Form1.Templet);document.Form1.Templet.focus();"></td>
- </tr>
- <tr class="hback">
- <td height="30"><div align="center">
- <input type="submit" name="Submit" value=" 确 定 ">
-
- <input onClick="history.back();" type="button" name="Submit2" value=" 取 消 ">
- </div></td>
- </tr>
- </form>
- </table>
- <% end if %>
- </body>
- </html>
- <%
- '参数f_Object_Table为目标数据库中的表名
- '参数f_Source_ID为采集库的新闻表(FS_News)中的ID集合,ID之间以***分割
- Function NewsToSystem(f_Object_Table,f_Source_ID)
- Dim f_Field_Array,f_Source_Sql,f_Object_Sql,f_Collect_RS,f_System_RS,f_i
- if f_Source_ID = "" then Exit Function
- f_Source_ID = Replace(f_Source_ID,"***",",")
- 'f_Field_Array数组的字段说明:
- '第一个字段是采集库中的新闻表(FS_News)中的字段
- '第二个字段是新闻采集系统中的新闻表的字段
- '第三个字段是表示是否需要进行转换,-1表示使用默认值,0表示不需要转换,1表示bool型转换为整形,保留大于1的值
- '对应关系如下:
- '标题
- '作者
- '来源
- '内容
- '添加时间
- '图片新闻
- '是否推荐
- '是否今日头条
- '是否滚动新闻
- '是否并排新闻
- '是否显示评论
- f_Field_Array = Array(_
- Array("Title","NewsTitle",0,""),_
- Array("","PopId",-1,"0"),_
- Array("","ClassID",-1,p_ClassID),_
- Array("Content","Content",0,""),_
- Array("","Templet",-1,p_Templet),_
- Array("Source","Source",0,""),_
- Array("","Editor",-1,Session("Admin_Name")),_
- Array("Author","Author",0,""),_
- Array("","SaveNewsPath",-1,"/" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "-cs"),_
- Array("","FileName",-1,""),_
- Array("","NewsID",-1,""),_
- Array("","FileExtName",-1,"html"),_
- Array("","NewsProperty",-1,"0,1,1,0,1,0,0,0,1,0,0"),_
- Array("","addtime",-1,Now)_
- )
- if f_Source_ID = "all" then
- f_Source_Sql = "Select * from FS_News where 1=1"
- else
- f_Source_Sql = "Select * from FS_News where ID in (" & f_Source_ID & ")"
- end if
- f_Object_Sql = "Select * from " & f_Object_Table & " where 1=0"
- Set f_Collect_RS = CollectConn.Execute(f_Source_Sql)
- if Not f_Collect_RS.Eof then
- Set f_System_RS = Server.CreateObject ("ADODB.RecordSet")
- f_System_RS.Open f_Object_Sql,Conn,3,3
- do while Not f_Collect_RS.Eof
- f_System_RS.AddNew
- for f_i=LBound(f_Field_Array) to UBound(f_Field_Array)
- if f_Field_Array(f_i)(1) = "NewsID" then
- f_System_RS(f_Field_Array(f_i)(1)) = GetRamCode(15)
- elseif f_Field_Array(f_i)(1) = "FileName" then
- f_System_RS(f_Field_Array(f_i)(1)) = GetRamCode(12)
- else
- if f_Field_Array(f_i)(2) = 1 then
- if f_Collect_RS(f_Field_Array(f_i)(0)) = True then
- f_System_RS(f_Field_Array(f_i)(1)) = 1
- else
- f_System_RS(f_Field_Array(f_i)(1)) = 0
- end if
- elseif f_Field_Array(f_i)(2) = -1 then
- f_System_RS(f_Field_Array(f_i)(1)) = f_Field_Array(f_i)(3)
- else
- f_System_RS(f_Field_Array(f_i)(1)) = f_Collect_RS(f_Field_Array(f_i)(0))
- end if
- end if
- Next
- f_Collect_RS.MoveNext
- Loop
- f_System_RS.Update
- end if
- f_Collect_RS.Close
- Set f_Collect_RS = Nothing
- NewsToSystem = True
- End Function
- Function UniteChildNewsList(TypeID,f_CompatStr)
- Dim f_ChildNewsRs,ChildTypeListStr,f_TempStr,f_isUrlStr,lng_GetCount
- Set f_ChildNewsRs = Conn.Execute("Select id,orderid,ClassName,ClassID,ParentID from FS_NS_NewsClass where IsURL=0 And ParentID='" & TypeID & "' and ReycleTF=0 order by Orderid desc,id desc" )
- f_TempStr =f_CompatStr & "┄"
- do while Not f_ChildNewsRs.Eof
- UniteChildNewsList = UniteChildNewsList & "<option value="""& f_ChildNewsRs("ClassID") &""">"
- UniteChildNewsList = UniteChildNewsList & "├" & f_TempStr & f_ChildNewsRs("ClassName")
- UniteChildNewsList = UniteChildNewsList & "</option>" & Chr(13) & Chr(10)
- UniteChildNewsList = UniteChildNewsList &UniteChildNewsList(f_ChildNewsRs("ClassID"),f_TempStr)
- f_ChildNewsRs.MoveNext
- loop
- f_ChildNewsRs.Close
- Set f_ChildNewsRs = Nothing
- End Function
- Set CollectConn = Nothing
- Set Conn = Nothing
- %>