📄 admin_addchannel.asp
字号:
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/Commoncode.asp"-->
<!--#include file="../checkvalid.asp"-->
<%
If Not FRAdminLevel(301) Then
Call ErrorMsg()
End If
action=request.QueryString("action")
eid=request.QueryString("eid")
if request.Form("submit1")<>"" then
ChannelName=request.Form("ChannelName")
ReadMe=request.Form("ReadMe")
ChannelType=request.Form("ChannelType")
ModuleType=request.Form("ModuleType")
ChannelDir=trim(request.Form("ChannelDir"))
ChannelShortName=request.Form("ChannelShortName")
ChannelItemUnit=request.Form("ChannelItemUnit")
Meta_Keywords=request.Form("Meta_Keywords")
Meta_Description=request.Form("Meta_Description")
LinkUrl=request.Form("LinkUrl")
OpenType=request.Form("OpenType")
Disabled=request.Form("Disabled")
if action="edit" and eid<>"" then
sql="select * from JOB_Channel where ChannelID<>"&eid&" and ChannelName='"&ChannelName&"'"'如果是修改则不用判断目录是否存在!
else
if ChannelType=2 then
sql="select * from JOB_Channel where ChannelName='"&ChannelName&"'"'如果添加外部频道只检查频道名称是否存在
else
sql="select * from JOB_Channel where ChannelName='"&ChannelName&"' or ChannelDir='"&ChannelDir&"'"'添加前判断频道名字和频道目录是否存在!
end if
end if
set rsc=conn.execute(sql)
if not rsc.eof then
if ChannelType=2 then
response.write "<script language=javascript>alert('对不起该频道已经存在!');location.href='admin_addchannel.asp';</script>"
else
response.write "<script language=javascript>alert('对不起该频道或目录已经存在!');location.href='admin_addchannel.asp';</script>"
end if
else
sqlo="select max(OrderID) as m from JOB_Channel"
set rso=conn.execute(sqlo)
max=rso("m")
rso.close
set rso=nothing
rsc.close
set rsc=nothing
set rs=server.CreateObject("adodb.recordset")
if action="edit" and eid<>"" then
sql="select * from JOB_Channel where ChannelID="&eid
else
sql="select * from JOB_Channel"
end if
rs.open sql,conn,1,3
if action<>"edit" then
rs.addnew
end if
if action<>"edit" then
if ChannelType<>2 then
if checkstr(ChannelDir) then
rs("ChannelDir")=ChannelDir
'**************************生成文件*********************************
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(server.MapPath(InstallDir&ChannelDir)) Then '判断文件夹是否存在
response.write "<font color=red>系统错误提示:</font>系统目录已经存在!<a href='admin_addchannel.asp'>返回</a>"
response.End()
else
fso.CreateFolder (server.MapPath(InstallDir&ChannelDir))
end if
'********************************************************************
else
response.write "<font color=red>系统错误提示:</font>对不起频道目录必须只是英文!<a href='admin_addchannel.asp'>返回</a>"
response.End()
end if
end if
end if
rs("ChannelName")=ChannelName
rs("ReadMe")=ReadMe
rs("ChannelType")=ChannelType
if ChannelType=2 then
rs("LinkUrl")=LinkUrl
else
if action<>"edit" then
rs("ModuleType")=ModuleType
end if
rs("ChannelShortName")=ChannelShortName
rs("ChannelItemUnit")=ChannelItemUnit
rs("Meta_Keywords")=Meta_Keywords
rs("Meta_Description")=Meta_Description
end if
if action<>"edit" then
rs("OrderID")=max+1
end if
rs("OpenType")=OpenType
rs("Disabled")=Disabled
'************更新参数start**************
if action="edit" and (ChannelType=0 or ChannelType=1) then
rs("UseCreateHTML")=request("UseCreateHTML")
rs("AutoCreateType")=request("AutoCreateType")
rs("ListFileType")=request("ListFileType")
rs("StructureType")=request("StructureType")
rs("FileNameType")=request("FileNameType")
rs("FileExt_Index")=request("FileExt_Index")
rs("FileExt_List")=request("FileExt_List")
rs("FileExt_Item")=request("FileExt_Item")
rs("MaxPerPage_Index")=request("MaxPerPage_Index")
rs("MaxPerPage_SearchResult")=request("MaxPerPage_SearchResult")
rs("MaxPerPage_New")=request("MaxPerPage_New")
rs("MaxPerPage_Hot")=request("MaxPerPage_Hot")
rs("MaxPerPage_Elite")=request("MaxPerPage_Elite")
end if
'************更新参数end**************
rs.update
rs.close
set rs=nothing
if ChannelType<>2 and action<>"edit" then
set rsc=conn.execute("select max(ChannelID) as m from JOB_Channel")
m=rsc("m")
rsc.close
set rsc=nothing
'********************************复制文件************************************
Set FSO=Server.CreateObject(FR_HR_fso)
If Err Then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>您的服务器不支持写文件,文件创建失败!</li>"
end If
'创建首页
set hndFile = fso.OpenTextFile(server.MapPath(InstallDir&"Article/index.asp"))
LoadFile = hndFile.ReadAll
Set hndFile = Nothing
Fso.CreateTextFile(Server.MapPath(InstallDir&ChannelDir&"/index.asp")).WriteLine(replace(LoadFile,"Cid=10","Cid="&m&""))
'创建列表页
set hndFile = fso.OpenTextFile(server.MapPath(InstallDir&"Article/List.asp"))
LoadFile = hndFile.ReadAll
Set hndFile = Nothing
Fso.CreateTextFile(Server.MapPath(InstallDir&ChannelDir&"/List.asp")).WriteLine(replace(LoadFile,"Cid=10","Cid="&m&""))
'创建内容页
set hndFile = fso.OpenTextFile(server.MapPath(InstallDir&"Article/Article.asp"))
LoadFile = hndFile.ReadAll
Set hndFile = Nothing
Fso.CreateTextFile(Server.MapPath(InstallDir&ChannelDir&"/Article.asp")).WriteLine(replace(LoadFile,"Cid=10","Cid="&m&""))
If Err Then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>您的服务器不支持写文件,频道文件创建失败!</li>"
End If
Set FSO=Nothing
'*******************************复制模板*************************************
sql="select * from JOB_Template where ChannelID=10"
set rsf=conn.execute(sql)
do while not rsf.eof
set rsa=server.CreateObject("adodb.recordset")
sql="select * from JOB_Template "
rsa.open sql,conn,1,3
rsa.addnew
rsa("ChannelID")=m
rsa("TemplateName")=rsf("TemplateName")
rsa("TemplateContent")=rsf("TemplateContent")
rsa("IsDefault")=rsf("IsDefault")
rsa("ProjectName")=rsf("ProjectName")
rsa("IsDefaultInProject")=rsf("IsDefaultInProject")
rsa("Deleted")=rsf("Deleted")
rsa("typeid")=rsf("typeid")
rsa.update
rsa.close
rsf.movenext
loop
rsf.close
set rsf=nothing
'********************************************************************
end if
response.write "<script language=javascript>alert('操作成功!');location.href='admin_channel.asp';</script>"
end if
end if
if action="edit" and eid<>"" then
sql="select * from JOB_Channel where ChannelID="&eid
set rse=conn.execute(sql)
if not rse.eof then
ChannelName_e=rse("ChannelName")
ReadMe_e=rse("ReadMe")
ChannelType_e=rse("ChannelType")
OpenType_e=rse("OpenType")
Disabled_e=rse("Disabled")
if ChannelType_e=2 then
LinkUrl_e=rse("LinkUrl")
else
ModuleType_e=rse("ModuleType")
ChannelDir_e=rse("ChannelDir")
ChannelShortName_e=rse("ChannelShortName")
ChannelItemUnit_e=rse("ChannelItemUnit")
Meta_Keywords_e=rse("Meta_Keywords")
Meta_Description_e=rse("Meta_Description")
UseCreateHTML_e=rse("UseCreateHTML")
AutoCreateType_e=rse("AutoCreateType")
ListFileType_e=rse("ListFileType")
StructureType_e=rse("StructureType")
FileNameType_e=rse("FileNameType")
FileExt_Index_e=rse("FileExt_Index")
FileExt_List_e=rse("FileExt_List")
FileExt_Item_e=rse("FileExt_Item")
MaxPerPage_Index_e=rse("MaxPerPage_Index")
MaxPerPage_SearchResult_e=rse("MaxPerPage_SearchResult")
MaxPerPage_New_e=rse("MaxPerPage_New")
MaxPerPage_Hot_e=rse("MaxPerPage_Hot")
MaxPerPage_Elite_e=rse("MaxPerPage_Elite")
end if
end if
rse.close
set rse=nothing
end if
%>
<html>
<head>
<title>频道添加</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<link href="../css/style.css" rel=stylesheet type=text/css>
<script language="javascript">
function show(a){
if (a==0)
{
div2.style.display="none"
div1.style.display="none"
ff.innerHTML="<font color=red>*</font>"
}else
{
div2.style.display=""
div1.style.display=""
ff.innerHTML=""
}
}
function check(){
if(form1.ChannelName.value=="")
{
alert("对不起频道名称不能为空!");
return false;
}
if(form1.ChannelType[0].checked){
if(form1.LinkUrl.value==""){
alert("外部连接地址不能为空!");
return false;
}
}else{
if(form1.ChannelDir.value==""){
alert("频道目录不能为空!");
return false;
}
if(form1.ChannelShortName.value==""){
alert("项目名称不能为空!");
return false;
}
if(form1.ChannelItemUnit.value==""){
alert("项目单位不能为空!");
return false;
}
}
return true;
}
</script></head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
<tr>
<th height=25 class="tableHeaderText">频道管理 </th>
</tr>
<tr>
<td height="22" class="bodytitle"><font color="ff6600"><b class="style1"> 频道管理</b></font>: <A href="Admin_Channel.asp">频道管理首页</A> | <a href="Admin_addChannel.asp">添加频道</a> | <a href="admin_orderchannel.asp">频道排序</a></td>
</tr>
</table>
<p>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
<form name="form1" method="post" action="?action=<%=action%>&eid=<%=eid%>" onSubmit="return check();"><tr>
<th height=25 colspan="2" class="tableHeaderText">频道添加</th>
</tr>
<tr class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#BFDFFF'">
<td width="26%"><font color="ff6600"><b class="style1">频道名称:</b></font></td>
<td width="74%">
<label>
<input name="ChannelName" type="text" id="ChannelName" value="<%=ChannelName_e%>">
</label>
<font color=red>*</font></td>
</tr>
<tr class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#BFDFFF'">
<td><font color="ff6600"><b class="style1">频道说明:</b></font><br>
鼠标移至频道名称上时将显示设定的说明文字(不支持HTML) </td>
<td><label>
<textarea name="ReadMe" cols="30" rows="3" id="ReadMe"><%=ReadMe_e%></textarea>
</label></td>
</tr>
<tr class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#BFDFFF'">
<td> </td>
<td><label>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -