<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>
<%
dim Result
Result=request.QueryString("Result")
dim ID,NavName,ViewFlag,NavUrl,HtmlNavUrl,OutFlag,Remark,ParentID,Angel_languageid
ID=request.QueryString("ID")
call NavEdit()
%>



<div id="Language">
<%If Result = "Add" then%>
<div style="height:37px;background:#ffffff;border:1px #628ae1 solid;padding-top:5px; width:100%; padding-left:10px;clear:both;">
<h2>简体中文</h2><!--<h2>ENGLISH</h2>-->
</div>
<%end if%>
<%
Dim  rs,sql,n,showm,mLid
  set rs = server.createobject("adodb.recordset")
  sql="select * from Angel_Language order by Lorder desc"
  rs.open sql,conn,1,1
  n=0
  do while not rs.eof
  if request("m")<>"" then
  showm=request("m")
  else
  showm=n
  end if
  if Result = "Add" then
  mLid=rs("id")
  Angel_languageid=rs("id")
  else
  mLid=""
  end if
%>
<ul>
<br>
<table bgcolor="#628AE1" width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <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 name="editForm<%=mLid%>" method="post" action="NavigationEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>&m=<%=showm%>">
  <tr>
    <td height="22" colspan="2" nowrap bgcolor="#FFFFFF"><font style="font-size:12px;">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>导航】</font></td>
  </tr>
  <tr>
    <td width="20%" align="right" nowrap bgcolor="#FFFFFF" >名称：</td>
    <td width="80%" nowrap bgcolor="#FFFFFF"><input name="NavName" type="text" id="NavName" style="width: 200" value="<%=NavName%>" maxlength="100"> 显示：<input name="ViewFlag" type="checkbox" value="1" checked <%if ViewFlag then response.write ("checked")%>> 
    <font color="red">*</font></td>
  </tr>
  <tr>
    <td align="right" nowrap bgcolor="#FFFFFF">所属菜单：</td>
    <td nowrap bgcolor="#FFFFFF"><INPUT 
      class=searchtxt id="ParentID" name=ParentID <%if ParentID="" then%>value="0" <%else%>value="<%=ParentID%>"<%end if%> readonly="true">*不选择则为一级菜单<%call Admin_ShowClass_Option(0)%></td> 
  </tr>
    <tr>
    <td align="right" nowrap bgcolor="#FFFFFF">动态页链接网址：</td>
    <td nowrap bgcolor="#FFFFFF"><input name="NavUrl" type="text" id="NavUrl" style="width: 500" value="<%=NavUrl%>"> <font color="red">*</font></td>
  </tr>
  <tr>
    <td align="right" nowrap bgcolor="#FFFFFF">静态页链接网址：</td>
    <td nowrap bgcolor="#FFFFFF"><input name="HtmlNavUrl" type="text" id="HtmlNavUrl" style="width: 500" value="<%=HtmlNavUrl%>"> <font color="red">*</font></td>
  </tr>
  <tr>
    <td width="20%" align="right" nowrap bgcolor="#FFFFFF">链接状态：</td>
    <td width="80%" nowrap bgcolor="#FFFFFF"><input name="OutFlag" type="checkbox" value="1" <%if OutFlag then response.write ("checked")%>>是否外部链接</td>
  </tr>
  <tr>
    <td align="right" nowrap bgcolor="#FFFFFF">备注：</td>
    <td nowrap bgcolor="#FFFFFF"><textarea name="Remark" rows="8" id="Remark" style="width: 500"><%=Remark%></textarea></td>
  </tr>
  <tr>
    <td width="20%" align="right" nowrap bgcolor="#FFFFFF"><input name="Angel_languageid" value="<%=Angel_languageid%>" type="hidden" /></td>
    <td width="80%" nowrap bgcolor="#FFFFFF"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"> <input type="button" value="返回上一页" onClick="history.back(-1)"></td>
  </tr>
  </form>
</table>
</ul>
<%
rs.movenext
n=n+1
If Result = "Modify" then
if n>0 then exit do
end if
loop
rs.close
%>
</div>
</BODY>
</HTML>
<%
sub NavEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then
    set rs = server.createobject("adodb.recordset")
	if len(trim(request.Form("NavName")))<2 then
      response.write ("<script language=javascript> alert('""中文""名称为必填项目,请填写导航名称并保持至少在一个汉字以上！');history.back(-1);</script>")
      response.end
    end if
	If trim(Request.Form("NavUrl")) = ""  Or trim(Request.Form("HtmlNavUrl")) = "" Then
		response.write ("<script language='javascript'>alert('请填写链接网址！');history.back(-1);</script>")
		response.end
	End If
    if Result="Add" Then
	  sql="select * from Angel_Navtions"
      rs.open sql,conn,1,3
      rs.addnew
      rs("NavName")=trim(Request.Form("NavName"))
      rs("NavUrl")=trim(Request.Form("NavUrl"))
	  rs("HtmlNavUrl")=trim(Request.Form("HtmlNavUrl"))
	  rs("ParentID")=trim(Request.Form("ParentID"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  if Request.Form("OutFlag")=1 then
        rs("OutFlag")=Request.Form("OutFlag")
	  else
        rs("OutFlag")=0
	  end if
	  rs("Remark")=trim(Request.Form("Remark"))
	  rs("Sequence")=99
	  rs("Angel_languageid")=trim(Request.Form("Angel_languageid"))
	  rs("AddTime")=now()
	end if
	if Result="Modify" Then
      sql="select * from Angel_Navtions where ID="&ID
      rs.open sql,conn,1,3
      rs("NavName")=trim(Request.Form("NavName"))
      rs("NavUrl")=trim(Request.Form("NavUrl"))
	  rs("HtmlNavUrl")=trim(Request.Form("HtmlNavUrl"))
	  rs("ParentID")=trim(Request.Form("ParentID"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	 
	  if Request.Form("OutFlag")=1 then
        rs("OutFlag")=Request.Form("OutFlag")
	  else
        rs("OutFlag")=0
	  end if
	  rs("Remark")=trim(Request.Form("Remark"))
	end If
	rs("Angel_languageid")=trim(Request.Form("Angel_languageid"))
	rs.update
	rs.close
    set rs=nothing
    response.write "<script language='javascript'>alert('设置成功！');location.replace('NavigationList.asp?m="&request("m")&"');</script>"
  else
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from Angel_Navtions where ID="& ID
      rs.open sql,conn,1,1
	  NavName=rs("NavName")
	  ViewFlag=rs("ViewFlag")
      Remark=rs("Remark")
	  OutFlag=rs("OutFlag")
      NavUrl=rs("NavUrl")
	  HtmlNavUrl=rs("HtmlNavUrl")
	  ParentID=rs("ParentID")
	  Angel_languageid=rs("Angel_languageid")
	  rs.close
      set rs=nothing
	end if
  end if
end sub

sub Admin_ShowClass_Option(id)
	Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From Angel_Navtions where ParentID="&id&" and Angel_languageid="&Angel_languageid&" order by id"
  rs.open sql,conn,1,1
  if id=0 and rs.recordcount=0 then
    response.write ("<center>暂无相关分类</center>")
    response.end
  end if
  i=1
  response.write("<table border='0' cellspacing='0' cellpadding='0'>")
  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="SortFileEnd"
	  else
	    FolderType="SortFile"
	  end if
	  FolderName=rs("NavName")
	  onMouseUp=""
    else
	  if i=rs.recordcount then
	 	FolderType="SortEndFolderClose"
		ListType="SortEndListline"
		onMouseUp="EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  else
		FolderType="SortFolderClose"
		ListType="SortListline"
		onMouseUp="SortChange('a"&rs("id")&"','b"&rs("id")&"');"
	  end if
	  FolderName=rs("NavName")
    end if
    response.write("<tr>")
    response.write("<td nowrap id='b"&rs("id")&"' class='"&FolderType&"' onMouseUp="&onMouseUp&"></td><td nowrap>"&FolderName&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
	if rs("ParentID")=0 then
    response.write("<a href=""javascript:void(0)"" onClick=""ParentID.value='"&rs("ID")&"';""> <font color='#ff6600'>选择</font></a>")
	end if
    response.write("</td></tr>")
    if ChildCount>0 then
%>
      <tr id="a<%= rs("id")%>" style="display:yes"><td class="<%= ListType%>" nowrap></td><td ><%Admin_ShowClass_Option(rs("id")) %></td></tr>
<%
    end if
    rs.movenext
    i=i+1
  wend
  response.write("</table>")
  rs.close
  set rs=nothing
end sub
Function SortText(ID)
  Dim rs,sql
  Set rs=server.CreateObject("adodb.recordset")
  sql="Select * From Angel_Navtions where ID="&ID
  rs.open sql,conn,1,1
  SortText=rs("NavName")
  SortText=replace(SortText," ","&nbsp;")
  rs.close
  set rs=nothing
End Function
%>

<%If Result = "Add" then%>
</div>
<%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>
<%end If%>