<!--#include file="../include/Conn.jsp"-->
<!--#include file="../Include/Char.jsp" -->
<!--#include file="../MailList/MailListConst.jsp" -->
<!--#include file="Admin_IsLogin.jsp" -->
<%
'Define Variable 
dim i
dim rs
dim mGrade,mSql,mFlag,mBgColor

'initialization 
mFlag=true'add

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

if Request.ServerVariables("REQUEST_METHOD")="POST" then
  mValue = checkStr(Trim(Request.Form("txtValue")))
  mValue2 = checkStr(Trim(Request.Form("txtValue2")))
  if Request("action")="Insert" then
    mSql = "Insert Into MailList_UserGroup(F_Value,F_Value2)"
	mSql = mSql + "Values('"&mValue&"','"&mValue2&"')"
    conn.Execute(mSql)
    response.redirect "Admin_MailGroup.jsp?action=IsInsert&pageno="&Request("pageno")
  else
    mSql = "Update MailList_UserGroup Set F_Value='"&mValue&"',F_Value2='"&mValue2&"'"
	mSql = mSql+" Where F_ID="&Request("ModifyID")
    conn.Execute(mSql)
    response.redirect "Admin_MailGroup.jsp?action=IsModify&pageno="&Request("pageno")
  end if
End if

'Delect Records
if request("action")="Delete" then
  mSql = "DELETE FROM MailList_UserGroup WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute mSql
  Response.write "<script>location.replace('Admin_MailGroup.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;
   }
}
</script>
</head>
<body text="#000000" >
<br>
<%
     admin_flag=",3|4|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
      %>
<table class=tableBorder width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
        <tr > 
          <th height="22" colspan="5">邮件列表组</th>
        </tr>
        <tr   onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EBEEF6'"  bgcolor="#dde1ec" align="center"> 
          <td width="8%" height="11" class=forumHeaderBackgroundAlternate><b>ID</b></td>
          <td class=forumHeaderBackgroundAlternate width="16%"><b>组名称</b></td>
          <td class=forumHeaderBackgroundAlternate><b>备注</b></td>
          <td class=forumHeaderBackgroundAlternate width="21%"><b>管理</b></td>
        </tr>
      </table>
      <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
        <%  
	Set rs=Server.createobject("Adodb.RecordSet")
    pageno=request.querystring("pageno")
    pmcount=16  
    mSql="select * from MailList_UserGroup 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  bgcolor="<%=mColor%>"   onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#EBEEF6'" > 
          <td class=forumRowHighlight  width="8%" align="center"><%=rs("F_ID")%></td>
          <td class=forumRowHighlight width="16%" align="center" ><%=rs("F_Value")%> </td>
          <td class=forumRowHighlight > &nbsp;<%=rs("F_Value2")%>&nbsp;</td>
          <td class=forumRowHighlight width="21%" align="center" > <a title="添加记录" href='Admin_MailGroup.jsp?pageno=<%=mPage%>'><font color="#666666">添加</font></a> 
            | <a title="修改记录" href='Admin_MailGroup.jsp?action=edit&ModifyID=<%=rs("F_ID")%>&BgColor=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>'><font color="#666666">修改</font></a> 
            | 
            <%if re=1 then
			  Response.write "<font color=999999>删除</font>"
			  else%>
            <a title="请确定是否删除,删除后不能恢复!" href="javascript:jDelete('Admin_MailGroup.jsp?DeleteID=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>')"><font color="#666666">删除</font> 
            </a> 
            <%end if%>
          </td>
        </tr>
        <%
 rs.movenext
 re=re+1
 rc=rc-1
 loop
 end if
%>
      </table>
      <table  width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="FFFFFF">
        <tr> 
          <td class=forumRowHighlight width="40%" 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 class=forumRowHighlight width="60%" align="right"> 
            <%
if pageno>1 then
   response.write "<a href='Admin_MailGroup.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_MailGroup.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_MailGroup.jsp?pageno="&pno&"'>"&pno&"</a></b>"
 end if
next
response.write "&nbsp"

if int(pageno) < int(rs.pagecount) then
  response.write "<a href='Admin_MailGroup.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_MailGroup.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%>
<br>
<br>
<strong><font color=red> </font></strong> 
<form name="form1" method="post" action="Admin_MailGroup.jsp?pageno=<%=mpage%>&action=Insert" onSubmit="return CheckData()">
<table class=tableBorder width="95%" border=0 align="center" cellpadding=2 cellspacing=1>
  <tbody>
    <tr> 
        <th height=21 colspan="2" sytle="line-height:150%">新增记录</th>
    </tr>
    <tr> 
      <td width="21%"  class=forumRow> 组名称：</td>
      <td width="79%"  class=forumRowHighlight><input name="txtValue" type="text"  class="INPUT" value="" size="21" maxlength="20"> 
      </td>
    </tr>
      <tr> 
        <td class=forumRow>备　注：</td>
      <td class=forumRowHighlight><input name="txtValue22" type="text"  class="INPUT" value="" size="50"></td>
    </tr>
    <tr> 
      <td class=forumRow>&nbsp;</td>
      <td class=forumRowHighlight><input type="submit" name="Submit" value="提交" class="button"> 
        <input type="reSet" name="Submit2" value="重置" class="button">
      </td>
    </tr>
  </tbody>
</table>
</form>
<%else%>
<br>
<br><form name="form1" method="post" action="Admin_MailGroup.jsp?pageno=<%=request("pageno")%>&ModifyID=<%=request("ModifyID")%>" onSubmit="return CheckData()">
<table class=tableBorder width="95%" border=0 align="center" cellpadding=2 cellspacing=1>
  <tbody>
    <tr> 
      <th height=21 colspan="2" sytle="line-height:150%">功能：修改记录</th>
    </tr>
    <tr> 
      <td width="21%"  class=forumRow> 组名称：</td>
      <td width="79%"  class=forumRowHighlight><input name="txtValue23" type="text"  class="INPUT" value="<%=mValue%>" size="21" maxlength="20"> 
      </td>
    </tr>
    <tr> 
      <td class=forumRow>备　注：</td>
      <td class=forumRowHighlight><input name="txtValue2" type="text"  class="INPUT" value="<%=mValue2%>" size="50"></td>
    </tr>
    <tr> 
      <td class=forumRow>&nbsp;</td>
      <td class=forumRowHighlight><input type="submit" name="Submit3" value="提交" class="button"> 
        <input type="reSet" name="Submit22" value="重置" class="button"> </td>
    </tr>
  </tbody>
</table>
</form>
<%end if%>
</body>
</html>
<%
 rs.close
 CloseDatabase()
%>
