<!--#include file="../../inc/config.asp" -->
<!--#include file="../../inc/conn.asp" -->
<!-- #include file="Session.asp" -->
<!-- #include file="checkrole.asp" -->
<!--#include file="function.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p01")
'''''''''''''''''''''''''''''''''''''''''''''''
Dim CurrPath,FsoObj,FolderObj,SubFolderObj,FileObj,i,FsoItem
Dim ParentPath,FileExtName,AllowShowExtNameStr
AllowShowExtNameStr = "htm,html,shtml"
CurrPath = Request("CurrPath")
if CurrPath = "" then
	CurrPath = "/"
end if
Set FsoObj = Server.CreateObject("Scripting.FileSystemObject")
Set FolderObj = FsoObj.GetFolder(Server.MapPath(CurrPath))
Set SubFolderObj = FolderObj.SubFolders
Set FileObj = FolderObj.Files
Function CheckFileShowTF(AllowShowExtNameStr,ExtName)
	if ExtName="" then
		CheckFileShowTF = False
	else
		if InStr(1,AllowShowExtNameStr,ExtName) = 0 then
			CheckFileShowTF = False
		else
			CheckFileShowTF = True
		end if
	end if
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=CurrPath %>目录文件列表</title>
<link href="../style/sys.css" rel="stylesheet">
</head>

<body topmargin="0" leftmargin="0" scroll=yes>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="20" class="ButtonList"> <div align="center"><font color="#000000">名称</font></div></td>
    <td height="20" class="ButtonList"> <div align="center"><font color="#000000">类型</font></div></td>
    <td height="20" class="ButtonList"> <div align="center"><font color="#000000">修改日期</font></div></td>
  </tr>
<%
for Each FsoItem In SubFolderObj
%>
  <tr> 
    <td height="20"> 
        <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);" onClick="SelectFolder(this);"> 
              <%=FsoItem.name %>
              </span> </td>
          </tr>
        </table>
      </div></td>
    <td height="20"> 
      <div align="center">文件夹</div></td>
    <td height="20"> 
      <div align="center"><%=FsoItem.Size %></div></td>
  </tr>
    <%
Next
for each FsoItem In FileObj
	FileExtName = LCase(Mid(FsoItem.name,InstrRev(FsoItem.name,".")+1))
	if CheckFileShowTF(AllowShowExtNameStr,FileExtName) = True then
%>
  <tr title="单击选择文件"> 
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="3%"><img src="../images/file/file.gif" width="34" height="17" align="absmiddle"></td>
          <td width="97%"><span class="TempletItem" File="<%=FsoItem.name %>" onClick="SelectFile(this);">
            <%=FsoItem.name %>
            </span></td>
        </tr>
      </table>
    </td>
    <td height="20"> <div align="center"> 
        <%=FsoItem.Type %>
      </div></td>
    <td height="20"> <div align="center"> 
        <%=FsoItem.DateLastModified %>
      </div></td>
  </tr>
  <%
  	end if
next
%>
</table>
</body>
</html>
<%
Set FsoObj = Nothing
Set FolderObj = Nothing
Set FileObj = Nothing
%>
<script language="JavaScript">
var CurrPath='<%=CurrPath %>';
var FileName='';
function SelectFile(Obj)
{
	for (var i=0;i<document.all.length;i++)
	{
		if (document.all(i).className=='TempletSelectItem') document.all(i).className='TempletItem';
	}
	Obj.className='TempletSelectItem';
	FileName=Obj.File;
}
function SelectFolder(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 OpenFolder(Obj)
{
	var SubmitPath='';
	if (CurrPath=='/') SubmitPath=CurrPath+Obj.Path;
	else SubmitPath=CurrPath+'/'+Obj.Path;
	location.href='FolderList.asp?CurrPath='+SubmitPath;
	AddFolderList(parent.document.all.FolderSelectList,SubmitPath,SubmitPath);
}
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 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;
}
</script>
<%call connclose()%>