<%@ LANGUAGE = VBScript.Encode %>
<html>
<head>
<title>文章管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../STYLE.CSS">
</head>

<body bgcolor="#FFFFFF">
<!--#include file="link.asp"-->
<!--#include file="articleCHAR.INC"-->
<br>
 <% 
if session("jaxe")<>"ok" then  'a
     Response.Redirect "admin.asp"		
	 response.end
else    'a
      if Request.QueryString("job")="" then  'b                                                                                                                                                                                                                          
           listlanmu
      elseif  Request.QueryString("job")="list" and Request.QueryString("classid")<>"" then 'b     
           listnote
      elseif  Request.QueryString("job")="new" and Request.QueryString("classid")<>"" then 'b  
           newnote
      elseif  Request.QueryString("job")="edit" and Request.QueryString("id")<>"" then 'b  
           editnote     
      elseif  Request.QueryString("job")="del" and Request.QueryString("id")<>"" and Request.QueryString("classid")<>"" then 'b  
           delnote     
       elseif  Request.QueryString("job")="upnew" and Request.QueryString("classid")<>"" then 'b  
           upnew
       elseif  Request.QueryString("job")="upedit" and Request.QueryString("id")<>"" then 'b  
           upedit
  
      end if  'b                                                                                                                                                                                                                                                                                                                                           
end if  'a   
%>     

<%sub listlanmu%>                                                                          
<!--#include file="conn.asp"-->                                                                          
<%                                                                          
SQL="SELECT * FROM lanmu"                                                                          
Set Rs=conn.Execute(SQL)                                                                          
If Rs.Eof then%>                                                                          
<p align="center">没有栏目</p>                                                                       
  <%else                                                                           
  do while not rs.eof                                                                          
   %>                                                                          
   <div align="center">ID:<%=RS("id")%> ----- <a href="admin_article.asp?job=list&classid=<%=rs("id")%>"><%=rs("lanmu")%></a></div><br>                                                                          
 <% rs.movenext                                                                                                                                                                                                                                                                                  
 loop                                                                            
  rs.close                                                                        
  end if                                                                        
end sub%>                                                                          
                                                                          
<%sub listnote%>                                                            
                                                         
     <p align="center"><a href="admin_article.asp?job=new&classid=<%=Request.QueryString("classid")%>">新文章</a></p>                                                      
 <!--#include file="conn.asp"-->                                                           
      <%                                                             
               CurrentPage=Request.QueryString("pages")                                                             
 if  CurrentPage="" then                                                            
  CurrentPage=1                                                           
  end if                                                                                                                                                                         
                                                                                                                                                                     
   set rs=server.createobject("adodb.recordset")                                                             
   sql="SELECT * FROM article where lanmuid="&Request.QueryString("classid")&" order by id desc"                                                                                                                                                                                                                                                                                                                                    
 rs.open sql,conn,1,1                                                                                                                                                                                                                                                  
rs.PageSize=35                                                               
%>                                                                                                                                                                                                                              
       <%if not rs.eof then                                                                                                                                                                                                                                                                               
  rs.AbsolutePage=CurrentPage                                                                                                                                                                                                                                                                                                                                                     
prevCurrentPage=CurrentPage-1                                                                                                                                                                                                                                                                                                                                                                                    
    nextCurrentPage=CurrentPage+1  %>                                                                                                                                                                                                                                                     
                           <div align="right"> <% if CurrentPage <=1 and   RS.PageCount<>1 then %>                                                                                                                                                                                                                                 
              上一页&nbsp;<A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=nextCurrentPage%>">[下一页]</a>                                                                                                                                                                                                                                                                                                                                                                                   
              <% elseif CurrentPage>1 and CLng(CurrentPage) < RS.PageCount then %>                                                                                                                                                                                                                                                                                                                                                                                                                 
              <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=prevCurrentPage%>">[上一页]</A> &nbsp;                                                                                                                                                                                                                                                                                                                                                                                           
          <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=nextCurrentPage%>">[下一页]</a>                                                                                                                                                                   
          <% elseif (CLng(CurrentPage) = RS.PageCount) and RS.PageCount<>1 then %>                                                                                                                                                                                                                                                                                                                                                                                                                 
              <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=prevCurrentPage%>">[上一页]</A>&nbsp;下一页                                                                                                                                                                                                                                                                                                                                                                                                                 
              <% end if%>  &nbsp;页次：<%=CurrentPage%>/<%=RS.PageCount%>页&nbsp;                                                                                                                                                                                                                                                                                                                                                                                           
          <%=Rs.PageSize%>条记录/页&nbsp;                                                                                                                                                                                                                                                                                                                                                                                   
                            </div>                                                                                                                                                                                                                                  
  
<table width="90%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#00659C">
  <tr> 
    <td width="17%" bgcolor="#006699"> 
      <div align="center"><font color="#FFFFFF">操作</font></div>
    </td>
    <td width="49%" bgcolor="#006699"> 
      <div align="center"><font color="#FFFFFF">文章标题</font></div>
    </td>
    <td width="34%" bgcolor="#006699"> 
      <div align="center"><font color="#FFFFFF">加入时间</font></div>
    </td>
  </tr>
  <%                                                                                                                                                                                                                                                                                                                                                                                            
NumRows=0                                                                                                                                                                                                                                                                                                                                                                                                 
 do while not rs.eof and NumRows < rs.PageSize                                                                                                                                                                                                                                                                                                                                                                                                     
 %> 
  <tr> 
    <td width="17%"> 
      <div align="center"><font color="#666666"><a href="admin_article.asp?job=edit&id=<%=rs("id")%>">[修改]</a> 
        <a href="admin_article.asp?job=del&id=<%=rs("id")%>&classid=<%=Request.QueryString("classid")%>">[删除]</a></font></div>
    </td>
    <td width="49%"> 
      <p align="center"><font color="#666666"><%=rs("title")%></font></p>
    </td>
    <td width="34%"> 
      <p align="center"><font color="#666666"><%=rs("date")%></font> 
    </td>
  </tr>
  <%                                                                                                                                                                                                                                                                                                                                                                                                
 rs.movenext                                                                                                                                                                                                                                                                                                                                                                                                
 NumRows=NumRows+1                                                                                                                                                                                                                                                                                                                                                                                                
 loop                                                                                                                                                                                                                                                                                                                                                                                                
 %> 
</table>                                                                                                                                                                                                                           
  <div align="right"> <% if CurrentPage <=1 and   RS.PageCount<>1 then %>                                                                                                                                                                                                                                                                                                                                                                                   
              上一页&nbsp;<A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=nextCurrentPage%>">[下一页]</a>                                                                                                                                                                                                                                                                                                                                                                                   
              <% elseif CurrentPage>1 and CLng(CurrentPage) < RS.PageCount then %>                                                                                                                                                                                                                                                                                                                                                                                                                 
              <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=prevCurrentPage%>">[上一页]</A> &nbsp;                                                                                                                                                                                                                                                                                                                                                                                           
          <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=nextCurrentPage%>">[下一页]</a>                                                                                                                                                                   
          <% elseif (CLng(CurrentPage) = RS.PageCount) and RS.PageCount<>1 then %>                                                                                                                                                                                                                                                                                                                                                                                                                 
              <A HREF="admin_article.asp?job=list&classid=<%=Request.QueryString("classid")%>&pages=<%=prevCurrentPage%>">[上一页]</A>&nbsp;下一页                                                                                                                                                                                                                                                                                                                                                                                                                 
              <% end if%>  &nbsp;页次：<%=CurrentPage%>/<%=RS.PageCount%>页&nbsp;                                                                                                                                                                                                                                                                                                                                                                                           
          <%=Rs.PageSize%>条记录/页&nbsp;                                                                                                                                                                                                                                                                                                                                                                                                
                            </div>                                                                                                                                                                                                                    
  <%else%>                                                                                                                                                                                                                      
  <p align="center">没有文章！</p>                                                                                                                                                                                                                                                                 
  <%end if%>                                                                                                                                                                                                                                 
  <%                                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                
rs.close                                                                                                                                                                                                                                                                                                                                                                                    
   set rs=nothing                                                                                                                                                                                                                                                                                                                                                                       
conn.close                                                                                                                                                                                                                                                                                                                            
set conn=nothing                                                                                                                                                                                                                                                                                                                                                                                                        
 %>                                                                                  
                                                           
<%end sub%>                                                       
                                                 
                                                 
                                                                    
                                                                          
<%sub newnote%>                                                   
       <!--#include file="conn.asp"-->                                                                          
<%                                                                          
SQL="SELECT * FROM lanmu where id="&Request.QueryString("classid")                                                                          
Set Rs=conn.Execute(SQL)                                                                          
If Rs.Eof then%>                                                                          
<p align="center">没有栏目</p>                                                                       
  <%else                                                                           
                                                                         
   %>                                         
     <form method="post" action="admin_article.asp?job=upnew&classid=<%=rs("id")%>">                                              
  <table width="86%" border="0" cellspacing="0" cellpadding="0" align="center">                                              
    <tr>                                               
      <td width="19%" height="333" valign="top">
        <div align="center">带*号的为必填项</div>
      </td>                                              
      <td width="73%" height="333" valign="top"> 标题： 
        <input type="text" name="title" size="30" maxlength="100">
        *<br>                                              
        作者：                                               
        <input type="text" name="author" size="20" maxlength="100">                                              
        <br>                                              
        图片描述：                                               
        <input type="text" name="pic" size="30" maxlength="100">                                              
        <br>                                              
        图片URL：                                              
        <input type="text" name="picurl" size="30" maxlength="100">
        <br>
        文章选自： 
        <input type="text" name="fileurl" size="30" maxlength="100">
        <br>                                              
        推荐：是                                              
        <input type="radio" name="tuijian" value="yes">                                              
        /否                                               
        <input type="radio" name="tuijian" value="no" checked>
        <br>                                              
        关键字：                                              
        <input type="text" name="key" size="30" maxlength="100">
        <br>
        内容： *<br>                                              
        <textarea name="content" cols="70" rows="10"></textarea>                                              
       <br>                                            
        <input type="hidden" name="lanmu" value="<%=rs("lanmu")%>">                                            
        <input type="hidden" name="lanmupic" value="<%=rs("lanmupic")%>">                                            
        <input type="hidden" name="lanmuurl" value="<%=rs("lanmuurl")%>">                                            
        <br>                                           
         <p align="center">                                      
          <input type="submit" name="Submit" value="提交">                                     
          <input type="reset" name="Submit2" value="重来">                                     
          <br>                                     
        </p>                                      
      </td>                                              
      <td width="8%" height="333">&nbsp;</td>                                              
    </tr>                                              
  </table>                                              
</form>                                              
 <% rs.close                                                                        
  end if                                                            
end sub%>                                                                          
                                                                          
                                             
                                          
                                          
<%sub upnew                                        
 if Request.form("title")="" then                                        
	response.write "没有标题！"                                        
	response.end                                        
	end if                                        
	if Request.form("content")="" then                                        
	response.write "没有内容！"                                        
	response.end                                          
	end if                                          
	%>                                          
   <!--#include file="conn.asp"-->                                           
                                                                                                                                                                                               
         <%                                                                                                                 
         content=htmlencode2(request.form("content"))                                                                                                                                                                                              
          set rs=server.createobject("adodb.recordset")                                           
          sql="select * from article where (id is null)"                                                                                                                                                                                         
rs.open sql,conn,1,3                                                                                                                                                                                                                                                                                                              
rs.addnew                                                                                                                                                                                                                                                                                                              
rs("title")=Request.form("title")                                         
if Request.form("author")<>"" then                                        
	rs("author")=Request.form("author")                                          
end if                                    
 rs("content")=content                                         
 if Request.form("pic")<>"" then                                        
	 rs("pic")=Request.form("pic")                                        
end if                                        
if Request.form("picurl")<>"" then                                        
	 rs("picurl")=Request.form("picurl")                                        
end if                                
if Request.form("fileurl")<>"" then                                        
	rs("fileurl")=Request.form("fileurl")                                          
	end if                                 
	  rs("lanmuid")=Request.QueryString("classid")                                
if Request.form("lanmu")<>"" then                                        
	 rs("lanmu")=Request.form("lanmu")                                         
end if                                          
if Request.form("lanmupic")<>"" then                                        
	rs("lanmupic")=Request.form("lanmupic")                                         
end if                                                                                                                                                                                                                                                                                                     
  if Request.form("lanmuurl")<>"" then                                        
	rs("lanmuurl")=Request.form("lanmuurl")                                         
end if                                
      if Request.form("tuijian")="yes" then                                        
 rs("tuijian")=1                                        
end if                                 
    if Request.form("key")<>"" then                                        
 rs("key")=Request.form("key")                                        
end if                                                                                                                                                                                                                                                                                             
rs("date")=date                                                                                                                                                                                                                                                                                                                            
rs.update                                                                                                                                                                                                                                                                                                           
rs.close                                                                                                                                                                                                                                                                                                                          
      set rs=nothing                                                                                                                                                                                                                                                                                                                  
conn.close                                                                                                                                                                                                                                                                                                                          
     set conn=nothing   %>                                                                                                                                                                                          
       <p align="center">文章已经添加到数据库中！</p>                                
        <p align="center"><a href="admin_article.asp?job=new&classid=<%=Request.QueryString("classid")%>">新文章</a></p>                                
<%end sub%>                                  
                  
                                                                 
<%sub delnote%>                           
   <% if Request.QueryString("del")="" then %>                        
   <p align="center"><a href="admin_article.asp?job=del&id=<%=Request.QueryString("id")%>&del=yes&classid=<%=Request.QueryString("classid")%>">确定删除</a></p>                          
 <%elseif Request.QueryString("del")="yes" then %>                       
  <!--#include file="conn.asp"-->                                 
  <%                                                                                                                      
      set rs=server.createobject("adodb.recordset")                        
      sql="delete from article where ID="&Request.QueryString("ID")                                                                                                                                  
rs.open sql,conn,1,3                                                                                                    
conn.close                        
theurl="admin_article.asp?job=list&classid="&Request.QueryString("classid")                    
Response.Redirect theurl                     
end if                      
end sub%>                                  
                                      
                              
 <%sub editnote%>                    
  <!--#include file="conn.asp"-->                                                                          
<%                                                                          
                                                                      
  sql="SELECT * FROM article where id="&Request.QueryString("id")                   
  Set Rs=conn.Execute(SQL)                                                                         
   %>                                         
     <form method="post" action="admin_article.asp?job=upedit&id=<%=rs("id")%>">                                              
  <table width="86%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td colspan="3" height="333"> 标题： 
        <input type="text" name="title" size="30" maxlength="100" value="<%=rs("title")%>">
        *<br>
        作者： 
        <input type="text" name="author" size="20" maxlength="100" value="<%=rs("author")%>">
        <br>
        图片描述： 
        <input type="text" name="pic" size="30" maxlength="100" value="<%=rs("pic")%>">
        <br>
        图片URL： 
        <input type="text" name="picurl" size="30" maxlength="100" value="<%=rs("picurl")%>">
        <br>
        文章选自： 
        <input type="text" name="fileurl" size="30" maxlength="100" value="<%=rs("fileurl")%>">
        <br>
        推荐：是 <%if rs("tuijian")=1 then %> 
        <input type="radio" name="tuijian" value="yes" checked>
        /否 
        <input type="radio" name="tuijian" value="no">
        <%else%> 
        <input type="radio" name="tuijian" value="yes">
        /否 
        <input type="radio" name="tuijian" value="no" checked>
        <%end if%> <br>
        关键字： 
        <input type="text" name="key" size="30" maxlength="100" value="<%=rs("key")%>">
        <br>
        内容： *<br>
        <%                
        content=replace(rs("content"),"<br>",chr(13))                                                                                                                                                                                      
     content=replace(content,"&nbsp;"," ")   %> 
        <textarea name="content" cols="70" rows="10"><%=content%></textarea>
        <p align="center"> 
          <input type="submit" name="Submit" value="提交">
          <input type="reset" name="Submit2" value="重来">
        </p>
      </td>
    </tr>
  </table>                                              
</form>                                              
 <%    rs.close                                                     
end sub%>                          
                  
                                                                  
  <%sub upedit            
 if Request.form("title")="" then                                        
	response.write "没有标题！"                                        
	response.end                                        
	end if                                        
	if Request.form("content")="" then                                        
	response.write "没有内容！"                                        
	response.end                                          
	end if                                          
	%>                                          
   <!--#include file="conn.asp"-->                                           
                                                                                                                                                                                               
         <%                                                                                                                 
         content=htmlencode2(request.form("content"))                                                                                                                                                                                              
          set rs=server.createobject("adodb.recordset")                                           
          sql="select * from article where id="&Request.QueryString("id")                                                                                                                                                                                          
rs.open sql,conn,1,3                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                         
rs("title")=Request.form("title")                                         
if Request.form("author")<>"" then                                        
	rs("author")=Request.form("author")                                          
end if                                    
 rs("content")=content                                         
                                   
	 rs("pic")=Request.form("pic")                                        
                  
	 rs("picurl")=Request.form("picurl")                                        
                                      
	rs("fileurl")=Request.form("fileurl")                                          
                              
	           
      if Request.form("tuijian")="yes" then                                        
 rs("tuijian")=1            
 else           
  rs("tuijian")=0                                      
end if                                 
     if Request.form("key")="" then                                           
 rs("key")="||"       
 else     
   rs("key")=Request.form("key")                          
      end if                                                                                                                                                                                                                                                                                                        
rs.update                                                                                                                                                                                                                                                                                                           
rs.close                                                                                                                                                                                                                                                                                                                          
      set rs=nothing                                                                                                                                                                                                                                                                                                                  
conn.close                                                                                                                                                                                                                                                                                                                          
     set conn=nothing   %>                                                                                                                                                                                          
       <p align="center">文章已经修改！</p>                
                                        
<%end sub%>    
</div>
</body>                                                                              
</html>                                                                              
