<!--#include file="fsoconfig.asp"-->
<!--#include file="checklogin.asp"-->
<!--#include file="fsofunctions.asp"-->
<%
page=trim(request.querystring("page"))
act=trim(request.querystring("act"))
if page<>"" and isnumeric(page) then
	page=fix(page)
else
	page=1
end if
if path="/" then
	goparent="↑回上级目录..."
else
	goparent="<a href='"&selfname&"?path="&server.urlencode(left(path,instrrev(path,"/",len(path)-1)))&"&ntime="&ntime&"'>↑回上级目录...</a>"
end if
parent_url=server.urlencode(parent_url)
pathurl=server.urlencode(path)
s_folderpath=server.mappath(path)
set obj_fso=server.createobject("scripting.filesystemobject")
if act="paste" and session("act")="copy" and session("basepath")<>s_folderpath and obj_fso.folderexists(s_folderpath)=true then
	n_errfile=0
	n_errfolder=0
	if session("folders")<>"" then
		a_folders=split(session("folders"),chr(9))
		m=ubound(a_folders)
		for i=0 to m
			s_sourcefolder=session("basepath")&"\"&a_folders(i)
			s_targetfolder=s_folderpath&"\"&a_folders(i)
			if obj_fso.folderexists(s_sourcefolder) then
				obj_fso.copyfolder s_sourcefolder,s_targetfolder,true
			else
				n_errfolder=n_errfolder+1
			end if
		next
	else
		m=0-1
	end if
	if session("files")<>"" then
		a_files=split(session("files"),chr(9))
		n=ubound(a_files)
		for i=0 to n
			s_sourcefile=session("basepath")&"\"&a_files(i)
			s_targetfile=s_folderpath&"\"&a_files(i)
			if obj_fso.fileexists(s_sourcefile) then
				obj_fso.copyfile s_sourcefile,s_targetfile,true
			else
				n_errfile=n_errfile+1
			end if
		next
	else
		n=0-1
	end if
elseif act="paste" and session("act")="cut" and session("basepath")<>s_folderpath and obj_fso.folderexists(s_folderpath)=true then
	n_errfile=0
	n_errfolder=0
	if session("folders")<>"" then
		a_folders=split(session("folders"),chr(9))
		m=ubound(a_folders)
		for i=0 to m
			s_sourcefolder=session("basepath")&"\"&a_folders(i)
			s_targetfolder=s_folderpath&"\"&a_folders(i)
			if obj_fso.folderexists(s_sourcefolder) then
				obj_fso.copyfolder s_sourcefolder,s_targetfolder,true
				obj_fso.deletefolder s_sourcefolder,true
			else
				n_errfolder=n_errfolder+1
			end if
		next
	end if
	if session("files")<>"" then
		a_files=split(session("files"),chr(9))
		n=ubound(a_files)
		for i=0 to n
			s_sourcefile=session("basepath")&"\"&a_files(i)
			s_targetfile=s_folderpath&"\"&a_files(i)
			if obj_fso.fileexists(s_sourcefile) then
				obj_fso.copyfile s_sourcefile,s_targetfile,true
				obj_fso.deletefile s_sourcefile,true
			else
				n_errfile=n_errfile+1
			end if
		next
	end if
	session("act")=""
	session("basepath")=""
	session("folders")=""
	session("files")=""
end if
%>
<html>
<head>
<title><%=sysname%>--文件管理</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<meta name="author" content="netasp;EMAIL:netasp@sohu.com">
<style type="text/css">
<!--
body,table,td{font-size:12px;color:#000090;}
body{margin:0 0 1px;padding:0;background:#ffffff url(fsoimg/bgbrick.gif);}
table{width:760px}
table table{width:100%;background:#eeeeee}
td{vertical-align:top;}
table table td{padding-left:4px;vertical-align:middle;background:#ffffff}
img{vertical-align:bottom}
form{margin:0;padding:0}
a{color:#000080;text-decoration:none;}
a:hover{color:#ff3333;text-decoration:underline}
div{width:100%;background:#eeeeee}
.button{width:65px;height:20px;border:solid 1px;border-color:#ffffff #666666 #666666 #ffffff;margin:3px 0;}
.imgbutton{width:32px;height:32px;border:solid 1px #d6d3cc;cursor:hand;}
.imgbt{border:solid 1px;border-color:#ffffff #999999 #999999 #ffffff;cursor:hand;}
//-->
</style>
<script language="javascript">
<!--
function viewfile(path)
{
window.open(path,'','');
}
function editfile(fname)
{
	fname=urlencoding(fname);
	window.open("fsoedit.asp?path=<%=pathurl%>"+fname,'','');
}
function is_edit(fname)
{
	if(window.confirm('你确定该文件为ASCII类型文件，并编辑它吗？'))
		editfile(fname);
}
function dis_edit()
{
	alert('该类型文件为非ASCII文件，无法编辑！');
}
function renameit(fname,act)
{
	var newname=window.prompt("请输入文件(夹) ["+fname+"] 的新名称：","");
	if(newname!=null)
	{
		fname=urlencoding(fname);
		newname=urlencoding(newname);
		window.location.href="fsorename.asp?act="+act+"&path=<%=pathurl%>&fname="+fname+"&newname="+newname+"&epath=<%=pathurl%>&epage=<%=page%>&ntime=<%=ntime%>";
	}
}
function downfile(fname)
{
	fname=urlencoding(fname);
	window.open("downfile.asp?path=<%=pathurl%>"+fname,'','');
}
function delbatch()
{
	if (window.confirm("你真的要删除该文件或目录吗？"))
	{
		document.delthis.submit();
	}
}
function delfile(act,fname)
{
	fname=urlencoding(fname);
	if (window.confirm("你真的要删除该文件或目录吗？")==true)
	{
	window.location.href="fsodel.asp?act="+act+"&path=<%=pathurl%>"+fname+"&epath=<%=pathurl%>&epage=<%=page%>&ntime=<%=ntime%>";
	}
}
function selectall(objname,act)
{
	if(objname==null)
		alert("对不起，当前目录下没有文件（夹）可选择/清除");
	else if(objname.length==null)
		objname.checked=act;
	else
	{
		var n=objname.length;
		for (i=0;i<n;i++)
		{
			objname[i].checked=act;
		}
	}
}
//-->
</script>
<script language="vbscript">
<!--
function urlencoding(vstrin)
    dim i,strreturn,strSpecial
    strSpecial = "!""#$%&'()*+,/:;<=>?@[\]^`{|}~%"
    strreturn = ""
    for i = 1 to len(vstrin)
        thischr = mid(vstrin,i,1)
        if abs(asc(thischr)) < &hff then
        	if thischr=" " then
        		strreturn = strreturn & "+"
            elseif instr(strSpecial,thischr)>0 then
                strreturn = strreturn & "%" & hex(asc(thischr))
            else
                strreturn = strreturn & thischr
            end if
        else
            innercode = asc(thischr)
            if innercode < 0 then
                innercode = innercode + &h10000
            end if
            hight8 = (innercode  and &hff00)\ &hff
            low8 = innercode and &hff
            strreturn = strreturn & "%" & hex(hight8) &  "%" & hex(low8)
        end if
    next
    urlencoding = strreturn
end function
function create_it(act)
	fname=trim(inputbox("请输入要创建的文件(夹)的名称：","输入待创建的文件(夹)名"))
	if fname<>"" then
		fname=urlencoding(fname)
		window.location.href="fsodel.asp?act="&act&"&path=<%=pathurl%>"&fname&"&epath=<%=pathurl%>&page=<%=page%>&ntime=<%=ntime%>"
	end if
end function
//-->
</script>
<head>
<body>
<table align="center" cellspacing=0 style="border:solid 1px;border-color:#f6f6f6 #999999 #999999 #f6f6f6;background:#d6d3cc">
<tr>
<td width="40%" style="border-right:none;padding-left:12px;vertical-align:middle"><%=sysname%></td>
<td align="center" width="40%" style="border-right:none;border-left:none;">
<img src="fsoimg/del.gif" class="imgbutton" onmouseover="this.className='imgbt'" onmouseout="this.className='imgbutton'" onclick="delbatch()" alt="删除选中文件">&nbsp;&nbsp;
<img src="fsoimg/copy.gif" class="imgbutton" onmouseover="this.className='imgbt'" onmouseout="this.className='imgbutton'" onclick="document.delthis.action='fsocopy.asp?path=<%=pathurl%>&page=<%=page%>';document.delthis.act.value='copy';document.delthis.submit();" alt="复制选中文件">&nbsp;&nbsp;
<img src="fsoimg/cut.gif" class="imgbutton" onmouseover="this.className='imgbt'" onmouseout="this.className='imgbutton'" onclick="document.delthis.action='fsocopy.asp?path=<%=pathurl%>&page=<%=page%>';document.delthis.act.value='cut';document.delthis.submit();" alt="剪切选中文件">&nbsp;&nbsp;
<%if session("act")="copy" or session("act")="cut" then%>
<img src="fsoimg/paste.gif" class="imgbutton" onmouseover="this.className='imgbt'" onmouseout="this.className='imgbutton'" onclick="window.location.href='<%=selfname%>?act=paste&path=<%=pathurl%>&page=<%=page%>&ntime=<%=ntime%>';" alt="粘贴文件到当前目录">&nbsp;&nbsp;
<%end if%>
<img src="fsoimg/refresh.gif" class="imgbutton" onmouseover="this.className='imgbt'" onmouseout="this.className='imgbutton'" onclick="window.location.reload()" alt="刷新">&nbsp;&nbsp;
</td>
<td style="text-align:right;vertical-align:middle;padding-right:12px;border-left:none;"><%if session("loginstatus")="islogined" and session("grade")=3 then%><a href="###" onclick="window.open('admin.asp','','menubar=no,scrollbars=no,location=no,status=no,width=310,height=210')">用户管理</a>　<%end if%><a href="loginout.asp?ntime=<%=ntime%>">注销登陆</a></td>
</tr>
</table>
<table align="center" cellspacing=0 style="border:solid 1px;border-color:#f6f6f6 #999999 #999999 #f6f6f6;background:#d6d3cc">
<tr>
<td colspan=3 vertical-align="middle">
<form method="get" action="<%=selfname%>" style="padding:0;margin:0">
　<span style="position:relative;top:-3px;">位置：</span><input type="text" name="path" style="margin:6px 6px 3px;width:614px;border:solid 1px #000099;" value="<%=path%>">
<input type="submit" class="button" value="跳转">
</form>
</td>
</tr>
</table>
<table align="center" border=1 cellspacing=1>
<tr>
<td width="30%">
<%if obj_fso.folderexists(s_folderpath) then%>
<div>&nbsp;<input type="button" value="全选目录" class="button" onclick="selectall(document.delthis.folders,true)"> 
<input type="button" value="清除选择" class="button" onclick="selectall(document.delthis.folders,false)"> 
<input type="button" value="新建目录" class="button" onclick="create_it('createfolder')"><br>
</div>
<%
	set obj_folder=obj_fso.getfolder(s_folderpath)
	if obj_folder.files.count mod pagesize=0 then
		totalpage=obj_folder.files.count\pagesize
	else
		totalpage=obj_folder.files.count\pagesize+1
	end if
	if page<1 then
		page=1
	end if
	if page>totalpage then
		page=totalpage
	end if
	response.write "<table cellspacing=1 border=0>"&vbcrlf&"<form name='delthis' method='post' action='fsodelbatch.asp?page="&page&"&path="&pathurl&"'><input type='hidden' name='act' value='delbatch'><input type='hidden' name='basepath' value='"&path&"'>"&vbcrlf&"<tr>"&vbcrlf&"<td colspan=2>"&vbcrlf
	response.write goparent&"<br><br>"&vbcrlf
	for each s_folder in obj_folder.subfolders
		response.write "<tr>"&vbcrlf&"<td width='70%'>"&vbcrlf
		response.write "<input type='checkbox' name='folders' value='"&s_folder.name&"'><img src='fsoimg/folder.gif'> <a href='"&selfname&"?path="&pathurl&server.urlencode(s_folder.name)&"&ntime="&ntime&"'>"&s_folder.name&"</a>"&vbcrlf
		response.write "<td><a href=""javascript:delfile('delfolder','"&s_folder.name&"')"">删除</a> <a href=""javascript:renameit('"&s_folder.name&"','renfolder')"">更名</a></td>"&vbcrlf&"</tr>"&vbcrlf
	next
%>
		</table>
	</td>
	<td align="right"><div><input type="button" value="全选文件" class="button" onclick="selectall(document.delthis.files,true)">　
<input type="button" value="清除选择" class="button" onclick="selectall(document.delthis.files,false)">　
<input type="button" value="新建文件" class="button" onclick="create_it('createfile')">　
<input type="button" value="上传文件" class="button" onclick="window.open('fsoupload.asp?path=<%=pathurl%>','','')">&nbsp;<br>
		</div><table cellspacing=1 border=0>
<%
	i=1
	startnum=(page-1)*pagesize
	for each s_file in obj_folder.files
		if i>startnum then
			response.write "<tr>"&vbcrlf&"<td width='41%'><input type='checkbox' name='files' value='"&s_file.name&"'>"&vbcrlf
			file_type=getname(s_file,".")
			select case file_type
				case "htm","html"
					response.write "<img src='fsoimg/html.gif'> "
				case "css"
					response.write "<img src='fsoimg/css.gif'> "
				case "asp"
					response.write "<img src='fsoimg/asp.gif'> "
				case "txt"
					response.write "<img src='fsoimg/text.gif'> "
				case "jpg","gif","png"
					response.write "<img src='fsoimg/img.gif'> "
				case "mdb"
					response.write "<img src='fsoimg/access.gif'> "
				case "doc"
					response.write "<img src='fsoimg/word.gif'> "
				case "mid","mp3"
					response.write "<img src='fsoimg/midi.gif'> "
				case "zip","rar"
					response.write "<img src='fsoimg/zip.gif'> "
				case "chm"
					response.write "<img src='fsoimg/chm.gif'> "
				case else
					response.write "<img src='fsoimg/unknown.gif'> "
			end select
			response.write "<a href=""javascript:viewfile('"&pathurl&"'+urlencoding('"&s_file.name&"'),'','');"">"&s_file.name&"</a></td>"&vbcrlf
			select case file_type  '#######################文件类型设置
				case "zip","rar","tar","exe","gif","jpg","jpe","jpeg","png","bmp","psd","mdb","doc","ppt","xls","mid","mp3","avi","chm"
					response.write "<td width='24%'><a href=""javascript:dis_edit();"">"
				case "txt","bat","c","htm","html","css","js","vbs","inc","stm","shtm","shtml","asp","asa","aspx","asax","ascx","asmx","aspa","php","php3","php4","jsp","cgi","xsl","wml","wmls","xml","xhtml"
					response.write "<td width='24%'><a href=""javascript:editfile('"&s_file.name&"')"">"
				case else
					response.write "<td width='24%'><a href=""is_edit('"&s_file.name&"')"">"
			end select
			response.write "编辑</a> <a href=""javascript:delfile('delfile','"&s_file.name&"')"">删除</a> <a href=""javascript:renameit('"&s_file.name&"','renfile')"">更名</a> <a href=""javascript:downfile('"&s_file.name&"')"">下载</a></td>"&vbcrlf
			response.write "<td width='11%'>"&s_file.size&"</td>"&vbcrlf
			response.write "<td>"&s_file.datelastmodified&"</td>"&vbcrlf&"</tr>"&vbcrlf
		end if
		if i>startnum+pagesize then
			exit for
		end if
		i=i+1
	next
	%>
		</td>
	</tr>
	<tr>
		<td colspan=4 align=center><%
	if page>1 then
		response.write "<a href='"&selfname&"?path="&pathurl&"&page="&(page-1)&"&ntime="&ntime&"'>上一页</a>　"
	end if
	response.write "共"&obj_folder.files.count&"个文件　当前第 "
	response.write "<select name='jtp' style='line-height:12px;border:none;height:12px;padding:0' onchange="&chr(34)&"window.location.href='"&selfname&"?page='+(this.options.selectedIndex+1)+'&path="&pathurl&"&ntime="&ntime&"'"&chr(34)&">"&vbcrlf
	for i=1 to totalpage
		if i=page then
			response.write "<option selected>"&i&vbcrlf
		else
			response.write "<option>"&i&vbcrlf
		end if
	next
	response.write "</select>"&vbcrlf
	response.write " 页"&vbcrlf
	response.write "　共 "&totalpage&" 页"
	if page<totalpage then
		response.write "　<a href='"&selfname&"?path="&pathurl&"&page="&(page+1)&"&ntime="&ntime&"'>下一页</a> "
	end if
	response.write "</td>"&vbcrlf&"</tr>"&vbcrlf
	response.write "</form>"&vbcrlf&"</table>"&vbcrlf
	set obj_folder=nothing
else
	response.write "<div style='width:100%;padding:25px 0 15px;text-align:center;background:transparent;color:#ff3333;font-weight:600'>文件夹不存在或者你没有访问权限</div>"
end if
set obj_fso=nothing
%>
</td>
</tr>
</table>
</body>
</html>
<!--#include file="fsofoot.asp"-->
 

