You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
711 lines
27 KiB
XML
711 lines
27 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:w2="http://www.inswave.com/websquare"
|
|
xmlns:xf="http://www.w3.org/2002/xforms">
|
|
<head>
|
|
<w2:type>UDC</w2:type>
|
|
<w2:buildDate />
|
|
<w2:model></w2:model>
|
|
</head>
|
|
<body>
|
|
<!--/** WEBSQUARE UDC */
|
|
{
|
|
"componentName": "udc_Multiupload",
|
|
"pluginName": "udc_Multiupload",
|
|
"company": "Inswave",
|
|
"developer": "Inswave",
|
|
"category": "Basic",
|
|
"notSupportBrowser": "IE10,IE11,FireFox,Opera,Chrome,Safari",
|
|
"version": "1.0",
|
|
"htmlRender": "",
|
|
"icon": "",
|
|
"disableIcon": "",
|
|
"description": "",
|
|
"width": "600px",
|
|
"height": "250px",
|
|
"properties": [
|
|
{
|
|
"name": "id",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "Y",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "Component id"
|
|
},
|
|
{
|
|
"name": "accept",
|
|
"default": "*/*",
|
|
"type": "string",
|
|
"option": "[*/*, image/*]",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "허용할 파일 확장자로 콤마(,)를 구분자로 한다. (file_extension | media_type ) e.g: .gif, .jpg, .png, .doc"
|
|
},
|
|
{
|
|
"name": "filter",
|
|
"default": "*:*.*",
|
|
"type": "string",
|
|
"option": "[그림파일:*.jpg;*.gif;*.png,*:*.*]",
|
|
"necessary": "N",
|
|
"hidden": "Y",
|
|
"bindparent": "",
|
|
"description": "accept 설정으로 변경될 필요가 있음"
|
|
},
|
|
{
|
|
"name": "style",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "Component style"
|
|
},
|
|
{
|
|
"name": "class",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "Component class"
|
|
},
|
|
{
|
|
"name": "ref",
|
|
"default": "",
|
|
"type": "bindColumn",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "Component ref"
|
|
},
|
|
{
|
|
"name": "action",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "업로드 처리 URL"
|
|
},
|
|
{
|
|
"name": "maxSize",
|
|
"default": "10",
|
|
"type": "number",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "전송 가능한 파일의 최대 크기(MB)"
|
|
},
|
|
{
|
|
"name": "maxCount",
|
|
"default": "10",
|
|
"type": "number",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "전송 가능한 파일의 최대 개수"
|
|
},
|
|
{
|
|
"name": "subDir",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "Y",
|
|
"bindparent": "",
|
|
"description": "websquare.xml에 정의된 기본 디렉토리 하위의 디렉토리 노드명"
|
|
},
|
|
{
|
|
"name": "selectCallback",
|
|
"default": "",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "Y",
|
|
"bindparent": "",
|
|
"description": "파일 선택 후 실행될 콜백 함수"
|
|
},
|
|
{
|
|
"name": "autoClosePop",
|
|
"default": "true",
|
|
"type": "combobox",
|
|
"option": "[true,false]",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "업로드 팝업을 자동으로 닫을 지 여부 [default:Y]"
|
|
},
|
|
{
|
|
"name": "autoCloseInterval",
|
|
"default": "1000",
|
|
"type": "string",
|
|
"option": "",
|
|
"necessary": "N",
|
|
"hidden": "N",
|
|
"bindparent": "",
|
|
"description": "autoClosePop이 Y일 경우 Interval time (단위:ms) [default:1000]"
|
|
}
|
|
],
|
|
"events": [{
|
|
"name": "onDone(data)",
|
|
"type": "user",
|
|
"description": "파일 업로드가 완료되었을 때 발생"
|
|
}],
|
|
"apis": [
|
|
{
|
|
"name": "searchFileList",
|
|
"description": "파일목록을 조회한다.",
|
|
"params": [{
|
|
"type": "String",
|
|
"name": "fileGroupStr",
|
|
"description": "파일그룹을 입력하여 파일목록을 조회한다. 예) searchFileList(\"AA11\");"
|
|
}],
|
|
"return": [{
|
|
"type": "Object",
|
|
"description": "파일목록"
|
|
}]
|
|
},
|
|
{
|
|
"name": "setFileGrpSeq",
|
|
"description": "파일그룹순번을 지정한다.",
|
|
"params": [{
|
|
"type": "Number",
|
|
"name": "seq",
|
|
"description": "파일그룹순번"
|
|
}],
|
|
"return": [{
|
|
"type": "String",
|
|
"description": "없음"
|
|
}]
|
|
}
|
|
]
|
|
}
|
|
-->
|
|
<xf:group class="w5udc_multi" id="" style="" pluginName="udc_Multiupload">
|
|
<link rel="stylesheet" type="text/css" href=""></link>
|
|
<style type="text/css"><![CDATA[
|
|
|
|
/* 파일 선택 버튼의 cursor:pointer 표현 */
|
|
.w5udc_multi .w2multiupload_html5_transparent input {
|
|
opacity: 0;
|
|
-moz-opacity: 0;
|
|
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
|
|
cursor: pointer;
|
|
position: absolute;
|
|
height: 100%;
|
|
top: 0;
|
|
right: 0;
|
|
font-size: 23px;
|
|
width:82px !important;
|
|
}
|
|
|
|
]]></style>
|
|
<script type="text/javascript" src=""></script>
|
|
<script ev:event="oncreated(options)" type="text/javascript"><![CDATA[
|
|
/**
|
|
* //property handling
|
|
* $w.log("id:" + options.id);
|
|
* $w.log("accept:" + options.accept);
|
|
* $w.log("filter:" + options.filter);
|
|
* $w.log("style:" + options.style);
|
|
* $w.log("class:" + options.class);
|
|
* $w.log("ref:" + options.ref);
|
|
* $w.log("action:" + options.action);
|
|
* $w.log("maxSize:" + options.maxSize);
|
|
* $w.log("maxCount:" + options.maxCount);
|
|
* $w.log("subDir:" + options.subDir);
|
|
* $w.log("selectCallback:" + options.selectCallback);
|
|
* $w.log("autoClosePop:" + options.autoClosePop);
|
|
* $w.log("autoCloseInterval:" + options.autoCloseInterval);
|
|
*
|
|
* //event trigger
|
|
* udc_obj.trigger("onDone", [data]);
|
|
*/
|
|
|
|
// 전역변수
|
|
udc_obj.UDC_USER_ID = options.id;
|
|
udc_obj.UDC_SEARCHMAP = options.id + "_dma_searchFile"; // 조회 request dataMap
|
|
udc_obj.UDC_INSERTLIST = "dlt_insertList"; // insert request dataList
|
|
udc_obj.UDC_DATALIST = options.id + "_dlt_fileInfo"; // 파일 목록 dataList
|
|
udc_obj.MAX_BYTE_SIZE = parseInt(options.maxSize)*1024*1024; // 최대 전송 크기 (Byte).
|
|
udc_obj.MAX_KB_SIZE = parseInt(options.maxSize)*1024; // 최대 전송 크기
|
|
udc_obj.MAX_MB_SIZE = options.maxSize; // 파일 크기 max size
|
|
udc_obj.SUPPORT_HTML5; // HTML5 지원여부
|
|
udc_obj.SHOW_LOG = true; // console log 활성화
|
|
udc_obj.FILE_GRP_SEQ = 0; // 파일그룹순번
|
|
|
|
udc_obj.FILE_DATALIST = options.id + "_dlt_fileList"; // 파일목록 DataList ID
|
|
|
|
// 업로드 팝업 자동닫기 옵션
|
|
udc_obj.autoClosePop = options.autoClosePop
|
|
udc_obj.closePopInterval = options.closePopInterval;
|
|
|
|
// 멀티업로드 property 설정
|
|
udc_mpd_attach.setAttribute("action", options.action); // hidden API ??
|
|
udc_mpd_attach.setAttribute("subDir" , options.subDir);
|
|
udc_mpd_attach.setAttribute("maxsize" , udc_obj.MAX_KB_SIZE);
|
|
udc_mpd_attach.setAttribute("maxcount" , options.maxCount);
|
|
udc_mpd_attach.setAttribute("selectCallback", options.id+".doSelectCallback");
|
|
|
|
// HTML5 지원 여부 검사 함수.
|
|
udc_obj.isSupportHTML5Upload = function(){
|
|
return 'multiple' in document.createElement('input');
|
|
};
|
|
|
|
// 파일 선택시 콜백 함수.
|
|
udc_obj.doSelectCallback = function(){
|
|
var obj = udc_obj.getMultiupload(); // 내부에서 this를 사용하면 안된다. this -> udc_Multi_udc_mpd_Attach 일 때도 있다.
|
|
var fileInfoArr = obj.getFileInfos();
|
|
|
|
// 파일팝업 오픈
|
|
var data = {data : { "fileInfoArr" : fileInfoArr, "html5Yn":udc_obj.SUPPORT_HTML5,
|
|
"udcId":udc_obj.UDC_USER_ID, "maxMbSize" : udc_obj.MAX_MB_SIZE }};
|
|
var options = {
|
|
id : "FileUploadPop",
|
|
popupName : "파일 업로드 진행상태",
|
|
modal : true,
|
|
width : 600,
|
|
height: 300 };
|
|
com.openPopup(com.getFullPath("/cm/common/fileUploadPop.xml"), options, data);
|
|
};
|
|
|
|
// 멀티업로드 객체 반환 함수.
|
|
udc_obj.getMultiupload = function(){
|
|
return udc_mpd_attach;
|
|
};
|
|
|
|
// 그리드 객체 반환 함수.
|
|
udc_obj.getGrid = function(){
|
|
return udc_grd;
|
|
};
|
|
|
|
// 최초 로딩시 호출 함수
|
|
udc_obj.initialize = function() {
|
|
|
|
udc_obj.SUPPORT_HTML5 = udc_obj.isSupportHTML5Upload();
|
|
if (udc_obj.SUPPORT_HTML5){
|
|
// input type=file 인 경우, accept 속성으로 (file_extension, media_type) 을 지정한다.
|
|
$("#"+options.id+"_udc_mpd_attach_file_input").attr("accept" , options.accept);
|
|
} else {
|
|
if(options.accept == "*/*" ){
|
|
udc_mpd_attach.setAttribute("filter", "*:*.*");
|
|
}else if (options.accept == "image/*" ){
|
|
udc_mpd_attach.setAttribute("filter", "이미지:*.jpg;*.jpeg;*.gif;*.png;*.bmp;");
|
|
}else {
|
|
options.accept = options.accept.replace(/(\s*)/g, "");
|
|
var filterStr = options.accept.replace(/(\.)(\w+)(,?)/gi, "*$1$2;");
|
|
udc_mpd_attach.setAttribute("filter", "파일:" + filterStr);
|
|
}
|
|
}
|
|
|
|
udc_mpd_attach.initialize(); // hidden API
|
|
|
|
// 조회용 request dataMap 생성
|
|
var dcStr = '<w2:dataMap id="'+ udc_obj.UDC_SEARCHMAP +'" baseNode="map">' +
|
|
'<w2:keyInfo>' +
|
|
'<w2:key id="fileGroup" name="fileGroup" dataType="text"></w2:key>'
|
|
'</w2:keyInfo>' +
|
|
'</w2:dataMap>' ;
|
|
$p.data.create( dcStr );
|
|
|
|
// 파일목록 dataList [gridview] 생성
|
|
var dcStr = '<w2:dataList id="'+ udc_obj.UDC_DATALIST +'" baseNode="list" saveRemovedData="true" repeatNode="map">' +
|
|
'<w2:columnInfo>' +
|
|
'<w2:column id="FILE_SEQ" name="FILE_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="DATA_SEQ" name="DATA_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_GRP_SEQ" name="FILE_GRP_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="STORED_FILE_NM" name="STORED_FILE_NM" dataType="text"></w2:column>' +
|
|
'<w2:column id="ORIGIN_FILE_NM" name="ORIGIN_FILE_NM" dataType="number"></w2:column>' +
|
|
'<w2:column id="FILE_SIZE" name="FILE_SIZE" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_UPLOAD_DATE" name="FILE_UPLOAD_DATE" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_MODIFIED_DATE" name="FILE_MODIFIED_DATE" dataType="text"></w2:column>' +
|
|
'</w2:columnInfo>' +
|
|
'</w2:dataList>' ;
|
|
$p.data.create( dcStr );
|
|
|
|
// 그리드와 바인딩될 dataList의 경우, dataList가 내부적으로 변경되어 그대로 사용할 수 없다.
|
|
udc_grd.options.dataList = udc_obj.UDC_DATALIST;
|
|
udc_grd.setDataList();
|
|
|
|
// 조회 submission 생성
|
|
// 옵션 설정 TODO
|
|
var submissionObj = {
|
|
id : udc_obj.UDC_USER_ID + "sbm_searchFile",
|
|
ref : "data:json,dma_search",
|
|
target : "data:json,dlt_fileInfo",
|
|
action : "/file/selectFileList",
|
|
method : "post",
|
|
mediatype : "application/json",
|
|
mode : "asynchronous",
|
|
encoding : "UTF-8",
|
|
processMsg : "",
|
|
submitDoneHandler : "scwin.searchCallback"
|
|
}
|
|
$p.createSubmission(submissionObj);
|
|
|
|
// 파일 저장 request dataList 생성
|
|
var dcStr = '<w2:dataList id="'+ udc_obj.UDC_INSERTLIST +'" baseNode="list" saveRemovedData="true" repeatNode="map">' +
|
|
'<w2:columnInfo>' +
|
|
'<w2:column id="FILE_SEQ" name="FILE_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="DATA_SEQ" name="DATA_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_GRP_SEQ" name="FILE_GRP_SEQ" dataType="text"></w2:column>' +
|
|
'<w2:column id="STORED_FILE_NM" name="STORED_FILE_NM" dataType="text"></w2:column>' +
|
|
'<w2:column id="ORIGIN_FILE_NM" name="ORIGIN_FILE_NM" dataType="number"></w2:column>' +
|
|
'<w2:column id="FILE_SIZE" name="FILE_SIZE" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_UPLOAD_DATE" name="FILE_UPLOAD_DATE" dataType="text"></w2:column>' +
|
|
'<w2:column id="FILE_MODIFIED_DATE" name="FILE_MODIFIED_DATE" dataType="text"></w2:column>' +
|
|
'</w2:columnInfo>' +
|
|
'</w2:dataList>' ;
|
|
$p.data.create( dcStr );
|
|
|
|
// insert submission 생성
|
|
var submissionObj = {
|
|
id : udc_obj.UDC_USER_ID + "_sbm_insertFileList",
|
|
ref : "data:json,dlt_insertList",
|
|
target : "",
|
|
action : "/file/insertFileList",
|
|
method : "post",
|
|
mediatype : "application/json",
|
|
mode : "asynchronous",
|
|
encoding : "UTF-8",
|
|
processMsg : "",
|
|
submitDoneHandler : "scwin.insertFileCallback"
|
|
}
|
|
$p.createSubmission(submissionObj);
|
|
};
|
|
|
|
// 조회 콜백 [TODO: 호출확인]
|
|
scwin.searchCallback = function(e){
|
|
//alert("조회 콜백.");
|
|
};
|
|
|
|
// 파일 저장 콜백 [TODO: 호출확인]
|
|
scwin.insertFileCallback = function(e){
|
|
//alert("insert 콜백.");
|
|
};
|
|
|
|
// 그리드 컬럼 포맷(formatter) 함수 : size - displayFormatter
|
|
udc_obj.setDisplaySize = function(fileSize){
|
|
if (parseInt(fileSize) >= (1024*1024*1024) ){
|
|
var gbSize = (parseInt(fileSize)/1024/1024/1024).toFixed(2);
|
|
return WebSquare.text.formatCurrency( gbSize, "#,###.##") + " GB";
|
|
} else if (parseInt(fileSize) >= (1024*1024) ){
|
|
var mbSize = (parseInt(fileSize)/1024/1024).toFixed(2);
|
|
return WebSquare.text.formatCurrency( mbSize, "#,###.##") + " MB";
|
|
} else if (parseInt(fileSize) >= 1024 ){
|
|
var kbSize = (parseInt(fileSize)/1024).toFixed(2);
|
|
return WebSquare.text.formatCurrency( kbSize, "#,###.##") + " KB";
|
|
} else {
|
|
return WebSquare.text.formatCurrency( fileSize, "#,###.##") + " B";
|
|
}
|
|
};
|
|
|
|
// 삭제버튼 클릭 후 콜백
|
|
scwin.deleteFileCallback = function(data){
|
|
if(data){
|
|
// TODO
|
|
// 삭제 submission 호출
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Function description...
|
|
* @date 2019. 01. 16
|
|
* @memberOf udc_obj
|
|
* @param
|
|
* @returns
|
|
* @author Administrator
|
|
* @example
|
|
* @since
|
|
*/
|
|
udc_obj.searchFileList = function(fileGroupStr){
|
|
var sbmId = udc_obj.UDC_USER_ID + "sbm_searchFile";
|
|
com.executeSubmission($p.getComponentById(sbmId));
|
|
};
|
|
|
|
// 초기화 함수 호출
|
|
udc_obj.initialize();
|
|
|
|
/**
|
|
* Function description...
|
|
* @date 2019. 02. 20
|
|
* @memberOf udc_obj
|
|
* @param
|
|
* @returns
|
|
* @author Administrator
|
|
* @example
|
|
* @since
|
|
*/
|
|
udc_obj.setFileGrpSeq = function(seq){
|
|
// 파일그룹순번 저장 (부모에서 넘어옴)
|
|
udc_obj.FILE_GRP_SEQ = seq;
|
|
};
|
|
|
|
]]></script>
|
|
<script ev:event="onattributeChanged(type,value)" type="text/javascript"><![CDATA[ ]]></script>
|
|
<script ev:event="ondestroyed()" type="text/javascript"><![CDATA[ ]]></script>
|
|
<xf:group id="" style="" class="section">
|
|
<xf:group class="defaultbox" id="" style="">
|
|
<w2:textbox class="df_tt fl" id="" label="파일목록" style="margin-right: 10px;"></w2:textbox>
|
|
<xf:group class="fr" id="" style="">
|
|
<xf:group class="ml5 fr" id="" style="">
|
|
<xf:group id="" style="position:relative;display:block;height:23px;float:left;cursor:pointer;">
|
|
<w2:anchor class="btn_gcm" id="" outerDiv="true" style="">
|
|
<xf:label><![CDATA[파일업로드]]></xf:label>
|
|
<script ev:event="onclick" type="text/javascript"><![CDATA[
|
|
|
|
|
|
|
|
]]></script>
|
|
</w2:anchor>
|
|
<w2:multiupload action="" defaultImage="" filter="" hoverImage="" id="udc_mpd_attach" maxcount="" maxsize=""
|
|
mode="html5_transparent" selectCallback="" sizeUnit=""
|
|
style="position:absolute;width:80px;height:23px;cursor:pointer;top:0px;z-index:10;" uploadButton="" wmode="false">
|
|
<script ev:event="onComplete(e)" type="text/javascript"><![CDATA[
|
|
// 플래시 지원 브라우저에서 화면 로딩이 끝날 경우 호출
|
|
|
|
]]></script>
|
|
<script ev:event="ondone(data)" type="text/javascript"><![CDATA[
|
|
|
|
var errorFlag = false;
|
|
var colId = "progress";
|
|
if(!udc_obj.SUPPORT_HTML5) colId = "flashProgress"; // HTML5를 지원하지 않는 경우 컬럼 교체
|
|
|
|
// 서버 설정(websquare.xml)에 따라 업로드 성공 여부가 달라진다.
|
|
var popWin = $p.getPopupWindow("FileUploadPop");
|
|
for( var idx=0; idx < data.length; idx++){
|
|
|
|
var rowIdx = idx ;
|
|
if(udc_obj.SUPPORT_HTML5){
|
|
var fileList = popWin.dlt_fileInfo.getAllJSON();
|
|
var fileName = fileList.map(function (file) { return file.name; })
|
|
rowIdx = fileName.indexOf(data[idx].localFile || data[idx].deniedFile);
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, "file", data[idx].file );
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, "key", data[idx].key );
|
|
}
|
|
|
|
if( data[idx].deniedCode != ""){
|
|
errorFlag = true; // error flag
|
|
var statusStr = "";
|
|
if( data[idx].deniedCode == "101" ){
|
|
statusStr = "<font color=red> 허용하지 않는 확장자입니다. </font>";
|
|
} else if ( data[idx].deniedCode == "102") {
|
|
var maxSize = udc_obj.setDisplaySize(data[idx].maxUploadSize);
|
|
statusStr = "<font color=red> 최대전송용량("+ maxSize + ")초과입니다. </font>";
|
|
} else {
|
|
statusStr = "<font color=red> 서버에서 오류가 발생했습니다. </font>";
|
|
}
|
|
|
|
if(!udc_obj.SUPPORT_HTML5) {
|
|
// 실패: (101: 허용하지 않는 확장자, 102: 허용범위 밖의 파일 사이즈, 999: 기타 서버 오류)
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, colId, statusStr );
|
|
} else {
|
|
// 실패
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, colId, data[idx].deniedCode );
|
|
}
|
|
|
|
popWin.dlt_fileInfo.setCellData(rowIdx, "progressSize", "0 KB");
|
|
|
|
} else {
|
|
if(!udc_obj.SUPPORT_HTML5){
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, colId, "100%" );
|
|
}
|
|
}
|
|
}
|
|
|
|
// 전체 파일 사이즈 셋팅
|
|
var sucSize = popWin.scwin.totSize;
|
|
var resultSize = 0;
|
|
if(sucSize > 1048576){ // 1MB 이상
|
|
resultSize = (sucSize/1024/1024).toFixed(2) + " MB";
|
|
}else{
|
|
resultSize = (sucSize/1024).toFixed(2) + " KB";
|
|
}
|
|
popWin.txt_totFileSize.setValue(resultSize);
|
|
|
|
// 전체 전송상태
|
|
// ondone에서 정상인 파일 row 개수 체크 후 setValue
|
|
var sucRowCnt = popWin.dlt_fileInfo.getMatchedJSON( "progress" , 100 , true ).length;
|
|
var totRowCnt = popWin.dlt_fileInfo.getRowCount();
|
|
var resultCnt = sucRowCnt + " / " + totRowCnt;
|
|
popWin.txt_totCnt.setValue(resultCnt);
|
|
|
|
// 업로드 오류가 없을 시 팝업 닫기 [오류 파일이 있을 경우 자동으로 닫지 않음]
|
|
if( (!errorFlag && udc_obj.autoClosePop == "true") || (!errorFlag && typeof udc_obj.autoClosePop == "undefined") ){
|
|
var closeInterval;
|
|
if(typeof udc_obj.closePopInterval != "undefined"){
|
|
closeInterval = Number(udc_obj.closePopInterval);
|
|
}else{
|
|
closeInterval = 1000; // [default time : 1000ms]
|
|
}
|
|
|
|
$p.setTimeout(function(){
|
|
popWin.com.closePopup();
|
|
}, {"delay" : closeInterval});
|
|
};
|
|
|
|
// 파일 정보 dataMap 저장
|
|
// request data 셋팅
|
|
// TODO
|
|
var currentDate = $p.getCurrentServerDate( "yyyyMMdd" );
|
|
for(var i=0; i<data.length; i++){
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).insertRow(i);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "FILE_SEQ", i + 1);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "DATA_SEQ", i + 1);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "FILE_GRP_SEQ", udc_obj.FILE_GRP_SEQ);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "STORED_FILE_NM", data[i].file);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "ORIGIN_FILE_NM", data[i].localFile);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "FILE_SIZE", data[i].size);
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "FILE_UPLOAD_DATE", currentDate); // TEMP
|
|
$p.getComponentById(udc_obj.UDC_INSERTLIST).setCellData(i, "FILE_MODIFIED_DATE", currentDate);
|
|
}
|
|
|
|
// insert submission
|
|
$p.executeSubmission(udc_obj.UDC_USER_ID + "_sbm_insertFileList");
|
|
|
|
// 사용자 이벤트 호출
|
|
udc_obj.trigger("onDone", [data]);
|
|
|
|
]]></script>
|
|
<script ev:event="onprogress(data)" type="text/javascript"><![CDATA[
|
|
|
|
// 팝업값 실시간 변경(HTML5)
|
|
var popWin = $p.getPopupWindow("FileUploadPop");
|
|
var rowIdx = -1;
|
|
for(var idx=0; idx<popWin.dlt_fileInfo.getRowCount(); idx++){
|
|
var fileName = popWin.dlt_fileInfo.getCellData( idx , "name" );
|
|
if( fileName == data.fileName ) {
|
|
rowIdx = idx;
|
|
break;
|
|
}
|
|
}
|
|
// progress 컬럼 실시간 변경
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, "progress", data.percentData );
|
|
|
|
// 전송량 컬럼 셋팅
|
|
var size = popWin.dlt_fileInfo.getCellData( rowIdx , "size" );
|
|
var mbSize = (parseInt(size)/1024/1024).toFixed(2);
|
|
var kbSize = (parseInt(size)/1024).toFixed(2);
|
|
var percent = data.percentData;
|
|
var partByteSize = 0;
|
|
var partMbSize = 0;
|
|
var returnValue = "";
|
|
|
|
if(size > 1048576){ // 1MB 이상
|
|
partByteSize = parseInt(size) * 0.01 * parseInt(percent);
|
|
partMbSize = (parseInt(partByteSize)/1024/1024).toFixed(2);
|
|
returnValue = partMbSize + " / " + mbSize + " MB";
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, "progressSize", returnValue );
|
|
}else{
|
|
partByteSize = parseInt(size) * 0.01 * parseInt(percent);
|
|
partKbSize = (parseInt(partByteSize)/1024).toFixed(2);
|
|
returnValue = partKbSize + " / " + kbSize + " KB";
|
|
popWin.dlt_fileInfo.setCellData( rowIdx, "progressSize", returnValue );
|
|
}
|
|
|
|
]]></script>
|
|
</w2:multiupload>
|
|
</xf:group>
|
|
<w2:anchor class="btn_gcm" clickEventElement="outerDiv" ev:onclick="scwin.btn_CancelGrp_onclick"
|
|
id="udc_btn_download" outerDiv="true" style="">
|
|
<xf:label><![CDATA[파일 다운로드]]></xf:label>
|
|
<script ev:event="onclick" type="text/javascript"><![CDATA[
|
|
|
|
// ##### TEST 중입니다.
|
|
/*
|
|
var fileName = "test1.txt"; // 실제 파일명
|
|
var fileUrl = "C:/WS5_SAMPLE/WORKSPACE/websquare5-template/WebContent/fileUpload/up"; // 파일 경로
|
|
var realFile = "파일1입니다.txt"; // 다운로드 파일명
|
|
|
|
var url = "/cm/jsp/downLoadFile.jsp?realFile="+realFile +"&fileUrl="+fileUrl+"&fileName="+fileName;
|
|
$p.download(url);
|
|
*/
|
|
|
|
// TODO
|
|
// 파일 다운로드
|
|
var jsonData = [
|
|
{fileName: "test1.txt", fileUrl : "C:/WS5_SAMPLE/WORKSPACE/WRM/WebContent/fileUpload/up", realFile : "파일1입니다.txt"}
|
|
,{fileName: "test2.txt", fileUrl : "C:/WS5_SAMPLE/WORKSPACE/WRM/WebContent/fileUpload/up", realFile : "파일2입니다.txt"}
|
|
];
|
|
var sendData = WebSquare.text.BASE64Encoder(JSON.stringify(jsonData));
|
|
WebSquare.net.download( "/cm/jsp/downLoadFile.jsp" , sendData , "post" );
|
|
|
|
]]></script>
|
|
</w2:anchor>
|
|
<w2:anchor class="btn_gcm" clickEventElement="outerDiv" ev:onclick="" id="udc_btn_delete" outerDiv="true"
|
|
style="">
|
|
<xf:label><![CDATA[파일 삭제]]></xf:label>
|
|
<script ev:event="onclick" type="text/javascript"><![CDATA[
|
|
|
|
var checkLength = udc_grd.getCheckedJSON("chk").length;
|
|
if(checkLength < 1){
|
|
com.alert("선택한 파일이 없습니다.");
|
|
return;
|
|
}
|
|
var message = "선택한 " + checkLength + "개의 파일을 삭제하시겠습니까?";
|
|
com.confirm(message, "scwin.deleteFileCallback");
|
|
|
|
]]></script>
|
|
</w2:anchor>
|
|
</xf:group>
|
|
</xf:group>
|
|
</xf:group>
|
|
<xf:group style="height:400px;" id="udc_grp_dropBox">
|
|
<w2:gridView sortEvent="onclick" ev:onrowindexchange="scwin.grd_GroupView_onrowindexchange" editModeEvent=""
|
|
showSortableImage="" useShiftKey="true" scrollByColumn="false" readOnly="" sortable="true" rowStatusHeaderValue="" rowStatusVisible=""
|
|
fixedColumnWithHidden="true" dataList="" keyMoveEditMode="" ignoreCellClick="false" style="height:400px;margin-top:10px;"
|
|
autoFit="allColumn" visibleRowNum="" id="udc_grd" ev:onafteredit="" class="cm_grid" noResultMessage="" noResultMessageStyle=""
|
|
noResultMessageClass="">
|
|
<w2:header style="" id="">
|
|
<w2:row style="" id="">
|
|
<w2:column width="20" style="height:25px;" inputType="checkbox" id="column15" value="" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="250" style="height:25px;" inputType="text" id="column13" value="파일명" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" id="column11" value="파일크기" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" id="column9" value="파일수정일자" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" id="column7" value="업로드일자" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
</w2:row>
|
|
</w2:header>
|
|
<w2:gBody style="" id="gBody4">
|
|
<w2:row style="" id="row5">
|
|
<w2:column width="20" style="height:25px;" inputType="checkbox" id="chk" value="" blockSelect="false"
|
|
displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="250" style="height:25px;" inputType="text" readOnly="true" id="ORIGIN_FILE_NM" value=""
|
|
blockSelect="false" displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" readOnly="true" id="FILE_SIZE" value=""
|
|
blockSelect="false" displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" readOnly="true" id="FILE_UPLOAD_DATE" value=""
|
|
blockSelect="false" displayMode="label">
|
|
</w2:column>
|
|
<w2:column width="100" style="height:25px;" inputType="text" readOnly="true" id="FILE_MODIFIED_DATE"
|
|
value="" blockSelect="false" displayMode="label">
|
|
</w2:column>
|
|
</w2:row>
|
|
</w2:gBody>
|
|
</w2:gridView>
|
|
</xf:group>
|
|
</xf:group>
|
|
</xf:group>
|
|
</body>
|
|
</html>
|