<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../Inc/Cls_Class.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),""&Request("ParentID")&"") then Call ReturnError()
if Not JudgePopedomTF(Session("Name"),"P0101") then Call ReturnError()
Dim ParentID,Result,ClassID,ParentCName,RsParentObj,SaveFilePath
ClassID = Request("ClassID")
Result = Request("Result")
ParentID = Request("ParentID")
SaveFilePath = Request("SaveFilePath")
if ParentID = "" then
	ParentCName = "参数传递错误，请重新加载"
elseif ParentID = "0" then
	ParentCName = "根栏目"
else
	Set RsParentObj = Conn.Execute("Select ClassCName from NewsClass where ClassID='" & ParentID & "'")
	if RsParentObj.Eof then
		ParentCName = "父栏目不存在，请重新加载"
	else
		ParentCName = RsParentObj("ClassCName")
	end if
	Set RsParentObj = Nothing
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>栏目添加</title>
</head>
<link href="Class.css" rel="stylesheet">
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<body>
<div align="center">
  <table width="98%" border="0" cellspacing="5" cellpadding="0">
    <form action="" method="post" name="ClassForm">
      <tr> 
        <td height="5" colspan="2"></td>
      </tr>
      <tr> 
        <td width="18%"><div align="center">中文名称</div></td>
        <td> <div align="center"> 
            <input value="<% = Request("ClassCName") %>" name="ClassCName" type="text" id="ClassCName" style="width:100%;">
          </div></td>
      </tr>
      <tr> 
        <td><div align="center">英文名称</div></td>
        <td> <div align="center"> 
            <input value="<% = Request("ClassEName") %>" name="ClassEName" type="text" id="ClassEName" style="width:100%;">
          </div></td>
      </tr>
      <tr> 
        <td><div align="center">父 栏 目</div></td>
        <td> <div align="center"> 
            <input readonly value="<% = ParentCName %>" style="width:100%;" type="text" name="textfield3">
          </div></td>
      </tr>
      <tr> 
        <td><div align="center">栏目模板</div></td>
        <td nowrap> <div align="left"> 
            <input name="ClassTemp" type="text" style="width:78%;" value="/<% = RemoveVirtualPath(TempletDir) %>/NewsClass/class.htm" readonly><input type="button" name="Submit" value="选择模板" onClick="OpenWindowAndSetValue('../Inc/SelectFileFrame.asp?CurrPath=/<% = TempletDir %>',400,300,window,document.ClassForm.ClassTemp);document.ClassForm.ClassTemp.focus();">
          </div></td>
      </tr>
      <tr> 
        <td><div align="center">保存路径</div></td>
        <td nowrap> <div align="left"> 
            <input readonly value="<% = SaveFilePath %>" type="text" style="width:78%;" name="SaveFilePath"><input type="button" name="Submit" value="选择路径" onClick="OpenWindowAndSetValue('../Inc/SelectPathFrame.asp?CurrPath=/<% = ClassDir %>',400,300,window,document.ClassForm.SaveFilePath);document.ClassForm.SaveFilePath.focus();">
          </div></td>
      </tr>
      <tr>
        <td><div align="center">浏览权限</div></td>
        <td nowrap>
		<select name="BrowPop" id="select3" style="width:100%" onChange="CheckFileExtName(this);">
            <option value="" <%if Request("BrowPop")="" then Response.Write("selected")%>> 
            </option>
            <%
		Dim BrowPopObj
		set BrowPopObj = Conn.Execute("Select Name,PopLevel from MemGroup order by PopLevel asc")
		while not BrowPopObj.eof
		%>
            <option value="<%=BrowPopObj("PopLevel")%>" <%if Request("BrowPop")<>"" and isnull(Request("BrowPop"))=false then if Cint(Request("BrowPop")) = Cint(BrowPopObj("PopLevel")) then Response.Write("selected") end if end if%>><%=BrowPopObj("Name")%></option>
            <%
			BrowPopObj.Movenext
		Wend
		BrowPopObj.Close
		Set BrowPopObj = Nothing
		%>
          </select></td>
      </tr>
      <tr> 
        <td><div align="center">扩 展 名</div></td>
        <td nowrap> <div align="left"> 
            <select name="FileExtName" style="width:100%;">
              <option value="htm" selected>htm</option>
              <option value="html">html</option>
              <option value="shtml">shtml</option>
              <option value="asp">asp</option>
            </select>
          </div></td>
      </tr>
      <tr>
        <td><div align="center">添加日期</div></td>
        <td><div align="left">
            <input readonly value="<%If Request("AddTime")="" then Response.Write(Now()) else Response.Write(Request("AddTime")) %>" type="text" style="width:77%;" name="AddTime"><input name="sdaf" type="button" id="sdaf" onClick="OpenWindowAndSetValue('../Inc/SelectDate.asp',280,120,window,document.ClassForm.AddTime);document.ClassForm.AddTime.focus();" value="选择日期">
        </div></td>
      </tr>
      <tr>
        <td><div align="center">允许投稿</div></td>
        <td><input name="Contribution" type="checkbox" id="Contribution" value="1"></td>
      </tr>
      <tr> 
        <td colspan="2">
		<div align="center"> 
                  <input type="button" name="Submitgsdfg" onClick="OK();" value=" 确 定 ">
                  <input name="Result" type="hidden" id="Result" value="Submit">
                  <input name="ClassID" value="<% = ClassID %>" type="hidden" id="ClassID">
                  <input name="ParentID" value="<% = ParentID %>" type="hidden" id="ParentID">
                  <input type="button" name="Submit2" onClick="window.close();" value=" 取 消 ">
        </div></td>
      </tr>
    </form>
  </table>
</div>
</body>
</html>
<%
if Result = "Submit" then
	Dim CClass,ReturnCheckInfo
	Set CClass = New ClassClass
	CClass.TForm = Request.Form
	ReturnCheckInfo = CClass.AddAndModifyClass()
	if ReturnCheckInfo = "" then
%>
<script>
dialogArguments.location.reload();
window.close();
</script>
<%
	else
%>
<script>alert('<% = ReturnCheckInfo %>');history.back();</script>
<%
	end if
end if
Set Conn = Nothing
%>
<script language="JavaScript">
function OK()
{
	if (CheckEnglishStr(document.ClassForm.ClassEName,'英文名称')==true)
	{
		document.ClassForm.submit();
	}
}
function CheckFileExtName(Obj)
{
	if (Obj.value!='')
	{
		for (var i=0;i<document.all.FileExtName.length;i++)
		{
			if (document.all.FileExtName.options(i).value=='asp') document.all.FileExtName.options(i).selected=true;
		}
		document.all.FileExtName.disabled=true;
	}
	else
	{
		document.all.FileExtName.disabled=false;
	}
}
</script>