529 lines
20 KiB
Plaintext
529 lines
20 KiB
Plaintext
<!-- #include virtual = "lib/config.asp" -->
|
|
|
|
<OBJECT RUNAT=Server PROGID=ADODB.Recordset id=rsp></OBJECT>
|
|
<OBJECT RUNAT=Server PROGID=ADODB.Recordset id=rsa></OBJECT>
|
|
<!-- 결재요청용 팝업 체크 -->
|
|
|
|
<meta http-equiv="Content-Type" content="application/vnd.ms-excel;charset=euc-kr">
|
|
<script language="javascript" src="/js/common.js"></script>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title><%=GNB_TITLE%></title>
|
|
<link rel="stylesheet" type="text/css" href="../css/basic.css">
|
|
<script src="/js/jquery.min.js"></script>
|
|
<script src="/js/jquery-ajax-call.js"></script>
|
|
<script src="/js/jquery.form.min.js"></script>
|
|
<script>
|
|
var jPath = "http://<%= split(Request.ServerVariables("HTTP_HOST"), ":")(0) %>:8088/krc_module/";
|
|
|
|
function fileadd() {
|
|
var attach_count = 1;
|
|
|
|
$(".file_id").each(function (index) {
|
|
attach_count++;
|
|
});
|
|
var temp_html = '<tr>' +
|
|
'<td align="center" >' + attach_count + '</td>' +
|
|
'<td align="center" >' +
|
|
'<select name="f_kind[' + (attach_count - 1) + ']">' +
|
|
'<option value="">선택</option>' +
|
|
'<option value="001">RFP</option>' +
|
|
'<option value="002">제안서</option>' +
|
|
'<option value="003">견적서</option>' +
|
|
'<option value="004">보고서</option>' +
|
|
'<option value="005">설문지</option>' +
|
|
'<option value="006">가이드</option>' +
|
|
'<option value="007">기타자료</option>' +
|
|
'<option value="008">실사(Field)</option>' +
|
|
'<option value="009">전산(DP)</option>' +
|
|
'</select>' +
|
|
'</td>' +
|
|
'<td align="center" >' +
|
|
'<input type="hidden" name="f_id[' + (attach_count - 1) + ']" value="" class="file_id"/>' +
|
|
'<input type="file" class="uploadFile_btn appendFile" name="ATTACH_FILENAME[' + (attach_count - 1) + ']" maxlength="1" style="width:565;" />' +
|
|
'</td>' +
|
|
'<td align="center" ></td>' +
|
|
'<td align="center" ></td>' +
|
|
'</tr>';
|
|
|
|
$("#attach_table").append(temp_html);
|
|
}
|
|
function download(f_id) {
|
|
url = jPath + "download";
|
|
var p_sn = document.pms.p_sn.value;
|
|
var param = "?p_sn=" + p_sn + "&f_id=" + f_id;
|
|
//파일 다운로드 로그
|
|
ajaxCallJson("/include/download_log.asp", { "f_id" : f_id }, null, "POST");
|
|
$(location).attr("href", url + param);
|
|
}
|
|
function delete_file(f_id, login_user) {
|
|
if (f_id == null) {
|
|
alert("삭제할 파일이 없습니다");
|
|
return false;
|
|
}
|
|
|
|
if (login_user != document.pms.user_no.value) {
|
|
alert("첨부파일은 담당자만 지울 수 있습니다.");
|
|
return false;
|
|
}
|
|
|
|
if (confirm("정말 삭제하시겠습니까?") == true) { //확인
|
|
var url = jPath + "system/deleteFiles";
|
|
var p_sn = document.pms.p_sn.value;
|
|
|
|
//ajaxCall(url, {"p_sn": p_sn, "f_id":f_id}, null, "post", deleteComplete());
|
|
|
|
document.pms.enctype = "application/x-www-form-urlencoded";
|
|
document.pms.encoding = "application/x-www-form-urlencoded";
|
|
document.pms.action = url;
|
|
//document.pms.enctype = "multipart/form-data";
|
|
//document.pms.encoding = "multipart/form-data";
|
|
// document.charset = "UTF-8";
|
|
//document.pms.del_f_id.value = f_id;
|
|
|
|
//alert(url + "//" + p_sn + "//" + f_id);
|
|
|
|
$("#pms").ajaxForm({
|
|
data: { "del_f_id": f_id },
|
|
success: function (data) {
|
|
//deleteComplete(data)
|
|
alert("삭제가 완료되었습니다");
|
|
location.reload(true);
|
|
},
|
|
error: function (jqXHR, exception) {
|
|
if (jqXHR.status === 0) {
|
|
//alert('Not connect.\n Verify Network.');
|
|
} else if (jqXHR.status == 404) {
|
|
//alert('Requested page not found. [404]');
|
|
} else if (jqXHR.status == 500) {
|
|
//alert('Internal Server Error [500].');
|
|
} else if (exception === 'parsererror') {
|
|
//alert('Requested JSON parse failed.');
|
|
} else if (exception === 'timeout') {
|
|
//alert('Time out error.');
|
|
} else if (exception === 'abort') {
|
|
//alert('Ajax request aborted.');
|
|
} else {
|
|
//alert('Uncaught Error.\n' + jqXHR.responseText);
|
|
}
|
|
|
|
alert("삭제 중 오류 발생!\n 관리자에게 문의바랍니다. ");
|
|
},
|
|
complete: function () {
|
|
|
|
|
|
},
|
|
dataType: "text"
|
|
}).submit();
|
|
|
|
//var form = document.pms;
|
|
//param = $(form).serializeArray();
|
|
//ajaxCall(jPath + "system/deleteFiles2", param, null, "post", deleteComplete());
|
|
} else { //취소
|
|
return;
|
|
}
|
|
}
|
|
function save(p_sn) {
|
|
var fileCount = 0;
|
|
var fileAttachCcount = 0;
|
|
var upload_Flag = true;
|
|
var depart_no = document.pms.depart_no.value;
|
|
$("input:file").each(function (index) {
|
|
var uploadpath = $(this).val();
|
|
fileCount++;
|
|
//console.log(index+"//uploadpath.length : "+uploadpath.length);
|
|
if (uploadpath.length > 0) {
|
|
fileAttachCcount++;
|
|
//alert($(this).attr("name") + "//" + $(this).val());
|
|
var fileExtension = uploadpath.substring(uploadpath.lastIndexOf(".") + 1, uploadpath.length);
|
|
if (depart_no != "17") {
|
|
if (fileExtension.toLowerCase() == "zip" || fileExtension.toLowerCase() == "rar" || fileExtension.toLowerCase() == "arj" || fileExtension.toLowerCase() == "egg") {
|
|
//write code for success
|
|
alert("압축 파일은 업로드 할 수 없습니다.");
|
|
upload_Flag = false;
|
|
return false;
|
|
}
|
|
}
|
|
if ($("select[name*='f_kind[" + index + "]']").val() == "") {
|
|
alert((index + 1) + "번 첨부 파일의 카테고리를 선택하십시오.");
|
|
upload_Flag = false;
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
//console.log("fileAttachCcount : "+fileAttachCcount);
|
|
document.pms.fileCount.value = fileCount;
|
|
//alert(upload_Flag);
|
|
if (upload_Flag) {
|
|
//if (confirm("프로젝트를 저장 하시겠습니까?")) {
|
|
//alert("p_sn : " + p_sn + "fileAttachCcount : " + fileAttachCcount);
|
|
fileInfo_save(p_sn, fileAttachCcount);
|
|
//} else {
|
|
// return;
|
|
//}
|
|
}
|
|
}
|
|
function fileInfo_save(p_sn, f_count) {
|
|
|
|
var rowCount = 0;
|
|
var saveValidFlag = false;
|
|
|
|
if (f_count > 0) {
|
|
saveValidFlag = true;
|
|
}
|
|
|
|
if (saveValidFlag) {
|
|
var tempSampleCount = 0;
|
|
|
|
//msg = "저장 하시겠습니까?";
|
|
/* if(confirm(msg)!=0) {
|
|
return true;
|
|
} */
|
|
document.pms.action = jPath + "system/uploadFiles";
|
|
document.pms.enctype = "multipart/form-data";
|
|
document.pms.encoding = "multipart/form-data";
|
|
document.pms.method = "POST";
|
|
document.charset = "UTF-8";
|
|
//alert(document.pms.action);
|
|
//alert("p_sn : " + p_sn + "fileAttachCcount : " + f_count);
|
|
$("#pms").ajaxForm({
|
|
success: function (response, textStatus, jqXHR) {
|
|
//alert("textStatus: "+textStatus+"\n jqXHR : "+jqXHR+"\n response : "+response);
|
|
if (response == "{'success':true}") {
|
|
formDataSave(x, p_sn);
|
|
} else {
|
|
saveFail();
|
|
}
|
|
},
|
|
error: function () {
|
|
saveFail();
|
|
},
|
|
complete: function () {
|
|
},
|
|
dataType: "text"
|
|
}).submit();
|
|
|
|
//IE8 에서 Formdata 기능 동작 안함 ==============================================================================================================================
|
|
/*
|
|
var form = document.pms;
|
|
var formdata = false;
|
|
|
|
if(window.FormData !== undefined){ // for HTML5 browsers
|
|
formdata = new FormData(form);
|
|
|
|
$("input[type=file]").each(function(index){
|
|
if($(this).val() != ""){
|
|
var fileIndex = $(this).attr("name").replace("ATTACH_FILENAME[", "");
|
|
fileIndex = fileIndex.replace("]", "");
|
|
}
|
|
});
|
|
|
|
$.ajax({
|
|
url: jPath + "system/uploadFiles",
|
|
type: "POST",
|
|
enctype: "multipart/form-data",
|
|
encoding: "multipart/form-data",
|
|
data: formdata,
|
|
contentType: false,
|
|
processData: false,
|
|
beforeSubmit: showRequest,
|
|
success: function(response, textStatus, jqXHR){
|
|
//alert("textStatus: "+textStatus+"\n jqXHR : "+jqXHR+"\n response : "+response);
|
|
if (response == "{'success':true}") {
|
|
formDataSave();
|
|
}else{
|
|
saveFail();
|
|
}
|
|
},
|
|
error: function () {
|
|
saveFail();
|
|
},
|
|
complete: function () {
|
|
}
|
|
});
|
|
}else{
|
|
alert("IE8 시발");
|
|
//generate a random id
|
|
var iframeId = 'unique' + (new Date().getTime());
|
|
|
|
//create an empty iframe
|
|
var iframe = $('<iframe src="javascript:false;" name="'+iframeId+'" />');
|
|
|
|
//hide it
|
|
iframe.hide();
|
|
|
|
//set form target to iframe
|
|
$(form).attr('target',iframeId);
|
|
|
|
//Add iframe to body
|
|
iframe.appendTo('body');
|
|
iframe.load(function(e){
|
|
var doc = getDoc(iframe[0]); //get iframe Document
|
|
var docRoot = doc.body ? doc.body : doc.documentElement;
|
|
var data = docRoot.innerHTML;
|
|
//data is returned from server.
|
|
});
|
|
|
|
$("#pms").submit();
|
|
}
|
|
*/
|
|
//IE8 에서 Formdata 기능 동작 안함 ==============================================================================================================================
|
|
} else {
|
|
//document.pms.enctype = "application/x-www-form-urlencoded";
|
|
formDataSave();
|
|
//alert("저장할 데이터가 없습니다.");
|
|
}
|
|
}
|
|
function saveFail() {
|
|
alert("첨부파일 저장 중 오류가 발생 하였습니다.\n관리자에게 문의 바랍니다.");
|
|
}
|
|
|
|
function formDataSave() {
|
|
document.pms.enctype = "application/x-www-form-urlencoded";
|
|
document.pms.encoding = "application/x-www-form-urlencoded";
|
|
document.charset = "EUC-KR";
|
|
alert("저장이 완료되었습니다");
|
|
location.reload(true);
|
|
//document.pms.action = 'project_list2_dep_ok_2014.asp';
|
|
//document.pms.submit();
|
|
}
|
|
|
|
</script>
|
|
<%
|
|
p_sn = Request("p_sn")
|
|
%>
|
|
|
|
</head>
|
|
|
|
<body topmargin="10" leftmargin="15">
|
|
|
|
<form id="pms" name="pms" method="post">
|
|
<input type="hidden" name="p_sn" value="<%=p_sn %>"/>
|
|
<input type="hidden" name="fileCount" value=""/>
|
|
<input type="hidden" name="f_work_type" value="001"/>
|
|
<input type="hidden" name="user_no" value="<%=Session("User_Number")%>"/>
|
|
<input type="hidden" name="depart_no" value="<%=Session("Depart_Code")%>"/>
|
|
<table border="0" cellspacing="0" cellpadding="4" width="1000" style="border-collapse=collapse;">
|
|
<tr height="26">
|
|
<td colspan="5" style="padding: 25px 0 0 0;">
|
|
<div style="position:relative; padding: 0px; margin: 0px;">
|
|
<img src="/images/main/bubble_1num.png" style="">
|
|
<span style="position:absolute; top: 1px; left: 27px; font-size: 12pt; font-weight:bold;">첨부문서</span>
|
|
<img src="/images/project/btn_cost3.jpg" onClick="fileadd()" style='CURSOR:pointer; position:absolute; top: 1px; right: 0px;' align="absmiddle">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="padding:0px;" colspan="5">
|
|
<table width="100%" cellpadding="3" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
<tr>
|
|
<td style="padding:0px 0 5px 0;">
|
|
<table id="attach_table" width="100%" cellpadding="3" cellspacing="0" border="0" style="border-collapse:collapse;">
|
|
<tr height="30px;">
|
|
<td align="center" width="6%">순번</td>
|
|
<td align="center" width="8%">자료카테고리</td>
|
|
<td align="center" width="58%">첨부문서파일명</td>
|
|
<td align="center" width="10%">담당자</td>
|
|
<td align="center" class="tit_left tit_right" width="16%">첨부일자</td>
|
|
<!-- <td align="center" class="tit_left tit_right" width="15%">기타</td> -->
|
|
</tr>
|
|
<%
|
|
query = " SELECT f_id, f_kind, f_p_sn, f_file_name, f_save_name, f_input_dt, f_input_user, p_name "
|
|
query = query & " FROM T_SYSTEM_ATTACH as TSA "
|
|
query = query & " LEFT OUTER JOIN person as P "
|
|
query = query & " ON TSA.f_input_user = P.p_no "
|
|
query = query & " WHERE f_p_sn = '"&p_sn& "' "
|
|
query = query & " AND f_use_yn = 'Y' "
|
|
query = query & " AND f_work_type = '001' and f_kind <> '099' "
|
|
query = query & " order by f_kind, f_id "
|
|
|
|
rsp.Open query, adoConn, 1
|
|
|
|
attach_file_count = rsp.recordCount
|
|
|
|
'If attach_file_count < 4 Then
|
|
' attach_file_count = 3
|
|
'End if
|
|
|
|
dim f_attach_info()
|
|
redim f_attach_info(attach_file_count, 6)
|
|
|
|
Dim f_attach_index
|
|
f_attach_index = 1
|
|
|
|
select_kind_code_flag = True
|
|
other_kind_code_falg = True
|
|
default_kind_code_flag = false
|
|
kind_code = ""
|
|
|
|
'response.write "query : " & query & "<br>"
|
|
|
|
i = 1
|
|
row_cnt = 1
|
|
Do While i < 10
|
|
kind_code = "00" & CStr(i)
|
|
|
|
If attach_file_count > 0 then
|
|
''' response.write "i : " & i & ", kind_code : " & kind_code & ", rsp('f_kind') : " & rsp("f_kind") & "<br>"
|
|
|
|
If default_kind_code_flag Then
|
|
select_kind_code_flag = true
|
|
Else
|
|
If kind_code = rsp("f_kind") Then
|
|
select_kind_code_flag = False
|
|
other_kind_code_falg = False
|
|
|
|
f_attach_info(f_attach_index, 0) = rsp("f_id")
|
|
f_attach_info(f_attach_index, 1) = rsp("f_kind")
|
|
f_attach_info(f_attach_index, 2) = rsp("f_file_name")
|
|
f_attach_info(f_attach_index, 3) = rsp("p_name")
|
|
f_attach_info(f_attach_index, 4) = rsp("f_input_dt")
|
|
f_attach_info(f_attach_index, 5) = rsp("f_input_user")
|
|
Else
|
|
select_kind_code_flag = True
|
|
End If
|
|
End If
|
|
|
|
If select_kind_code_flag Then
|
|
If other_kind_code_falg then
|
|
|
|
%>
|
|
<tr>
|
|
<td align="center" ><%=row_cnt%></td>
|
|
<td align="center" >
|
|
<input type="hidden" name="f_id[<%=row_cnt-1%>]" value="" class="file_id"/>
|
|
<select name="f_kind[<%=row_cnt-1%>]">
|
|
<option value="">선택</option>
|
|
<% query = "select c_common_code, c_code_name from T_COMMON_CODE_DETAIL where c_kind_code = '001' and c_common_code <> '099' "
|
|
rsa.Open query, adoConn, 1
|
|
if rsa.RecordCount > 0 then
|
|
for j = 1 to rsa.RecordCount %>
|
|
<option value="<%=rsa("c_common_code")%>" <% if rsa("c_common_code") = kind_code then %> selected <% end if %>> <%=rsa("c_code_name")%></option>
|
|
<% rsa.MoveNext
|
|
next
|
|
end if
|
|
rsa.Close
|
|
%>
|
|
</select>
|
|
</td>
|
|
<td align="center" >
|
|
<input type="file" class="uploadFile_btn " name="ATTACH_FILENAME[<%=row_cnt-1%>]" maxlength="1" style="width:565;" />
|
|
</td>
|
|
<td align="center" ></td>
|
|
<td align="center" ></td>
|
|
</tr>
|
|
<%
|
|
row_cnt = row_cnt + 1
|
|
other_kind_code_falg = false
|
|
End if
|
|
i = i + 1
|
|
other_kind_code_falg = true
|
|
Else
|
|
%>
|
|
<tr>
|
|
<td align="center" ><%=row_cnt%></td>
|
|
<td align="center" >
|
|
<input type="hidden" name="f_id[<%=row_cnt-1%>]" value="<%=f_attach_info(f_attach_index, 0)%>" class="file_id"/>
|
|
|
|
<% query = "select c_common_code, c_code_name from T_COMMON_CODE_DETAIL where c_kind_code = '001' and c_common_code <> '099' "
|
|
rsa.Open query, adoConn, 1
|
|
if rsa.RecordCount > 0 then
|
|
for j = 1 to rsa.RecordCount
|
|
if rsa("c_common_code") = kind_code Then
|
|
%>
|
|
<input type="hidden" name="f_kind[<%=row_cnt-1%>]" value="<%=rsa("c_common_code")%>"/>
|
|
<input type="text" value="<%=rsa("c_code_name")%>" readonly style="border: 0px none0; text-align: center;"/>
|
|
<%
|
|
end if
|
|
rsa.MoveNext
|
|
next
|
|
end if
|
|
rsa.Close
|
|
%>
|
|
</td>
|
|
<td align="center" >
|
|
<input type="file" class="uploadFile_btn" name="ATTACH_FILENAME[<%=row_cnt-1%>]" maxlength="1" style="width:200;" />
|
|
<input type="text" onclick="download(<%=f_attach_info(f_attach_index, 0)%>)" style="width:360; color:blue; CURSOR:pointer;" value = "<%=f_attach_info(f_attach_index, 2)%>" readonly/>
|
|
<!--<button type="button" style="width:60;" value="삭제" onclick="delete_file('<%=f_attach_info(f_attach_index, 0)%>', '<%=f_attach_info(f_attach_index, 5)%>')">삭제</button> -->
|
|
</td>
|
|
<td align="center" ><%=f_attach_info(f_attach_index, 3)%></td>
|
|
<td align="center" ><%=f_attach_info(f_attach_index, 4)%></td>
|
|
</tr>
|
|
<%
|
|
f_attach_index = f_attach_index + 1
|
|
row_cnt = row_cnt + 1
|
|
|
|
If f_attach_index <= attach_file_count Then
|
|
rsp.MoveNext
|
|
Else
|
|
If kind_code <> "009" Then
|
|
default_kind_code_flag = true
|
|
else
|
|
Exit do
|
|
End if
|
|
End if
|
|
End If
|
|
Else
|
|
%>
|
|
<tr>
|
|
<td align="center" ><%=row_cnt%></td>
|
|
<td align="center" >
|
|
<input type="hidden" name="f_id[<%=row_cnt-1%>]" value="" class="file_id"/>
|
|
<select name="f_kind[<%=row_cnt-1%>]" >
|
|
<option value="">선택</option>
|
|
<% query = "select c_common_code, c_code_name from T_COMMON_CODE_DETAIL where c_kind_code = '001' and c_common_code <> '099' "
|
|
rsa.Open query, adoConn, 1
|
|
if rsa.RecordCount > 0 then
|
|
for j = 1 to rsa.RecordCount %>
|
|
<option value="<%=rsa("c_common_code")%>" <% if rsa("c_common_code") = ("00"&CStr(row_cnt)) then %> selected <% end if %>> <%=rsa("c_code_name")%></option>
|
|
<% rsa.MoveNext
|
|
next
|
|
end if
|
|
rsa.Close
|
|
%>
|
|
</select>
|
|
</td>
|
|
<td align="center" >
|
|
<input type="file" class="uploadFile_btn" name="ATTACH_FILENAME[<%=row_cnt-1%>]" maxlength="1" style="width:565;" />
|
|
</td>
|
|
<td align="center" ></td>
|
|
<td align="center" ></td>
|
|
</tr>
|
|
<%
|
|
row_cnt = row_cnt + 1
|
|
i = i + 1
|
|
End if
|
|
Loop
|
|
rsp.Close
|
|
%>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="6" height="1" bgcolor="#cecece"></td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td align="center" colspan="6" style="padding:10 0 0 0; position:relative;">
|
|
<img src="/images/project/btn_save.jpg" align="absmiddle" style="cursor:pointer" onclick="save('<%=p_sn%>')">
|
|
<img src="/images/common/btn_cancel2.jpg" align="absmiddle" style="cursor:pointer" onclick="window.close();"> <!-- 취소하기 -->
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
|
</body>
|
|
</html>
|