📄 newssort.asp
字号:
<tr>
<td width="190" nowrap>名称:<input name="SortName" type="text" class="textfield" id="SortName" size="22"></td>
<td width="130" nowrap>显示:<input name="ViewFlag" type="radio" value="1" checked="checked" />是<input name="ViewFlag" type="radio" value="0" />否</td>
<td width="120" nowrap>父类ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="6" value="<%=ParentID %>"></td>
<td nowrap>父类数字路径:<input readonly name="ParentPath" type="text" class="textfield" id="ParentPath" size="44" value="<%=ParentPath%>"></td>
</tr>
<tr>
<td colspan="4" align="center" height="30" valign="bottom" nowrap><input name="submitSave" type="submit" class="button" id="保存" value=" 保存 "></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<br>
<%
End Function
'生成节点文字路径--------------------------
Function TextPath(ID)
Dim rs,sql,SortTextPath
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From Csys_NewsSort where ID="&ID
rs.open sql,conn,1,1
SortTextPath=rs("SortName")&" → "
if rs("ParentID")<>0 then TextPath rs("ParentID")
response.write(SortTextPath)
End Function
'保存添加、修改节点-------------------------
Function saveFolder
if len(trim(request.Form("SortName")))=0 then
response.write ("<script language=javascript> alert('类别名称为必填项目!');history.back(-1);</script>")
response.end
end if
Dim From,Action,rs,sql,SortTextPath
From=request.QueryString("From")
Set rs=server.CreateObject("adodb.recordset")
if From="Add" then
sql="Select * From Csys_NewsSort"
rs.open sql,conn,1,3
rs.addnew
Action="添加类别"
rs("SortPath")=request.Form("ParentPath") & rs("ID") &","
else
sql="Select * From Csys_NewsSort where ID="&request.QueryString("ID")
rs.open sql,conn,1,3
Action="修改类别"
rs("SortPath")=request.Form("SortPath")
end if
rs("SortName")=request.Form("SortName")
rs("ViewFlag")=request.Form("ViewFlag")
rs("ParentID")=request.Form("ParentID")
rs.update
response.write ("<script language=javascript> alert('"&Action&"保存成功,点击确定查看类别树!');location.replace('NewsSort.asp');</script>")
End Function
'修改节点---------------------------------
Function editFolder()
Dim ID
ID=request.QueryString("ID")
editFolderForm ID
end function
'修改节点表单------------------------------
Function editFolderForm(ID)
Dim SortName,ViewFlag,ParentID,SortPath,rs,sql
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From Csys_NewsSort where ID="&ID
rs.open sql,conn,1,1
SortName=rs("SortName")
ViewFlag=rs("ViewFlag")
ParentID=rs("ParentID")
SortPath=rs("SortPath")
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
<form name="FolderForm" method="post" action="NewsSort.asp?Action=Save&From=Edit&ID=<%=ID%>">
<tr>
<td height="24" nowrap><font color="#FFFFFF"><strong>修改类别:通过"发布"可控制每种分类是否在网站里显示出来。</strong></font></td>
</tr>
<tr>
<td height="24" nowrap bgcolor="#EBF2F9">| 根类 → <% if ParentID<>0 then TextPath(ParentID)%></td>
</tr>
<tr>
<td height="24" bgcolor="#EBF2F9">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="190" nowrap>名称:<input name="SortName" type="text" class="textfield" id="SortName" size="22" value="<%=SortName%>"></td>
<td width="130" nowrap>发布:<input name="ViewFlag" type="radio" value="1" <%if ViewFlag then response.write ("checked=checked")%> />是<input name="ViewFlag" type="radio" value="0" <%if not ViewFlag then response.write ("checked=checked")%>/>否</td>
<td width="120" nowrap>父类ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="6" value="<%=ParentID %>"></td>
<td nowrap>父类数字路径:<input readonly name="SortPath" type="text" class="textfield" id="SortPath" size="45" value="<%=SortPath%>"></td>
</tr>
<tr>
<td colspan="4" align="center" height="30" valign="bottom" nowrap><input name="submitSave" type="submit" class="button" id="保存" value=" 保存 "></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<br>
<%
End Function
'转移节点表单------------------------------
Function moveFolderForm()
Dim ID,ParentID,SortName,SortPath
ID=request.QueryString("ID")
ParentID=request.QueryString("ParentID")
SortName=request.QueryString("SortName")
SortPath=request.QueryString("SortPath")
%>
<table id="SortFromTo" width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
<form name="MoveForm" method="post" action="NewsSort.asp?Action=MoveSave">
<tr>
<td height="24" colspan="3" nowrap><font color="#FFFFFF"><strong>类别移动:通过点击分类树中类别对应的"移"可重新选择将要作移动的类别,包括本类、子类及所有下属信息条目将一起被移动。</strong></font></td>
</tr>
<tr>
<td height="24" colspan="3" nowrap bgcolor="#EBF2F9">→ <% response.write (SortName) %></td>
</tr>
<tr>
<td nowrap bgcolor="#EBF2F9">移动类ID:<input readonly name="ID" type="text" class="textfield" id="ID" size="14" value="<%=ID%>"></td>
<td nowrap bgcolor="#EBF2F9">移动类父ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="14" value="<%=ParentID%>"></td>
<td nowrap bgcolor="#EBF2F9">移动类数字路径:<input readonly name="SortPath" type="text" class="textfield" id="SortPath" size="30" value="<%=SortPath%>"></td>
</tr>
<tr>
<td height="24" colspan="3" nowrap><font color="#FFFFFF"><strong>目标位置:通过点击"至"选择将要放置到的类别。</strong></font></td>
</tr>
<tr>
<td height="24" colspan="3" nowrap bgcolor="#EBF2F9">→ 请选择…</td>
</tr>
<tr>
<td nowrap bgcolor="#EBF2F9">目标类ID:<input readonly name="toID" type="text" class="textfield" id="toID" size="14" value=""></td>
<td nowrap bgcolor="#EBF2F9">目标类父ID:<input readonly name="toParentID" type="text" class="textfield" id="toParentID" size="14" value=""></td>
<td nowrap bgcolor="#EBF2F9">目标类数字路径:<input readonly name="toSortPath" type="text" class="textfield" id="toSortPath" size="30" value=""></td>
</tr>
<tr>
<td height="40" colspan="3" nowrap bgcolor="#EBF2F9" align="center"><input name="submitMove" type="submit" class="button" id="转移" value=" 转移 "></td>
</tr>
</form>
</table>
<br>
<%
End Function
'保存转移节点------------------------------
Function saveMoveFolder()
Dim rs,sql,fromID,fromParentID,fromSortPath,toID,toParentID,toSortPath,fromParentSortPath
fromID=request.Form("ID")
fromParentID=request.Form("ParentID")
fromSortPath=request.Form("SortPath")
toID=request.Form("toID")
toParentID=request.Form("toParentID")
toSortPath=request.Form("toSortPath")
if toID="" or toParentID="" or toSortPath="" then
response.write ("<script language=javascript> alert('没有选择移动的目标位置,请返回选择!');history.back(-1);</script>")
response.end
end if
if fromParentID=0 then
response.write ("<script language=javascript> alert('一级分类不能被移动,请返回选择!');history.back(-1);</script>")
response.end
end if
if fromSortPath=toSortPath then
response.write ("<script language=javascript> alert('选择的移动类别和目标位置相同了,请返回重新选择!');history.back(-1);</script>")
response.end
end if
if Instr(toSortPath,fromSortPath)>0 or fromParentID=toID then
response.write ("<script language=javascript> alert('不能将类别移动到本类或下属类里,请返回重新选择!');history.back(-1);</script>")
response.end
end if
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From Csys_NewsSort where ID="&fromParentID
rs.open sql,conn,0,1
fromParentSortPath=rs("SortPath")
conn.execute("update Csys_NewsSort set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")'更新类别数字路径
conn.execute("update Csys_NewsSort set ParentID='"&toID&"' where ID="&fromID)'更新类别父类ID
conn.execute("update Csys_News set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")'更新信息数字路径
response.write ("<script language=javascript> alert('移动类别成功,点击确定查看类别树!');location.replace('NewsSort.asp');</script>")
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -