⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mov.asp

📁 asp
💻 ASP
字号:
<!--#include file="../inc/conn.asp"-->
<%
userid=Session("userid")
userlevel=Session("userlevel")
if userid="" or userlevel="" then
  call msgbox("请重新登陆!",3)
end if
if not isnumeric(userid) or not isnumeric(userlevel) then
  call msgbox("请重新登陆!",3)
end if

id=strFilter(request("id"),10)
if id="" then
  call msgbox("请正确指定关系文章!",1)
end if
if not isnumeric(id) then
  call msgbox("请正确指定关系文章!",1)
end if
id=CCur(id)
sql="select top 1 categoryid from article where id="&id
rs.open sql,conn,1,1
if not rs.eof then
  categoryid	=rs(0)
else
  rs.close
  call msgbox("该关系文章不存在!",1)
end if
rs.close

add=request("add")
if add><"" then
  addcategory=request("addcategory")
  if addcategory><"" then
    if isnumeric(addcategory) then
      sql="select categoryname from category where categoryid="&addcategory
      rs.open sql,conn,1,1
      if not rs.eof then
        if not instr(categoryid,"."&addcategory&".")>0 then
          categoryid	=categoryid&addcategory&"."&rs(0)&"."
        end if
      end if
      rs.close
    end if
  end if
  rs.open "update article set categoryid='"&categoryid&"' where id="&id,conn,1,3
end if
del=request("del")
if del><"" then
  delcategory=request("delcategory")
  if delcategory><"" then
    if isnumeric(delcategory) then
      sql="select categoryname from category where categoryid="&delcategory
      rs.open sql,conn,1,1
      if not rs.eof then
        newcategoryid	=replace(categoryid,delcategory&"."&rs(0)&".","")
      end if
      rs.close
    end if
  end if
  if newcategoryid><"." then categoryid=newcategoryid
  rs.open "update article set categoryid='"&categoryid&"' where id="&id,conn,1,3
end if

categoryid	=split(categoryid,".")

sql="select categoryid,categoryname,categoryindex from category where not categoryindex like '%.%' order by categoryid ASC"
rs.open sql,conn,1,1
if not rs.eof then
  category=rs.getrows
else
  response.write "<P align='center'>现在尚无任何分类~</P>"
end if
rs.close

dim categoryarray(0)
if isarray(category) then
  for i=0 to ubound(category,2)
    sql="select categoryid,categoryname,categoryindex from category where categoryindex like '"&category(2,i)&".%'"
    rs.open sql,conn,1,1
    if not rs.eof then
      categoryarraytree=rs.getrows
    end if
    rs.close
    if i=0 then
      catearray=categoryarray
      catearray(0)=categoryarraytree
    else
      redim preserve catearray(i)
      catearray(i)=categoryarraytree
    end if
    categoryarraytree=""
  next
end if

Set rs=nothing
Set conn=nothing
%>
<!--#include file="../inc/head.asp"-->

<table border="0" align="center" width="380" cellpadding="2" cellspacing="1" class="menuline">
  <tr class="menutitle"><th colspan="2" width="80%">添加关联</th><th width="20%">删除关联</th></tr>
  <tr><td>
    <table>
<%
if isarray(category) then
  for i=0 to ubound(category,2)%>
  <tr><td><select onchange="addcategoryid(this[this.selectedIndex].text,this[this.selectedIndex].value);this.selectedIndex=0">
  <option>==> <%=category(1,i)%> <==
  <option value="<%=category(0,i)%>"><%=category(1,i)%>
<%  if isarray(catearray) then
      categorytree=catearray(i)
      if isarray(categorytree) then

        for k=0 to ubound(categorytree,2)
'          catelevel=split(categorytree(2,k),".")
' for l=0 to ubound(catelevel,1)
'   if l=ubound(catelevel,1) then
'     response.write "┗"
'   else
'     response.write " "
'   end if
' next
%>
  <option value="<%=categorytree(0,k)%>"> <%=categorytree(1,k)%>
<%      next
        Set categorytree=nothing

      end if
    end if%>
  </select></td></tr>
<%next
end if
Set category=nothing%>
    </table>

<script>
function addcategoryid(text,value){
  document.addform.addcategory.options[0] = new Option(text,value);
}
</script>

  </td><td nowrap style="color:FFFFFF">

<form method="POST" action="../article/mov.asp" name="addform" autocomplete="off" onsubmit="return(come());">
    <input type="hidden" name="id" value="<%=id%>">
=>  <select name="addcategory"></select>
<div align=right><input class=button type=submit name=add value=" 添 加 "></div>
</form>

  </td><td>

<form method="POST" action="../article/mov.asp" name="delform" autocomplete="off" onsubmit="return(come());">
    <input type="hidden" name="id" value="<%=id%>">
    <select name="delcategory">
<%
  if isarray(categoryid) then
    for j=1 to ubound(categoryid,1)-1 step 2
response.write "<option value="""&categoryid(j)&""">"&categoryid(j+1)
    next
  end if
%>
    </select>
<div align=right><input class=button type=submit name=del value=" 去 除 "></div>
</form>

  </td></tr>
</table>

<!--#include file="../inc/foot.asp"-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -