<!--#include file="../../inc/config.asp" -->
<!--#include file="../../inc/conn.asp" -->
<!--#include file="function.asp" -->
<!-- #include file="Session.asp" -->
<!-- #include file="checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p01")
'''''''''''''''''''''''''''''''''''''''''''''''
Dim CurrPath,FsoObj,SubFolderObj,FolderObj,i,FsoItem
Dim ParentPath
CurrPath = Request("CurrPath")
if CurrPath = "" then
	CurrPath = "/"
	ParentPath = ""
else
	ParentPath = Mid(CurrPath,1,InstrRev(CurrPath,"/")-1)
	if ParentPath = "" then
		ParentPath = "/"
	end if
end if
Set FsoObj = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set FolderObj = FsoObj.GetFolder(Server.MapPath(CurrPath))
Set SubFolderObj = FolderObj.SubFolders
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件和目录列表</title>
</head>
<link href="../style/sys.css" rel="stylesheet">
<script language="JavaScript" src="../../js/PublicJS.js"></script>
<body topmargin="0" leftmargin="0" onClick="SelectFolder();" oncontextmenu="SelectFolder();showMenu(MouseRightMenu);return false;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="30%" class="ButtonList"> <div align="center">名称</div></td>
    <td width="40%" class="ButtonList"> <div align="center">类型</div></td>
    <td class="ButtonList"> <div align="center">大小</div></td>
  </tr>
  <%
if Err.Number = 0 then
	for each FsoItem In SubFolderObj
%>
  <tr> 
    <td width="30%"><table border="0" cellspacing="0" cellpadding="0">
        <tr title="双击鼠标进入此目录"> 
          <td height="25"><img src="../Images/Folder.gif" width="18" height="18"></td>
          <td> <span class="TempletItem" Path="<% = FsoItem.name %>" onDblClick="OpenFolder(this);"> 
            <% = FsoItem.name %>
            </span> </td>
        </tr>
      </table></td>
    <td><div align="center">文件夹</div></td>
    <td><div align="center"> 
        <% = FsoItem.Size %>
      </div></td>
  </tr>
  <%
	next
else
%>
  <tr> 
    <td height="20" colspan="3">
      <div align="center"><% = "路径不存在" %></div></td>
  </tr>
  <%
end if
%>
</table>
</body>
</html>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onClick="ClickMenu(this);" onMouseOver="MouseOverRightMenu();" onMouseOut="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="AddLable" ExeFunction="AddFolderOperation();">新建</div>
  <div class="MouseRightItem" id="DelLable" ExeFunction="if (confirm('确定要删除吗？')==true) DelFolderFile();">删除</div>
  <div class="MouseRightItem" id="EditFolderName" ExeFunction="EditFolder();">重命名</div>
  <hr id="nouse2">
  <div class="MouseRightItem" id="reFresh" ExeFunction="window.location.href='SelectPath.asp?CurrPath='+CurrPath;">刷新</div> 
</div>
<%
Set FsoObj = Nothing
Set SubFolderObj = Nothing
%>
<script language="JavaScript">
var CurrPath='<% = CurrPath %>';
DelLable.className='MenuItemDisable';
EditFolderName.className='MenuItemDisable';
var SelectedFolder='';
function SelectFolder()
{
	Obj=event.srcElement;
	for (var i=0;i<document.all.length;i++)
	{
		if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
	}
	if (Obj.Path!=null)
	{
		Obj.className='TempletSelectItem';
		SelectedFolder=Obj.Path;
	}
	else
	{
		SelectedFolder='';
	}
	if (SelectedFolder!='')
	{
		DelLable.className='MouseRightItem';
		EditFolderName.className='MouseRightItem';
	}
	else
	{
		DelLable.className='MenuItemDisable';
		EditFolderName.className='MenuItemDisable';
	}
}
function OpenParentFolder(Obj)
{
	location.href='SelectPath.asp?CurrPath='+Obj.Path;
	SearchOptionExists(parent.document.all.FolderSelectList,Obj.Path);
}

function OpenFolder(Obj)
{
	var SubmitPath='';
	if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
	else SubmitPath=CurrPath+'/'+Obj.Path;
	location.href='SelectPath.asp?CurrPath='+SubmitPath;
	AddFolderList(parent.document.all.FolderSelectList,SubmitPath,SubmitPath);
}

function SelectUpFolder(Obj)
{
	for (var i=0;i<document.all.length;i++)
	{
		if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
	}
	Obj.className='TempletSelectItem';
}
function AddFolderList(SelectObj,Lable,LableContent)
{
	var i=0,AddOption;
	if (!SearchOptionExists(SelectObj,Lable))
	{
		AddOption = document.createElement("OPTION");
		AddOption.text=Lable;
		AddOption.value=LableContent;
		SelectObj.add(AddOption);
		SelectObj.options(SelectObj.length-1).selected=true;
	}
}
function DelFolderList(SelectObj,Lable,LableContent)
{
	var i,SelectIndex=-1;
	for(i=0;i<SelectObj.length;i++)
	{
		if (SelectObj.options(i).text==Lable) SelectIndex=i;
	}
	if (SelectIndex!=-1)
	{
		SelectObj.options.remove(SelectObj.selectedIndex);
	}
}
function SearchOptionExists(Obj,SearchText)
{
	var i;
	for(i=0;i<Obj.length;i++)
	{
		if (Obj.options(i).text==SearchText)
		{
			Obj.options(i).selected=true;
			return true;
		}
	}
	return false;
}
function AddFolderOperation()
{
	var ReturnValue=prompt('新建目录名：','');
	if ((ReturnValue!='') && (ReturnValue!=null))
	{
		ReturnValue=SendDataToServer('FolderFileOperate.asp?Type=AddFolder&Path='+CurrPath+'/'+ReturnValue);
		//alert(ReturnValue);
		//return;
		//window.parent.location.reload();
		//alert(ReturnValue);
		window.location.href='SelectPath.asp?CurrPath='+CurrPath;
		//window.location.href='FolderFileOperate.asp?Type=AddFolder&Path='+CurrPath+'/'+ReturnValue;
	}
}
function DelFolderFile()
{
	var ReturnValue='';
	if (SelectedFolder!='')
	{
		ReturnValue=SendDataToServer('FolderFileOperate.asp?Type=Del&Path='+CurrPath+'/'+SelectedFolder);
		//window.location.href='FolderFileOperate.asp?Type=Del&Path='+CurrPath+'/'+SelectedFolder;
		window.location.href='SelectPath.asp?CurrPath='+CurrPath;
		//var SubmitPath='';
		//if (CurrPath=='/') SubmitPath=CurrPath+SelectedFolder;
		//else SubmitPath=CurrPath+'/'+SelectedFolder;
		//DelFolderList(parent.document.all.FolderSelectList,SubmitPath,SubmitPath);
	}
}
function EditFolder()
{
	if (SelectedFolder!='')
	{
		//alert('Frame.asp?FileName=FolderReName.asp&OldFileName='+SelectedFolder+'&Path='+CurrPath+'&TitleName=文件夹重命名');
		//return;
		OpenWindow('Frame.asp?FileName=FolderReName.asp&OldPathName='+SelectedFolder+'&Path='+CurrPath+'&PageTitleName=文件夹重命名',200,100,window);	
		window.location.href='SelectPath.asp?CurrPath='+CurrPath;
	}
}
</script>
<%call connclose()%>