<!--#include file="../conn.asp"-->
<!--#include file="inc/admin_config.asp"-->
<%
If Cint(AdminGroup(4))=1   or Cint(Request.Cookies("IsSuper"))=1 then
else
Response.Redirect("Default.asp")
Response.End()
End If



%>
<!--#include file="inc/top.asp"-->
<%
select case request("action")
case "edit"
call edit()
case else
call normal()
end select
sub normal()
dim  strFileName
strFileName="news.asp?keywords="&trim(request.Form("keywords"))&"&search="&request.Form("search")
pageno=20
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <tr> 
    <td align="center" class="banner">新闻管理</td>
  </tr>
   <%
  dim rs
  set rs=server.CreateObject("adodb.recordset")
  rs.open "select * from wd_news_sort order by wt_grade asc,wt_id desc ",conn,1,1
  if rs.bof and rs.eof then
  %>
    <tr>
    <td align="center" class="tablebody">目前没有栏目</td>
  </tr>
  <%else%>
  <tr>
    <td align="center" class="tablebody">&nbsp;|
	<%
	dim i
	for i=1 to rs.recordcount
	if rs.eof then exit for
	if i mod 10=0 then
	response.Write("<br>&nbsp;|")
	end if
	response.Write " <a href=""news.asp?sortId="&rs("wt_id")&""">"
	if cint(request("sortid"))=rs("wt_id") then
	response.Write "<font color=red>"&htmlcode(rs("wt_title"))&"</font>"
	else
	response.Write htmlcode(rs("wt_title"))
	end if
	response.Write "	</a>&nbsp;|&nbsp;"
	rs.movenext
	next	
	%>
	</td>
  </tr>
  <%
  end if
  rs.close
  set rs=nothing%>
</table>
<%
set rs=server.CreateObject("adodb.recordset")
if request("sortId")="" then
rs.open "select * from wd_news order by wt_grade asc,wt_id desc",conn,1,1
else
rs.open "select * from wd_news where wt_sortid="&request("sortId")&" order by wt_grade asc,wt_id desc",conn,1,1
end if
rscount=rs.recordcount
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <%
   if  rscount<1 then
  %>
  <tr> 
    <td height="25" colspan="5" align="center" class="tablebody">该栏目还没有数据</td>
  </tr>
<%
else
%>
<tr> 
    <td width="50" align="center" class="tablebody">自动编号</td>
    <td width="30" align="center" class="tablebody">排序</td>
    <td align="center" class="tablebody">标题</td>
    <td width="30" align="center" class="tablebody">图</td>
    <td width="70" align="center" class="tablebody">加入时间</td>
    <td width="110" align="center" class="tablebody">更新时间</td>
<!--    <td width="30" align="center" class="tablebody">推荐</td>
    <td width="30" align="center" class="tablebody">显示</td>-->
 	<td width="30" align="center" class="tablebody">修改</td>
    <td width="30" align="center" class="tablebody">删除</td>
  </tr><form name="form2" method="post" action="?action=edit" onSubmit="return checkf(form2)">
<%
call showsql(pageno)
rs.move(rsno)
for i=1 to loopno
  %>
   <tr bgcolor="#ffffff"  onMouseOver="this.style.background='#E7EFFF'; " onmouseout ="this.style.background='#ffffff'; "  > 
    <td align="center"><%=rs("wt_id")%></font></td>
    <td align="center"><%=rs("wt_grade")%></font></td>
    <td align="center"><a target="_blank" href="../news-show.asp?id=<%=rs("wt_id")%>"  ><%=rs("wt_title")%></a></td>
    <td align="center"><%
	if rs("wt_images")<> "" then
	response.Write "<a target=""_blank"" href="""&rs("wt_images")&""" title=""点击查看图片"" ><img src=""images/photo.png"" border=0 /> </a>"
	end if%></font></td>
    <td align="center"><%=rs("wt_addtime")%></td>
    <td align="center"><%=rs("wt_upDateTime")%></td>
<!--    <td align="center"><%if rs("wt_Elite")= 1 then response.Write("<font color=red>√</font>") else response.Write("×") end if%></td>
    <td align="center"><%if rs("wt_isview")= 1 then response.Write("<font color=red>√</font>") else response.Write("×") end if%></td>-->
	<td align="center"><a href="news_add.asp?id=<%=rs("wt_id")%>&wt_sortId=<%=rs("wt_sortId")%>">修改</a></td>
    <td align="center">
 <input name="id" type="checkbox" id="id" value="<%=rs("wt_id")%>">  </td>     </tr><%
  rs.movenext
  next
  %>
  <tr>
    <td height="25" colspan="11" align="right"  class="tablebody"><INPUT onclick=CheckAll(this.form) type=checkbox value=on name=chkall>全选
        <!-- <input type="submit" name="Submit" value="显示">
        <input name="Submit" type="submit" id="Submit" value="隐藏">
         <input type="submit" name="Submit" value="推荐">
        <input name="Submit" type="submit" id="Submit" value="取消推荐">-->
       <input name="Submit" type="submit" id="Submit" value="删除" onClick="SetSubmitImgId('realdel');">
        &nbsp;</td>
  </tr>  
  </form>
  <tr> 
      <td colspan="11" align="right"  class="tablebody"><%call showpage(strFileName,rscount,pageno,false,true,"条信息")%></td>
  </tr>
  <% end if%>
</table>
<%
end sub
sub edit()
dim id,sql
if request("id")="" then
response.Write("<script>alert('参数错误！');history.back(-1)</script>")
response.End()
end if
select case request("submit")
case "推荐"
sql="update wd_news set wt_Elite=1 where wt_id="
case "取消推荐"
sql="update wd_news set wt_Elite=0 where wt_id="
case "置顶"
sql="update wd_news set wt_istop=1 where wt_id="
case "取消置顶"
sql="update wd_news set wt_istop=0 where wt_id="
case "程序采集"
sql="update wd_news set wt_isCJ=1 where wt_id="
case "后台录入"
sql="update wd_news set wt_isCJ=0 where wt_id="
case "显示"
sql="update wd_news set wt_isview=1 where wt_id="
case "隐藏"
sql="update wd_news set wt_isview=0 where wt_id="
case "删除"
sql="delete from wd_news where wt_id="
case else
response.Write("<script>alert('参数错误！');history.back(-1)</script>")
response.End()
end select
for each id in request("id")
conn.execute(sql&id)
next
dim ip
ip=Request.ServerVariables("HTTP_REFERER")
response.Write("<script>alert('操作成功！');location='"&ip&"'</script>")
response.End()
end sub
%> 
<%CloseConn%><!--#include file="inc/end.asp"-->
