⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_managefiles.asp

📁 后台管理系统
💻 ASP
字号:
<!--#include file="Inc/Inc.asp" -->
<%
	Dim tempCurrentPath,CurrentPath,Cookie_tempCurrentPath,DirCmd,myPathRoot
    tempCurrentPath=ClsAdmin.FilterPath(Trim(Request("CurrentPath")))
    DirCmd=Request("DirCmd")
    Cookie_tempCurrentPath=Request.Cookies("UpLoadFiles_Path")
    myPathRoot=SysPath
    Select Case DirCmd
        Case "/"
            tempCurrentPath = ""
        Case "../"
            tempCurrentPath = ClsAdmin.GetParent(tempCurrentPath)
        Case Else :
            If tempCurrentPath="" And Cookie_tempCurrentPath<>"" Then
                tempCurrentPath = Cookie_tempCurrentPath
            End If
    End Select
    CurrentPath = FixPath(myPathRoot & tempCurrentPath)
	Response.Cookies("UpLoadFiles_Path")=tempCurrentPath
	Dim Fso
	Set Fso = Server.CreateObject("Scripting.FileSystemObject")
	Dim Fol,Fols 
	Dim Fle,Fles
	If Fso.FolderExists(Server.MapPath(CurrentPath)) Then
		Set Fol=Fso.GetFolder(Server.MapPath(CurrentPath))
	Else
		Response.Cookies("UpLoadFiles_Path")=""
		Response.Write "<b>"&CurrentPath&"</b>目录不存在。"
		Response.End
	End If

	Select Case Request("Work")
		Case "DelItem"
			DelItem()
			Response.Redirect("?CurrentPath=" & tempCurrentPath)
		Case "MoveItem"
			MoveItem()
			Response.Redirect("?CurrentPath=" & tempCurrentPath)
		Case "CreateFolder"
			CreateFolder()
			Response.Redirect("?CurrentPath=" & tempCurrentPath)
		Case Else
	End Select

	Dim ItemCount
	ItemCount=0
%>
<html>
<head>
<title>拓网虚拟文件系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/Admin_Css.css" rel="stylesheet" type="text/css">
</head>
<body><a name="Top"></a> 
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
        <tr> 
      <td height="22" class="title" align=center>系统文件管理器</td>	 
    </tr>
<tr align=center height=23>
<td class="td"Highlight width="90%"><table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
  <tr> 
    <td width="15%" class="td"> <img src="images/m_Home.gif" width="20" height="20" style="cursor:hand" onClick="window.location='?DirCmd=/#'" title="回到主目录"><img src="images/m_Front.gif" width="20" height="20" style="cursor:hand" onClick="history.back()" title="后退"><img src="images/m_Back.gif" width="20" height="20" style="cursor:hand" onClick="history.forward()" title="前进"><img src="images/m_STOP.gif" width="20" height="20" style="cursor:hand" onClick="window.stop" Title="停止"><img src="images/m_Ref.gif" width="20" height="20" style="cursor:hand" onClick="location.reload()" title="刷新"><img src="images/m_MakeFolder.gif" width="20" height="20" style="cursor:hand" onClick="CreateFolder()" title="创建目录"></td>
    <td class="td">
      <input name="Path" type="text" class="Input" id="Path" value="<%=Replace(CurrentPath,SysPath,"系统主目录")%>" size="80"  readonly="true" style="width:100%">
    </td>
  </tr>
</table>
<form name="form1" method="post" action="">
  <table border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC" style="table-layout:fixed; word-break :break-all;width:100%">
    <tr bgcolor="#336699"> 
      <td width="4%" align="center"> </td>
      <td width="60%"><font color="#FFFFFF">&nbsp;&nbsp;标题</font></td>
      <td width="14%" align="center"><font color="#FFFFFF">&nbsp;&nbsp;大小</font></td>
      <td width="13%" align="center" title="Created Time"><font color="#FFFFFF"> 
        创建时间</font></td>
      <td width="9%" align="center"><font color="#FFFFFF">操作</font></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td align="center"><img src="images/Folder_Root.gif" width="16" height="16" Title="文件夹"></td>
      <td><a <%If tempCurrentPath<>"" Then%>href="?DirCmd=/" <%Else%>href="#" disabled="true"<%End If%>>回到主目录</a></td>
      <td align="center"><font color="#999999">None</font></td>
      <td align="center"><font color="#999999">None</font></td>
      <td align="center"><font color="#999999">None</font></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td align="center"><img src="images/Folder_Parent.gif" width="16" height="16" Title="文件夹"></td>
      <td><a <%If tempCurrentPath<>"" Then%>href="?DirCmd=../&CurrentPath=<%=tempCurrentPath%>" <%Else%>href="#" disabled="true"<%End If%>>回到父目录</a></td>
      <td align="center"><font color="#999999">None</font></td>
      <td align="center"><font color="#999999">None</font></td>
      <td align="center"><font color="#999999">None</font></td>
    </tr>
    <%
    Call ShowFolderList()
    Sub ShowFolderList()
        Dim Item
        Set Fols=Fol.SubFolders
        For Each Item In Fols 
            ItemCount=ItemCount+1
%>
    <tr bgcolor="#FFFFFF"> 
      <td align="center"><img src="images/Folder.gif" width="16" height="16" Title="文件夹"></td>
      <td><a href="?CurrentPath=<%=tempCurrentPath&"/"&Item.Name%>"><%=Item.Name%></a></td>
      <td align="center"><%=FormatNumber(Item.Size/1024,2)&" KB"%></td>
      <td align="center"><span Title="<%=Item.DateCreated%>"><%=FormatDateTime(Item.DateCreated,2)%></span></td>
      <td align="center"> 
        <input name="Item" type="checkbox" id="Item" value="<%=Item.Name & "1"%>">
      </td>
    </tr>
    <%
        Next
    End Sub
%>
    <%
    Call ShowFileList()
    Sub ShowFileList()
    	Dim PageSize,Page,Item,FileCount,i
    	Dim FieldName(1),FieldValue(1)
    	PageSize=10
		Page=Request.QueryString("Page")
		If Page="" OR Not IsNumeric(Page) Then
			Page=1
		Else
			Page=Int(Page)
		End If
        Set Fles=Fol.Files
        FileCount=Fles.Count
        For Each Item In Fles 
            ItemCount=ItemCount+1
			i=i+1
            If i>(Page-1)*PageSize And i<=Page*Pagesize Then
%>
    <tr bgcolor="#FFFFFF"> 
      <td align="center"><img src="images/<%=ClsAdmin.FileIco(Item.Name)%>" width="16" height="16"></td>
      <td bgcolor="#FFFFFF"><a href="<%=SysPath&"UpLoadFiles"&tempCurrentPath&"/"&Item.Name%>" target="_balnk" Title="<%=Item.Type%>" Id="File<%=ItemCount%>"><%=Item.Name%></a> 
[<a href="#" onClick="prompt('[<%=Item.Name%>]文件的URL',File<%=ItemCount%>.href)"><font color="#0000FF">取得URL</font></a>]</td>
      <td align="center"><%=FormatNumber(Item.Size/1024,2)&" KB"%></td>
      <td align="center"><span Title="<%=Item.DateCreated%>"><%=FormatDateTime(Item.DateCreated,2)%></span></td>
      <td align="center"> 
        <input name="Item" type="checkbox" id="Item" value="<%=Item.Name & "0"%>">
      </td>
    </tr>
    <%	    ElseIf i>Page*PageSize Then
			Exit For
		End If
        Next
        FieldName(0)="Path"
		FieldValue(0)=Request.QueryString("CurrentPath")
%>
    <tr align="right" bgcolor="#f6f6f6"> 
      <td colspan="5"><%=ClsPub.PageList(Pagesize,FileCount,Page,FieldName,FieldValue)%>&nbsp;|&nbsp; <a href="#Top">Top</a></td>
    </tr>
  </table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
      <td align="right">
        <input type="submit" name="Submit" value="Submit" style="display:none">
        <input name="Work" type="hidden" id="Work">
        <input name="Parameter" type="hidden" id="Parameter">
        <input name="CurrentPath" type="hidden" id="CurrentPath" value="<%=tempCurrentPath%>">
        <img src="images/DelFile.gif" width="36" height="37" onClick="DelItem()" title="删除所选项目" style="cursor:hand"><img src="images/MoveFile.gif" width="36" height="37" onClick="MoveItem()" title="移动所选项目" style="cursor:hand"> 
      </td>
    </tr>
  </table>
</form>
<script language="JavaScript" type="text/JavaScript">
function UploadFile()
{
    var Result=showModalDialog("Admin_UpLoadFiles.asp?UpLoadField=UpFiles&Path=<%=tempCurrentPath%>","","dialogWidth:500px;dialogHeight:400px;center:yes;scroll:yes;");
    if(Result){
        window.location.reload();
    }
}
function DelItem()
{
    if(confirm("请确定要将所选中的文件/文件夹删除!\n(删除后将无法还原)"))
    {    
        form1.Work.value='DelItem';
        form1.Submit.click()
    }
}
function MoveItem()
{
    var Result=prompt("请输入目标目录位置(详见帮助):","")
    if(Result)
    {    
        form1.Work.value="MoveItem"
        form1.Parameter.value=Result
        form1.Submit.click()
    }
}
function CreateFolder()
{
    var str;
    str=prompt("<创建目录>\n请输入[目录名]:","Folder"+Math.floor(Math.random()*1000));
    if(str!=null)
    {
        if(str=="")
        {
            alert("<操作失败>\n未填写[目录名]");
            return false;
        }else{
            window.location='?CurrentPath=<%=tempCurrentPath%>&Work=CreateFolder&Title='+str;
        }
    }
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td colspan="2" bgcolor="#f6f6f6" style="cursor:hand" onClick="if(HelpTab.style.display=='none'){HelpTab.style.display='';window.scrollTo(window.pageXOffset,2000);}else{HelpTab.style.display='none'}">&nbsp;<img src="Images/why.gif" width="14" height="14"> 
      ::Help::</td>
  </tr>
  <tr Id="HelpTab" style="display:"> 
    <td width="2%" bgcolor="#FFFFFF"> </td>
    <td width="98%" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td>·删除</td>
        </tr>
        <tr> 
          <td>  被删除的文件/目录(含该目录下的所有子目录及文件)将不能还原</td>
        </tr>
        <tr> 
          <td>·移动</td>
        </tr>
        <tr> 
          <td>目标目录名的结尾不能包含"/";</td>
        </tr>
        <tr> 
          <td>  1.只输入"/"表示移动到主目录</td>
        </tr>
        <tr> 
          <td>  2."/aaa/bbb"表示移动到从主目录开始算起的aaa/bbb目录下面</td>
        </tr>
        <tr>
          <td>  3."aaa/bbb"表示移动到从当前所在目录开始算起的aaa/bbb目录下面</td>
        </tr>
      </table>
      <a name="Help"></a></td>
  </tr>
</table>
<%End Sub%>
<p> </p>
</body>
</html>
<%
	Set Fol=Nothing
	Set Fso=Nothing

	'#####删除对象
	Function DelItem()
		Dim ItemList
		DelItem=true
		If Trim(Request("Item"))="" Then
			DelItem=false
			Exit Function
		End If
		ItemList=Split(Trim(Request("Item")),",",-1,1)
		on error resume next
		err.clear
		Dim I,ItemPath
		For I=0 To Ubound(ItemList)
			ItemPath=Server.MapPath(FixPath(CurrentPath&"/"&Trim(Left(ItemList(I),Len(ItemList(I))-1))))
			'根据文件/文件夹进行删除
			If CBool(Right(ItemList(I),1)) Then
				Fso.DeleteFolder(ItemPath)
			Else
				Fso.DeleteFile(ItemPath)
			End If
			If err.Number<>0 then        
				DelItem=false
			End If
		Next
	End Function

	'#####移动对象
	Function MoveItem()
		Dim DirectionPath
			DirectionPath=""
		Dim Parameter
			Parameter=Request("Parameter")
		If Parameter="/" Then
			DirectionPath=Server.MapPath(FixPath(SysPath&"UpLoadFiles"))&"\"
		Else
			If Left(Parameter,1)="/" Then
				DirectionPath=Server.MapPath(FixPath(SysPath&"UpLoadFiles"&Parameter))&"\"
			Else
				DirectionPath=Server.MapPath(FixPath(CurrentPath&"/"&Parameter))&"\"
			End If
		End If
		If Not Fso.FolderExists(DirectionPath) Then
			Set Fso=Nothing
			Response.Write("<script>alert(""<操作失败>\n目录:"&Parameter&" 不存在\n详见帮助"");window.history.back();</script>")
			Response.End()
		End If
		MoveItem=true
		If Trim(Request("Item"))="" Then
			DelItem=false
			Exit Function
		End If
		Dim ItemList
			ItemList=Split(Trim(Request("Item")),",",-1,1)
		on error resume next
		err.clear    
		Dim I,ItemPath
		For I=0 To Ubound(ItemList)
			ItemPath=Server.MapPath(FixPath(CurrentPath&"/"&Trim(Left(ItemList(I),Len(ItemList(I))-1))))
			'根据文件/文件夹进行删除
			If CBool(Right(ItemList(I),1)) Then
				Fso.MoveFolder ItemPath,DirectionPath
			Else
				Fso.MoveFile ItemPath,DirectionPath
			End If
			If err.Number<>0 then        
				MoveItem=false
			End If
		Next
	End Function

	'#######创建目录
	Function CreateFolder()
		Dim Title
		Title=ClsAdmin.FilterPath(Trim(Request("Title")))
		If Title="" Then
			CreateFolder=false
			Exit Function
		End If
		Dim FolderPath
		on error resume next
		err.clear
		FolderPath=Server.MapPath(FixPath(CurrentPath&"/"&Title))
		If err.Number<>0 Then
			Response.Write("<script>alert(""<操作失败>\n目录名包含非法字符"");window.history.back();</script>")
			Response.End
		End If
		If Fso.FolderExists(FolderPath) Then
			Response.Write("<script>alert(""<操作失败>\n存在同名目录"");window.history.back();</script>")
			Response.End
		Else
			Fso.CreateFolder(FolderPath)
			CreateFolder=true
		End If
	End Function

	Function FixPath(Path)
		If Instr(Path,"//")>0 Then
			FixPath=Replace(Path,"//","/")
		ElseIf Instr(Path,"///")>0 Then
			FixPath=Replace(Path,"///")
		Else
			FixPath=Path
		End If
	End Function
%></td>
</tr>
</table>
<%CloseAll%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -