<%@ codepage ="936" %>
  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="52"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/FileSystem.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>

<script language="javascript">
function checkmodi()
{
  if(document.formmoid.class_1_name.value.replace(/^\s+|\s+$/g,'')=="")
 {
   alert("您必须输入大类名称!");
   document.formmoid.class_1_name.focus();
   return false;
 } 
 if(document.formmoid.orderid_1.value.replace(/^\s+|\s+$/g,'')=="")
 {
   alert("您必须输入排序号!");
   document.formmoid.orderid_1.focus();
   return false;
 }
}
</script></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 height=25 colspan="2" class="tableHeaderText">商业信息管理 </th> 
  </tr> 
  <tr> 
     <td colspan="2"   height="20"><font color="#666666">温馨提示：①类别直接与发布的信息相关联，删除类别可能会影响到以前发布的专项商机信息。</font> </td> 
  </tr> 
  <tr> 
     <td width="10%" height=25 class="forumRowHighlight"> <B>操作选项</B></td> 
         <FORM name=searchForm action="index.asp" method=post onSubmit="javascript:if(doSearch()==false) return false;"><td class="forumRowHighlight">
       关键字：<input name="keywords" type="text" value="<%=keywords%>" maxlength="10">
&nbsp;所属类别：
<select name="typeid" size="1">  
<%
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from Websen_newsType"
rs1.open sql1,conn,1,1
if not rs1.eof then
do while not rs1.eof
response.write "<option value='"&rs1("typeid")&"'>"&rs1("type")&"类信息</option>"&chr(13)+chr(10)
rs1.movenext
loop
rs1.close
end if
%>
</select> <input type="submit" value="立刻查找" id=submit name=submit>
         </td></form>
  </tr><Tr><td colspan="2" height="1"  bgcolor="#CCCCCC"></td></Tr>
  <tr>
    <td height=25 class="forumRowHighlight">&nbsp;</td>
	 <td class="forumRowHighlight"><a href="index.asp">管理商业信息</a> | <a href="addinfo.asp">添加商业信息</a> | <a href="type.asp">管理信息类别</a> | <a href="Class_Ok.asp?action=add_class_1">添加信息类别</a> | [<a href="javascript:location.reload()">刷新页面</a>] </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;
 }
  if(document.FORM1.orderid.value.length<1)
 {
   alert("您必须输入排序号!");
   document.FORM1.orderid.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=39% height=40 align=right class="forumRowHighlight">要添加的类别名称：</TD> 
      <TD width=61% height=25 class="forumRowHighlight"><INPUT maxLength=16 size=25 name=class_name onBlur="this.value=this.value.replace(/\s/igm,'')">&nbsp;  排序号:
  <input type="text" name="orderid"  value="0" maxlength="5" onKeyUp="value=value.replace(/[^\d]/g,'') " size=5   tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">	 </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_newstype where typeid="+Cstr(request("id"))
    rs.open sqltext,conn,1,1
%> 



  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder"> 
  <form name=formmoid action="class_ok.asp?action=savedit_1" method=post  onSubmit="return checkmodi()"> 
  <input type=hidden name=id value="<%=Cstr(request("id"))%>">   <TR> 
      <Th colSpan=2 height="28" class="tableHeaderText">修改商业信息类别</Th> 
    </TR> 
    <tr> 
      <td width="38%" height="40" align=right class="forumRowHighlight">要修改的类别名称：</td> 
      <td width="62%" class="forumRowHighlight"> <input name="class_1_name" type="text" onBlur="this.value=this.value.replace(/\s/igm,'')" value="<%=rs("type")%>" size='25' maxlength="16">
	  &nbsp;  排序号:
  <input type="text" name="orderid_1"  value="<%=rs("orderid")%>" maxlength="5" onKeyUp="value=value.replace(/[^\d]/g,'') " size=5   tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">	 
      </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_newstype where typeid="+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"))
	   orderid_1=Replace_Text(Request.Form ("orderid_1"))
	   if not isnumeric(orderid_1) then
	   orderid_1=0
	   end if
	   rs("orderid")=orderid_1
       rs.Update
    end if 

%>

<script language="javascript">
function Make_Select(Content)
{
//弹出确认对话框,为真则生成当前分类信息
var i=confirm(Content);
var ID1;
var ID2;
if(i)
{
document.write("<iframe src='../../manage/makehtml/info/makelist.asp?all=all'  scrolling='no' height=30 width='100%' frameborder='0'></iframe>")

document.write("<iframe src='../../manage/makehtml/info/makedetail.asp?all=all'  scrolling='no' height=30 width='100%' frameborder='0'></iframe>")


}
else
{
	document.write("分类修改成功");
}
}
</script>
<%
response.write"<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>"
Response.write "<script>Make_Select('您否继续生成修改后的分类?')</script>"
Response.write "</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>"
 rs.close
set rs=nothing
 end sub
  
sub del_class_1()
		
		FileName=HOPE_InstallDir&"info/community/"&Cstr(request("id"))&".html"
		FilePath=HOPE_InstallDir&"info/community/"
		Call FileDel(FileName) '删除生成的分类列表页面
		
 		 Call Del_Page(FilePath,Cstr(request("id"))) '删除生成的分类列表页面
		
		Set RsYxNews=Server.CreateObject("Adodb.Recordset")
			SqlYxNews="Select newsid,Typeid,Picture From Websen_news Where Typeid="&Cstr(request("id"))&""
			RsYxNews.Open SqlYxNews,Conn,1,3

			IF NOt RsYxNews.Eof Then 
				do while not RsYxNews.Eof
				typeid=RsYxNews("Typeid")
				ttid=RsYxNews("newsid")
				Picture=RsYxNews("Picture")
				
				FileName=HOPE_InstallDir&"info/detail/"&typeid&"-"&ttid&".html"
				 Call FileDel(FileName) '删除生成的当前分类的所有详细页面
				 
			     RsYxNews.MOvenExt
				 	if RsYxNews.Eof Then exit Do
				loop
			End if
				RsYxNews.Close
				Set RsYxNews=Nothing
    set rs=server.createobject("adodb.recordset")
    sqltext="delete from Websen_newstype where typeid="+Cstr(request("id"))
response.write"<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>"
%>

<script language="javascript">
function Make_Select(Content)
{
//弹出确认对话框,是否生成当前分类信息
var i=confirm(Content);
var ID1;
var ID2;
if(i)
{
document.write("<iframe src='../../manage/makehtml/info/makelist.asp?all=all'  scrolling='no' height=30 width='100%' frameborder='0'></iframe>")
 }
else
{
	document.write("分类修改成功");
}
}
</script>

<%
Response.write "<script>Make_Select('您否继续生成删除后页面的分类?')</script>"
Response.write "</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>"    
rs.open sqltext,conn,3,3
end sub

 sub add_class_1_ok()
    set rs=server.createobject("adodb.recordset")
    sqltext="select * from Websen_newstype 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_newstype"
       rs.open sqltext,conn,3,3
       rs.addnew
       rs("type")=Replace_Text(request.form("class_name"))
	   orderid=Replace_Text(request.form("orderid"))
	   if not isnumeric(orderid) then
	   orderid=0
	   end if
	   rs("orderid")=orderid
       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>"
Response.write "<div align=center><br><br>"
	rs.close
	set rs=nothing
%>

<script language="javascript">
//生成所有分类
function Make_Select_ADD(Content)
{
//弹出确认对话框,为真则生成当前分类信息
var i=confirm(Content);
var ID1;
var ID2;
if(i)
{
document.write("<iframe src='../../manage/makehtml/info/makelist.asp?all=all'  scrolling='no' height=30 width='100%' frameborder='0'></iframe>")
 }
else
{
	document.write("分类修改成功");
}
}
</script>

<%
Response.write "<script>Make_Select_ADD('您否继续生成添加后的分类?')</script>"
 Response.write "</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" --> 
  