<!--#include file="../include/Conn.jsp"-->
<!--#include file="Admin_IsLogin.jsp" -->
<%
'Define Variable 
dim i
dim rs,rst
dim mTypeName,mGrade,mSql,mFlag,mBgColor
Set rs=Server.CreateObject("Adodb.RecordSet")

'initialization 
mFlag=true'add


'edit
if request("action")="edit" then 
  mSql="Select * From T_WebContent Where F_ID="&Request.QueryString("ModifyID")
  Set rs=Conn.Execute(mSql)
  If not rs.Eof then
    mValue=rs("F_Value")
    mValue2=rs("F_Value2")
	mContent=rs("F_Content")	
    rs.Close
  End if
  mFlag=false
end if

'Insert Records
if request("action")="Insert" then
  mSql="Select * From T_WebContent"
  rs.open mSql,conn,1,3
  rs.AddNew
  rs("F_Value")=Trim(Request.Form("txtValue"))
  rs("F_Value2")=Trim(Request.Form("txtValue2"))
  rs("F_Content")=Trim(Request.Form("txtContent"))
  rs.update
  rs.close
  response.redirect "Admin_WebContent.jsp?action=IsInsert&pageno="&Request("pageno")
end if

'Modify Records
if request("action")="editsave" then
  mSql="Select * From T_WebContent Where F_ID="&Request.QueryString("ModifyID")
  rs.open mSql,conn,1,3
  rs("F_Value")=Trim(Request.Form("txtValue"))
  rs("F_Value2")=Trim(Request.Form("txtValue2"))
  rs("F_Content")=Trim(Request.Form("txtContent"))
  rs.update
  response.redirect "Admin_WebContent.jsp?action=IsModify&pageno="&Request.Querystring("pageno")
  flag=false
end if

'Delect Records
if request("action")="delete" then
  mSql = "DELETE FROM T_WebContent WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute mSql
  Response.write "<script>location.replace('Admin_WebContent.jsp?action=IsDelete&pageno="&Request.Querystring("pageno")&"')</script>"
end if


%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=delete';
}
</SCRIPT>
<script language="javascript">
function CheckData(){
  if (document.form1.txtValue.value=="")
   {
    alert("网站名称不能为空，请输入！");
	document.form1.txtValue.focus();
	return false;
   }
  if (document.form1.txtValue2.value=="")
   {
    alert("网址不能为空，请输入！");
	document.form1.txtValue2.focus();
	return false;
   }

}
</script>
</head>
<body text="#000000" >

<%
	admin_flag=",0|9|0,"
	if instr(session("flag"),admin_flag)=0 or isnull(session("flag"))=true then
	Response.write "<br><br><br><br><b><font color=red>对不起，您没有管理本页面的权限!</font></B>"
	Response.end
	end if
%>
<br>
<table class=tableBorder width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr > 
    <th height="22" colspan="4"> 网页内容</span></th>
  </tr>
  <tr > 
    <td width="8%" align="center" class=forumHeaderBackgroundAlternate><b>ID</b></td>
    <td class=forumHeaderBackgroundAlternate width="32%"><b>参数名</b></td>
    <td width="39%" class=forumHeaderBackgroundAlternate><b>标题</b></td>
    <td width="21%" align="center" class=forumHeaderBackgroundAlternate><b>管理</b></td>
  </tr>
  <%  
	Set rs=Server.createobject("Adodb.RecordSet")
    pageno=request.querystring("pageno")
    pmcount=26  
    mSql="select * from T_WebContent order by F_ID"
	rs.open mSql,conn,1,1
	if rs.eof then
	   'response.write "<br><p  align='center'><font color=red><B> 对不起，数据已清空！</B></font></p>"
    else
    rs.pagesize=pmcount
    mpage=rs.pagecount
    if pageno="" then pageno=1
    if  cint(pageno)<1 or cint(pageno)>mpage then  pageno=1
    rs.absolutepage=pageno

 Dim rc,re
 rc=rs.pagesize
 re=1
 do while not rs.eof and rc>0
 mBgColor=Request.Querystring("BgColor")
 if Trim(rs("F_ID"))=Trim(mBgColor) then mColor= "D6DFFF" else mColor= "ffffff"
%>
  <tr  > 
    <td  class=forumRow width="8%" align="center"><%=rs("F_ID")%></td>
    <td class=forumRow width="32%" ><%=rs("F_Value")%> </td>
    <td class=forumRow > <%=rs("F_Value2")%></td>
    <td class=forumRow width="21%" align="center" ><a title="添加记录" href='Admin_WebContent.jsp?pageno=<%=mPage%>'><font color="#666666">[添加]</font></a><a title="修改记录" href='Admin_WebContent.jsp?action=edit&ModifyID=<%=rs("F_ID")%>&BgColor=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>'><font color="#666666">[修改]</font></a><a title="请确定是否删除,删除后不能恢复!" href="javascript:jDelete('Admin_WebContent.jsp?DeleteID=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>')"><font color="#666666">[删除]</font></a> 
    </td>
  </tr>
  <%
 rs.movenext
 re=re+1
 rc=rc-1
 loop
 end if
%>
  <tr  > 
    <td class=forumRow align="center" colspan="6"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="38%" height="22"> &nbsp;共 <font color=red><strong> 
            <% = rs.recordcount%>
            </strong></font> 条记录 当前第 <font color=red><strong> 
            <% = Trim(pageno)%>
            </strong></font>页/共 <font color=red><strong> 
            <% = Trim(mpage)%>
            </strong></font>页 </td>
          <td width="62%" align="right"> <%
if pageno>1 then
   response.write "<a href='Admin_WebContent.jsp'> <img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'>"
end if

if pageno>1 then
   response.write "<a href='Admin_WebContent.jsp?pageno="&pageno-1&"'><img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'>"
end if

add=5'数字分页个数+1
if pageno-int(add/2)<=1 then m=1 else m=pageno-int(add/2)
if m+add>mpage then 
   n=mpage
   if mpage-add<=1 then m=1 else m=mpage-add
else
   n=m+add
end if

for pno=m to n
 if pno=cint(pageno) then
   response.write "&nbsp;<font color=red>"&pno&"</font>"
 else
   response.write "<b>&nbsp;<a href='Admin_WebContent.jsp?pageno="&pno&"'>"&pno&"</a></b>"
 end if
next
response.write "&nbsp"

if int(pageno) < int(rs.pagecount) then
  response.write "<a href='Admin_WebContent.jsp?pageno="&pageno+1&"'><img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'></a>"
else 
  response.write "<img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'>"
end if

if int(pageno) < int(rs.pagecount) then
   response.write "<a href='Admin_WebContent.jsp?pageno="&mpage&"'><img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'>"
end if
Response.write "&nbsp;&nbsp;"
%> </td>
        </tr>
      </table></td>
  </tr>
</table> 
        <%if mFlag=true then'add%>
            <form name="form1" method="post" action="Admin_WebContent.jsp?pageno=<%=mpage%>&action=Insert" onSubmit="return CheckData()">
<table class=tableBorder width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
    <tr > 
    <th height="22" colspan="2">功能：新增记录</th>
   </tr>
                        
						<tr> 
                          
      <td class=forumRowHighlight width="12%" height="19">参数：</td>
                          <td class=forumRow width="88%"><input name="txtValue" type="text"  class='text' value="" size="22" maxlength="80"></td>
                        </tr>
                        <tr> 
                          
      <td class=forumRowHighlight>标题： </td>
                          <td class=forumRow><input name="txtValue2" type="text"  class='text' value="" size="22" maxlength="80"></td>
                        </tr>
                        <tr> 
                          
      <td class=forumRowHighlight>内容：</td>
                          <td class=forumRow>	<textarea name="txtContent" style="display:none"></textarea> 
                          <IFRAME ID="LatticeEditDocument" SRC="../Editor/eWebEditor.jsp?id=txtContent&style=standard" FRAMEBORDER="0" SCROLLING="no" WIDTH="620" HEIGHT="350"></IFRAME></td>
                        </tr>
                        <tr> 
                          <td class=forumRowHighlight height="40" colspan="2"><input type="submit" name="Submit3" value="提交" class="button"> 
        <input type="reSet" name="Submit22" value="重置" class="button"></td>
                        </tr>
                      </table>
            </form>
        <%else%>
            <form name="form1" method="post" action="Admin_WebContent.jsp?pageno=<%=request("pageno")%>&action=editsave&ModifyID=<%=request("ModifyID")%>" onSubmit="return CheckData()">
<table class=tableBorder  width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
     <tr > 
      <th height="22" colspan="2">功能：修改记录</th>
   </tr>
                        <tr> 
                          
      <td class=forumRowHighlight width="12%">参数：</td>
                          <td class=forumRow width="88%"><input name="txtValue" type="text"  class='text' value="<%=mValue%>" size="22" maxlength="80"></td>
                        </tr>
                        <tr> 
                          
      <td class=forumRowHighlight>标题：</td>
                          <td class=forumRow><input name="txtValue2" type="text"  class='text' value="<%=mValue2%>" size="22" maxlength="80"></td>
                        </tr>
                        <tr> 
                          
      <td class=forumRowHighlight>内容 ：</td>
                          <td class=forumRow><textarea name="txtContent" style="display:none"><% = mContent %></textarea> 
                          <IFRAME ID="LatticeEditDocument" SRC="../Editor/eWebEditor.jsp?id=txtContent&style=standard" FRAMEBORDER="0" SCROLLING="no" WIDTH="620" HEIGHT="350"></IFRAME> </td>
                        </tr>
                        <tr> 
                          <td class=forumRowHighlight height="40" colspan="2"><input type="submit" name="Submit32" value="提交" class="button"> 
                    <input type="reSet" name="Submit222" value="重置" class="button"></td>
                        </tr>
                      </table>
            </form>
        <%end if%>

</body>
</html>
<%
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing
%>
