<%
guidedisplay=1
copyrightend=1
headdisplay=1
%>
<!--#include file="admin_start.asp" -->
<%
dim i
dim c
dim n
i=0

Function replace_vbs(cs,str1,str2)
	
	replace_vbs=replace(cs,str1,str2)

end function


Function ListFolders(path,imgh)
	dim folders
	dim fso
	dim cc
	dim ccc
	dim folder
	dim ii
	dim imgs
	dim imgh_t
	dim i_files
	dim t1
	imgh_t=imgh
	if imgh="" then imgh="|"
	imgh=split(imgh,"|")
	set fso=server.CreateObject("Scripting.FileSystemObject")  
	
	set folders=fso.getfolder(server.mappath(path))
	
	i_files=0
	
	for each file in folders.files
		if instr(1,file.type,"图像")>0 then i_files=i_files+1
	next
	
	'n=folders.subfolders.count+i_files
	
	'i=0
	ii=i
	
	if folders.subfolders.count+i_files-1<=0 then
	
		cc=cc+"<div style='height:22px;padding-left:10px;'  onmouseover=this.style.background='#f7f7f7' onmouseout=this.style.background='#ffffff'><nobr>"
		
		for iii=0 to ubound(imgh)
			if imgh(iii)<>"" then cc=cc+"<img src='images/class"&(5+imgh(iii))&"_b.gif'>"
		next
		
		cc=cc+"<img src='images/class4_b.gif'><img id=img_head_"&i&" src='images/arc_i.gif' hspace=5 ><font color=#aaaaaa >没有任何图片文件！</font></nobr></div>" 
		ListFolders=cc
		i=i+1
		exit function
		
	end if
		
	for each folder in folders.subfolders
		if (i-ii)<folders.subfolders.count+i_files-1 then imgs=3 else imgs=4
		
		ccc="<div style='height:22px;padding-left:10px;' onclick=""show("&i&",'"&path&""&folder.name&"/','"&imgh_t&"|"&(imgs-3)&"');"" onmouseover=this.style.background='#f7f7f7' onmouseout=this.style.background='#ffffff'><nobr>"
		
		for iii=0 to ubound(imgh)
			if imgh(iii)<>"" then ccc=ccc+"<img src='images/class"&(5+imgh(iii))&"_b.gif'>"
		next
		
		ccc=ccc+"<img src='images/class"&imgs&"_b.gif'><img id=img_head_"&i&" src='images/tree_fold1.gif' > "&folder.name&"</nobr></div>" 
		ccc=ccc+"<div id=div_"&i&" style='display:none;' ></div>" 
		i=i+1
		ListFolders=ListFolders+ccc
	next
	
	for each file in folders.files
		if instr(1,file.type,"图像")>0 then
			if (i-ii)<folders.subfolders.count+i_files-1 then imgs=3 else imgs=4
			
			ccc="<div style='height:110px;padding-left:10px;'  onmouseover=this.style.background='#f7f7f7' onmouseout=this.style.background='#ffffff'><div style='float:left;height:110px;'>"
			
			for iiii=0 to 4
				for iii=0 to ubound(imgh)
					if imgh(iii)<>"" then ccc=ccc+"<img src='images/class"&(5+imgh(iii))&"_b.gif'>"
				next
				ccc=ccc+"<br>"
			next
			
			
			ccc=ccc+"</div><div style='float:left;height:110px;'>"
			
			for iiii=0 to 1
				ccc=ccc+"<img src='images/class5_b.gif'><br>"
			next
			
			ccc=ccc+"<img src='images/class"&imgs&"_b.gif'>"
			
			if imgs=3 then
				for iiii=0 to 1
					ccc=ccc+"<br><img src='images/class5_b.gif'>"
				next
			end if
			
			ccc=ccc+"</div><div class=div_f1 ><div class=div_f2  ><table width=100% height=100% cellpadding=0 cellspacing=0 ><tr><td valign=middle align=center><img onclick='insertImg("""&path&file.name&""")' alt='"&file.name&"' width=90 src='"&path&file.name&"' ></td></tr></table></div>"
			ccc=ccc+"<div class=div_f3 ><font class=font_f >- <font color=blue>"&trim(replace(file.type,"图像",""))&"</font> / "&(file.size)\1024&" KB </font></div>"
			ccc=ccc+"</div></div>" 
			i=i+1
			ListFolders=ListFolders+ccc
		end if
	next
	
	set fso=nothing
	
end function

if request("path")<>"" then
	i=int(request("i"))
	rr=ListFolders(request("path"),trim(request("imgh")))
	response.write i&"<#>"&rr
	response.end
	
end if
%>

<style>
body {font:Arial;font-size:9pt}
.div_d{
	padding-left:10px;padding-top:0px;height:22px;width:300%;
}
.div_f1{
	float:left;padding-top:7px;height:110px;width:100px;
}
.div_f2{
	text-align:center;background-color:#ffffff;border:1px solid #aaaaaa;border-left:2px solid #FF6B00;border-bottom:0px;float:left;width:100px;height:80px;overflow:hidden;
}
.div_f3{
	text-align:left;background-color:#ffffff;border:1px solid #aaaaaa;border-left:2px solid #666666;border-top:0px;float:left;width:100px;height:16px;overflow:hidden;padding-top:0px;
}
.font_f{
	color:#666666;font-family:Arial;font-size:8pt;
}
img{
	vertical-align:middle
}

</style>

<body topmargin="0"  rightmargin="0" onmousemove="top.changew(2,event.x)" onmouseup="top.changew(1,event.x)">

<div class=div_d onclick=show(0,'../','') onmouseover=this.style.background='#f7f7f7' onmouseout=this.style.background='#ffffff'>
	<nobr><img id=img_head_0 src='images/tree_fold1.gif' > 系统根目录 </nobr>
</div>

<div id=div_0 style='display:none;width:300%;' ></div>
<div id="imgv" style='display:none;z-index:10;left:10px;top:50px;padding:10px;width:180px;background-color:#f7f7f7;position:absolute;height:30px;border:1px solid #666666'>正在获取文件列表，请稍候！
</div>

<script language="javascript" >
function BytesToBstr(bodys, Cset){
	if (Cset=="")Cset="GB2312"
	var objstream =new ActiveXObject("adodb.stream")
	objstream.Type = 1
	objstream.Mode = 3
	objstream.open
	//alert(bodys)
	objstream.write(bodys)
	objstream.Position = 0
	objstream.Type = 2
	objstream.Charset = Cset
	var r = objstream.ReadText
	objstream.Close
	objstream = null
	return r
}

var opened=new Array
var i=1
function show(n,path,imgh){

			document.getElementById("imgv").style.posTop=document.body.scrollTop+50;
			document.getElementById("imgv").style.display=""
			var timename=setTimeout("shows("+n+",'"+path+"','"+imgh+"')",100);

}
function shows(n,path,imgh){
	var ls
	
			//alert(n)
	var s=document.getElementById("div_"+n).style.display
	if(s=="none"){

		if(opened[n]!=1){
		////////////////////////////////////////////////////////////////
			var xh = new ActiveXObject("Microsoft.XMLHTTP"); 
			//xh.onreadystatechange = getReady; 
			xh.open("GET","admin_edit_label_files_sys_list.asp?i="+i+"&path="+path+"&imgh="+imgh,false);                     
			xh.send();
			//alert(xh.responseText)
			if (xh.readyState==4) {
				//ls = BytesToBstr(xh.responseBody,"");
				ls = xh.responseText;
			}else{
				ls=false;
			}
			//alert(ls)
			xh=null
		////////////////////////////////////////////////////////////////
			if(!ls){
				document.getElementById("div_"+n).innerHTML=ls
			}else{
				ls=ls.split("<#>");
				i=ls[0]
				document.getElementById("div_"+n).innerHTML=ls[1]
				opened[n]=1
			}
		}
		document.getElementById("div_"+n).style.display=""
		document.getElementById("imgv").style.display="none"
		document.getElementById("img_head_"+n).src="images/tree_fold.gif"

	}else{
		document.getElementById("imgv").style.display="none"
		document.getElementById("div_"+n).style.display="none"
		document.getElementById("img_head_"+n).src="images/tree_fold1.gif"
	}
}

function InsertLabel(s){
var string
string="<font color=green>{$"
string+=s
string+="$}</font>"
top.InsertLabel(string);
top.focus
}

function insertImg(o){
	var upfilepath;
	if(o){
		var editmode=top.document.getElementById("edit_method").checked
		//alert(o.replace("../",""))
		if(editmode)
		top.InsertLabel("&lt;img src=&#39;"+o.replace("../","")+"&#39;&gt;");
		else
		top.InsertLabel("<img src='"+o.replace("../","")+"'>");
		top.focus
	}

}
show(0,'../','')
</script>
</body>
<!--#include file="admin_end.asp" -->