⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setnewsattribute.asp

📁 asp源码 图片ASP整站
💻 ASP
字号:
<% Option Explicit %>
<!--#include file="../../../Inc/NosqlHack.asp" -->
<!--#include file="../../../Inc/Const.asp" -->
<!--#include file="../../../Inc/Cls_DB.asp" -->
<!--#include file="../../../Inc/Function.asp" -->

<%
'修正问题
'1、读取新闻中的图片的时候,只可以读取src后面以"结束的情况,现在可以是src=a.gif'||a.gif height=||a.gif>||a.gif"
'2、新闻原来为文字新闻,在转换为图片新闻的时候在新闻内容中没有找到图片,但是如果我设置了焦点、精彩、幻灯等属性的时候,也会加上这些属性(只是没显示出来)
'3、选中一部分新闻,其中有的有推荐属性,有的没有,但是我想都加上滚动属性,在保持原来推荐属性的前提下没有办法实现
'4、改进了设置后点不中新闻的情况 需要同时改动NewsList.asp文件
'5、选中焦点、幻灯、精彩属性的时候,自动选中图片新闻属性(如只想使现有图片新闻加上这些属性,则可手动把图片新闻属性取消)
'6、可以同时适用于ACCESS和SQL版本,商业用户也可下载
'2005-11-9号更新
'7、增加公告新闻、显示评论、内部链接 的批量设置
'8、增加批量取消某一属性时,不影响其他属性的功能
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../../Inc/Session.asp" -->
<!--#include file="../../../Inc/CheckPopedom.asp" -->
<%
'判断权限
if Not JudgePopedomTF(Session("Name"),"P010500") then Call ReturnError1()
'判断权限结束
Dim Action,NewsIDStr,PicNewsTF,RecTF,TodayNewsTF,MarqueeNews,SBSNews,ReviewTF,FilterNews,FocusNewsTF,ClassicalNewsTF,Sql
Dim tempsql,RstempObj,tempstr,i 
Dim re,RemoteFile,ReplaceFileUrl,RemoteFileurl,NewsContent,ShowReviewTF,ProclaimNews,LinkTF
Action = Request("Action")
if Action = "Submit" then

	NewsIDStr = Request("NewsIDStr")
	if NewsIDStr <> "" then
		NewsIDStr = Replace(NewsIDStr,"***","','")
		PicNewsTF = Request.Form("PicnewsTF")
		if PicNewsTF = "1" and Request.Form("IsOper")<>"1" then
            tempSql = "Select * from fs_News where newsID in ('" & NewsIDStr & "') and PicNewsTF=0"
            Set RstempObj = Server.CreateObject(G_FS_RS)
            RstempObj.Open tempSql,Conn,1,1
			For i = 1 to RstempObj.RecordCount
				If RstempObj.Eof then Exit For
				NewsContent=RstempObj("Content")
				Set re = New RegExp
				re.IgnoreCase = True
				re.Global=True
				re.Pattern = "(src\S+\.{1}(gif|jpg|png|bmp|swf)(""|\'|>|\s)?)"
				RemoteFile=""
				Set RemoteFile = re.Execute(NewsContent)
				Set re = Nothing
				ReplaceFileUrl=""
				For Each RemoteFileurl in RemoteFile
					ReplaceFileUrl = Replace(Replace(Replace(RemoteFileurl,"src=",""),"'",""),"""","")
					If LCase(Left(ReplaceFileUrl,Len(Get_RootDir)))=LCase(Get_RootDir) Then
						ReplaceFileUrl = Mid(ReplaceFileUrl,Len(Get_RootDir)+1)
					End If
					Exit For
				Next
				If ReplaceFileUrl<>"" And (Not IsNull(ReplaceFileUrl)) then
					 Conn.Execute("Update FS_News Set PicNewsTF=1,PicPath='"&ReplaceFileUrl&"' where newsID ='" & RstempObj("NewsID") & "'")
				End If					
				RstempObj.MoveNext
            Next
 			 RsTempObj.Close
            Set RsTempObj = Nothing
		ElseIf Request.Form("NoOper")<>"1" and  PicNewsTF ="" then
			Conn.Execute("Update FS_News Set PicNewsTF=0,PicPath='' where NewsID in('"&NewsIDStr&"')")
		End if
		RecTF = Request.Form("RecTF")
		if RecTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set RecTF=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  RecTF ="" then
			Conn.Execute("Update FS_News set RecTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		TodayNewsTF = Request.Form("TodayNewsTF")
		if TodayNewsTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set TodayNewsTF=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  TodayNewsTF ="" then
			Conn.Execute("Update FS_News set TodayNewsTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		MarqueeNews = Request.Form("MarqueeNews")
		if MarqueeNews = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set MarqueeNews=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  MarqueeNews ="" then
			Conn.Execute("Update FS_News set MarqueeNews=0 where newsID in ('" & NewsIDStr & "')")
		end if
		SBSNews = Request.Form("SBSNews")
		if SBSNews = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set SBSNews=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  SBSNews ="" then
			Conn.Execute("Update FS_News set SBSNews=0 where newsID in ('" & NewsIDStr & "')")
		end if
		ProclaimNews = Request.Form("ProclaimNews")
		if ProclaimNews = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set ProclaimNews=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  ProclaimNews ="" then
			Conn.Execute("Update FS_News set ProclaimNews=0 where newsID in ('" & NewsIDStr & "')")
		end if
		ReviewTF = Request.Form("ReviewTF")
		if ReviewTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set ReviewTF=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  ReviewTF ="" then
			Conn.Execute("Update FS_News set ReviewTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		ShowReviewTF = Request.Form("ShowReviewTF")
		if ShowReviewTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set ShowReviewTF=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  ShowReviewTF ="" then
			Conn.Execute("Update FS_News set ShowReviewTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		LinkTF = Request.Form("LinkTF")
		if LinkTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set LinkTF=1 where newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  LinkTF ="" then
			Conn.Execute("Update FS_News set LinkTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		FilterNews = Request.Form("FilterNews")
		if FilterNews = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set FilterNews=1 where PicNewsTF=1 and newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  FilterNews ="" then
			Conn.Execute("Update FS_News set FilterNews=0 where newsID in ('" & NewsIDStr & "')")
		end if
		FocusNewsTF = Request.Form("FocusNewsTF")
		if FocusNewsTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set FocusNewsTF=1 where PicNewsTF=1 and newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  FocusNewsTF ="" then
			Conn.Execute("Update FS_News set FocusNewsTF=0 where newsID in ('" & NewsIDStr & "')")
		end if
		ClassicalNewsTF = Request.Form("ClassicalNewsTF")
		if ClassicalNewsTF = "1" and Request.Form("IsOper")<>"1" then
			Conn.Execute("Update FS_News set ClassicalNewsTF=1 where PicNewsTF=1 and newsID in ('" & NewsIDStr & "')")
		elseIf Request.Form("NoOper")<>"1" and  ClassicalNewsTF ="" then
			Conn.Execute("Update FS_News set ClassicalNewsTF=0 where newsID in ('" & NewsIDStr & "')")
		end if		
	end if
	Set Conn = Nothing
	Response.Write("<script>window.close();</script>")
	Response.End
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>设置新闻属性</title>
</head>
<link href="../../../CSS/ModeWindow.css" rel="stylesheet">
<body topmargin="0" leftmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <form name="SetForm" action="" method="post">
  <tr> 
      <td height="26"><div align="center"><strong>设置选定新闻属性</strong>
          <input type="hidden" name="NewsIDStr" value="<% = Request("NewsIDStr") %>">
          <input type="hidden" name="Action" value="Submit"><br>
		  <input name="NoOper" type="checkbox" value="1" checked onClick="SetOper(this);">未勾选的属性保持原属性
		  <input name="IsOper" type="checkbox" value="1" onClick="SetOper(this);">勾选的属性保持原属性</div></td>
  </tr>
  <tr> 
    <td height="36"> 
      <div align="center"> 
        <input name="PicNewstf" type="checkbox" id="PicNewsTF" value="1">
        图片新闻 
        <input name="RecTF" type="checkbox" id="RecTF" value="1">
        推荐新闻 
        <input name="TodayNewsTF" type="checkbox" id="TodayNewsTF" value="1">
        今日头条 
        <input name="MarqueeNews" type="checkbox" id="MarqueeNews" value="1">
滚动新闻</div></td>
  </tr>
  <tr> 
    <td height="36"> 
      <div align="center">
      	<input name="SBSNews" type="checkbox" id="SBSNews" value="1">
        并排新闻 
        <input name="ProclaimNews" type="checkbox" id="ProclaimNews" value="1">
        公告新闻 
        <input name="ReviewTF" type="checkbox" id="ReviewTF" value="1">
允许评论
<input name="ShowReviewTF" type="checkbox" id="ShowReviewTF " value="1">
显示评论 </div></td>
  </tr>
    <tr> 
    <td height="36"> 
      <div align="center"> 
        <input name="LinkTF" type="checkbox" id="LinkTF" value="1">
内部链接
<input name="FilterNews" type="checkbox" id="FilterNews" value="1" onClick="SetPicNews(this);">
        幻灯新闻 
        <input name="FocusNewsTF" type="checkbox" id="FocusNewsTF" value="1" onClick="SetPicNews(this);">
        焦点新闻 
        <input name="ClassicalNewsTF" type="checkbox" id="ClassicalNewsTF" value="1" onClick="SetPicNews(this);">
        精彩新闻</div></td>
  </tr>
      <tr> 
    <td height="36" align="center"> 
      <div align="center"><font color="#ff0000">
      &nbsp;&nbsp;&nbsp;注意事项:
      ●设置文字新闻为<font color="#003399"><strong>幻灯新闻、焦点新闻、精彩新闻</strong></font>时一定要先选择<strong>图片新闻</strong>属性。</font></div></td>
  </tr>
  <tr> 
    <td height="46" colspan="2">
<div align="center">
	<input name="Submitfgsfd" type="submit" id="Submitfgsfd" value=" 确 定 ">
	&nbsp;&nbsp;&nbsp;&nbsp; 
        <input name="Submit2fasd" type="button" id="Submit2fasd" onClick="window.close();" value=" 取 消 ">
      </div></td>
  </tr>
 </form>
</table>
</body>
</html>
<%
Set Conn = Nothing
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function SetPicNews(a) 
{ 
	if (a.checked==true)
		document.SetForm.PicNewsTF.checked=true;
	else
		if(document.SetForm.ClassicalNewsTF.checked==false&&document.SetForm.FocusNewsTF.checked==false&&document.SetForm.FilterNews.checked==false)
		document.SetForm.PicNewsTF.checked=false;
}
function SetOper(a) 
{ 
	if (a.checked==true&&a==document.SetForm.IsOper)
		document.SetForm.NoOper.checked=false;
	if(a.checked==true&&a==document.SetForm.NoOper)
		document.SetForm.IsOper.checked=false;
}
//-->
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -