Files
KIN/ess/Donfile_folder.asp
2025-09-29 17:55:08 +09:00

241 lines
7.3 KiB
Plaintext

<!-- #include virtual = "lib/config.asp" -->
<script>
window.resizeTo(400, 450);
</script>
<%
set rsp = server.CreateObject("ADODB.RECORDSET")
set rsf = server.CreateObject("ADODB.RECORDSET")
d_no = request("d_no")
dcode = request("dcode")
'Response.Write d_no & "<BR>"
if dcode = "0" then
tmp_type = "consultation"
end if
Dim RootDir
Dim tmp_folder(50, 50)
tmp_y = right(year(date), 2)
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'파일 다운로드 가능여부를 체크
'tmp_downok가 1이면 다운가능 0이면 불가능
tmp_downok = 1
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'RootDir = "D:\project_db\data\" & tmp_y & "\consultation\" & d_no & "\"
RootDir = "D:\project_db\data\" & tmp_y & "\Document\" & tmp_type & "\"' & d_no & "\"
tmp_folder_cnt = 1
call getFolder(RootDir, 0, true, true)
'===================================================================
' func : getFolder(경로, 뎁스, 서브폴더, 파일)
' param :
' memo :
'===================================================================
function getFolder(sPath, iDepth, bSonFdr, bShowFile)
Dim fso, objFolder
Dim folders, folder
Dim files, file
Dim sSpace
sSpace = ""
for i=0 to iDepth
sSpace = sSpace & ":tab:"
next
'Response.Write sPath & " 1<BR>"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(sPath)
set fso = nothing
set folders = objFolder.SubFolders
Set files = objFolder.Files
set objFolder = nothing
For Each folder in folders
if instr(1, folder, d_no) then
'Response.Write folder & "<BR>"
'해당 폴더의 파일
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(sPath & "\" & folder.name)
set fso = nothing
Set hfiles = objFolder.Files
'Response.Write sPath & folder.name & "<BR>"
tmp_folder(tmp_folder_cnt,0) = sPath & folder.name
i = 1
For Each file in hfiles
tmp_folder(tmp_folder_cnt,i) = file.name
i = i + 1
Next
tmp_folder_cnt = tmp_folder_cnt + 1
'++ 하위폴더
if bSonFdr then
call getFolder(sPath & folder.name & "\", iDepth+1, bSonFdr, bShowFile)
end if
end if
Next
'++ 파일도 보여준다면
if bShowFile then
For Each file in files
'response.write sSpace& "<font color='#5D5D5D'>[파]</font>" &file.name & "<br>"& vbCRLF
Next
end if
end function
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ks_c_5601-1987">
<!--meta http-equiv="content-type" content="text/html; charset=euc-kr"-->
<LINK rel="stylesheet" type="text/css" href="/lib/text.css">
<title>
KRI INTRANET
</title>
<script language=javascript>
function clsit() {
self.close();
}
function downit(z,x) {
document.pms.action = 'Dfiledown_folder.asp?DnFilePath=' + z + '&d_no=' + document.pms.d_no.value;
document.pms.submit();
}
function chkit() {
document.pms.action = 'onfile_req.asp';
document.pms.submit();
}
function upit() {
if (document.pms.down_tip.value == '') {
alert('멀 입력하라는 거에효~ -0-;;');
document.pms.down_tip.focus();
return false;
}
document.pms.action = 'upcoment_ok.asp';
document.pms.submit();
}
</script>
</head>
<meta http-equiv="refresh" content="300;url=onfile.asp">
<body>
<form name="pms" method="post">
<input type="hidden" value="<%=d_no%>" name="d_no">
<table border="0" cellspacing="0" cellpadding="0" width="350">
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="center"><font color="blue" size="3"><b><%=tmp_name%></b></font>
</td>
</tr>
</table>
<%
tmp_folder_link = ""
'Response.Write tmp_folder(2,0)
for j = 1 to ubound(tmp_folder)
%>
<% if tmp_folder(j,0) <> "" then %>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<%
tmp_subject_folder = ""
tmp_aa = split(tmp_folder(j,0), "\")
tmp_subject_cnt = left(tmp_aa(ubound(tmp_aa)), 1)
tmp_subject_name = "<BR>" & tmp_aa(ubound(tmp_aa))
tmp_link = tmp_folder(j,0)
%>
<b><%=tmp_subject_name%></b>
<table border="1" cellspacing="0" cellpadding="5" width="100%">
<tr>
<td>
<%
tmp = 0
tmp_folder(j,0) = replace(tmp_folder(j,0),"\","/")
'Response.Write RootDir & "<BR>"
'Response.Write tmp_folder(j,0) & "<BR>"
'Response.Write mid(tmp_folder(j,0), len(RootDir) + 1, len(tmp_folder(j,0)) - len(RootDir)) & "<BR>"
tmp_tmp_folder = mid(tmp_folder(j,0), len(RootDir) + 1, len(tmp_folder(j,0)) - len(RootDir))
'Response.Write tmp_tmp_folder & " " & instr(1, tmp_tmp_folder, "/") & "<BR>"
'------------------------------------------------------
'6개 폴더중에 한폴더의 모든걸 다운로드 하고플 때 (대신 해당 폴더의 root에 파일이 존재해야 에러가 없음, 폴더만 있으면 에러)
'예) 6Man 폴더 밑에 폴더 뿐만 아니라 파일이 존재해야 함
'if instr(1, tmp_tmp_folder, "/") then
'
'else
' tmp_folder_link = tmp_folder(j,0)
'end if
'수정본
if left(tmp_tmp_folder, 4) = tmp_tmp_folder_base then
else
tmp_folder_link = tmp_folder(j,0)
tmp_tmp_folder_base = left(tmp_tmp_folder, 4)
end if
'------------------------------------------------------
'------------------------------------------------------
'선택한 현 폴더와 그 하위 폴더만 다운로드 하고플 때
'한글 폴더 전달이 안되넹.. ㅠ.ㅠ
'if isnumeric(left(tmp_tmp_folder, 1)) then
' tmp_folder_link = tmp_folder(j,0)
'else
'
'end if
'------------------------------------------------------
'Response.Write j & " " & tmp_folder_link & "<BR>"
for i = 1 to ubound(tmp_folder,2)
if tmp_folder(j,i) <> "" then
if tmp_downok = 1 then
Response.Write "<a href=javascript:downit('" & Server.UrlEncode(tmp_folder_link) & "')>" & tmp_subject_folder & tmp_folder(j,i) & "</a><BR>"
else
Response.Write tmp_subject_folder & tmp_folder(j,i) & "<BR>"
end if
tmp = 1
end if
next
'if tmp = 0 then
'Response.Write "<center><font color='red'><b>파일이 없습니다</b></font></center>"
'end if
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<% end if %>
<%
next
%>
<br>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="center">
<input type="button" value="닫 기" onclick="clsit()">
</td>
</tr>
</table>
</td>
</tr>
</table>