<!--#include file="../../inc/config.asp"-->
<!--#include file="../../inc/conn.asp"-->
<!-- #include file="../inc/Session.asp" -->
<HTML>
<HEAD>
<TITLE>插入标签</TITLE>
<link href="../../css.css" rel="stylesheet">
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<%
dim first,classid,noclass
classid=0
dim i
if not isempty(request("classid")) then
	classid=Cint(request("classid"))
else
	classid=0
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from catalogs where parentid="&classid&" order by id asc"
rs.open sql,conn,3,1
if not rs.eof then
	first=rs.GetRows()
else
	noclass=true
end if
rs.close
set rs=nothing
'response.Write("bigclass-----------------------"&ubound(first,2)&"----------------<br>")

'获得所有par_id=<>的类别------主类：par_id=0

Function getcatalogs(parentid,str)
	Dim Sql,rstemp,TemptempStr,tempStr	
	tempStr=str&"&nbsp;"
	sql="select * from catalogs where parentid="&parentid
	Set rstemp = Conn.Execute(Sql)
	do while Not rstemp.Eof
		getcatalogs = getcatalogs &"<option value="&rstemp("id")&">│"&tempStr&"└"&rstemp("title")&"</option>"&Chr(10)
		getcatalogs = getcatalogs & getcatalogs(rstemp("id"),tempStr)
		rstemp.MoveNext
	loop
	rstemp.close
	Set rstemp = Nothing
End Function
%>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<link href="cs.css" rel="stylesheet" type="text/css">
<base target="_self">
</HEAD>

<BODY bgColor=menu>
<fieldset style="text-align:center; ">
<legend>插入标签</legend>
<table width="400" border="0" align="center" cellpadding="1" cellspacing="5">
  <tr>
    <td>类别：</td>
    <td><select name="classid" id="classid" size="1" onChange="ChangeFolder(this.value);">  
	<option value="0">根目录</option>    
      <%
      if(noclass<>true) then
  	for i=0 to ubound(first,2)
		response.Write("<option value="&first(0,i)&">├"&first(2,i)&"</option>"&Chr(10))	
    	response.Write(getcatalogs(first(0,i),""))		
	next
	end if	
	%>
    </select></td>
  </tr>
  <tr><td colspan="2">
  <iframe id="LabelList" width="100%" height="300" frameborder="1" src="labels.asp?classid=<%=classid %>"></iframe>
  </td></tr>
  
</table>

</fieldset>
  </CENTER></DIV>
  <div align="center"><br><input onClick="window.close();" type="button" name="Submit3" value=" 取 消 "></div>
</BODY>
</HTML>
<script language="JavaScript">
var SysRootDir='<% = SysRootDir %>';
function ChangeFolder(ClassId)
{
	frames["LabelList"].location='labels.asp?classid='+ClassId;
}
function SelectFile()
{
	if (frames["LabelList"].LabelName!='')
	{		
		window.returnValue=frames["LabelList"].LabelName;
		window.close();
	}
	else
		alert('请选择选择文件');
}
window.onunload=SetReturnValue;
function SetReturnValue()
{
	if (typeof(window.returnValue)!='string') window.returnValue='';
}
</script>
<%
call connclose()
%>