<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>栏目/分类管理-目录树</title>
<link rel="stylesheet" href="css/tree.css">
<script language="javascript" src="js/tree_view.js"></script>
<script src="js/xmlhttp.js" type="text/javascript"></script>
<script type="text/javascript">
function SearchCatalog(obj){
    var s=document.getElementById('Key').value;
    if(s!=""){
			rootCell.parentNode.parentNode.parentNode.parentNode.removeChild(rootCell.parentNode.parentNode.parentNode);
			iconMap.length=0;
			iconList.length=0;    
		  // s=encodeURI(s);
			var xmlhttp;	 
	    xmlhttp=getXMLRequester();		
	    Initialise();
      d=CreateTreeItem( rootCell, "images/tree/project.gif", "images/tree/project.gif",0,"ROOT", null, null,2);    	
	    if(xmlhttp){	
		    xmlhttp.onreadystatechange = function doAction() {		
					if (xmlhttp.readyState == 4)
					{			
							/*alert(xmlhttp.responseText);*/				
							var response = xmlhttp.responseXML.documentElement;
							var classidList = response.getElementsByTagName('catalog');				
							for(var i=0;i<classidList.length;i++){
								xx=classidList[i].getElementsByTagName('classid');
								yy=classidList[i].getElementsByTagName('catatitle');
								classid=xx[0].firstChild.data
								classtitle=yy[0].firstChild.data				
								CreateTreeItem(d,"images/tree/folder_closed.gif", "images/tree/folder_open.gif",classid, classtitle, "classmodi.asp?ClassID="+classid,"_self",1);
							}
					}
		    };
		    var ReturnValue=xmlhttp.open("get", "Category_GetSearch.asp?key="+s,true);				
		    xmlhttp.send("");
	    }
	}
}
function addChild(pdiv,classid,classtitle){
	CreateTreeItem( pdiv,"images/tree/folder_closed.gif","images/tree/folder_open.gif",classid,classtitle,"classmodi.asp?ClassID="+classid,"_self",1);
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p01")
'''''''''''''''''''''''''''''''''''''''''''''''
Dim ClassSql,rs,ParentId
if not isempty(request.QueryString("classid")) then
	ParentId=Clng(request.QueryString("classid"))
else
	ParentId=0
end if
%>

<body ondragstart="return false;" onselectstart="return false;"  onLoad="CreateProjectExplorer()">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<div class="notice">
            <strong>栏目搜索</strong>：
<input id="Key" name="Key" type="text" onKeyUp="SearchCatalog()" />
              <input id="Button1" type="button" 
                  value="搜索" onClick="SearchCatalog()" /> 
　<a href="category_reset.asp" onClick="return confirm('确定删除所有栏目吗？')">清空栏目 </a></div>
<%
ClassSql = "Select * from catalogs where parentID="&ParentId
Set rs = Conn.Execute(ClassSql)
response.Write("<script language=""JavaScript"" type=""text/JavaScript"">"&Chr(10))
response.Write("function CreateProjectExplorer()"&Chr(10))
response.Write("{"&Chr(10))
response.Write("	Initialise();"&Chr(10))
response.Write("	d=CreateTreeItem( rootCell, ""images/tree/project.gif"", ""images/tree/project.gif"",0,""根目录"", null, null,2);"&Chr(10))
do while Not rs.Eof
	Response.Write("	CreateTreeItem(d,""images/tree/folder_closed.gif"", ""images/tree/folder_open.gif"","&rs("id")&", """&rs("title")&""", ""classmodi.asp?ClassId="&rs("id")&""",""_self"",1);"&Chr(10))
	rs.MoveNext
loop
response.Write("}"&Chr(10))
response.Write("</script>"&Chr(10))
%>
<%
rs.close
Set rs = Nothing
%>
</body>
</html>
<%call connclose()%>