?? 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 + -