20260907 :: 김현정 > 260824 PMS 개선 요청_경영문화본부 4차 반영

This commit is contained in:
2026-09-15 17:54:28 +09:00
parent 2d73de12d1
commit b1bdb33a23
5 changed files with 191 additions and 9 deletions

93
ess/doc_attach_add.asp Normal file
View File

@@ -0,0 +1,93 @@
<!-- #include virtual = "lib/config.asp" -->
<%
Response.CharSet = "euc-kr"
Response.AddHeader "Pragma","no-cache"
Response.Expires = -1
Dim attachClientIp
attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
If attachClientIp <> "10.10.13.47" And _
attachClientIp <> "10.10.13.105" And _
attachClientIp <> "10.10.13.48" And _
attachClientIp <> "10.10.13.6" And _
attachClientIp <> "10.10.13.29" Then
Response.Write "{""result"":""denied""}"
Response.End
End If
Dim uploadform, fso, krc_no, folderPath, i, foundSlot, targetPath, fileName, ext
Dim allowedExt, folderObj, oneFile, us, dt, idxPart
Dim usedSlot(20)
' PDFs are rasterized into jpg on the client (pdf.js) before upload, same as the
' registration page, so the server only ever needs to save the file as-is.
allowedExt = "|jpg|jpeg|png|gif|zip|pdf|hwp|doc|docx|xls|xlsx|ppt|pptx|"
Set uploadform = Server.CreateObject("DEXT.FileUpload")
uploadform.Codepage = 949
krc_no = uploadform("krc_no")
If krc_no = "" Or InStr(krc_no, "..") > 0 Or InStr(krc_no, "/") > 0 Or InStr(krc_no, "\") > 0 Then
Response.Write "{""result"":""fail""}"
Response.End
End If
fileName = uploadform("attach_file")(1).FileName
If fileName = "" Then
Response.Write "{""result"":""fail""}"
Response.End
End If
ext = LCase(Mid(fileName, InStrRev(fileName, ".") + 1))
If InStr(allowedExt, "|" & ext & "|") = 0 Then
Response.Write "{""result"":""badtype""}"
Response.End
End If
Set fso = Server.CreateObject("Scripting.FileSystemObject")
folderPath = Server.Mappath("/") & "/Upload/DOC_ATTACH/" & krc_no
If fso.FolderExists(folderPath) = False Then
fso.CreateFolder folderPath
End If
' find used index slots regardless of extension
Set folderObj = fso.GetFolder(folderPath)
For Each oneFile In folderObj.Files
us = InStrRev(oneFile.Name, "_")
dt = InStrRev(oneFile.Name, ".")
If us > 0 And dt > us Then
idxPart = Mid(oneFile.Name, us + 1, dt - us - 1)
If IsNumeric(idxPart) Then
If CInt(idxPart) >= 1 And CInt(idxPart) <= 20 Then
usedSlot(CInt(idxPart)) = 1
End If
End If
End If
Next
foundSlot = 0
For i = 1 To 20
If usedSlot(i) <> 1 Then
foundSlot = i
Exit For
End If
Next
If foundSlot = 0 Then
Response.Write "{""result"":""full""}"
Response.End
End If
targetPath = folderPath & "/" & krc_no & "_" & CStr(foundSlot) & "." & ext
uploadform("attach_file")(1).saveAs(targetPath)
Response.Write "{""result"":""ok""}"
Set fso = Nothing
Set uploadform = Nothing
%>

83
ess/doc_attach_del.asp Normal file
View File

@@ -0,0 +1,83 @@
<!-- #include virtual = "lib/config.asp" -->
<%
Response.CharSet = "euc-kr"
Response.AddHeader "Pragma","no-cache"
Response.Expires = -1
Dim attachClientIp
attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
If attachClientIp <> "10.10.13.47" And _
attachClientIp <> "10.10.13.105" And _
attachClientIp <> "10.10.13.48" And _
attachClientIp <> "10.10.13.6" And _
attachClientIp <> "10.10.13.29" Then
Response.Write "{""result"":""denied""}"
Response.End
End If
Dim fso, krc_no, delIdx, folderPath, i, writePos
Dim folderObj, oneFile, us, dt, idxPart, srcName, extPart
Dim fileMap(20)
krc_no = Request.Form("krc_no")
If krc_no = "" Or InStr(krc_no, "..") > 0 Or InStr(krc_no, "/") > 0 Or InStr(krc_no, "\") > 0 Then
Response.Write "{""result"":""fail""}"
Response.End
End If
If Not IsNumeric(Request.Form("idx")) Then
Response.Write "{""result"":""fail""}"
Response.End
End If
delIdx = CInt(Request.Form("idx"))
If delIdx < 1 Or delIdx > 20 Then
Response.Write "{""result"":""fail""}"
Response.End
End If
Set fso = Server.CreateObject("Scripting.FileSystemObject")
folderPath = Server.Mappath("/") & "/Upload/DOC_ATTACH/" & krc_no
If fso.FolderExists(folderPath) = False Then
Response.Write "{""result"":""ok""}"
Response.End
End If
Set folderObj = fso.GetFolder(folderPath)
For Each oneFile In folderObj.Files
us = InStrRev(oneFile.Name, "_")
dt = InStrRev(oneFile.Name, ".")
If us > 0 And dt > us Then
idxPart = Mid(oneFile.Name, us + 1, dt - us - 1)
If IsNumeric(idxPart) Then
If CInt(idxPart) >= 1 And CInt(idxPart) <= 20 Then
fileMap(CInt(idxPart)) = oneFile.Name
End If
End If
End If
Next
If fileMap(delIdx) <> "" Then
fso.DeleteFile folderPath & "/" & fileMap(delIdx)
fileMap(delIdx) = ""
End If
' close the numbering gap, preserving each remaining file's own extension
writePos = delIdx
For i = delIdx + 1 To 20
If fileMap(i) <> "" Then
srcName = fileMap(i)
extPart = Mid(srcName, InStrRev(srcName, "."))
fso.MoveFile folderPath & "/" & srcName, folderPath & "/" & krc_no & "_" & CStr(writePos) & extPart
writePos = writePos + 1
End If
Next
Response.Write "{""result"":""ok""}"
Set fso = Nothing
%>

View File

@@ -30,6 +30,9 @@
'--------------- <20>߰<EFBFBD>(20170306)<29><> ------------------------
dim xadmin : xadmin = request("xadmin") '-- <20><><EFBFBD><EFBFBD>(edit)
dim attachClientIp, attachEditAllowed
attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
attachEditAllowed = (attachClientIp = "10.10.13.47" Or attachClientIp = "10.10.13.105" Or attachClientIp = "10.10.13.48" Or attachClientIp = "10.10.13.6" Or attachClientIp = "10.10.13.29")
'response.write "[" & xadmin & "]"
dim pay_type(4)
@@ -915,7 +918,7 @@ if rsc.RecordCount > 0 then
%>
<div class="attach_preview">
<img src="<%="/Upload/DOC_ATTACH/" & krc_no & "/" & attachFileMap(i)%>" />
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<span class="attach_del_btn" data-idx="<%=i%>">&times;</span>
<% End If %>
</div>
@@ -927,7 +930,7 @@ if rsc.RecordCount > 0 then
<span class="attach_file_ext"><%=Ucase(Mid(attachFileMap(i), InStrRev(attachFileMap(i),".")+1))%></span>
<span class="attach_file_name"><%=attachFileMap(i)%></span>
</a>
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<span class="attach_del_btn" data-idx="<%=i%>">&times;</span>
<% End If %>
</div>
@@ -936,7 +939,7 @@ if rsc.RecordCount > 0 then
End If
Next
%>
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<div class="attach_add_btn" id="attachAddBtn">+ <20>߰<EFBFBD></div>
<input type="file" id="attachFileInput" accept="image/*,.zip,.pdf,.hwp,.doc,.docx,.xls,.xlsx,.ppt,.pptx" multiple style="display:none;" />
<% End If %>

View File

@@ -28,6 +28,9 @@ Response.CharSet="euc-kr"
'--------------- <20>߰<EFBFBD>(20170306)<29><> ------------------------
dim xadmin : xadmin=request("xadmin") '-- <20><><EFBFBD><EFBFBD>(edit)
dim attachClientIp, attachEditAllowed
attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
attachEditAllowed = (attachClientIp = "10.10.13.47" Or attachClientIp = "10.10.13.105" Or attachClientIp = "10.10.13.48" Or attachClientIp = "10.10.13.6" Or attachClientIp = "10.10.13.29")
dim pay_type(4)
pay_type(1) = "ī<><C4AB>/<2F><><EFBFBD><EFBFBD>"
pay_type(2) = "<22><><EFBFBD>ݰ<EFBFBD><DDB0>꼭"
@@ -947,7 +950,7 @@ if rsc.RecordCount > 0 then
%>
<div class="attach_preview">
<img src="<%="/Upload/DOC_ATTACH/" & krc_no & "/" & attachFileMap(i)%>" />
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<span class="attach_del_btn" data-idx="<%=i%>">&times;</span>
<% End If %>
</div>
@@ -959,7 +962,7 @@ if rsc.RecordCount > 0 then
<span class="attach_file_ext"><%=Ucase(Mid(attachFileMap(i), InStrRev(attachFileMap(i),".")+1))%></span>
<span class="attach_file_name"><%=attachFileMap(i)%></span>
</a>
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<span class="attach_del_btn" data-idx="<%=i%>">&times;</span>
<% End If %>
</div>
@@ -968,7 +971,7 @@ if rsc.RecordCount > 0 then
End If
Next
%>
<% If xadmin = "edit" And Session("N_depart") = "M" And Session("N_team") = "101" Then %>
<% If xadmin = "edit" And attachEditAllowed Then %>
<div class="attach_add_btn" id="attachAddBtn">+ <20>߰<EFBFBD></div>
<input type="file" id="attachFileInput" accept="image/*,.zip,.pdf,.hwp,.doc,.docx,.xls,.xlsx,.ppt,.pptx" multiple style="display:none;" />
<% End If %>