<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="IsLogin.asp" -->
<%
mUserID = checkStr(Session("CurUserID"))
'Auto Create Category
m_Sql = "Select * From BM_Category Where F_UserID="&mUserID
Set rs = conn.Execute(m_Sql) 
if rs.eof then
  m_Sql = "Insert into BM_Category(F_UserID,F_Value)Values("&mUserID&",'常用书签')"
  conn.Execute(m_Sql)
end if
rs.Close
If Request.QueryString("action") = "edits" then
m_Sql = "Select * From BM_Category Where F_ID="&Request.QueryString("B_ID")
Set rs = conn.Execute(m_Sql)
 if not rs.eof then
 F_Value=rs("F_Value")
 end if
rs.Close
end if


If Request.ServerVariables("REQUEST_METHOD")="POST" then
  If Request.QueryString("action") = "insert" then
    txtTypeName = Request.Form("txtTypeName")
	if txtTypeName = "" then 
      response.write "<script>alert('请输入所要创建的组别名称！');history.back();</Script>"
	  Response.end
	end if
    txtTypeName = checkStr(Trim(Request.Form("txtTypeName")))
    mSql = "Insert Into BM_Category(F_UserID,F_Value)"
    mSql = mSql + " Values('"&mUserID&"','"&txtTypeName&"')"
    conn.Execute(mSql)
    Response.Redirect "BM_BookmarkGroup.asp"
  end if
  If Request.QueryString("action") = "editss" then
    txtTypeName = Request.Form("txtTypeName")
	F_ID = Request.Form("F_ID")
	if txtTypeName = "" or F_ID="" then 
      response.write "<script>alert('组别名称不能为空！');history.back();</Script>"
	  Response.end
	end if
	m_Sql = "Update BM_Category set"
    m_Sql = m_Sql + " F_Value='"&txtTypeName&"'"
    m_Sql = m_Sql + " Where F_ID="&F_ID
    set rs=conn.execute(m_Sql)
	Response.Redirect "BM_BookmarkGroup.asp"
  end if
  
End if

    If Request.QueryString("action") = "dels" then
	D_ID = Request.QueryString("D_ID")
	if D_ID="" then 
      response.write "<script>alert('请选择您要删除的组！');history.back();</Script>"
	  Response.end
	end if
	m_Sqld = "Select * From BM_Category Where F_UserID="&mUserID&" order by F_ID"
    set rs=conn.execute(m_Sqld)
    if not rs.eof then
	 F_ID=rs("F_ID")
	end if
    if F_ID=D_ID then
	 response.write "<script>alert('默认组不能删除！');history.back();</Script>"
	 Response.end
	else
	 mSql = "Delete from BM_Category where F_UserID="&mUserID&" and  F_ID=" & D_ID
	 conn.execute(mSql) 
	end if
					
	m_Sql = "Update BM_Bookmark set"
    m_Sql = m_Sql + " F_CategoryID='"&F_ID&"'"
    m_Sql = m_Sql + " Where F_CategoryID="&D_ID
    set rs=conn.execute(m_Sql)
	Response.Redirect "BM_BookmarkGroup.asp"
  end if

%>

<HTML><HEAD><TITLE>会员俱乐部在线书签</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link href="../css/member.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!--#include file="../include/top.asp" -->
<!--#include file="../include/member_top.asp" --><!--#include file="club_top.asp" -->
<!--#include file="Top.asp" -->
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="183" height="400" align="center" valign="top"> 
      <!--#include file="left.asp" -->
    </td>
    <td width="597" align="center" valign="top"><table width="96%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="100%" height="40" align="right"><img src="../Images/member/hy_c_7.gif" width="230" height="80"></td>
        </tr>
        <tr> 
          <td height="1" bgcolor="#c7c7c7"></td>
        </tr>
      </table>
      <TABLE width="96%" 
      border=0 align="center" cellPadding=0 cellSpacing=0 
      borderColor=#111111 bgcolor="#FFFFFF" id=AutoNumber7 style="BORDER-COLLAPSE: collapse">
        <TBODY>
          <TR valign="top"> 
            <TD colSpan=2> <br> 
              <TABLE cellSpacing=3 cellPadding=0 width=100% border=0>
                  <TBODY>
                    <TR bgColor=#f2f2f2> 
                    <TD width="542" height=30>【组别管理】【<a href="BM_Bookmark.asp">反回收藏</a>】</TD>
                    </TR>
                    <TR bgColor=#f2f2f2>
                      <TD height=30 bgcolor="#FFFFFF">                            
                        <table width="51%"  border="0" align="center" cellpadding="6" cellspacing="2">
                          <% mSql = "Select F_ID,F_Value From BM_Category where F_UserID=" & mUserID &" order by F_ID asc"
		                  Set rs = conn.Execute(mSql)
		                  do while not rs.eof%><tr>
                            <td width="60%" height="26"><%=rs("F_Value")%></td>
                            <td width="21%"><%if rs("F_Value")<>"常用书签" then%><a href="?B_ID=<%=rs("f_ID")%>&action=edits"><img src="../Images/member/edit.gif" width="18" height="13" border="0">修改</a><%end if%></td>
                            <td width="19%"><%if rs("F_Value")<>"常用书签" then%><a href="?D_ID=<%=rs("F_ID")%>&action=dels"><img src="../Images/member/deletes.gif" width="13" height="13" border="0">删除</a><%end if%></td>
                          </tr><%rs.movenext
	 	                  loop
						  rs.Close %>
                        </table></TD>
                    </TR>
                    <TR> 
                      <TD align=middle 
                  height=25> <form name="form3" method="post" action="bm_bookmarkgroup.asp?action=<%if trim(Request.QueryString("B_ID"))="" then%>insert<%else%>editss<%end if%>" >
<table width="100%" border="0" cellspacing="3" cellpadding="3">
                        <tr> 
                          <td> 组别名称: 
                            <input name="txtTypeName" value="<%=F_Value%>" size="21" maxlength="10" >
                            <input name="F_ID" type="hidden" id="F_ID" value="<%=trim(Request.QueryString("B_ID"))%>"> 
                          </td>
                        </tr>
                        <tr> 
                          <td> <input type="submit" value="保存" name="btnInsert"> 
							</td>
                        </tr> 
                      </table></form></TD>
                    </TR>
                   
              </TABLE></TD>
          </TR>
      </TABLE>
       </td>
  </tr>
</table>
<!--#include file="../include/bottom.asp" -->
</BODY></HTML>
