<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：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友情连接
'==============================================================================
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0104") then Call ReturnError()
%>
<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>专题/频道添加</title>
</head>
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<script language="JavaScript">
function OK()
{
	if (CheckEnglishStr(document.SpecialFrom.EName,'英文名称')==true)
	{
		document.SpecialFrom.submit();
	}
}
</script>
<body topmargin="0" leftmargin="0">
<form action="" name="SpecialFrom" method="post">
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
    <tr> 
      <td height="3" colspan="3"></td>
    </tr>
    <tr> 
      <td width="7%">&nbsp;</td>
      <td width="14%">中文名称</td>
      <td width="79%"><input name="CName" type="text" id="CName" style="width:92%" value="<%=Request("CName")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>英文名称</td>
      <td><input name="EName" type="text" id="EName" style="width:92%" value="<%=Request("EName")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>导航图片</td>
      <td><input name="NaviPic" type="text" id="NaviPic" size="23" value="<%=Request("NaviPic")%>"> 
        <input type="button" name="Submit" value="选择图片" onClick="OpenWindowAndSetValue('../inc/SelectPic.asp?CurrPath=/<% = UpFiles %>',550,290,window,document.SpecialFrom.NaviPic);"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>专题/频道模板</td>
      <td> <input name="Templet" readonly type="text" id="Templet" size="23" value="<% if Request("Templet")="" then Response.Write("/"&RemoveVirtualPath(TempletDir)&"/NewsClass/Special.htm") else Response.Write(Request("Templet"))%>"> 
        <input type="button" name="Submit2" value="选择模板" onClick="OpenWindowAndSetValue('../Inc/SelectFileFrame.asp?CurrPath=/<% = TempletDir %>',400,300,window,document.SpecialFrom.Templet);document.SpecialFrom.Templet.focus();"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>保存路径</td>
      <td><input readonly name="SaveFilePath" type="text" size="23" value="<%=Request("SaveFilePath")%>">
        <input type="button" name="Submit5" value="选择路径" onClick="OpenWindowAndSetValue('../Inc/SelectPathFrame.asp?CurrPath=/<% = ClassDir %>',400,300,window,document.SpecialFrom.SaveFilePath);document.SpecialFrom.SaveFilePath.focus();"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>首页说明</td>
      <td><textarea name="IndexNaviWord" id="IndexNaviWord" style="width:92%"><%=Request("IndexNaviWord")%></textarea></td>
    </tr>
    <tr  style="display:none;"> 
      <td>&nbsp;</td>
      <td>栏目说明</td>
      <td><input name="ClassNaviWord" type="text" id="ClassNaviWord" style="width:92%" value="<%=Request("ClassNaviWord")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>更多图片</td>
      <td> <input name="MorePic" type="text" id="MorePic" style="width:92%" value="<%=Request("MorePic")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>添加时间</td>
      <td><input name="AddTime" type="text" id="AddTime" value="<%if Request("AddTime")="" then Response.Write(now()) else Response.Write(Request("AddTime")) end if%>" size="23"> 
        &nbsp;导航显示 
        <input name="ShowNaviTF" type="checkbox" id="ShowNaviTF2" value="1" checked></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>扩 展 名</td>
      <td><select name="FileExtName" style="width:92%;">
          <option value="htm" <%if Request("FileExtName")="htm" then Response.Write("selected")%>>htm</option>
          <option value="html" <%if Request("FileExtName")="html" then Response.Write("selected")%>>html</option>
          <option value="shtm" <%if Request("FileExtName")="shtm" then Response.Write("selected")%>>shtm</option>
		  <option value="shtml" <%if Request("FileExtName")="shtml" then Response.Write("selected")%>>shtml</option>
          <option value="asp" <%if Request("FileExtName")="asp" then Response.Write("selected")%>>asp</option>
        </select></td>
    </tr>
    <tr> 
      <td colspan="3"><div align="center"> 
          <input type="button" name="Submit3" onClick="OK();" value=" 添 加 ">
          <input name="action" type="hidden" id="action" value="add">
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          <input type="submit" name="Submit4" value=" 取 消 " onClick="window.close();">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
<%
  if Request("action")="add" then
     Dim SpecialObj,SpecialSql,SpCName,SpEName,TempObj,SpAddDate
	 if Request.Form("CName") <> "" then
	 	SpCName = Replace(Replace(Request.Form("CName"),"""",""),"'","")
		if Len(SpCName)>=25 then
			Response.Write("<script>alert(""专题中文名称不能超过25个字符"");</script>")
			Response.End
		end if
	 else
	    Response.Write("<script>alert(""请输入专题中文名称"");</script>")
		Response.End
	 end if
	 if Request.Form("EName")<>"" then
	    SpEName = Replace(Replace(Request.Form("EName"),"""",""),"'","")
		if Len(SpCName)>=50 then
			Response.Write("<script>alert(""专题英文名称不能超过50个字符"");</script>")
			Response.End
		end if
		Set TempObj = Conn.Execute("Select EName from Special where EName='"&SpEName&"'")
		if not TempObj.eof then
			Response.Write("<script>alert(""专题英文名称重复"");</script>")
			Response.End
		end if
	 else
	    Response.Write("<script>alert(""请输入专题英文名称"");</script>")
		Response.End
	 end if
	 if Request.Form("Templet")="" then
	    Response.Write("<script>alert(""请选择专题模板"");</script>")
		Response.End
	 end if
	 if Request.Form("SaveFilePath")="" or isnull(Request.Form("SaveFilePath")) then
	    Response.Write("<script>alert(""请选择文件保存路径"");</script>")
		Response.End
	 End if
	 if Request.Form("FileExtName")="" or isnull(Request.Form("FileExtName")) then
	    Response.Write("<script>alert(""请选择文件扩展名"");</script>")
		Response.End
	 End If
     if isdate(Request.Form("AddTime")) then
		 SpAddDate = Formatdatetime(Request.Form("AddTime"))
	 else
	    Response.Write("<script>alert(""专题添加时间类型错误"");</script>")
		Response.End
	 end if
	  Set SpecialObj=server.createobject("adodb.recordset")
	  SpecialSql="select * from Special where 1=0"
	  SpecialObj.open SpecialSql,Conn,3,3
	  SpecialObj.addnew 
	  SpecialObj("SpecialID") = GetRandomID18
	  SpecialObj("CName") = SpCName
	  SpecialObj("EName") = SpEName
	  if Request.Form("NaviPic")<>"" then
		  SpecialObj("NaviPic") = Request.Form("NaviPic")
	  end if
	  if Request.Form("IndexNaviWord")<>"" then
		  SpecialObj("IndexNaviWord") = Request.Form("IndexNaviWord")
	  end if
	  if Request.Form("ClassNaviWord")<>"" then
		  SpecialObj("ClassNaviWord") = Request.Form("ClassNaviWord")
	  end if
	  if Request.Form("MorePic")<>"" then
		  SpecialObj("MorePic") = Request.Form("MorePic")
	  end if
	  SpecialObj("Templet") = Request.Form("Templet")
	  if Request.Form("ShowNaviTF") = "1" then
		  SpecialObj("ShowNaviTF") = "1"
	  else
		  SpecialObj("ShowNaviTF") = "0"
	  end if 
	  SpecialObj("SaveFilePath") = Request.Form("SaveFilePath")
	  SpecialObj("FileExtName") = Request.Form("FileExtName")
	  SpecialObj("AddTime") = SpAddDate
	  SpecialObj.update
	  SpecialObj.Close
	  Set SpecialObj = Nothing
	  Response.Write("<script>alert(""专题添加成功"");dialogArguments.self.location.reload();window.close();</script>")
	  Response.End
  end if
%>