<%@ LANGUAGE = VBScript.Encode %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>导航栏目列表</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<BODY>
<%
if Instr(session("AdminPurview"),"|3,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
  response.end
end if
%>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <th>导航栏目：添加，修改导航栏目相关的内容（<font color="red"><b>栏目请修改名称使用，一般不要删除或增加，特别是“动态页链接网址”和“静态页链接网址”不要修改，否则出错！！！</b></font>）</th>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  class="forumrow"><a href="NavigationEdit.asp?Result=Add" onClick='changeAdminFlag("添加导航栏目")'>添加导航栏目</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NavigationList.asp" onClick='changeAdminFlag("导航栏目列表")'>查看导航栏目</a></td>
  </tr>
</table>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
<form action="DelContent.asp?Result=Navigation" method="post" name="formDel">
  <tr>
  <td class="title" width="200">导航名称</td>
    <td class="title" width="20">ID</td>
	<td class="title" width="20">中</td>
	<td class="title" width="20">英</td>
	
	<td class="title">链接地址(ASP/HTML)</td>
	<td class="title" width="40">状态</td>
	<td class="title" width="80">显示顺序</td>
	<td class="title" width="120">发布时间</td>
	<td class="title" width="40">操作</td>
	<td class="title" width="100"><input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button" id="submitAllSearch" value="全选"> <input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" id="submitOtherSelect" value="反选"></td>
  </tr>
  <% NavigationList(0)
      Response.Write "<tr>" & vbCrLf
    Response.Write "<td colspan='10' nowrap align=""right"" class=""forumRow""><input type=""submit"" name=""batch"" value=""批量修改排序"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""中文批量显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""英文批量显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""中文批量不显示"" onClick=""return test();""> <input type=""submit"" name=""batch"" value=""英文批量不显示"" onClick=""return test();"">  <input name='batch' type='submit' value='删除所选' onClick=""return test();""></td>" & vbCrLf
    Response.Write "</tr>" & vbCrLf

  Response.Write "<tr>" & vbCrLf
  Response.Write "<td colspan='10' nowrap class=""forumRow"">" & vbCrLf
  Response.Write "</td>" & vbCrLf  
  Response.Write "</tr>" & vbCrLf
  %>
  </form>
</table>
<% if request.QueryString("Result")="ModifySequence" then call ModifySequence() %>
<% if request.QueryString("Result")="SaveSequence" then call SaveSequence() %>
</BODY>
</HTML>
<%
function NavigationList(mmid)
  Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,datafrom
  datafrom="TianTianCMS_Navigation"
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From TianTianCMS_Navigation where ParentID="&mmid&" order by Sequence"
  rs.open sql,conn,1,1
  if id=0 and rs.recordcount=0 then
    response.write ("<center>暂无一级导航</center>")
    response.end
  end if  
  i=1
    while(not rs.eof)
	ChildCount=conn.execute("select count(*) from [TianTianCMS_Navigation] where ParentID="&rs("id")&"")(0)
    if ChildCount=0 then
	  if i=rs.recordcount then
	    FolderType="NavFileEnd"
	  else
	    FolderType="NavFile"
	  end if
	  FolderName=rs("NavNameCH")
	  onMouseUp=""
    else
	  if i=rs.recordcount then
	 	FolderType="NavEndFolderClose"
		ListType="NavEndListline"
		onMouseUp="EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  else
		FolderType="NavFolderClose"
		ListType="NavListline"
		onMouseUp="SortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  end if
	  FolderName=rs("NavNameCH")
    end If
	  Response.Write "<tr>" & vbCrLf
	    if rs("ParentID")>0 then 
	  response.write("<td nowrap id='b"&rs("id")&"' style='background-color:#eafefe;'><img src='Images/tree_line1.gif' width='17' height='16' valign='abvmiddle'>"&FolderName&"&nbsp;")	
	  else   
	   response.write("<td nowrap id='b"&rs("id")&"'style='background-color:#eafefe;'><img src='Images/tree_folder4.gif' width='15' height='15' valign='abvmiddle'>"&FolderName&"&nbsp;")	
	   end if
      Response.Write "<td nowrap class=""forumRow"">"&rs("ID")&"</td>" & vbCrLf
      if rs("ViewFlagCH") then
        Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=downCH"" title=""点击更改显示状态""><font color='green'>√</font></a></td>" & vbCrLf
      else
        Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=upCH"" title=""点击更改显示状态""><font color='red'>×</font></a></td>" & vbCrLf
	  end if
      if rs("ViewFlagEN") then
        Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=downEN"" title=""点击更改显示状态""><font color='green'>√</font></a></td>" & vbCrLf
      else
        Response.Write "<td nowrap align='center' class=""forumRow""><a href=""Conversion.asp?id="&rs("ID")&"&LX="&datafrom&"&Operation=upEN"" title=""点击更改显示状态""><font color='red'>×</font></a></td>" & vbCrLf
	  end if  
	
      Response.Write "<td nowrap class=""forumRow"">" & vbCrLf
	  if rs("ViewFlagCH") then
      Response.Write "<a href=""../CH/"&rs("NavUrl")&""">中文动态页面</a> <a href=""../CH/html/"&rs("HtmlNavUrl")&""">中文静态页面</a>" & vbCrLf
      else
      Response.Write "" & vbCrLf
	  end if
	  if rs("ViewFlagEN") then
      Response.Write "<a href=""../EN/"&rs("NavUrl")&""">英文动态页面</a> <a href=""../EN/html/"&rs("HtmlNavUrl")&""">英文静态页面</a>" & vbCrLf
      else
      Response.Write "" & vbCrLf
	  end if
      Response.Write "</td>" & vbCrLf
      if rs("OutFlag") then
        Response.Write "<td nowrap align='center' class=""forumRow""><font color='red'>新窗口</font></td>" & vbCrLf
      else
        Response.Write "<td nowrap align='center' class=""forumRow"">原窗口</td>" & vbCrLf
	  end if
      Response.Write "<td nowrap align='center' class=""forumRow""><input type=""text"" name=""Sequence"" size=""5"" value="""&rs("Sequence")&""" onkeypress=""if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false""><input name=""Nav_id"" type=""hidden"" value="""&rs("ID")&"""></td>" & vbCrLf
      Response.Write "<td nowrap class=""forumRow"">"&rs("AddTime")&"</td>" & vbCrLf
      Response.Write "<td align=""center""nowrap class=""forumRow""><a href='NavigationEdit.asp?Result=Modify&ID="&rs("ID")&"'>修改</a> <a href='NavigationList.asp?Result=ModifySequence&ID="&rs("ID")&"'>排序</a></td>" & vbCrLf
 	  Response.Write "<td nowrap align='center' class=""forumRow""><input name='selectID' type='checkbox' value='"&rs("ID")&"'></td>" & vbCrLf
      Response.Write "</tr>" & vbCrLf
	  if ChildCount>0 then
%>
<% NavigationList(rs("id")) %>
<%
	end if
	  rs.movenext
    wend
  rs.close
  set rs=nothing
end Function

sub ModifySequence()
  dim rs,sql,ID,NavNameCH,Sequence
  ID=request.QueryString("ID")
  set rs = server.createobject("adodb.recordset")
  sql="select * from TianTianCMS_Navigation where ID="& ID
  rs.open sql,conn,1,1
  NavNameCH=rs("NavNameCH")
  Sequence=rs("Sequence")
  rs.close
  set rs=nothing
  response.write "<br>"
  response.write "<table width='95%' border='0' cellpadding='3' cellspacing='1'>"
  response.write "<form action='NavigationList.asp?Result=SaveSequence' method='post' name='formSequence'>"
  response.write "<tr>"
  response.write "<td align='center' nowrap>ID：<input name='ID' type='text' style='width: 28' value='"&ID&"' maxlength='4' readonly> 导航栏目名称：<input name='NavNameCH' type='text' id='NavNameCH' style='width: 180;' value='"&NavNameCH&"' maxlength='35' readonly> 排序号：<input name='Sequence' type='text' style='width: 60;' value='"&Sequence&"' maxlength='4' onKeyDown='if(event.keyCode==13)event.returnValue=false' onchange=""if(/\D/.test(this.value)){alert('序号必须为整数！');this.value='"&Sequence&"';}""> <input name='submitSequence' type='submit' value='修改'></td>"
  response.write "</tr>"
  response.write "</form>"
  response.write "</table>"
end sub

sub SaveSequence()
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select * from TianTianCMS_Navigation where ID="& request.form("ID")
  rs.open sql,conn,1,3
  rs("Sequence")=request.form("Sequence")
  rs.update
  rs.close
  set rs=nothing
  response.write "<script language='javascript'>alert('修改成功！');location.replace('NavigationList.asp');</script>"
end sub
%>