首页 | 站长免费中心 | 新手上路 | 网站运营 | 网页制作 | 图片设计 | 动画设计 | 网页编程 | 网页特效 | 本站专题 | 虚拟主机 | 域名注册 | 网站建设 | 程序下载
       免费空间资源 | 新闻咨询 | 免费域名 | 免费网盘 | 网站推广 | 网站策划 | 建站经验 | 网站优化 | 网页代码 | 源码下载 | 音乐小偷 | 网络赚钱 | 论坛交流
网站建设
网站建设
虚拟主机
虚拟主机
域名注册
域名注册
711网络首页
站长工具
站长工具
网站源码
网站源码
站长论坛
站长论坛

 711网络 网页编程ASP代码

网站栏目无限分类的代码

来源: 互联网    日期:2008-7-5
 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<TITLE>网站栏目添加</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<LINK href="images/style.css" type=text/css rel=stylesheet>
<style type="text/css">
<!--
.style1 {
 color: #FF0000;
 font-weight: bold;
}
-->
</style>
</head>
<!--#include file="conn.asp"-->
<%
'系统页面加载初始化参数设定
ChannelID=trim(request("ChannelID"))
ParentID=trim(request("ParentID"))
if ChannelID="" or not isnumeric(ChannelID) then ChannelID=Session("ChannelID")
if ChannelID="" then ChannelID=0

if ParentID="" or not isnumeric(ParentID) then ParentID=0


  
Function ShowClassFormOption(sChannelID,CurrentID,sClassDepth,ShowType)
 dim rsClass,sqlClass,sTemp,tmpClassDepth,i,n
 dim arrShowLine(10)

 for i=0 to ubound(arrShowLine)
  arrShowLine(i)=False
 next
 
 if ShowType=0 then
     sTemp="<option value=""0"""
  if CurrentID=0 then sTemp=sTemp & " selected"
  sTemp=sTemp & ">无(作为一级栏目)</option>"
 end if
 
 sqlClass="Select ClassID,ClassName,ClassDepth,IDPath,ChannelID From SystemClass where ChannelID="&sChannelID&" "
 
 if sClassDepth>0 then
  sqlClass=sqlClass & " and ClassDepth<"&sClassDepth&" order by RootID,ClassDepth,IDPath,OrderID"
 else
  sqlClass=sqlClass & " order by RootID,IDPath,OrderID"
 end if
 'response.Write(sqlClass)
 'response.End()
 
 set rsClass=conn.Execute(sqlClass)
  
 if rsClass.bof and rsClass.bof then
  ShowClassFormOption = sTemp & "<option value="""">请先添加栏目</option>"
  rsClass.close
  set rsClass=Nothing
  Exit Function
 else
  sqlClass=rsClass.GetRows(-1)
  rsClass.close
  set rsClass=Nothing 
 End if
 
   
 
 Dim sChecked, sTClassName
 For i=0 to Ubound(sqlClass,2)
  tmpClassDepth=sqlClass(2,i)
  if sqlClass(3,i)>0 then
   arrShowLine(tmpClassDepth)=True
  else
   arrShowLine(tmpClassDepth)=False
  end if
  sChecked = "" : sTClassName = ""
  if sqlClass(0,i)=CurrentID then sChecked = " selected"
  
  if tmpClassDepth>0 then
   for n=1 to tmpClassDepth
    sTClassName = sTClassName & "&nbsp;&nbsp;"
    if n=tmpClassDepth then
     if sqlClass(3,i)>0 then
      sTClassName = sTClassName & "├&nbsp;"
     else
      sTClassName = sTClassName & "└&nbsp;"
     end if
    else
     if arrShowLine(n)=True then
      sTClassName = sTClassName & "│"
     else
      sTClassName = sTClassName & "&nbsp;"
     end if
    end if
   next
  end if
  
  sTClassName = sTClassName & sqlClass(1,i)
  Select Case ShowType
  Case 0
   sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
   if sqlClass(4,i)=1 then sTemp=sTemp & "(外)"
   sTemp=sTemp & "</option>"
  Case 1
   if sqlClass(4,i)=1 then
    sTemp=sTemp & "<option value=""0"" "&sChecked&">" & sTClassName & "(外)"
   else
    sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
   end if
   sTemp=sTemp & "</option>"
  Case 2
   if sqlClass(4,i)=1 then
    sTemp=sTemp & "<option value=""0"" "&sChecked&">" & sTClassName & "(外)"
   elseif Not Cl.ChkUserLevel(sqlClass(5,i),Cl.UserLevel) then
    sTemp=sTemp & "<option value=""0"" "&sChecked&">" & sTClassName & "(*)"
   else
    sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
   end if
   sTemp=sTemp & "</option>"
  Case 3
   if sqlClass(4,i)=0 then
    sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
    sTemp=sTemp & "</option>"
   end if
  Case 4
   if Cl.ChkUserLevel(sqlClass(5,i),Cl.UserLevel) then
    sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
    sTemp=sTemp & "</option>"
   end if
  Case else
   sTemp=sTemp & "<option value=""" & sqlClass(0,i) & """ "&sChecked&">" & sTClassName
   sTemp=sTemp & "</option>"
  End Select
 Next
 
 ShowClassFormOption=sTemp
 sqlClass=Empty
End Function

if request("action")="add" then

ParentID=trim(request("ParentID"))
ClassName=trim(request("ClassName"))
ClassDir=trim(request("ClassDir"))
ClassMemo=trim(request("ClassMemo"))
ClassLinkUrl=trim(request("ClassLinkUrl"))

OrderID=trim(request("OrderID"))
CssID=trim(request("CssID"))
StyleID=trim(request("StyleID"))

IsCreateHtml=trim(request("IsCreateHtml"))
IsCreateList=trim(request("IsCreateList"))
ClassLogo=trim(request("ClassLogo"))
ClassBanner=trim(request("ClassBanner"))

if ClassName="" Then
response.write("<script>alert('系统出错!请返回填写网站栏目名称');history.go(-1);</script>")
response.End()
end if

if ClassDir="" Then
response.write("<script>alert('系统出错!请返回填写网站栏目目录文件夹');history.go(-1);</script>")
response.End()
end if

if ClassLinkUrl="" Then
response.write("<script>alert('系统出错!请返回填写收购网站栏目');history.go(-1);</script>")
response.End()
end if

if ClassMemo="" Then
response.write("<script>alert('系统出错!请返回填写网站栏目说明');history.go(-1);</script>")
response.End()
end if

if ParentID=0 then
AddTopParentClass

Function AddTopParentClass()
'添加栏目名称并记录添加人IP等信息 

 UserIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
 If UserIP = "" Then UserIP = Request.ServerVariables("REMOTE_ADDR")  
 UserFrom=Cstr(Request.ServerVariables("HTTP_REFERER"))

  set rs=server.CreateObject("Adodb.recordset")
  sql="select * from SystemClass where ClassDir='"&CorrectSqlClassDir&"' and  ClassName='"&CorrectSqlClassName&"'"
  rs.open sql,conn,3,3
  if rs.eof and rs.bof then
  rs.addnew
 
  rs("RootID")=rs("ClassID")
  rs("ClassDepth")=0
 
  rs("ClassName")=ClassName
  rs("ClassDir")=ClassDir
  rs("ClassMemo")=ClassMemo
  rs("ClassLinkUrl")=ClassLinkUrl
 
  rs("ParentName")=ClassName
  rs("IDPath")=rs("ClassID")
  rs("TitlePath")=ClassName
 
  rs("OrderID")=OrderID
  rs("CssID")=CssID
  rs("StyleID")=StyleID
   
  rs("ClassLogo")=ClassLogo
  rs("ClassBanner")=ClassBanner
  rs("IsCreateHtml")=IsCreateHtml
  rs("IsCreateList")=IsCreateList
 
  rs("AddUser")=Session("UserName")
  rs("AddTime")=now()
  rs("AddIP")=UserIP
  rs("AddFrom")=UserFrom
  rs.update   
   
  response.write("<script>alert('网站栏目添加成功!确定返回栏目添加页面');location.href='SystemClassAdd.asp';</script>")
  else 
  response.write("<script>alert('网站栏目已经存在!系统即将返回上一页');history.go(-1);</script>")
  end if
   rs.close
  set rs=nothing
  '写入读取后一个ID
 
End Function


else
response.Write(ParentID)
'response.End()
'response.Write(GetLastParentPath(ParentID))

GetLastParentPath ParentID,sParentClassName,sParentClassDir,sParentClassDepth,sParentClassRootID,sParentIDPath,sParentTitlePath
response.Write("<br>ParentClassName:"&sParentClassName)
response.Write("<br>ParentClassDir:"&sParentClassDir)
response.Write("<br>ParentClassDepth:"&sParentClassDepth)
response.Write("<br>ParentClassRootID:"&sParentClassRootID)


 
Function GetLastParentPath(sParentID,sParentClassName,sParentClassDir,sParentClassDepth,sParentClassRootID,sParentIDPath,sParentTitlePath)
  set rs=server.CreateObject("Adodb.recordset")
  sql="select * from SystemClass where ClassID="&sParentID
  response.Write(sql)
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
  response.write("<script>alert('为能查询到父类ID对应的栏目!系统即将返回上一页');history.go(-1);</script>")
  response.End()
  else

  sParentClassDepth=rs("ClassDepth")
  '深度递减
  sParentClassRootID=rs("RootID")
  '大类ID不变
  sParentClassName=rs("ClassName")
  '类名循环
  sParentClassDir=rs("ClassDir")
  '路径循环
  sParentIDPath=rs("IDPath")
  'ID循环
  sParentTitlePath=rs("TitlePath")
  '标题循环
  end if
 
  rs.close
  set rs=nothing
 
end Function

AddCurrentClassName ParentID,sParentClassName,sParentClassDir,sParentClassDepth,sParentClassRootID,sParentIDPath,sParentTitlePath

Function AddCurrentClassName(ParentID,sParentClassName,sParentClassDir,sParentClassDepth,sParentClassRootID,sParentIDPath,sParentTitlePath)
'添加栏目名称并记录添加人IP等信息 

 UserIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
 If UserIP = "" Then UserIP = Request.ServerVariables("REMOTE_ADDR")  
 UserFrom=Cstr(Request.ServerVariables("HTTP_REFERER"))

  set rs=server.CreateObject("Adodb.recordset")
  sql="select * from SystemClass where ClassDir='"&CorrectSqlClassDir&"' and  ClassName='"&CorrectSqlClassName&"'"
  rs.open sql,conn,3,3
  if rs.eof and rs.bof then
  rs.addnew

  rs("RootID")=sParentClassRootID
  rs("ParentID")=ParentID
  rs("ParentName")=sParentClassName
  rs("ClassDepth")=sParentClassDepth+1
  rs("ClassDir")=sParentClassDir&"/"&ClassDir
  rs("IDPath")=sParentIDPath&","&rs("ClassID")
  rs("TitlePath")=sParentTitlePath&","&ClassName
 
  rs("ClassName")=ClassName 
  rs("ClassMemo")=ClassMemo
  rs("ClassLinkUrl")=ClassLinkUrl
 
  rs("OrderID")=OrderID
  rs("CssID")=CssID
  rs("StyleID")=StyleID
   
  rs("ClassLogo")=ClassLogo
  rs("ClassBanner")=ClassBanner
  rs("IsCreateHtml")=IsCreateHtml
  rs("IsCreateList")=IsCreateList
  conn.execute("Update SystemClass Set NextID="&rs("ClassID")&" where ClassID="&ParentID)
 
  rs("AddUser")=Session("UserName")
  rs("AddTime")=now()
  rs("AddIP")=UserIP
  rs("AddFrom")=UserFrom
  rs.update 
  response.write("<script>alert('网站栏目添加成功!确定返回栏目添加页面');location.href='SystemClassAdd.asp';</script>")
  else 
  response.write("<script>alert('网站栏目已经存在!系统即将返回上一页');history.go(-1);</script>")
  response.End()
  end if
   rs.close
  set rs=nothing
End Function

end if
 conn.close
 set conn=nothing 
response.End() 
end if
%>
<script language="javascript">
function checkform()        
{
if (document.form1.ClassName.value=="")
{
alert("栏目名称忘记填写");
document.form1.ClassName.value="新闻文章";
document.form1.ClassName.focus;
return false;
}

if (document.form1.ClassDir.value=="")
{
alert("栏目目录忘记填写");
document.form1.ClassDir.value="www";
document.form1.ClassDir.focus;
return false;
}

if (document.form1.ClassLinkUrl.value=="")
{
alert("栏目链接地址忘记填写");
document.form1.ClassLinkUrl.value="http://www.";
document.form1.ClassLinkUrl.focus;
return false;
}

if (document.form1.ClassMemo.value=="")
{
alert("栏目说明忘记填写");
document.form1.ClassMemo.value="在这里填写栏目说明";
document.form1.ClassMemo.focus;
return false;
}
if (document.form1.OrderID.value=="")
{
alert("排列顺序忘记填写");
document.form1.OrderID.value=1;
document.form1.OrderID.focus;
return false;
}
if (document.form1.StyleID.value=="")
{
alert("栏目模扳ID忘记填写");
document.form1.StyleID.value=1;
document.form1.StyleID.focus;
return false;
}

if (document.form1.CssID.value=="")
{
alert("CSS样式ID忘记填写");
document.form1.CssID.value=1;
document.form1.CssID.focus;
return false;
}

}
</script>
</head>
<body>
<!--#include file="top.asp"-->
<table width="870" height="350" border="0" align="center" cellpadding="0" cellspacing="0">
<form id="form1" name="form1" method="post" onsubmit="return checkform()" action="SystemClassAdd.asp?action=add">
  <tr>
    <td height="25" colspan="2" align="center"><strong>网站栏目添加</strong></td>
  </tr>
<tr class="tdbg">
      <td width="150" align="right"><strong>所属栏目:</strong></td>
      <td><% response.Write(ChannelID)
 response.Write(ParentID)
 'response.End()%> 
 
    <select name="ParentID" id="ParentID">
          <%=ShowClassFormOption(ChannelID,ParentID,0,0)%>
        </select>
  &nbsp;&nbsp;<span class="style1">*</span><font color="#ff0033">注意:不能指定为外部栏目</font></td>
    </tr>
  <tr>
    <td height="25" align="right">栏目名称:</td>
    <td width="548" height="25"><input name="ClassName" type="text" id="ClassName" size="30" maxlength="30" value="<%=Session("ClassName")%>" />
      <span class="style1">*</span></td>
  </tr>
   <tr>
      <td height="25" align="right">栏目文件夹:</td>
      <td height="25"><input name="ClassDir" type="text" id="ClassDir" size="30" maxlength="255" value="<%=Session("ClassDir")%>" />
        <span class="style1">*</span></td>
    </tr>
 <tr>
    <td height="25" align="right">链接地址:</td>
    <td height="25"><input name="ClassLinkUrl" type="text" id="ClassLinkUrl" size="40" maxlength="255" value="<%=Session("ClassLinkUrl")%>" />
      <span class="style1">*</span></td>
  </tr> 
  
    <tr>
      <td height="25" align="right">栏目说明:</td>
      <td height="25"><textarea name="ClassMemo" cols="40" rows="6" id="ClassMemo"><%=Session("ClassMemo")%></textarea>
        <span class="style1">*</span></td>
    </tr>
  <tr>
    <td height="25" align="right">生成列表:</td>
    <td height="25">
<select name="IsCreateList" id="IsCreateList" >
<option value="1" <%if Session("IsCreateList")=1 then response.Write("selected")%>>是</option>
<option value="0" <%if Session("IsCreateList")=0 then response.Write("selected")%> >否</option>
</select></td>
  </tr>
  <tr>
    <td height="25" align="right">生成HTML:</td>
    <td height="25">
<select name="IsCreateHtml" id="IsCreateHtml" >
<option value="1" <%if Session("IsCreateHtml")=1 then response.Write("selected")%> >是</option>
<option value="0" <%if Session("IsCreateHtml")=0 then response.Write("selected")%>>否</option>
</select></td>
  </tr>
    <tr>
    <td height="25" align="right"><p>栏目Logo:</p>      </td>
    <td height="25"><input name="ClassLogo" type="text" id="ClassLogo" value="<%=Session("ClassLogo")%>" size="40" maxlength="255"/></td>
  </tr>
  <tr>
    <td height="25" align="right">栏目Banner:</td>
    <td height="25"><input name="ClassBanner" type="text" id="ClassBanner" size="40" maxlength="255" value="<%=Session("ClassBanner")%>" />    </td>
  </tr>
   
    <tr>
      <td height="25" align="right">排列顺序:</td>
      <td height="25">
   <input name="OrderID" type="text" id="OrderID" size="10" maxlength="4" value="<%=Session("OrderID")%>" />
   (数字)
      <span class="style1">*</span></td>
    </tr>
    <tr>
    <td height="25" align="right">模板样式:</td>
    <td height="25">
<input name="StyleID" type="text" id="StyleID" size="10" maxlength="4" value="<%=Session("StyleID")%>" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
(数字)
      <span class="style1">*</span></td>
  </tr>
  <tr>
    <td height="25" align="right">CSS样式:</td>
    <td height="25">
<input name="CssID" type="text" id="CssID" size="10" maxlength="4" value="<%=Session("CssID")%>" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
(数字)
      <span class="style1">*</span></td>
  </tr>
 
   <tr>
    <td height="25" colspan="2" align="center">
 <input type="submit" name="Submit" value="确认添加" />
      &nbsp;&nbsp;&nbsp;&nbsp; <input name="Button" type="button" id="Button"  value="返回列表" onclick="window.open('SystemClassList.asp','_self')"/></td>
    </tr>
  </form>
</table>
<!--#include file="bom.asp"-->
</body>
</html>



更多的网站栏目无限分类的代码请到论坛查看: http://BBS.TC711.COM



【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】 来源: 互联网    日期:2008-7-5   

发 表 评 论
查看评论

  您的大名:
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
认证编码: 刷新验证码
点评内容: 字数0
  精品推荐  
  本月推荐  
  友情赞助  

关于我们 | 联系我们 | 广告投放 | 留言反馈 | 免费程序 | 虚拟主机 | 网站建设 |  网站推广 |  google_sitemap baidu_sitemap RSS订阅
本站所有资源均来自互联网,如有侵犯您的版权或其他问题,请通知管理员,我们会在最短的时间回复您
Copyright © 2005-2015 Tc711.Com All Rights Reserved 版权所有·711网络   蜀ICP备05021915号
110网监备案 信息产业备案 不良信息举报