<!--#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.ServerVariables("REQUEST_METHOD")="POST" then
  If Request.QueryString("action") = "insert" then
    'Insert    
    mCategoryID = Request.Form("selCategory")
	if mCategoryID = "" then 
      response.write "<script>alert('对不起,请创建书签的组别！');history.back();</Script>"
	  Response.end
	end if
    mWebSiteName = checkStr(Trim(Request.Form("txtWebSiteName")))
    mURL = checkStr(Trim(Request.Form("txtURL")))
    mSql = "Insert Into BM_Bookmark(F_CategoryID,F_WebSiteName,F_URL,F_Addtime,F_UserID)"
    mSql = mSql + " Values('"&mCategoryID&"','"&mWebSiteName&"','"&mURL&"','"&now()&"','"&mUserID&"')"
    conn.Execute(mSql)
    Response.Redirect "BM_Bookmark.asp"
  else
   
    m_Delete=request.form("hidDelete")
    m_MoveTO=request.form("btnMoveTO")
    if request.form("box").count < 1 then
      response.write "<script>alert('对不起,请选择你要操作的链接！');history.back();</Script>"
    else
	
	  if m_Delete = "删除" then
	    'Delete
		for each m_LinkID in Request.form("box")
	      mSql = "Delete from BM_Bookmark where F_UserID=" & mUserID & " and F_ID=" & m_LinkID
	     ' response.write mSql
		  conn.execute(mSql)
	    next
	    response.redirect "BM_Bookmark.asp"
	  else '进行移动到操作
	    'MoveTo
		m_CategoryID = Request.Form("selMoveTO")
	    for each m_linkID in request.form("box")
	      mSql="update BM_Bookmark set F_CategoryID=" & m_CategoryID & " where F_UserID=" & mUserID & " and F_ID=" & m_linkID
	      'response.write mSql
		  conn.execute(mSql)
	    next
	    Response.Redirect "BM_Bookmark.asp"
	  end if
	  
    end if
  end if
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">
<script language="javascript">
<!--
function CheckData()
{
  if (document.form1.txtWebSiteName.value=="")
  {
    alert("对不起，网站名称不能为空！");
	document.form1.txtWebSiteName.focus();
	return false;
   }
  if (document.form1.txtURL.value=="")
  {
    alert("对不起，网址不能为空！");
	document.form1.txtURL.focus();
	return false;
   }

}

function CheckData2()
{
  if (document.form3.txtTypeName.value=="")
  {
    alert("对不起，类别名称不能为空！");
	document.form3.txtTypeName.focus();
	return false;
   }
}

function PerDelete2()
{
  if((confirm("警告:请确认是否要删除该组别?\n删除后该组相关的书签也会全部删除!"))==true) 
  {
    document.form3.hidDelete2.value="删除";
    document.form3.submit();
	return false
   }
}


function CheckAll()
{     
  for (var k=0;k<document.form2.elements.length;k++)
    {
      var e = document.form2.elements[k];
      if (e.name != 'allbox')
	e.checked = document.form2.allbox.checked;
    }
}

function PerDelete(){
var tmptotal = 0;
  for(var i=0;i<document.form2.elements.length;i++)
  {
    var e=document.form2.elements[i];
    if(e.name=='box') 
    {
      if(e.checked==true){tmptotal++;
    }
  }
}
if( tmptotal > 0 ) {
if((confirm("确定要永久删除这 "+tmptotal+" 个书签吗?"))==true) {
document.form2.hidDelete.value="删除";
document.form2.submit();
}
} else {
alert( "你还没有选择任何书签!" );
}
}


//-->
</script>
</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>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td height="6"></td>
                </tr>
              </table>
              <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#999999">
                <tr> 
                  <td bgcolor="f0f8ff">【添加新书签】</td>
                </tr>
                <tr> 
                  <td bgcolor="#FFFFFF"><table width="100%" border="0" >
                      <form name="form1" action="BM_Bookmark.asp?action=insert" method="POST" onSubmit="return CheckData()">
                        <tr bgcolor="#FFFFFF"> 
                          <td>网站名称: 
                            <input name="txtWebSiteName" size="13" style="width:100;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff">
                            　网址http://<input name="txtURL" size="25" style="width:120;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff">
                            　组名: 
                            <select size="1" name="selCategory" style="width:80;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff">
                              <%
		 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
		   Response.write "<option value='"&rs(0)&"'>"&rs(1)&"</option>"
		   rs.movenext
		loop
		rs.Close
		%>
                            </select> <input type="submit" value="添加" name="add" style="width:50;height:18;border:1 solid #9a9999; font-size:9pt; background-color:#f8f8f8"> 
                          </td>
                        </tr>
                      </form>
                    </table></td>
                </tr>
              </table>
              <table width="99%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td height="6"></td>
                </tr>
              </table>
              <table width="100%" border=0 cellpadding=0 cellspacing=0>
                <tbody>
                  <tr> 
                    <td height="360" valign="top"> <form name="form2" action="BM_Bookmark.asp" method="POST">
                        <%
		            mSql = "Select F_ID,F_Value From BM_Category Where F_UserID=" & mUserID
					Set rst = conn.Execute(mSql)
		            do while not rst.eof
		            %>
                        <table width="99%" border="0" align="center" cellspacing="1" bgcolor="#C0C0C0">
                          <tr bgcolor="f0f8ff"> 
                            <td height="8" colspan="4" valign="middle"> <img src="../Images/member/url.gif" width="16" height="16" align="absbottom">&nbsp;<%=rst(1)%>                            </td>
                          </tr>
                          <%
					mSql = "Select * From BM_Bookmark where F_CategoryID="&rst("F_ID")
					Set rs = conn.Execute(mSql)
					if rs.Eof then
                      response.write "<tr valign='middle' bgcolor='#fcfcfc'><td><font color=#cccccc>本组暂时还没有书签！</font><td></tr>"
                    else
                    Do While Not rs.Eof
                   %>
                          <tr bgcolor="#FFFFFF"> 
                            <td width="3%" height="8"> <input type="checkbox" name="box" value="<%=rs("F_ID")%>"> 
                            </td>
                            <td width="31%" height="8"><img src="../Images/member/url.gif" width="16" height="16" align="absbottom"> 
                              <%response.write "<a href='http://" & rs("F_URL") & "' target='_blank'>" & rs("F_WebSiteName") & "</a>　"%>                            </td>
                            <td width="58%" height="8"> 
                              <%response.write "<a href='http://" & rs("F_URL") & "' target='_blank'>http://" & rs("F_URL") & "</a>　"%>
                            </td>
                            <td width="5%" height="8" align="center"> <span style="cursor:hand" onClick="window.open('BM_Update.asp?action=read&ID=<%=rs("F_ID")%>','test','height=128,width=280,top=45,left=500,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no, status=no')"><img alt="修改" src="../Images/member/edit.gif" width="18" height="13"></span></td>
                          </tr>
                          <%
                   rs.movenext
                   loop
				   rs.Close
                 end if
		         %>
                        </table>
                        <%
		 rst.movenext
	   loop
	   rst.Close
		 %>
                        <table width="99%" border="0" align="center">
                          <tr> 
                            <td align="right"><a href="BM_BookmarkGroup.asp"><font color="#FF0000">组别设置</font></a> 
                              <input type="hidden" name="hidDelete"> 
                              <input type="checkbox" name="allbox" value="Check All" onClick="CheckAll();">
                              选中所有的网址 
                              <input onClick="javascript:PerDelete();" type="button"  value="删除" name="btnDelete1" style="width:50;height:18;border:1 solid #9a9999; font-size:9pt; background-color:#f8f8f8">
                              　 
                              <input type="submit" value="移动到" name="btnMoveTO" style="width:60;height:18;border:1 solid #9a9999; font-size:9pt; background-color:#f8f8f8"> 
                              <select size="1" name="selMoveTO">
                                <%
		                  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
                            Response.Write "<option value='"&rs("F_ID")&"'>"&rs("F_Value")&"</option>"
                            rs.movenext
	 	                  loop
						  rs.Close
		                 %>
                              </select></td>
                          </tr>
                        </table>
                      </form></td>
                  </tr>
                </tbody>
              </table> </TD>
          </TR>
      </TABLE> </td>
  </tr>
</table>
<!--#include file="../include/bottom.asp" -->
</BODY></HTML>
