大家知道,目前官方发布的V2.1版本是允许前台所有栏目投稿的.但往往我们只希望,允许投稿的栏目才可以投稿.为了解决这个问题,以下是自己修改的方法:
第一步:
打开 syscls/KS_ChannelFolderCls.asp,大约找到96行,插入下面红色的语句:
.Write " <td height='28' nowrap><b>" & vbCrLf
.Write " <INPUT title='英文名称:不能带\/:*?“ < > | 等特殊符号' NAME='FolderEname' TYPE='text' id='FolderEname' style='border-style: solid; border-width: 1' size=30>"
.Write " </b> 不能改 </td>" & vbCrLf
.Write " </tr>" & vbCrLf
.Write ("<tr> ")
.Write (" <td height=""28"" align=""right"" nowrap> <div align=""center"">此" & TempStr &"是否允许投稿:</div></td>")
.Write " <td width='20' height='28' align='right' nowrap> <div align='center'></div></td>"
.Write (" <td height=""28"" nowrap> ")
.Write ("<input name=""CommentTF"" type=""radio"" value=""1"" checked>")
.Write ("允许 ")
.Write ("<input name=""CommentTF"" type=""radio"" value=""0"">")
.Write ("不允行</td>")
.Write ("</tr>")
If FolderID = "0" Then
.Write " <tr>" & vbCrLf
.Write " <td height='30' align='right' nowrap>频道顶部导航:</td>" & vbCrLf
.Write " <td width='20' height='28' align='right' nowrap> <div align='center'></div></td>" & vbCrLf
.Write " <td height='28' nowrap><input name='TopFlag' type='radio' value='1' checked>"
再找到 439行左右,插入以下红色语句:
RST("FolderOrder") = FolderOrder
RST("ChannelID") = ChannelID
RST("CommentTF")=KSCMS.G("CommentTF")
RST("DelTF") = 0
RST("OrderID") = 0
以上完成了添加频道或栏目时,是否允许投稿的设定,同理,编辑频道或栏目时,也可以进行修改,再找到494行,插入以下红色语句
RS("FolderTemplateID") = FolderTemplateID
RS("FolderFsoIndex") = FolderFsoIndex
RS("ArticleTemplateID") = ArticleTemplateID
RS("ArticleFnameType") = ArticleFnameType
RS("ArticleFsoType") = ArticleFsoType
RS("FolderOrder") = FolderOrder
RS("CommentTF")=KSCMS.G("CommentTF")
RS.Update
587行左右
.Write (" </b></td>")
.Write ("</tr>")
.Write ("<tr> ")
.Write (" <td width=""150"" height=""28"" align=""right"" nowrap> <div align=""center"">此" & TempStr &"是否允许投稿:</div></td>")
.Write (" <td height=""28"" nowrap> ")
If RS("CommentTF") = 1 Then
.Write ("<input name=""CommentTF"" type=""radio"" value=""1"" checked>")
Else
.Write ("<input name=""CommentTF"" type=""radio"" value=""1"">")
End If
.Write ("允许 ")
If RS("CommentTF") = 0 Then
.Write ("<input name=""CommentTF"" type=""radio"" value=""0"" checked>")
Else
.Write ("<input name=""CommentTF"" type=""radio"" value=""0"">")
End If
.Write ("不允行</td>")
.Write ("</tr>")
If ParentID = "0" Then
.Write ("<tr>")
第二步:
打开syscls/KS_Commoncls.asp,任意位置插入下面两个函数:
'**************************************************
'函数名:ReturnAllowTree
'作 用:返回允许投稿的目录树。
'参 数:FolderID ----选择项ID, ChannelID-----返回频道目录树
'返回值:整棵树
'**************************************************
Public Function ReturnAllowTree(FolderID, ChannelID)
KSCache.name=Cstr(SiteSN & "ClassAllowTree" &ChannelID&FolderID)
IF KSCache.valid and KSCache.value<>"" Then
ReturnAllowTree=KSCache.value
Else
Call KSCache.clean
Dim RS,FolderName,TreeStr,ID
Set RS=Server.CreateObject("ADODB.Recordset")
FolderID = Trim(FolderID)
If Not IsNumeric(ChannelID) Then Return
RS.Open ("select ID,FolderName from KS_Class Where ChannelID=" & ChannelID & " AND tj=1 And CommentTF=1 Order BY FolderOrder ASC"), Conn, 1, 1
Do While Not RS.EOF
ID = Trim(RS(0))
FolderName = Trim(RS(1))
If FolderID = ID Then
TreeStr = TreeStr & "<option selected value='" & ID & "'>" & FolderName & "</option>"
Else
TreeStr = TreeStr & "<option value='" & ID & "'>" & FolderName & " </option>"
End If
TreeStr = TreeStr & ReturnAllowSubList(ID, FolderID)
RS.MoveNext
Loop
RS.Close:Set RS = Nothing
ReturnAllowTree = TreeStr
KSCache.add ReturnAllowTree,dateadd("n",1000000,now)
End If
End Function
'**************************************************
'函数名:ReturnAllowSubList
'作 用:查找并返子树数据。
'参 数:ParentID ----父节点ID, FolderID ----选择项ID
'返回值:子树
'**************************************************
Public Function ReturnAllowSubList(ParentID, FolderID)
Dim SubTypeList, SubRS, SpaceStr, k, Total, Num,FolderName, ID,TJ
Set SubRS = Server.CreateObject("ADODB.RECORDSET")
SubRS.Open ("Select count(ID) AS total from KS_Class Where CommentTF=1 And TN='" & ParentID & "'"), Conn, 1, 1
Total = SubRS("Total")
SubRS.Close
SubRS.Open ("Select ID,FolderName,TJ from KS_Class Where CommentTF=1 And TN='" & ParentID & "' Order BY FolderOrder ASC"), Conn, 1, 1
Num = 0
Do While Not SubRS.EOF
Num = Num + 1
SpaceStr = ""
TJ = CInt(SubRS(2))
For k = 1 To TJ - 1
If k = 1 And k <> TJ - 1 Then
SpaceStr = SpaceStr & " │"
ElseIf k = TJ - 1 Then
If Num = Total Then
SpaceStr = SpaceStr & " └ "
Else
SpaceStr = SpaceStr & " ├ "
End If
Else
SpaceStr = SpaceStr & " │"
End If
Next
ID = Trim(SubRS(0))
FolderName = Trim(SubRS(1))
If FolderID = ID Then
SubTypeList = SubTypeList & "<option selected value='" & ID & "'>" & SpaceStr & FolderName & "</option>"
Else
SubTypeList = SubTypeList & "<option value='" & ID & "'>" & SpaceStr & FolderName & "</option>"
End If
SubTypeList = SubTypeList & ReturnAllowSubList(ID, FolderID)
SubRS.MoveNext
Loop
SubRS.Close:Set SubRS = Nothing
ReturnAllowSubList = SubTypeList
End Function
说明:这两个函数的作用是返回允许投稿的栏目
第三步:打开 member/User_AddArticle.asp,找到第175行左右
<select size='1' name='ClassID' style="width:250">
<option value="0">-请选择文章栏目-</option>
<%=KSCMS.ReturnTree(0, 1)%>
</select></td>
</tr>
</table></td>
将<%=KSCMS.ReturnTree(0, 1)%>改为<%=KSCMS.ReturnAllowTree(0, 1)%>
member目录下的所有KSCMS.ReturnTree都可以替换为KSCMS.ReturnAllowTree
这样,就实现了.我们所要的功能
以下为补丁包下载,下载后覆盖程序即可:
以下内容只有回复后才可以浏览,请先登录!