<% Option Explicit %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Description" CONTENT="" />
<TITLE>导航栏目列表</TITLE>
<link rel="stylesheet" href="../Images/CssAdmin.css">
<script language="javascript" src="../inc/Admin.js"></script>
</HEAD>
<!--#include file="../../Include/Const.asp" -->
<!--#include file="../../Include/Conn1.asp" -->
<!--#include file="../CheckAdmin.asp"-->
<BODY>

<div id="Language">
<div style="height:37px;background:#ffffff;border:1px #628ae1 solid;padding-top:5px; width:100%; padding-left:10px;clear:both;">
<h2>简体中文</h2> 
</div>
<%
Dim rsL,sqlL,n
set rsL = server.createobject("adodb.recordset")
  sqlL="select * from Angel_Language order by Lorder desc"
  rsL.open sqlL,conn,1,3
  n=0
  do while not rsL.eof
  response.Write("<ul>")%>
<br>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#628AE1">
  <tr>
 <td height="24" nowrap><font color="#FFFFFF"><img src="../Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;&nbsp;<strong>导航栏目：添加，修改导航栏目相关的内容</strong></font></td>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  bgcolor="#FFFFFF"><a href="NavigationEdit.asp?Result=Add&m=<%=n%>" onClick='changeAdminFlag("添加导航栏目")'>添加导航栏目</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NavigationList.asp?&m=<%=n%>" onClick='changeAdminFlag("导航栏目列表")'>查看导航栏目</a></td>
  </tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#628AE1">
<form action="../Product/DelContent.asp?Result=Navigation" method="post" name="formDel">
  <tr>
  <td class="title" width="200" nowrap bgcolor="#8DB4E9">导航名称</td>
    <td class="title" width="20" nowrap bgcolor="#8DB4E9">ID</td>
	<td class="title" width="60" nowrap bgcolor="#8DB4E9">是否显示</td>
	<td class="title" nowrap bgcolor="#8DB4E9">链接地址(ASP/HTML)</td>
	<td class="title" width="40" nowrap bgcolor="#8DB4E9">状态</td>
	<td class="title" width="80" nowrap bgcolor="#8DB4E9">显示顺序</td>
	<td class="title" width="120" nowrap bgcolor="#8DB4E9">发布时间</td>
	<td class="title" width="40" nowrap bgcolor="#8DB4E9">操作</td>
	<td class="title" width="100" nowrap bgcolor="#8DB4E9"><input onClick="CheckAll(this.form)"  class="button" name="buttonAllSelect" type="button" id="submitAllSearch" value="全选" style="HEIGHT: 18px;WIDTH: 16px;"> <input onClick="CheckOthers(this.form)" name="buttonOtherSelect"  class="button" type="button" id="submitOtherSelect" value="反选" style="HEIGHT: 18px;WIDTH: 16px;"></td>
  </tr>
  <%
  Call NavigationList(0,rsL("id"))

    Response.Write "<tr><td colspan='8' nowrap  bgcolor='#FFFFFF'>&nbsp;</td>" & vbCrLf
    Response.Write "<td colspan='2' align=""right"" nowrap  bgcolor='#FFFFFF'><input name=""submitDelSelect"" type=""submit"" class=""button""  id=""submitDelSelect"" value=""删除所选"" onClick=""return AngelConfirmDel('您真的要删除这些导航栏目吗？');""></td>" & vbCrLf
    Response.Write "</tr>" & vbCrLf

  Response.Write "<tr>" & vbCrLf
  Response.Write "<td colspan='10'>" & 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() %>
<%response.Write("</ul>")	
  rsL.movenext
  n=n+1
  loop
  rsL.close 
  %>


<%dim m
m=request.QueryString("m")
if m="" then m=0
%>
<script>
function $(id){return document.getElementById(id);}
function $tag(id,tagName){return $(id).getElementsByTagName(tagName)}
var onum=<%=m%>;//用于控制默认打开的标签
var Ds=$tag("Language","ul");
var Ts=$tag("Language","h2");
for(var i=0; i<Ds.length;i++){
if(i==onum){
Ds[i].style.display="block";
Ts[i].className = "title_current";
}
else{
Ds[i].style.display="none";
Ts[i].className = "title_normal";
}
Ts[i].value=i;
Ts[i].onmousedown=function(){
if(onum==this.value){return false;};
Ts[onum].className="title_normal";
Ts[this.value].className="title_current";
Ds[onum].style.display="none";
Ds[this.value].style.display="block";
onum=this.value;
}
}
</script>
</div>
</BODY>
</HTML>
<%
function NavigationList(mmid,Angel_languageid)
  Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,datafrom,id
  datafrom="Angel_Navtions"
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From Angel_Navtions where ParentID="&mmid&" and Angel_languageid="&Angel_languageid&" 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 [Angel_Navtions] where Angel_languageid="&Angel_languageid&" and ParentID="&rs("id")&"")(0)
    if ChildCount=0 then
	  if i=rs.recordcount then
	    FolderType="NavFileEnd"
	  else
	    FolderType="NavFile"
	  end if
	  FolderName=rs("NavName")
	  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("NavName")
    end If
	  Response.Write "<tr bgcolor=""#ffffff"" onMouseOver = ""this.style.backgroundColor = '#D7E3F7'"" onMouseOut = ""this.style.backgroundColor = ''"">" & vbCrLf
	    if rs("ParentID")>0 then 
	  response.write("<td nowrap id='b"&rs("id")&"' class=""forumRow""><img src='../Images/tree_line1.gif' width='17' height='16' valign='abvmiddle'>"&FolderName&"&nbsp;")	
	  else   
	   response.write("<td nowrap id='b"&rs("id")&"' class=""forumRow""><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("ViewFlag") then
        Response.Write "<td nowrap align='center' class=""forumRow""><font color='green'>√</font></td>" & vbCrLf
      else
        Response.Write "<td nowrap align='center' class=""forumRow""><font color='red'>×</font></td>" & vbCrLf
	  end if
      Response.Write "<td nowrap class=""forumRow"">" & vbCrLf
	  if rs("ViewFlag") then
      Response.Write "<a href=""../../"&rs("NavUrl")&""">动态页面</a> <a href=""../../"&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")&"&m="&n&"'>修改</a> <a href='NavigationList.asp?Result=ModifySequence&ID="&rs("ID")&"&m="&n&"'>排序</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
%>
<% Call NavigationList(rs("id"),Angel_languageid) %>
<%
	end if
	  rs.movenext
    wend
  rs.close
  set rs=nothing
end Function

sub ModifySequence()
  dim rs,sql,ID,NavName,Sequence
  ID=request.QueryString("ID")
  set rs = server.createobject("adodb.recordset")
  sql="select * from Angel_Navtions where ID="& ID
  rs.open sql,conn,1,1
  NavName=rs("NavName")
  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='"&NavName&"' 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 Angel_Navtions 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?m="&request("m")&"');</script>"
end sub
%>

