<!--#include file="Access.asp"  -->
<!-- #include file="inc/functions.asp" -->
<!-- #include file="x_to_html/index_to_html.asp" -->
<%
pid_name=request.querystring("pid_name")
pid_name2=request.querystring("pid_name2")
pid=cint(request.querystring("pid"))
ppid=cint(request.querystring("ppid"))

act=Request("act")
If act="save" Then 
pid=trim(request.form("pid"))
ppid=trim(request.form("ppid"))
c_name=trim(request.form("c_name"))
c_folder=trim(request.form("c_folder"))
c_image=trim(request.form("web_image"))
c_keywords=trim(request.form("c_keywords"))
c_description=trim(request.form("c_description"))
c_content=trim(request.form("c_content"))
c_index_push=trim(request.form("c_index_push"))
c_time=now()

set rs=server.createobject("adodb.recordset")
sql="select * from web_com_type"
rs.open(sql),cn,1,3
rs.addnew
if ppid=2 then
rs("pid")=pid
rs("ppid")=2
elseif ppid=3 then
rs("pid")=pid
rs("ppid")=3
else
rs("ppid")=1
end if
rs("name")=c_name
rs("folder")=c_folder
rs("image")=c_image
rs("keywords")=c_keywords
rs("description")=c_description
rs("content")=c_content
rs("index_push")=c_index_push
rs("time")=c_time
rs.update
rs.close
set rs=nothing
%>

<% '在/firm/class中创建分类文件夹
set rs=server.createobject("adodb.recordset")
sql="select top 1 [id] from [web_com_type] where [name]='"&c_name&"' order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
NewFolderDir="/firm/class/"&rs("id")
call CreateFolderB(NewFolderDir)
end if
rs.close
set rs=nothing
%>

<%
response.Write "<script language='javascript'>alert('添加成功！');location.href='com_type_list.asp';</script>"
end if 
 %>
	<%
Call header()

%>

  <form id="form1" name="form1" method="post" action="?act=save">
         <script language='javascript'>
function checksignup1() {
if ( document.form1.c_name.value == '' ) {
window.alert('请输入分类名称^_^');
document.form1.c_name.focus();
return false;}

return true;}
</script>
	<table cellpadding='3' cellspacing='1' border='0' class='tableBorder' align=center>
	<tr>
	  <th class='tableHeaderText' colspan=2 height=25>添加黄页分类</th>
	<tr>
	<td width="15%" height=23 class='forumRow'>分类名称 (必填) </td>
	<td class='forumRow'><input name='c_name' type='text' id='c_nampe' size='40'>
	<input name='pid' type='hidden' id='pid' size='40' value="<%=pid%>">
	<input name='ppid' type='hidden' id='ppid' size='40' value="<%=ppid%>">
	  &nbsp;<span style="color: #FF0000"><%
	  if ppid=2 then
response.write "当前为二级分类:&nbsp;"&pid_name
elseif ppid=3 then
response.write "当前为三级分类:&nbsp;"&pid_name&"&nbsp;>&nbsp;"&pid_name2
else
response.write "当前为一级分类"
end if%></span></td>
	</tr>
	<tr>
	<td class='forumRowHighLight' height=23>分类文件夹名称</td>
    <td class='forumRowHighLight'><input type='text' id='c_folder' name='c_folder' size='40'>
      &nbsp;必须使用英文字符，不填则显示随机四位数字</td>
	</tr>
	  <tr>
	    <td class='forumRow' height=23>分类图片</td>
	    <td width="85%" class='forumRow'><table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td width="22%"  class='forumRow'><input name="web_image" type="text" id="web_image"  size="30"></td>
           <td width="78%"  class='forumRow'><iframe width="500" name="ad" frameborder=0 height=30 scrolling=no src=upload.asp></iframe></td>
         </tr>
       </table></td>
      </tr>

      <td class='forumRowHighLight' height=11>分类关键字</td>
	      <td class='forumRowHighLight'><input type='text' id='v3' name='c_keywords' size='80'>
	  &nbsp;请以，隔开</td>
	</tr><tr>
	  <td class='forumRow' height=11>分类描述</td>
	  <td class='forumRow'><textarea name='c_description'  cols="100" rows="4" id="c_description" ></textarea></td>
	</tr>
	<tr>
	  <td class='forumRow' height=23>分类简介</td>
	  <td class='forumRow'> <textarea name='c_content' style='display:none' dataType='Require'  ></textarea>
 <iframe ID='eWebEditor1' src='editor/ewebeditor.htm?id=c_content&style=coolblue&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename' frameborder='0' scrolling='no' width='100%' HEIGHT='260'></iframe></td>
	</tr>
	<tr>
	  <td class='forumRowHighLight' height=23>分类推荐</td>
	  <td class='forumRowHighLight'><label>
	    <input type="radio" name="c_index_push" value="1">
      是
      &nbsp;
      <input name="c_index_push" type="radio" value="0" checked>
      否</label></td>
	</tr>
	<tr><td height="50" colspan=2  class='forumRow'><div align="center">
	  <INPUT type=submit value='提交' onClick='javascript:return checksignup1()' name=Submit>
	  </div></td></tr>
	</table>
</form>

<%
Call DbconnEnd()
 %>