<!--#include file="mdb.asp"-->
<!--#include file="config.asp"-->
<!--#include file="chklogin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>收藏夹</title>
<style type="text/css">
<!--
a {
	font-size: 12px;
	color: #6A6A6A;
}
a:visited {
	color: #4F4F4F;
	text-decoration: none;
}
a:active {
	color: #F97C00;
	text-decoration: none;
}
a:link {
	color: #4F4F4F;
	text-decoration: none;
}
a:hover {
	text-decoration: none;
	color: #F97C00;
}
body,td,th {
	font-size: 12px;
	color: #4F4F4F;
}
.greenborder {border:1px solid #7EC8EA;}
.greenborder1 {border-right:1px solid #7EC8EA; background-color:#EFF8FC}
.inp {width:154px;border:1px solid #7f9db9;color:#052A5C}
.inp1 {width:66px;border:1px solid #7f9db9;color:#052A5C;font-size:9px;height:15px;margin-right:2px}
.slct {width:158px}
.sub {width:36px}
body {
	margin-top: 0px;
}
.style1 {font-weight: bold}
-->
</style>
<script>
function addclasscheck()
{
    var form = document.addclassForm;
	if (form.classname.value == "")
	{
		alert("分类名称不能为空!");
		form.classname.focus();
		return false;
	}
	if (form.classname.value.length > 6)
	{
		alert("分类名称最多为6个汉字!");
		form.classname.focus();
		return false;
	}
	if (form.memo.value.length > 50)
	{
		alert("备注最多为50个汉字!");
		form.memo.focus();
		return false;
	}
	return true;
}
function upclasscheck()
{
    var form = document.upclassForm;
	if (form.classname.value == "")
	{
		alert("分类名称不能为空!");
		form.classname.focus();
		return false;
	}
	if (form.classname.value.length > 6)
	{
		alert("分类名称最多为6个汉字!");
		form.classname.focus();
		return false;
	}
	if (form.memo.value.length > 50)
	{
		alert("备注最多为50个汉字!");
		form.memo.focus();
		return false;
	}
	return true;
}
</script>
</head>

<body>
<%set rs=server.createobject("adodb.recordset")
set rss=server.createobject("adodb.recordset")
dim classname,memo,classid
classname=Request("classname")
classid=Request("classid")
memo=Trim(Request("memo"))
select case Request("menu")
case ""
main()
case "addclass"
addclass()
case "upclass"
upclass()
case "addchkclass"
addchkclass()
case "upchkclass"
upchkclass()
case "delclass"
delclass()
end select
sub addclass()
%>
<form action="?" method="post" name="addclassForm" onSubmit="return addclasscheck();">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
    <tr>
      <td width="6%" bgcolor="#BFDFFF">分类名：</td>
      <td width="94%" bgcolor="#FFFFFF"><input name="classname" type="text" id="classname" size="10">
        最多6个汉字&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">备&nbsp;&nbsp;注：</td>
      <td bgcolor="#FFFFFF"><textarea name="memo" id="memo"></textarea> 
      备注最多为50个汉字 </td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">操&nbsp;&nbsp;作：</td>
      <td bgcolor="#FFFFFF"><input type="hidden" name="menu" value="addchkclass"><input type="submit" name="Submit2" value="提交">
          <input type="reset" name="Submit3" value="取消">
      </td>
    </tr>
  </table>
</form>
<%end sub
sub upclass()
rs.open "select * from 84wz_my_class where id="&classid,conn,1,3
%>
<form action="?" method="post" name="upclassForm"  onSubmit="return upclasscheck();">
  <table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
    <tr>
      <td width="6%" bgcolor="#BFDFFF">分类名：</td>
      <td width="94%" bgcolor="#FFFFFF"><input name="classname" type="text" id="classname" value="<%=rs("classname")%>" size="10">
        最多6个汉字&nbsp;&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">备&nbsp;&nbsp;注：</td>
      <td bgcolor="#FFFFFF"><textarea name="memo" id="memo"><%=trim(rs("memo"))%></textarea>        备注最多为50个汉字  </td>
    </tr>
    <tr>
      <td bgcolor="#BFDFFF">操&nbsp;&nbsp;作：</td>
      <td bgcolor="#FFFFFF"><input type="hidden" name="menu" value="upchkclass"><input type="hidden" name="classid" value='<%=classid%>'>
      <input type="submit" name="Submit22" value="提交">
          <input type="reset" name="Submit32" value="取消">
      </td>
    </tr>
  </table>
</form>
<%rs.close
end sub
sub addchkclass()
rs.open "select * from 84wz_my_class where username='"&username&"'",conn,1,3
if rs.recordcount>15 then
Response.Write("<script language=javascript>alert('最多添加15个分类');this.location.href='main.asp';</script>")
Response.end
end if
rs.close
rs.open "select * from 84wz_my_class",conn,1,3
rs.addnew
rs("username")=username
rs("classname")=classname
if memo="" then memo=" "
rs("memo")=memo
rs.update
rs.close
Response.Write("<script language=javascript>alert('分类添加成功');this.location.href='main.asp';</script>")
end sub
sub upchkclass()
rs.open "select * from 84wz_my_class where id="&classid,conn,1,3
rs("classname")=classname
if memo="" then memo=" "
rs("memo")=memo
rs.update
rs.close
Response.Write("<script language=javascript>alert('分类修改成功');this.location.href='main.asp';</script>")
end sub
sub main()
rs.open "select * from 84wz_my_class where username='"&username&"'",conn,1,3
%>
<table width="100%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#62B0FF">
  <tr align=center>
    <td width="15%" bgcolor="#FFFFFF">分类名称</td>
    <td width="74%" bgcolor="#FFFFFF">备注</td>
    <td width="5%" bgcolor="#FFFFFF">编辑</td>
    <td width="6%" bgcolor="#FFFFFF">删除</td>
  </tr>
<%while not rs.eof%>
  <tr>
    <td width="15%" bgcolor="#FFFFFF"><%=rs("classname")%></td>
    <td width="74%" bgcolor="#FFFFFF"><%=left(rs("memo"),20)%>...</td>
    <td width="5%" bgcolor="#FFFFFF"><div align="center"><a href='?menu=upclass&classid=<%=rs("id")%>'>编辑</a></div></td>
    <td width="6%" bgcolor="#FFFFFF"><div align="center"><a href='?menu=delclass&classid=<%=rs("id")%>' onClick='return confirm("确定要删除此分类吗？同时删除分类下所有记录！");'>删除</a></div></td>
  </tr>
<%rs.movenext
wend
rs.close%>
</table>
<%end sub
sub delclass
conn.execute "delete from 84wz_my_class where id="&classid
conn.execute "delete from 84wz_my_url where classid="&classid
Response.Write("<script language=javascript>alert('分类已删除');this.location.href='main.asp';</script>")
end sub
%>
</body>
</html>

