<%@language=vbscript codepage=936%>
<%
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
dim dns
dns="../"
%>
<!--#Include file="../Common/Inc_DatConn.asp"-->
<!--#Include file="Common/Inc_Config.asp"-->
<!--#Include file="Common/Inc_Function.asp"-->
<!--#Include file="fy_admin_check.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/Admin_Style.Css" rel="stylesheet" type="text/css">
<script src="../common/Admin.js" type="text/javascript"></script>
<script language="javascript">
//检验表单的合法性
function addinfock(){
	if (document.myform.NewsClass.value == "#") {
		alert("\请选择新闻类型！");
		document.myform.NewsClass.focus();
		return false;
	}
    else if (document.myform.Topic.value == "") {
		alert("\请填写标题！");
		document.myform.Topic.focus();
		return false;
	}
  for(var i=0;i<document.myform.TempUploadFiles.length;i++){
      if (document.myform.UploadFiles.value=="") document.myform.UploadFiles.value=document.myform.TempUploadFiles.options[i].value;
      else document.myform.UploadFiles.value+="|"+document.myform.TempUploadFiles.options[i].value;
  }
}
</script>
</head>
<%
bbaction=changechr(request("bbaction"))
Select case bbaction
  	Case "editnews"
		call editnews
	Case "saveeditnews"
		call saveeditnews
 	Case "saveeditpoint"
		call saveeditpoint
 	Case "addnews"
		call addnews
	Case "saveaddnews"
		call saveaddnews
	Case "locknews"
		call fynewssh
	Case "delnews"
		call delnews
 	Case else
if fla11<>1 and fla10<>1 and Session("intUserLevel")<2 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>错误：操作权限出错，您没有权限操作些功能！</li>"
Call Admin_ShowErr(ErrMsg)
end if
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" colspan="3" align="center"><strong>行业新闻管理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="22%" height="30"><strong>管理导航：</strong></td>
    <td height="30" width="48%">
			<img border="0" src="../images/dot_02.gif" width="14" height="14"><a href="?bbaction=addnews">添加文章</a>
			<img border="0" src="../images/dot_02.gif" width="14" height="14"><a href="?strstata=1">已审文章</a>
			<img border="0" src="../images/dot_02.gif" width="14" height="14"><a href="?strstata=0">未审文章</a></td>
<form method="post" action name="Form1">
		  <td width="30%" height="25" align="right">新闻主题：
      <input type="text" name="KeyWord" size="20" value="<% = Request("KeyWord")%>" class="face"> <input type="submit" name="Submit" value="搜" class="button"></td>
    </form>
  </tr>
</table>
</body>
</html>
<form name="form1" method="POST" action="Admin_Js.asp?ChannelID=<%=ChannelID%>">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" Class="border">
    <tr class="title"> 
      <td width="60" align="center">编 号</td>
      <td align="center" width="80">类别</td>
      <td align="center">主 题</td>
      <td width="50" align="center">状 态</td>
      <td align="center" width="61">浏 览</td>
      <td width="93" align="center">添加时间</td>
      <td width="160" align="center">操 作</td>
    </tr>
<%
Dim rdsNews    '/通告的数据库对象及SQL语句/
Dim sqlNews
Dim rdsTotalRec   
Dim strKeyWord    '/关键字/
Dim intPage       '/当前页/
Dim intTotalRec	  '/所有记录/
Dim intNewsCot	  '/通告条数/
Dim intNewsCount
Dim n,p,ii	      '/定义一些临时变量/
Dim strState

strKeyWord = Request("KeyWord")
strstata= Request("strstata")
strsql=""
if strstata<>"" then
strsql=strsql&" and State="&strstata&" "
end if
if strKeyWord<>"" then
strsql=strsql&"  And Topic like '%"& strKeyWord &"%' "
end if
intPage = Trim(Request("Page"))
if intPage = "" then
	intPage = 1
else
	intPage = Clng(intPage)
end if

intNewsCot = 20

set rdsNews = Server.CreateObject("ADODB.Recordset")
	set rdsTotalRec = Conn.Execute("Select Count(NewsKey) From Dat_News Where Topic<>'' "&strsql&"")
	intTotalRec = rdsTotalRec(0)
	sqlNews = "Select * From Dat_News Where  Topic<>'' "&strsql&" Order By NewsKey Desc"
rdsNews.Open sqlNews,Conn,1,1
if not rdsNews.EOF then
	if intTotalRec mod intNewsCot = 0 then
		n = intTotalRec \ intNewsCot
	else
		n = intTotalRec \ intNewsCot + 1
	end if
	rdsNews.MoveFirst
	if intPage > n then intPage = n
	if intPage < 1 then intPage = 1
	rdsNews.Move (intPage - 1) * intNewsCot
	do while not rdsNews.EOF and intNewsCount < Clng(intNewsCot)
		intNewsCount = intNewsCount + 1
		newsid=rdsNews("NewsKey")
		newsclass=rdsNews("NewsClass")
		if rdsNews("State") = 1 then
			strState = "<font color=""#0000ff"">已审</font>"
			strOperState = "<a href=""?bbaction=locknews&id="& newsid &"&lx=0"">锁定</a>"
		else
			strState = "<font color=""red"">未审</font>"
			strOperState = "<a href=""?bbaction=locknews&id="& newsid &"&lx=1"">审核</a>"
		end if
%>
    <tr class="tdbg" onMouseOut="this.className='tdbg'" onMouseOver="this.className='tdbg2'"> 
      <td width="60" align="center"> 
<% =newsid%></td>
      <td align=center width="80"><%
      Select case clng(newsclass)
  	Case clng(1)
		Response.Write("<font color=#008000>本站公告</font>")
 	Case clng(2)
		Response.Write("<font color=#FF00FF>行业新闻</font>")
	Case clng(3)
		Response.Write("<font color=#ff0000>行业知识</font>")
End Select
      %></td>
      <td><a href="?bbaction=editnews&Id=<% =newsid%>"><% = rdsNews("Topic")%></a></td>
      <td width="44" align="center"><% = strState%></td>
      <td align="center"><% = rdsNews("Hits")%></td>
      <td width="87" align="center"> 
		<% = FormatTime(rdsNews("CreateTime"),4)%></td>
      <td width="160" align="center"><%=strOperState%>
	<a href="?bbaction=editnews&Id=<% =newsid%>">编辑</a>&nbsp;<a onClick="{if(confirm('确定删除吗?')){return true;}return false;}" href="?bbaction=delnews&id=<% =newsid%>">删除</a></td>
    </tr>
<%
		rdsNews.MoveNext
	loop
else
	Response.Write "<tr><td width=""100%"" height=""25"" colspan=""20"">&nbsp;<font color=""#FF0000"">没有新闻...</font></td></tr>"
end if
rdsNews.Close
set rdsNews = nothing

if intPage - 1 mod 10 = 0 then
	p = (intPage - 1) \ 10
else
	p = (intPage - 1) \ 10
end if	
%>
  </table>
	  <table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">
	    <tr></tr><form method="post" action="?" name="Form2">
	    <input type="hidden" name="KeyWord" value="<% = strKeyWord%>">
	    <input type="hidden" name="strstata" value="<% =strstata%>">
		  <td width="30%" height="30" valign="middle">页次：<b><%= intPage %></b>/<b><%= n %></b>页 每页<b><%= intNewsCot %></b>条 共<b><%= intTotalRec %></b>条</td>
		  <td width="70%" height="30" valign="middle"><div align="right">分页：
			<%
				if intPage = 1 then
					Response.Write "<font face=webdings>9</font>   "
				else
					Response.Write "<a href='?strstata="&strstata&"&Page=1&KeyWord="& strKeyWord &"' title=首页><font face=webdings>9</font></a>   "
				end if
				if p * 10 > 0 then Response.Write "<a href='?strstata="&strstata&"&Page="&Cstr(p*10)&"&KeyWord="& strKeyWord &"' title=上十页><font face=webdings>7</font></a>   "
				Response.Write "<b>"
				for ii = p * 10 + 1 to P * 10 + 10
					   if ii = intPage then
				          Response.Write "<font color=""#FF0000"">"+Cstr(ii)+"</font> "
					   else
					      Response.Write "<a href='?strstata="&strstata&"&Page="&Cstr(ii)&"&KeyWord="& strKeyWord &"'>"+Cstr(ii)+"</a>   "
					   end if
					if ii = n then exit for
				next
				Response.Write "</b>"
				if ii < n then Response.Write "<a href='?strstata="&strstata&"&Page="&Cstr(ii)&"&KeyWord="& strKeyWord &"' title=下十页><font face=webdings>8</font></a>   "
				if intPage=n then
					Response.Write "<font face=webdings>:</font>   "
				else
					Response.Write "<a href='?strstata="&strstata&"&Page="&Cstr(n)&"&KeyWord="& strKeyWord &"' title=尾页><font face=webdings>:</font></a>   "
				end if
			%>
			转到：<input type="text" name="Page" size="2" maxlength="10" value="<%= intPage %>" class="face"> <input type="submit" value="Go" name="submit" class="button">
			</div></td>
		</form></tr>
		
	  </table>
<%
End Select
sub editnews
if fla7<>1 and Session("intUserLevel")<2 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>错误：操作权限出错，您没有权限操作些功能！</li>"
Call Admin_ShowErr(ErrMsg)
end if
	Dim rdsNews
	Dim sqlNews
	Dim intNewsKey
	
	intNewsKey = Request("Id")
	if intNewsKey = "" then intNewsKey = 0
	
	set rdsNews = Server.CreateObject("ADODB.Recordset")
	sqlNews = "Select * From Dat_News Where NewsKey = "& intNewsKey
	rdsNews.Open sqlNews,Conn,1,1
	if not rdsNews.EOF then
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" height="73">
  <tr class="title"> 
    <td height="22" colspan="2" align="center"><strong>信息编辑</strong></td>
  </tr><form method="post" action="?bbaction=saveeditnews" name="myform" OnSubmit="return addinfock()">
  <tr class="tdbg"><input type="hidden" name="Id" value="<% =intNewsKey%>">
    <td width="12%" height="23" align="right">新闻类别：</td>
    <td height="23" width="87%"><select size="1" name="NewsClass" class="face">
				  <option value="1" <%if rdsNews("NewsClass") = "1" then Response.Write "selected"%>>本站公告</option>
				  <option value="2" <%if rdsNews("NewsClass") = "2" then Response.Write "selected"%>>行业新闻</option>
				  <option value="3" <%if rdsNews("NewsClass") = "3" then Response.Write "selected"%>>行业知识</option>
				</select></td>
  </tr>
  <tr class="tdbg">
    <td width="12%" height="23" align="right">标题：</td>
    <td height="23" width="87%"><input type="text" name="Topic" size="60" class="face" value="<% = rdsNews("Topic")%>"></td>
  </tr>
  <tr class="tdbg">
    <td width="12%" height="23" align="right">来自：</td>
    <td height="23" width="87%"><input type="text" name="From" size="25" class="face" value="<% = rdsNews("From")%>"></td>
  </tr>  <tr class="tdbg">
    <td width="12%" height="23" align="right">内容：</td>
    <td height="23" width="87%">
<input name="content" type="hidden" value="<%=server.htmlencode(rdsNews("content"))%>">
<iframe id="eWebEditor1" src="editor/ewebeditor.htm?id=content&style=coolblue" frameborder="0" scrolling="no" width="500" HEIGHT="350"></iframe>
    </td>
  </tr>
        <tr class="tdbg">
          <td height="12" align="right" colspan="2">
			<p align="center"><input type="submit" value="更 新" name="Submit"> <input onClick="parent.location.href='Javascript:history.back()'" type="button" value="返 回" name=button1></td>
        </tr></form>
</table>
<%
	end if
	rdsNews.Close
	set rdsNews = nothing
end sub
sub addnews
if fla6<>1 and Session("intUserLevel")<2 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>错误：操作权限出错，您没有权限操作些功能！</li>"
Call Admin_ShowErr(ErrMsg)
end if
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" height="73">
  <tr class="title"> 
    <td height="22" colspan="2" align="center"><strong>添加信息</strong></td>
  </tr><form method="post" action="?bbaction=saveaddnews" name="myform" OnSubmit="return addinfock()">
  <tr class="tdbg"><input type="hidden" name="Id" value="<% =intNewsKey%>">
    <td width="12%" height="23" align="right">新闻类别：</td>
    <td height="23" width="87%"><select size="1" name="NewsClass" class="face">
				  <option value="1">本站公告</option>
				  <option value="2">行业新闻</option>
				  <option value="3">行业知识</option>
				</select></td>
  </tr>
  <tr class="tdbg">
    <td width="12%" height="23" align="right">标题：</td>
    <td height="23" width="87%"><input type="text" name="Topic" size="60" class="face"></td>
  </tr>
  <tr class="tdbg">
    <td width="12%" height="23" align="right">来自：</td>
    <td height="23" width="87%"><input type="text" name="From" size="25" class="face"></td>
  </tr>  <tr class="tdbg">
    <td width="12%" height="23" align="right">内容：</td>
    <td height="23" width="87%"><input name="content" type="hidden">
<iframe id="eWebEditor1" src="editor/ewebeditor.htm?id=content&style=coolblue" frameborder="0" scrolling="no" width="500" HEIGHT="350"></iframe>
</td>
  </tr> 
        <tr class="tdbg">
          <td height="12" align="right" colspan="2">
			<p align="center"><input type="submit" value="提 交" name="Submit"> <input onClick="parent.location.href='Javascript:history.back()'" type="button" value="返 回" name=button1></td>
        </tr></form>
</table>
<%
end sub

%>