var gubun = "0"; var basicattachsize = parseFloat("0"); var VarszRealDownURLList = ""; var ckDisplayName = ""; var strMusicTag = ""; var inlineattachsize = parseFloat(0); var thisfilepath = ""; // 임시저장파일경로 + szFormFeed + 파일크기 // 1.Submit할때 객체간의 구분자(파일명(파일크기) 구분자 파일경로 구분자 임시경로 구분자 실제저장파일명) var szVerticalTab = "\x0B"; var szFormFeed = "\x0C"; // 1. 객체간의 oarray배열 저장 구분자. htmlTag 구분자 파일명(파일크기) 구분자 파일경로 구분자 임시경로 구분자 실제저장파일명 // 2. Submit할때 행간의 구분자 var szDimention = "\x0A"; // 첨부파일 저장 배열 // 추가될수록 차수 증가 var oarray = new Array(); var oarray2 = new Array(); var oarray3 = new Array(); var oarray4 = new Array(); var oarray5 = new Array(); var att_array = new Array(); var att_array2 = new Array(); var att_array3 = new Array(); var att_array4 = new Array(); var att_array5 = new Array(); var inline_array = new Array(); var mi = 0, mj = 0; var mi2 = 0; var mi3 = 0; var mi4 = 0; var mi5 = 0; var bmi = 0; var bmi2 = 0; var bmi3 = 0; var bmi4 = 0; var bmi5 = 0; //var att_File_Sz = ""; // 현재 파일크기 //var tempFolder = ""; // 임시저장경로 //var att_Str0_Name = "" // 실제 저장경로 // 첨부파일 갯수 선택가능 /* * num : 한 화면에서 최대 가능한 첨부파일갯수 * file_indx : 첨부파일 버튼이 여러개일 경우 * file_cnt : 첨부파일 버튼이 여러개일 경우 각 버튼이 첨부가능한 갯수 */ function fnFileUpload(num, file_indx) { // 신규 업로드도 없고 기존 업로드 파일도 없을 경우 // 첨부파일은 필수 입력 if(document.filedown != null && document.filedown["totCnt"+file_indx] != null){ if(eval(document.filedown["totCnt"+file_indx].value) >= eval(num)){ showMessage( eval("CO999") + "[첨부파일은 "+num+"개만 가능합니다.]", "CO0", false); return; } } /* if(file_indx != '' && file_cnt =='1' && document.all.wherefile[file_indx].innerHTML != ''){ showMessage( eval("CO999") + "[첨부파일은 1개만 가능합니다.]", "CO0", false); return; } */ var sub = window.open("./jsp/com/popAttach.jsp?selectCnt="+num+"&file_indx="+file_indx, "attach", "height=390, width=500, top=200, left=300, resizable=yes, status=yes"); sub.focus(); } function MakeFilePath(thisfilepath) { // 임시저장파일경로 +szFormFeed+ 파일크기 this.thisfilepath = thisfilepath; } /** * 파일 업로드 페이지에서 업로드 확인 후 오픈창에 업로드 파일 정보를 보여줌. * filename : 업로드 파일명 * totalbytes : 기존 업로드 파일 크기 + 현재 업로드 파일 크기 * currbytes : 현재 업로드 파일 크기 * thisfilepath : 현재 업로드 임시저장 파일 경로 * tempFolder : 임시저장경로 * str0_Name : 실제 폴더에 저장될 파일명 * file_indx : 첨부파일이 여러개일 경우의 해당 인덱스 */ function AddFileName(filename, totalbytes, currbytes, thisfilepath, tempFolder, str0_Name, file_indx) { // 전체 업로드 파일 크기 this.basicattachsize = parseFloat(totalbytes); // 업로드 파일 정보 레이어 document.all["filearea"+file_indx].style.display = ""; // ####### 업로드 파일 Insert ########## InsertFileTag(filename, currbytes, thisfilepath, tempFolder, str0_Name, file_indx) } function AddInlineFile(fullpath, nbytes, align) { this.inlineattachsize = parseFloat(nbytes); execCom("attachurl", fullpath, "", align); fullpath = fullpath.replace(/\\/g, "/").replace(/%/g, "%25").replace(/ /g, "%20").replace(/&/g, "%26").replace(/#/g, "%23").replace(/}/g, "%7D").replace(/{/g, "%7B").replace(/]/g, "%5D").replace(/\[/g, "%5B").replace(/\^/g, "%5E").replace(/\)/g, "|1").replace(/\(/g, "|2").replace(/\$/g, "|3").replace(/\+/g, "|4"); this.inline_array[this.mj] = fullpath; this.mj++; } function MakeInlineAttachList(strContent) { var inlineattachlist = ""; for(var i=0; i= 0) inlineattachlist += this.inline_array[i] + szVerticalTab; } return inlineattachlist; } function MakeRealDownURLList(strContent) { var realdownurllist = ""; var arrFile; strContent = strContent.replace(/&/g, "&"); var arrRetReal = VarszRealDownURLList.split(szFormFeed); for(var i=0; i' + '' + '' + '' + filename ; if (filesize > 0) strTag = strTag + ' (' + filesize + ' KB)'; strTag = strTag + '' + '' + ''; var objATTTR = document.getElementById("trAttList"+file_indx); if (objATTTR.style.display == "none") { objATTTR.style.display = "block"; } // 업로드 파일 목록 표시함. // 오픈너에게 첨부파일 표시 document.all["wherefile"+file_indx].insertAdjacentHTML("beforeEnd", strTag); if(file_indx=='1'){ // 배열로 첫 첨부파일 저장 this.oarray[this.mi] = strTag + szDimention + filename + " (" + filesize + " KB)" + szDimention + thisfilepath + szDimention + tempFolder + szDimention + str0_Name; this.mi++; if(document.all.filecount1 != null) document.all.filecount1.value=this.mi; }else if(file_indx=='2'){ // 배열로 첫 첨부파일 저장 this.oarray2[this.mi2] = strTag + szDimention + filename + " (" + filesize + " KB)" + szDimention + thisfilepath + szDimention + tempFolder + szDimention + str0_Name; this.mi2++; if(document.all.filecount2 != null) document.all.filecount2.value=this.mi2; }else if(file_indx=='3'){ // 배열로 첫 첨부파일 저장 this.oarray3[this.mi3] = strTag + szDimention + filename + " (" + filesize + " KB)" + szDimention + thisfilepath + szDimention + tempFolder + szDimention + str0_Name; this.mi3++; if(document.all.filecount3 != null) document.all.filecount3.value=this.mi3; }else if(file_indx=='4'){ // 배열로 첫 첨부파일 저장 this.oarray4[this.mi4] = strTag + szDimention + filename + " (" + filesize + " KB)" + szDimention + thisfilepath + szDimention + tempFolder + szDimention + str0_Name; this.mi4++; if(document.all.filecount4 != null) document.all.filecount4.value=this.mi4; }else if(file_indx=='5'){ // 배열로 첫 첨부파일 저장 this.oarray5[this.mi5] = strTag + szDimention + filename + " (" + filesize + " KB)" + szDimention + thisfilepath + szDimention + tempFolder + szDimention + str0_Name; this.mi5++; if(document.all.filecount5 != null) document.all.filecount5.value=this.mi5; } } /** * 수정화면에서 첨부파일 재등록 및 삭제 가능 목록 * url : 다운로드 액션 * tName : 테이블 id * tdName : 레이어 id * filename : 파일명 * downType : 첨부파일 구분 * att_File_N : 첨부파일 번호 * att_File_Path : 첨부파일 경로 * att_Str0_Nm : 실제 저장파일명 */ function fnUpdateFileMultiTag(url, tName, tdName, filename, downType, att_File_N, att_File_Path, att_Str0_Nm) { var npos = filename.lastIndexOf("."); var extension = filename.substr(npos, 4); var imgname = ""; if(att_Str0_Nm != '0000000000000'){ if(extension == ".ppt") imgname = "f_ppt.jpg"; else if(extension == ".doc") imgname = "f_doc.jpg"; else if(extension == ".jpg") imgname = "f_jpg.jpg"; else if(extension == ".gif") imgname = "f_gif.jpg"; else if(extension == ".hwp") imgname = "f_hwp.jpg"; else if(extension == ".pdf") imgname = "f_pdf.jpg"; else if(extension == ".xls" || extension == ".csv" || extension == ".xlsx") imgname = "f_xls.jpg"; else if(extension == ".htm" || extension == ".html" || extension == ".xml") imgname = "f_htm.jpg"; else if(extension == ".mp3" || extension == ".wav" || extension == ".mid" || extension == ".mpg" || extension == ".mpeg" || extension == ".avi" || extension == ".mov") imgname = "f_video.jpg"; else if(extension == ".txt" || extension == ".rtf" || extension == ".log") imgname = "f_txt.jpg"; else if(extension == ".alz" || extension == ".ace" || extension == ".arc" || extension == ".arj" || extension == ".cab" || extension == ".ear" || extension == ".gz" || extension == "ice" || extension == "jar" || extension == "lha" || extension == "lzh" || extension == "pak" || extension == "rar" || extension == "tar" || extension == "tgz" || extension == "war" || extension == "z" || extension == "zip" ) imgname = "f_zip.jpg"; else imgname = "f_etc.jpg"; var strTag = '' + '' + '' + '' + '' + '' + '
' + filename + '
'; var objATTTR = document.getElementById(tName); objATTTR.style.display = "block"; document.getElementById(tdName).insertAdjacentHTML("beforeEnd", strTag); this.bmi++; } /* if(att_Str0_Nm == '0000000000000'){ alert(att_Str0_Nm); //deleteFile(tName + this.bmi, downType, att_File_N, att_File_Path, att_Str0_Nm); } */ } /** * 세부화면에서 첨부파일 목록 리스트 * url : 다운로드 액션 * tName : 테이블 id * tdName : 레이어 id * filename : 파일명 * downType : 첨부파일 구분 * att_File_N : 첨부파일 번호 * att_File_Path : 첨부파일 경로 * att_Str0_Nm : 실제 저장파일명 */ function fnDetailFileMultiTag(url, tName, tdName, filename, downType, att_File_N, att_File_Path, att_Str0_Nm) { var npos = filename.lastIndexOf("."); var extension = filename.substr(npos, 4); var imgname = ""; if(att_Str0_Nm != '0000000000000'){ if(extension == ".ppt"){ imgname = "f_ppt.jpg"; }else if(extension == ".doc"){ imgname = "f_doc.jpg"; }else if(extension == ".jpg"){ imgname = "f_jpg.jpg"; }else if(extension == ".gif"){ imgname = "f_gif.jpg"; }else if(extension == ".hwp"){ imgname = "f_hwp.jpg"; }else if(extension == ".pdf"){ imgname = "f_pdf.jpg"; }else if(extension == ".xls" || extension == ".csv" || extension == ".xlsx"){ imgname = "f_xls.jpg"; }else if(extension == ".htm" || extension == ".html" || extension == ".xml"){ imgname = "f_htm.jpg"; }else if(extension == ".mp3" || extension == ".wav" || extension == ".mid" || extension == ".mpg" || extension == ".mpeg" || extension == ".avi" || extension == ".mov"){ imgname = "f_video.jpg"; }else if(extension == ".txt" || extension == ".rtf" || extension == ".log"){ imgname = "f_txt.jpg"; }else if(extension == ".alz" || extension == ".ace" || extension == ".arc" || extension == ".arj" || extension == ".cab" || extension == ".ear" || extension == ".gz" || extension == ".ice" || extension == ".jar" || extension == ".lha" || extension == ".lzh" || extension == ".pak" || extension == ".rar" || extension == ".tar" || extension == ".tgz" || extension == ".war" || extension == ".z" || extension == ".zip" ){ imgname = "f_zip.jpg"; }else{ imgname = "f_etc.jpg"; } // KIMSUNGSU++ // downType 결정 if(extension=='.xml'){ //XML 파일 downType = 'BILLXML'; }else if(extension == '.ktx'){ //세금계산서 downType = 'BILL'; }else if(extension == '.kcx'){ //전자계약서 downType = 'CONT'; }else { //기타 나머지(엑셀도포함) downType = 'ETC'; } var strTag = '' + '' + '' + '' + '' + '
' + filename + '
'; var objATTTR = document.getElementById(tName); objATTTR.style.display = "block"; document.getElementById(tdName).insertAdjacentHTML("beforeEnd", strTag); this.bmi++; } } /** * url : 다운로드 액션 * downType : 첨부파일 구분 * att_File_N : 첨부파일 번호 * att_File_Path : 첨부파일 경로 * att_Str0_Nm : 실제 저장파일명 */ function downloadFile(url, downType, atch_Numb, atch_File_Name, atch_File_Path, atch_Str0_Name) { var form = document.filedown; form.atch_Numb.value = atch_Numb; form.atch_File_Name.value = atch_File_Name; form.atch_File_Path.value = atch_File_Path; form.atch_Str0_Name.value = atch_Str0_Name; form.downType.value = downType; form.action = url; form.submit(); } function downloadFile2(form, url, downType, atch_Numb, atch_File_Name, atch_File_Path, atch_Str0_Name) { form.atch_Numb.value = atch_Numb; form.atch_File_Name.value = atch_File_Name; form.atch_File_Path.value = atch_File_Path; form.atch_Str0_Name.value = atch_Str0_Name; form.downType.value = downType; form.action = url; form.submit(); } /** * 수정에서 첨부파일 삭제시 레이어 수정 * oName : 테이블 id * deleteType : 첨부파일 구분 * att_File_N : 첨부파일 번호 * att_File_Path : 첨부파일 경로 * att_Str0_Nm : 실제 저장파일명 */ function deleteFile(oName, deleteType, att_File_N, att_File_Path, att_Str0_Nm) { /* alert(oName); alert(deleteType); alert(att_File_N); alert(att_File_Path); alert(att_Str0_Nm); */ //if(att_Str0_Nm == '0000000000000'){ /* var eladjace = document.getElementById(oName); if(eladjace != null && eladjace != "undefined") { eladjace.style.display = "none"; eladjace.id = ""; if(document.all.filebtn != null){ document.all.filebtn.style.display = "block"; } var end_Cnt ='0'; // 기존 업로드된 파일갯수 if(document.filedown != null && document.filedown.totCnt != null){ end_Cnt = document.filedown.totCnt.value; document.filedown.totCnt.value = eval(end_Cnt)-1; } */ // 첨부파일 삭제 액션 // deleteFileAction(deleteType, att_File_N, att_File_Path, att_Str0_Nm); //}else{ if (confirm('첨부파일을 삭제하시겠습니까?')) { var eladjace = document.getElementById(oName); if(eladjace != null && eladjace != "undefined") { eladjace.style.display = "none"; eladjace.id = ""; } if(document.all.filebtn != null){ document.all.filebtn.style.display = "block"; } var end_Cnt ='0'; // 기존 업로드된 파일갯수 if(document.filedown != null && document.filedown.totCnt != null){ end_Cnt = document.filedown.totCnt.value; document.filedown.totCnt.value = eval(end_Cnt)-1; } // 첨부파일 삭제 액션 deleteFileAction(deleteType, att_File_N, att_File_Path, att_Str0_Nm); } else { return; } //} } /** * 첨부파일 삭제 액션 * deleteType : 첨부파일 구분, FileDeleteAction에서 체크 안함. 해당 파일의 경로와 파일명을 읽어 바로 삭제함. * att_File_N : 첨부파일 번호 * att_File_Path : 첨부파일 경로 * att_Str0_Nm : 실제 저장파일명 */ function deleteFileAction(deleteType, atch_Numb, atch_File_Path, atch_Str0_Name){ var form = document.filedown; if(form.deleteURL != null){ form.action = form.deleteURL.value; } form.atch_Numb.value = atch_Numb; form.atch_File_Path.value = atch_File_Path; form.atch_Str0_Name.value = atch_Str0_Name; form.deleteType.value = deleteType; form.submit(); } // 각각의 파일 선택 후 삭제 버튼 클릭시 // 레이어 수정 function CheckDelFileName(oNumstr, nbytes, tempFolder, filename, file_indx) { if (confirm('첨부파일을 삭제하시겠습니까?')) { var oNumk = oNumstr.replace('adjace'+file_indx, ''); var oNumkr = parseInt(oNumk) + 1; var nbytesk = this.basicattachsize - parseFloat(nbytes); DelFileName(oNumkr, nbytesk, file_indx); var end_Cnt ='0'; // 기존 업로드된 파일갯수 if(document.filedown != null && document.filedown["totCnt"+file_indx] != null){ end_Cnt = document.filedown["totCnt"+file_indx].value; document.filedown["totCnt"+file_indx].value = eval(end_Cnt)-1; } var EditedFilePath = ""; for(var i=0; i 4) { i = i + 1; } if(i <= cnt) ss = ss + str.charAt(k); k = k + 1; } return ss; } function LenH(aquery) { var tmpStr; var temp = 0; var onechar; var tcount; tcount = 0; tmpStr = new String(aquery); temp = tmpStr.length; for(k=0; k 4) { tcount += 2; } else if(onechar != '\r') { tcount++; } } return tcount; } // 메일 크기 체크 function CheckMailSize(basicattachsize, inlineattachsize) { var maxbytes = 10485760; var totbytes = 0; totbytes = parseFloat(basicattachsize) + parseFloat(inlineattachsize); if(totbytes > maxbytes) { if(this.basicattachsize > 0) alert("용량이 초과되었습니다.\n한번에 보낼 수 있는 편지크기 : " + maxbytes + "바이트\n현재 본문(첨부화일 포함) 크기 : " + inlineattachsize + basicattachsize + " 바이트"); else alert("용량이 초과되었습니다.\n한번에 보낼 수 있는 편지크기 : " + maxbytes + "바이트\n현재 본문 크기 : " + inlineattachsize + " 바이트"); return false; } else { return true; } } /** * 파일 업로드 등록 버튼 클릭할때 filepath에 업로드 정보를 저장함. */ function fnFillFilePath(SubmitForm){ //******************** file upload 필요부분 var EditedFilePath = ""; // arrValue[0] : HtmlTag(파일이름과 크기 삭제이미지등...) // arrValue[1] : 파일명 // arrValue[2] : 임시저장파일경로 + szFormFeed + 파일크기 // arrValue[3] : 임시저장경로 // arrValue[4] : 실제저장파일명 /*= ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ 첨부파일 버튼 1 ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ =*/ for (var i=0; i 0) EditedFilePath = EditedFilePath + szDimention; // 행간구분 // 파일명 || 저장임시파일경로 || 임시저장경로 || 실제저장파일명 EditedFilePath = EditedFilePath + arrValue[1] + szVerticalTab + arrValueFile + szVerticalTab + arrValue[3] + szVerticalTab + arrValue[4] ; } // 파일명.확장자 CHECK // 회원가입시 또는 정보수정시 jpg,gif파일인지 확인 // 파라미터중에 확장자의 유효성 체크여부 chkFileGb가 Null이 아니면 if(this.oarray.length > 0 && SubmitForm.chkFileGb != null){ var fileName = arrValue[1].substring(0, arrValue[1].indexOf('(')-1 ); // 인장이미지 gif,jpg파일인지 체크 if(fileName.indexOf('.') != -1){ fileType = fileName.split('.')[1]; if(fileType.toLowerCase() != 'gif' && fileType.toLowerCase() != 'jpg'){ showMessage( eval("CO999") + "[파일 형식 gif, jpg]", "CO030", false); return; } }else{ showMessage( eval("CO999") + "[파일의 확장자명]", "CO021", false); return; } } /*= ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ 끝 ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ =*/ /*= ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ 첨부파일 버튼 2 ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ =*/ for (var i=0; i 0 && SubmitForm.chkFileGb != null){ var fileName = arrValue[1].substring(0, arrValue[1].indexOf('(')-1 ); // 인장이미지 gif,jpg파일인지 체크 if(fileName.indexOf('.') != -1){ fileType = fileName.split('.')[1]; if(fileType.toLowerCase() != 'gif' && fileType.toLowerCase() != 'jpg'){ showMessage( eval("CO999") + "[파일 형식 gif, jpg]", "CO030", false); return; } }else{ showMessage( eval("CO999") + "[파일의 확장자명]", "CO021", false); return; } } /*= ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ 끝 ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ =*/ /*= ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ 첨부파일 버튼 3 ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ =*/ for (var i=0; i 0 && SubmitForm.chkFileGb != null){ var fileName = arrValue[1].substring(0, arrValue[1].indexOf('(')-1 ); // 인장이미지 gif,jpg파일인지 체크 if(fileName.indexOf('.') != -1){ fileType = fileName.split('.')[1]; if(fileType.toLowerCase() != 'gif' && fileType.toLowerCase() != 'jpg'){ showMessage( eval("CO999") + "[파일 형식 gif, jpg]", "CO030", false); return; } }else{ showMessage( eval("CO999") + "[파일의 확장자명]", "CO021", false); return; } } /*= ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ 끝 ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ =*/ /*= ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ 첨부파일 버튼 4 ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ =*/ for (var i=0; i 0 && SubmitForm.chkFileGb != null){ var fileName = arrValue[1].substring(0, arrValue[1].indexOf('(')-1 ); // 인장이미지 gif,jpg파일인지 체크 if(fileName.indexOf('.') != -1){ fileType = fileName.split('.')[1]; if(fileType.toLowerCase() != 'gif' && fileType.toLowerCase() != 'jpg'){ showMessage( eval("CO999") + "[파일 형식 gif, jpg]", "CO030", false); return; } }else{ showMessage( eval("CO999") + "[파일의 확장자명]", "CO021", false); return; } } /*= ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ 끝 ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ =*/ /*= ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ 첨부파일 버튼 5 ┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳┳ =*/ for (var i=0; i 0 && SubmitForm.chkFileGb != null){ var fileName = arrValue[1].substring(0, arrValue[1].indexOf('(')-1 ); // 인장이미지 gif,jpg파일인지 체크 if(fileName.indexOf('.') != -1){ fileType = fileName.split('.')[1]; if(fileType.toLowerCase() != 'gif' && fileType.toLowerCase() != 'jpg'){ showMessage( eval("CO999") + "[파일 형식 gif, jpg]", "CO030", false); return; } }else{ showMessage( eval("CO999") + "[파일의 확장자명]", "CO021", false); return; } } /*= ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ 끝 ┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻┻ =*/ SubmitForm.filepath.value = EditedFilePath; //*********************** 여기까지 }