<%@ codepage ="936" %>
 
<% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="no"
	dir="no" 
  %>
 <!--#include file="../../conn/conn.asp"-->
 <!--#include file="../../inc/safe.asp"-->
  <!--#include file="../rolecheck.asp"-->
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/style.css" rel=stylesheet type=text/css>
</head>
<%
dim body
call main()
set rs=nothing
conn.close
set conn=nothing
sub main()
%>
 <table width="98%" border="0" cellspacing="0" cellpadding="0"  align=center class="tableBorder"> 
  <tr> 
     <th width="100%" height=25 class="tableHeaderText">展会资讯类别管理 </th> 
   </tr> 
  <tr> 
     <td height="20" colspan="2"  ><font color="#666666">温馨提示： 
         ①类别直接与发布的信息相关联，删除类别可能会影响到以前发布的展会资讯信息。</font> </td> 
   </tr> 
</table> 
<font color="<%=TableContentColor%>"> 
<%
           if request("action") ="add_class_1" then 
              call add_class_1()
           elseif request("action")="add_class_1_ok" then
              call add_class_1_ok()
           elseif request("action")="edit_class_1" then
              call edit_class_1()
           elseif request("action")="savedit_1" then
              call savedit_1()
           elseif request("action")="del_class_1" then
              call del_class_1()
           else
              call linkinfo()
           end if
           %> 
 <%=body%> 
</font> 
<%
end sub
sub add_class_1()
%> 
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
 if(document.FORM1.class_name.value.length<1)
 {
   alert("您必须输入类别名称!");
   document.FORM1.class_name.focus();
   return false;
 }
}
</SCRIPT> 
  <TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder"> 
  <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=class_ok.asp?action=add_class_1_ok method=post> 
  <TR> 
      <Th colSpan=2 height="28" class="tableHeaderText">添加展会资讯类别</Th> 
    </TR> 
    <TR> 
      <TD width=41% height=40 class="forumRowHighlight" align=center><b>要添加的类别名称：</b></TD> 
      <TD width=59% height=25 class="forumRowHighlight"><INPUT maxLength=16 size=25 name=class_name></TD> 
    </TR> 
    <TR> 
      <TD colSpan=2 height="27" align=center class="forumRowHighlight"> <INPUT type=submit value='确 定 添 加' name=Submit2> </TD> 
    </TR> </FORM> 
   </TABLE> 
<%
end sub
sub edit_class_1()
    set rs=server.createobject("adodb.recordset")
    sqltext="select * from Websen_expoinfotype where id="+Cstr(request("id"))
    rs.open sqltext,conn,1,1
%> 
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder"> 
 <form name=form1 action="class_ok.asp?action=savedit_1" method=post> 
  <input type=hidden name=id value="<%=Cstr(request("id"))%>"> 
   <TR> 
      <Th colSpan=2 height="28" class="tableHeaderText">修改展会资讯类别</Th> 
    </TR> 
    <tr> 
      <td width="40%" height="40" align=center class="forumRowHighlight"><b>要修改的类别名称：</b></td> 
      <td width="60%" class="forumRowHighlight"> <input name="class_1_name" type="text" value="<%=rs("type")%>" size='40' maxlength="16"> </td> 
    </tr> 
    <tr> 
      <td height="30" colspan="2" class="forumRowHighlight" align="center"> <input type="submit" name="Submit" value="确 定 修 改"> </td> 
    </tr> </form> 

  </table> 
<%
rs.close
set rs=nothing
end sub
sub savedit_1()
    set rs= server.createobject ("adodb.recordset")
    sql = "select * from Websen_expoinfotype where id="+Cstr(Replace_Text(request("id")))
    rs.Open sql,conn,1,3
    if rs.eof and rs.bof then
       body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息。"
    else
       rs("type")=Replace_Text(Request.Form ("class_1_name"))
       rs.Update
    end if 
response.write"<br><table cellpadding=2 cellspacing=1 border=0 width=100% class=tableBorder align=center>"
response.write"<TR>"
response.write"<TH class=tableHeaderText colSpan=2 height=25>展会资讯类别管理</TH>"
response.write"<TR><tr><td height=85 valign=top class=forumRow><div align=center><br><br>分类修改成功！</div></td></tr>"
response.write"<tr align=center><td height=30 class=forumRowHighlight><a href='type.asp'>&lt;&lt; 返回上一页</a></td>"
response.write"</tr>"
response.write"</table>"
end sub

sub del_class_1()
     conn.execute "delete from Websen_expoinfotype where id="+Cstr(Replace_Text(request("id")))
response.write"<br><table cellpadding=2 cellspacing=1 border=0 width=100% class=tableBorder align=center>"
response.write"<TR>"
response.write"<TH class=tableHeaderText colSpan=2 height=25>展会资讯类别管理</TH>"
response.write"<TR><tr><td height=85 valign=top class=forumRow><div align=center><br><br>分类删除成功！</div></td></tr>"
response.write"<tr align=center><td height=30 class=forumRowHighlight><a href='type.asp'>&lt;&lt; 返回上一页</a></td>"
response.write"</tr>"
response.write"</table><br>"    
 
end sub

sub add_class_1_ok()
if Replace_Text(request.form("class_name"))="" then
response.Redirect(request.ServerVariables("HTTP_REFERER"))
end if

    set rs=server.createobject("adodb.recordset")
    sqltext="select * from Websen_expoinfotype where type='"&Replace_Text(request.form("class_name"))&"'"
    rs.open sqltext,conn,1,1
    '查找数据库，检查大类是否已经存在
    if rs.recordcount >= 1 then 
       if rs("type")=Replace_Text(request.form("class_name")) then
          response.write"<SCRIPT language=JavaScript>alert('此类别已经存在，请选用其它名称！');"
          response.write"this.location.href='class_ok.asp?action=add_class_1';</SCRIPT>"
       end if
    else
       set rs=server.createobject("adodb.recordset")
       sqltext="select * from Websen_expoinfotype"
       rs.open sqltext,conn,3,3
       rs.addnew
       rs("type")=Replace_Text(request.form("class_name"))
       rs.update
response.write"<br><table cellpadding=2 cellspacing=1 border=0 width=100% class=tableBorder align=center>"
response.write"<TR>"
response.write"<TH class=tableHeaderText colSpan=2 height=25>展会资讯类别管理</TH>"
response.write"<TR><tr><td height=85 valign=top class=forumRow><div align=center><br><br>添加展会资讯类别成功！</div></td></tr>"
response.write"<tr align=center><td height=30 class=forumRowHighlight><a href='type.asp'>&lt;&lt; 返回上一页</a></td>"
response.write"</tr>"
response.write"</table>"
end if
end sub
%> 
<!--#include file="../copy.asp" --> 
