/*
 * DEXTUploadX5 - Application
 * http://www.dextsolution.com
 *
 * Copyright ⓒ DEXTSolution Inc.
 */
var gfileEngine = null; var gselectedList = []; var gsortedList = []; var gdx5Parameter = {}; var gDEF_HEADER_HEIGHT = 36, gMIN_HEADER_HEIGHT = 24, gMAX_HEADER_HEIGHT = 40; var gDEF_LSTITEM_HEIGHT = 24, gMIN_LSTITEM_HEIGHT = 24, gMAX_LSTITEM_HEIGHT = 40; var gDEF_FOOTER_HEIGHT = 36; var gDEF_CHECKER_WIDTH = 30; var gDEF_SIZECOL_WIDTH = 64; var gDEF_OPCOL_WIDTH = 30; var gvector = { version: "3.2.0.0",   uitype: "LIST", tileColumnCount: 2, maxFileCount: -1, maxFileCountWithVF: false, minFileSize: -1, maxFileSize: -1,
maxTotalSize: -1, maxTotalSizeWithVF: false, filterSilence: false, downloadLimitSize: -1, filters: [], reversedFilters: [], allowedNoExtension: true, uploadMode: "ORAF",   duplicable: false, useProgressDialog: true,   enableColumnSorting: false,   autoSortingType: 0,   sortPriorityVF: false, headerHeight: gDEF_HEADER_HEIGHT, savedHeaderHeight: gDEF_HEADER_HEIGHT, fileItemHeight: gDEF_LSTITEM_HEIGHT, footerHeight: gDEF_FOOTER_HEIGHT, headerTextBaseline: Math.floor(gDEF_HEADER_HEIGHT / 2) + 5, itemTextBaseline: Math.floor(gDEF_LSTITEM_HEIGHT / 2) + 5, footerTextBaseline: Math.floor(gDEF_FOOTER_HEIGHT / 2) + 5,
checkerWidth: gDEF_CHECKER_WIDTH, vscrollbarWidth: 0, downloadButtonVisible: true, openButtonVisible: true, fileFormats: { image: ["jpg", "jpeg", "gif", "bmp", "tif", "tiff", "png", "rif", "ppm", "pgm", "pbm", "pnm", "svg", "webp", "pcx", "tga", "wmf", "raf", "orf", "crw", "raw", "scr", "nef", "srf", "cr2", "erf", "nrw", "pef", "dng", "ico", "jp2", "psp", "tgf", "cdr", "pic", "eps"], video: ["webm", "mkv", "flv", "vob", "avi", "wmv", "rm", "asf", "mp4", "m4p", "m4v", "mpg", "mpeg", "mov"], audio: ["aac", "au", "flac", "m4a", "mmf", "mp3", "ra", "ogg", "wma", "wav", "cda", "asx", "m3u"], msdoc: ["doc", "docx"],
msxls: ["xls", "xlsx"], msppt: ["ppt", "pptx"], archv: ["zip", "arj", "7z", "alz", "gz", "rar", "cab", "tar", "lzh", "egg"], exec: ["exe", "sh", "msi", "com"], html: ["html", "htm", "xml", "css"], flash: ["fla", "swf", "air", "swz", "as"], outlook: ["pst", "eml", "dbx"], document: ["txt", "ps", "hlp", "rtf", "gul", "lwd"], clang: ["c", "hrc", "h"], cpplang: ["cpp", "hpp"], rubylang: ["rb", "rbw"], objclang: ["m", "mm"], javalang: ["java", "jsp", "jar", "war", "class"], etclang: ["bas", "pas", "por", "cgi", "rc"], font: ["ttf", "hft", "otf", "fnt", "fot", "eot", "woff"],
adobePremiere: ["ppj", "ptl", "prtl", "plb", "prproj"], adobeAfterEffect: ["aep", "aet", "aepx"], threeDimension: ["3ds", "max", "ma", "mb", "lwo", "lws", "xsi", "dwf", "hsf", "dxf", "dwg", "3dm", "blend"], asp: ["asp", "aspx", "asa", "ashx", "asax"], data: ["dat", "mdf", "ldf", "frm", "ibd", "myd", "myi"], others: ["ai", "bat", "chm", "exe", "hwp", "pdf", "log", "psd", "torrent", "cs", "pl", "js", "py", "swift", "vbs", "php", "csv", "log", "id", "sql"] }, enablePreview: false,   previewMethod: 1, previewBgColor: "#5E6E8D",
  enableDnd: true,   useHDWhenSingle: false,   sizeColumnWidth: gDEF_SIZECOL_WIDTH,   opWidth: gDEF_OPCOL_WIDTH,   wheelEnabled: true,   columnTotWidth: 0 }; var guploadStatus = { totalSize: 0, totalCount: 0, totalSendSize: 0, completeCount: 0, currentName: "", currentSize: 0, currentSendSize: 0, totalRate: 0, totalSpeed: 0, currentRate: 0, currentSpeed: 0, totalTime: null, currentTime: null, remainedTotalTime: null, remainedCurrentTime: null }; var gdownloadStatus = { totalSize: 0, totalCount: 0, totalReceiveSize: 0,
completeCount: 0, currentName: "", currentSize: 0, currentSendSize: 0, totalRate: 0, totalSpeed: 0, currentRate: 0, currentSpeed: 0, totalTime: null, currentTime: null, remainedTotalTime: null, remainedCurrentTime: null }; var gbrowser = null; var genvironment = null; var gRB = new ResourceBundle(); var svgh = new SVGHelper(); var gui = null; function onLoadHandler(evt) { if (typeof window.parent.dx5 === "undefined") return; console.log("DX5: Start " + gvector.version);    console.log("DX5: Initialize variables.");  initVariables();
  console.log("DX5: Initialize engine.");  initEngine();    var worker = new Worker("dextuploadx5-worker-resource.js"); worker.onmessage = function (evt) {   console.log("DX5: Initialize resource bundle."); gRB.init(evt.data);   console.log("DX5: Initialize UI.");  initUI();   console.log("DX5: Initialize APIs."); initInterfaces(); }; worker.onerror = function (evt) { console.log("DX5: Text resource(main view) loading failed!\n" + evt.message); alert("Text resource(main view) loading failed!\n" + evt.message); };
  worker.postMessage(gvector.lang); } function initEngine() { gfileEngine = new DX5FileEngine();   gfileEngine.browser = gbrowser;   gfileEngine.environment = genvironment;   gfileEngine.controlId = gvector.elementId;   gfileEngine.onerror = onErrorHandler;   gfileEngine.onbegin = onUploadBeginHandler; gfileEngine.onprogress = onUploadProgressHandler; gfileEngine.oncomplete = onUploadCompletehandler; gfileEngine.onitemstart = onUploadItemStartHandler; gfileEngine.onitemend = onUploadItemEndHandler; gfileEngine.oncancel = onUploadCancelHandler;
  gfileEngine.ondownloadbegin = onDownloadBeginHandler; gfileEngine.ondownloadprogress = onDownloadProgressHandler; gfileEngine.ondownloadcomplete = onDownloadCompletehandler; gfileEngine.ondownloaditemstart = onDownloadItemStartHandler; gfileEngine.ondownloaditemend = onDownloadItemEndHandler; gfileEngine.ondownloadcancel = onDownloadCancelHandler;   gfileEngine.oncompressbegin = onCompressBeginHandler; gfileEngine.oncompresscomplete = onCompressCompleteHandler; gfileEngine.oncompresscancel = onCompressCancelHandler; }
function initInterfaces() {  document["getVersion"] = api_getVersion; document["getSplitString"] = api_getSplitString; document["setSplitString"] = api_setSplitString; document["getEmptyString"] = api_getEmptyString; document["setEmptyString"] = api_setEmptyString; document["getAuthkey"] = api_getAuthkey; document["setAuthkey"] = api_setAuthkey; document["getUploadURL"] = api_getUploadURL; document["setUploadURL"] = api_setUploadURL; document["setDownloadLimitSize"] = api_setDownloadLimitSize; document["setUploadMode"] = api_setUploadMode; document["getUploadMode"] = api_getUploadMode;
document["enableResumingUpload"] = api_enableResumingUpload; document["setUploadBlockSize"] = api_setUploadBlockSize; document["openFileDialog"] = api_openFileDialog; document["openFolderDialog"] = api_openFolderDialog; document["addFileList"] = api_addFileList; document["addEntriesForChrome"] = api_addEntriesForChrome; document["addVirtualFile"] = api_addVirtualFile; document["addVirtualFileList"] = api_addVirtualFileList; document["getMaxFileCount"] = api_getMaxFileCount; document["setMaxFileCount"] = api_setMaxFileCount; document["getMaxFileSize"] = api_getMaxFileSize;
document["setMaxFileSize"] = api_setMaxFileSize; document["getMinFileSize"] = api_getMinFileSize; document["setMinFileSize"] = api_setMinFileSize; document["getMaxTotalSize"] = api_getMaxTotalSize; document["setMaxTotalSize"] = api_setMaxTotalSize; document["setFilterSilence"] = api_setFilterSilence; document["getExtentionFilter"] = api_getExtentionFilter; document["setExtentionFilter"] = api_setExtentionFilter; document["isAllowNoExtension"] = api_isAllowNoExtension; document["setAllowNoExtension"] = api_setAllowNoExtension; document["clearItems"] = api_clearItems;
document["getTotalItemCount"] = api_getTotalItemCount; document["getTotalFileSize"] = api_getTotalFileSize; document["getItems"] = api_getItems; document["addItems"] = api_addItems; document["getSelectedItems"] = api_getSelectedItems; document["getItemIds"] = api_getItemIds; document["getSelectedItemIds"] = api_getSelectedItemIds; document["getSelectedIndices"] = api_getSelectedIndices; document["getItemById"] = api_getItemById; document["getItemByIndex"] = api_getItemByIndex; document["getCheckedItems"] = api_getCheckedItems; document["getCheckedIds"] = api_getCheckedIds;
document["getItemId"] = api_getItemId; document["getItemIndex"] = api_getItemIndex; document["lockById"] = api_lockById; document["lockByIndex"] = api_lockByIndex; document["unlockById"] = api_unlockById; document["unlockByIndex"] = api_unlockByIndex; document["getTotalRemovedFileCount"] = api_getTotalRemovedFileCount; document["getTotalRemovedFileSize"] = api_getTotalRemovedFileSize; document["getRemovedFileIds"] = api_getRemovedFileIds; document["getRemovedFiles"] = api_getRemovedFiles; document["getRemovedFileById"] = api_getRemovedFileById; document["removeById"] = api_removeById;
document["removeByIndex"] = api_removeByIndex; document["removeSelected"] = api_removeSelected; document["removeAll"] = api_removeAll; document["removeChecked"] = api_removeChecked; document["purgeRemovedVirtual"] = api_purgeRemovedVirtual; document["revokeVirtualFile"] = api_revokeVirtualFile; document["revokeAllVirtualFiles"] = api_revokeAllVirtualFiles; document["checkAll"] = api_checkAll; document["checkById"] = api_checkById; document["checkByIndex"] = api_checkByIndex; document["changeToVirtualFile"] = api_changeToVirtualFile; document["changeStatus"] = api_changeStatus;
document["checkDuplication"] = api_checkDuplication; document["getMetaDataByIndex"] = api_getMetaDataByIndex; document["getMetaDataById"] = api_getMetaDataById; document["setMetaDataByIndex"] = api_setMetaDataByIndex; document["setMetaDataById"] = api_setMetaDataById; document["deleteMetaDataByIndex"] = api_deleteMetaDataByIndex; document["deleteMetaDataById"] = api_deleteMetaDataById; document["getResponse"] = api_getResponse; document["getUploadStatus"] = api_getUploadStatus; document["getDownloadStatus"] = api_getDownloadStatus; document["stopUploading"] = api_stopUploading;
document["stopDownloading"] = api_stopDownloading; document["hasUploadableItems"] = api_hasUploadableItems; document["upload"] = api_upload; document["downloadById"] = api_downloadById; document["download"] = api_download; document["executeItem"] = api_executeItem; document["dispatchSVGResize"] = api_dispatchSVGResize; document["selectAll"] = api_selectAll; document["unselectAll"] = api_unselectAll; document["selectByIndex"] = api_selectByIndex; document["unselectByIndex"] = api_unselectByIndex; document["isSelectedByIndex"] = api_isSelectedByIndex;
document["useProgressDialog"] = api_useProgressDialog; document["isUsingProgressDialog"] = api_isUsingProgressDialog; document["getSupportPHP"] = api_getSupportPHP; document["setSupportPHP"] = api_setSupportPHP; document["setLimitMultiDownloadSize"] = api_setLimitMultiDownloadSize; document["getEnableColumnSorting"] = api_getEnableColumnSorting; document["setEnableColumnSorting"] = api_setEnableColumnSorting; document["setSortPriorityVirtualFile"] = api_setSortPriorityVirtualFile; document["getAutoSortingType"] = api_getAutoSortingType; document["setAutoSortingType"] = api_setAutoSortingType;
document["sortItems"] = api_sortItems; document["moveItemUp"] = api_moveItemUp; document["moveItemDown"] = api_moveItemDown; document["isPreviewEnable"] = api_isPreviewEnable; document["setPreviewEnable"] = api_setPreviewEnable; document["getPreviewMethod"] = api_getPreviewMethod; document["setPreviewMethod"] = api_setPreviewMethod; document["getPreviewBackgroundColor"] = api_getPreviewBackgroundColor; document["setPreviewBackgroundColor"] = api_setPreviewBackgroundColor; document["preview"] = api_preview; document["updateUI"] = api_updateUI;
document["getCompressURL"] = api_getCompressURL; document["setCompressURL"] = api_setCompressURL; document["downloadCompressed"] = api_downloadCompressed; document["stopCompressWaiting"] = api_stopCompressWaiting; document["getEnableDnd"] = api_getEnableDnd; document["setEnableDnd"] = api_setEnableDnd; document["isUsingHDWhenSingle"] = api_isUsingHDWhenSingle; document["setUsingHDWhenSingle"] = api_setUsingHDWhenSingle; document["getCustomHeader"] = api_getCustomHeader; document["setCustomHeader"] = api_setCustomHeader; document["removeCustomHeader"] = api_removeCustomHeader;
document["getTotalCustomHeaders"] = api_getTotalCustomHeaders; document["getWithCredentials"] = api_getWithCredentials; document["setWithCredentials"] = api_setWithCredentials;   document["getResourceBundle"] = api_getResourceBundle;   document["setDownObjects"] = api_setDownObjects;   document["isWheelEnabled"] = api_isWheelEnabled; document["setWheelEnabled"] = api_setWheelEnabled;   document["show"] = api_show; document["createColumn"] = api_createColumn; document["deleteColumn"] = api_deleteColumn; document["setColumnVisible"] = api_setColumnVisible;
document["setHeaderVisible"] = api_setHeaderVisible; document["setHeaderHeight"] = api_setHeaderHeight; document["setStatusBarVisible"] = api_setStatusBarVisible; document["setCheckerVisible"] = api_setCheckerVisible; document["setBorderVisible"] = api_setBorderVisible; document["setHeaderSolidColor"] = api_setHeaderSolidColor; document["setStatusBarSolidColor"] = api_setStatusBarSolidColor; document["setHeaderGradient"] = api_setHeaderGradient; document["setItemHeight"] = api_setItemHeight; document["setBackgroundColor"] = api_setBackgroundColor; document["setBackgroundImage"] = api_setBackgroundImage;
document["setHeaderFontName"] = api_setHeaderFontName; document["setHeaderFontColor"] = api_setHeaderFontColor; document["setItemFontName"] = api_setItemFontName; document["setItemFontColor"] = api_setItemFontColor; document["setStatusBarFontName"] = api_setStatusBarFontName; document["setStatusBarFontColor"] = api_setStatusBarFontColor; document["setTileColumnCount"] = api_setTileColumnCount; document["setDownloadButtonVisible"] = api_setDownloadButtonVisible; document["setOpenButtonVisible"] = api_setOpenButtonVisible; document["setItemBackColor"] = api_setItemBackColor;
document["setGridLineColor"] = api_setGridLineColor; document["setBorderColor"] = api_setBorderColor; document["setHeaderLineColor"] = api_setHeaderLineColor; document["setColumnLineColor"] = api_setColumnLineColor; document["setStatusBarLineColor"] = api_setStatusBarLineColor; document["setGridLineVisible"] = api_setGridLineVisible; document["setFilterVisible"] = api_setFilterVisible; document["setSizeColumnVisible"] = api_setSizeColumnVisible; } function onErrorHandler(code, message, parameters) { errorOut(code, gRB.get(code, message), parameters);
} function onUploadBeginHandler(upstatus) { onUploadProgressHandler(upstatus); setTimeout(function () { dispatchDEXTX5Event("uploadBegin", createDEXTX5Event("uploadBegin", { id: gvector.elementId })); }, 1); } function onUploadItemStartHandler(upstatus) { onUploadProgressHandler(upstatus); setTimeout(function () { dispatchDEXTX5Event("uploadItemStart", createDEXTX5Event("uploadItemStart", { id: gvector.elementId, itemId: upstatus.currentItem ? upstatus.currentItem.id : null })); }, 1); } function onUploadProgressHandler(upstatus) { if (!upstatus) return;
guploadStatus.totalSize = upstatus.totalSize; guploadStatus.totalSendSize = upstatus.totalSendSize; guploadStatus.totalCount = upstatus.totalCount; guploadStatus.completeCount = upstatus.completeCount; guploadStatus.currentSize = upstatus.currentSize; guploadStatus.currentSendSize = upstatus.currentSendSize; guploadStatus.currentName = upstatus.currentName; guploadStatus.totalRate = upstatus.getTotalRate(); guploadStatus.totalSpeed = upstatus.getTotalSpeed(); guploadStatus.currentRate = upstatus.getCurrentRate(); guploadStatus.currentSpeed = upstatus.getCurrentSpeed();
guploadStatus.totalTime = upstatus.getTotalSendTime(); guploadStatus.currentTime = upstatus.getCurrentSendTime(); guploadStatus.remainedTotalTime = upstatus.getRemainedTotalTime(); guploadStatus.remainedCurrentTime = upstatus.getRemainedCurrentTime(); } function onUploadItemEndHandler(upstatus, responseText) { onUploadProgressHandler(upstatus); setTimeout(function () { dispatchDEXTX5Event("uploadItemEnd", createDEXTX5Event("uploadItemEnd", { id: gvector.elementId, itemId: upstatus.currentItem ? upstatus.currentItem.id : null, response: responseText })); }, 1);
} function onUploadCompletehandler() { setTimeout(function () { dispatchDEXTX5Event("uploadCompleted", createDEXTX5Event("uploadCompleted", { id: gvector.elementId })); }, 1); } function onUploadCancelHandler() { setTimeout(function () { dispatchDEXTX5Event("uploadStopped", createDEXTX5Event("uploadStopped", { id: gvector.elementId })); }, 1); } function onDownloadBeginHandler(downstatus) { onDownloadProgressHandler(downstatus); setTimeout(function () { dispatchDEXTX5Event("downloadBegin", createDEXTX5Event("downloadBegin", { id: gvector.elementId })); }, 1);
} function onDownloadItemStartHandler(downstatus) { onDownloadProgressHandler(downstatus); setTimeout(function () { dispatchDEXTX5Event("downloadItemStart", createDEXTX5Event("downloadItemStart", { id: gvector.elementId, itemId: downstatus.currentItem ? downstatus.currentItem.id : null })); }, 1); } function onDownloadProgressHandler(downstatus) { if (!downstatus) return; gdownloadStatus.totalSize = downstatus.totalSize; gdownloadStatus.totalReceiveSize = downstatus.totalSendSize; gdownloadStatus.totalCount = downstatus.totalCount; gdownloadStatus.completeCount = downstatus.completeCount;
gdownloadStatus.currentSize = downstatus.currentSize; gdownloadStatus.currentReceiveSize = downstatus.currentSendSize; gdownloadStatus.currentName = downstatus.currentName; gdownloadStatus.totalRate = downstatus.getTotalRate(); gdownloadStatus.totalSpeed = downstatus.getTotalSpeed(); gdownloadStatus.currentRate = downstatus.getCurrentRate(); gdownloadStatus.currentSpeed = downstatus.getCurrentSpeed(); gdownloadStatus.totalTime = downstatus.getTotalSendTime(); gdownloadStatus.currentTime = downstatus.getCurrentSendTime(); gdownloadStatus.remainedTotalTime = downstatus.getRemainedTotalTime();
gdownloadStatus.remainedCurrentTime = downstatus.getRemainedCurrentTime(); } function onDownloadItemEndHandler(downstatus) { onDownloadProgressHandler(downstatus); setTimeout(function () { dispatchDEXTX5Event("downloadItemEnd", createDEXTX5Event("downloadItemEnd", { id: gvector.elementId, itemId: downstatus.currentItem ? downstatus.currentItem.id : null })); }, 1); } function onDownloadCompletehandler() { setTimeout(function () { dispatchDEXTX5Event("downloadCompleted", createDEXTX5Event("downloadCompleted", { id: gvector.elementId })); }, 1);
} function onDownloadCancelHandler() { setTimeout(function () { dispatchDEXTX5Event("downloadStopped", createDEXTX5Event("downloadStopped", { id: gvector.elementId })); }, 1); } function onCompressBeginHandler() { setTimeout(function () { dispatchDEXTX5Event("compressBegin", createDEXTX5Event("compressBegin", { id: gvector.elementId })); }, 1); } function onCompressCompleteHandler() { setTimeout(function () { dispatchDEXTX5Event("compressCompleted", createDEXTX5Event("compressCompleted", { id: gvector.elementId })); }, 1);
} function onCompressCancelHandler() { setTimeout(function () { dispatchDEXTX5Event("compressStopped", createDEXTX5Event("compressStopped", { id: gvector.elementId })); }, 1); } var gResizingThreshold = 0; var gResizingTimerHandle = 0; function onResizeHandler(evt) {         gResizingThreshold += 1; if (!gResizingTimerHandle) { gResizingTimerHandle = setTimeout(function () { if (gResizingThreshold <= 0) { clearTimeout(gResizingTimerHandle); gResizingThreshold = 0; gResizingTimerHandle = 0; gui.updateUI(); } else {
gResizingThreshold -= 2; setTimeout(arguments.callee, 50); } }, 50); } } function stringfyBound(t) { var bound = null; if ((typeof (DOMRect) != "undefined" && t instanceof DOMRect) || (typeof (ClientRect) != "undefined" && t instanceof ClientRect)) { bound = [ t.left + "", t.top + "", t.width + "", t.height + "" ]; } else if (t instanceof SVGRect) { bound = [ t.x.toString(), t.y.toString(), t.width + "", t.height + "" ]; } else { bound = [ t.x.baseVal.value + "", t.y.baseVal.value + "", t.width.baseVal.value + "", t.height.baseVal.value + ""
]; } return bound.join(","); } var gdbclickTargets = {}; function onItemClickHandler(evt) { evt.preventDefault(); evt.stopPropagation(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return; } var t = evt.currentTarget; var item = t.dataItem; if (!item) return; if (gdbclickTargets[item.id] === true) {   gdbclickTargets[item.id] = false;   setTimeout(function () { dispatchDEXTX5Event("itemdbclick", createDEXTX5Event("itemdbclick", { id: gvector.elementId, itemIndex: gsortedList.indexOf(item.id), itemId: item.id, itemType: item.type })); }, 1);
} else {   gdbclickTargets[item.id] = true; setTimeout(function () { gdbclickTargets[item.id] = false; }, 300);   if (evt.ctrlKey) { if (existFileItem(item.id)) { unselectFileItem(item.id, true); } else { selectFileItem(item.id, true); setTimeout(function () { dispatchDEXTX5Event("itemselect", createDEXTX5Event("itemselect", { id: gvector.elementId, itemIndex: gsortedList.indexOf(item.id), itemId: item.id, itemType: item.type })); }, 1); } } else if (evt.shiftKey && gselectedList.length > 0) { var first = gselectedList[0]; unselectAllFileItems(true);
selectRangeByShift(first, item.id); setTimeout(function () { dispatchDEXTX5Event("itemselect", createDEXTX5Event("itemselect", { id: gvector.elementId, itemIndex: gsortedList.indexOf(item.id), itemId: item.id, itemType: item.type })); }, 1); } else { unselectAllFileItems(true); selectFileItem(item.id, true); setTimeout(function () { dispatchDEXTX5Event("itemselect", createDEXTX5Event("itemselect", { id: gvector.elementId, itemIndex: gsortedList.indexOf(item.id), itemId: item.id, itemType: item.type })); }, 1);
} } } function onFileItemKeyDownHandler(evt) { if (evt.defaultPrevented) {   return; } var keyValue = evt.keyCode;     evt.preventDefault(); evt.stopPropagation(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return; }                       if (keyValue == 33 || keyValue == 34 || keyValue == 35 || keyValue == 36 || keyValue == 38 || keyValue == 40 || keyValue == 39 || keyValue == 37) { var area = svgh.getAsUnit("UIC-FILE-AREA");     var first = getSelectedFirstSVGUnit(true); var last = getSelectedLastSVGUnit(true);
if (first == null || last == null) return;   var sibling = getRelativeSVGUnit(last, keyValue);   if (!sibling) return; if (!(sibling.element instanceof SVGElement)) return; var clss = sibling.att("class"); if (!clss || clss.indexOf("css-item") != 0) return;   var bound = sibling.getBound();   if (bound.bottom > (area.getYinViewbox(0) + area.getSVGHLen(0))) { gui.scrollTo(gsortedList.indexOf(sibling.getId())); } else if (bound.top < area.getYinViewbox(0)) { gui.scrollTo(gsortedList.indexOf(sibling.getId())); }
  unselectAllFileItems(true); if (evt.shiftKey) {     var fbound = first.getBound(); selectRangeByShift(first.getId(), sibling.getId(), fbound.top < bound.top); } else { selectFileItem(sibling.getId(), true); } setTimeout(function () { dispatchDEXTX5Event("itemselect", createDEXTX5Event("itemselect", { id: gvector.elementId, itemIndex: gsortedList.indexOf(sibling.getId()), itemId: sibling.getId(), itemType: sibling.element.type })); }, 1); } else if (keyValue == 46 || keyValue == 8) {     var dtargets = []; for (var i = 0, len = gselectedList.length, item = null; i < len; i++) {
item = gfileEngine.ufiles.getItem(gselectedList[i]); if (!item) continue; else if (item.lock === true) { errorOut("ESVG-00052", gRB.get("ESVG-00052", "_잠겨 있는 항목이 존재하므로 삭제할 수 없습니다.")); return; } else { dtargets.push(item.id); } } if (dtargets.length > 0) { removeItems(dtargets, false, true); } else { errorOut("ESVG-00038", gRB.get("ESVG-00038", "_삭제할 대상이 없습니다.")); } } } function onRunFileHandler(evt) { evt.stopPropagation(); evt.preventDefault(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return;
} var t = evt.currentTarget; if (t.correspondingUseElement) t = t.correspondingUseElement; var item = t.dataItem; if (item) { if (item.type != "VIRTUAL") { errorOut("ESVG-00041", gRB.get("ESVG-00041", "_가상 파일만 열 수 있습니다.")); } else if (!item.openUrl) { errorOut("ESVG-00040", gRB.get("ESVG-00040", "_경로(다운로드, 열기)가 정의되지 않았습니다.")); } else { gfileEngine.run(item.id); } } } function onDownloadFileHandler(evt) { evt.stopPropagation(); evt.preventDefault(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return;
} var t = evt.currentTarget; if (t.correspondingUseElement) t = t.correspondingUseElement; var item = t.dataItem; if (item) { if (item.type != "VIRTUAL") { errorOut("ESVG-00031", gRB.get("ESVG-00031", "_가상 파일만 다운로드할 수 있습니다.")); } else if (!item.downUrl) { errorOut("ESVG-00040", gRB.get("ESVG-00040", "_경로(다운로드, 열기)가 정의되지 않았습니다.")); } else if (genvironment.supportedOSForSingleDownload === false) { errorOut("ESVG-00084", gRB.get("ESVG-00084", "_대상 환경은 파일 다운로드를 지원하지 않습니다.")); return; } else { if (gvector.useHDWhenSingle === true) {  
dispatchDEXTX5Event("downloadToHDForSingle", createDEXTX5Event("downloadToHDForSingle", { id: gvector.elementId, itemId: item.id })); } else { gfileEngine.download([item.id]); } } } } function onDeleteFileHandler(evt) { evt.stopPropagation(); evt.preventDefault(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return; } var t = evt.currentTarget; if (t.correspondingUseElement) t = t.correspondingUseElement; var item = t.dataItem; if (item && item.lock === false) { removeItems([item.id], false, true);
} } function onFileCheckHandler(evt) { evt.stopPropagation(); evt.preventDefault(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return; } var t = evt.target;   if (t.correspondingUseElement) t = t.correspondingUseElement;         if (!t.dataItem) { if (!t.id || t.id != "UIC-HEADER-CHECKER-NOT" || t.id != "UIC-HEADER-CHECKER-CHK") { t = evt.currentTarget; if (t.correspondingUseElement) t = t.correspondingUseElement; } } if (t && t.dataItem) { t.dataItem.checked = !t.dataItem.checked;
checkItem(t.dataItem); } else if (t.id === "UIC-HEADER-CHECKER-NOT") {   for (var i = 0, len = gfileEngine.ufiles.length, item = null; i < len; i++) { item = gfileEngine.ufiles[i]; item.checked = true; checkItem(item); } } else if (t.id === "UIC-HEADER-CHECKER-CHK") { for (var i = 0, len = gfileEngine.ufiles.length, item = null; i < len; i++) { item = gfileEngine.ufiles[i]; item.checked = false; checkItem(item); } } else { return; } var count = 0, len = gfileEngine.ufiles.length;   if (svgh.get("UIC-HEADER-CHECKER") && len > 0) { for (var i = 0, item = null; i < len; i++) {
item = gfileEngine.ufiles[i]; count += (item.checked ? 1 : 0); } svgh.get("UIC-HEADER-CHECKER-NOT").style.display = count == len ? "none" : "block"; svgh.get("UIC-HEADER-CHECKER-CHK").style.display = count == len ? "block" : "none"; } setTimeout(function () { dispatchDEXTX5Event("itemCheck", createDEXTX5Event("itemCheck", { id: gvector.elementId, count: count })); }, 1); } function onFileAreaWheelHandler(evt) {   if (!gvector.wheelEnabled) return; if (evt.stopPropagation) evt.stopPropagation(); if (evt.preventDefault) evt.preventDefault(); var wd = 0;
        if (evt.detail) wd = evt.detail > 0 ? -1 : 1;     else if (evt.wheelDelta) wd = evt.wheelDelta > 0 ? 1 : -1; else return; if (wd == 1) { gui.scrollRegion("up"); } else if (wd == -1) { gui.scrollRegion("down"); } } function errorOut(cd, msg, parameters) {   if (gui) gui.toggleJobWorking(false); var maked = parameters ? sformat(msg, parameters) : msg;   setTimeout(function () { dispatchDEXTX5Event("error", createDEXTX5Event("error", { id: gvector.elementId, code: cd, message: maked })); }, 10); }
function resetHtmlFiles() { var input; input = svgh.get("XHTML-INPUT-FILES"); if (input && input.files && input.files.length > 0) { svgh.get("XHTML-FILE-FORM").reset(); } input = svgh.get("XHTML-INPUT-FOLDER"); if (input && input.files && input.files.length > 0) { svgh.get("XHTML-FILE-FORM").reset(); } } function getCheckedItemIds() { var checkeds = [];   gfileEngine.ufiles.forEach(function (v, i) { if (v.checked === true) checkeds.push(v.id); }); return checkeds; } function queryItems(rettype, condition) { var targets = [];
  gfileEngine.ufiles.forEach(function (v, i) { if (isDefined(condition.lock) && condition.lock != v.lock) return; if (isDefined(condition.checked) && condition.checked != v.checked) return; if (isDefined(condition.type) && condition.type != v.type) return; if (isDefined(condition.status) && condition.status != v.status) return; if (rettype == "ID") targets.push(v.id); else if (rettype == "ITEM") targets.push(v); }); return targets; } function checkNotAllowedFileExtension(list) { var al = [], nl = []; for (var i = 0, t = null, ext = null; i < list.length; i++) {
  t = list[i]; ext = getFileExtension(t.name).toLowerCase();   if (ext === "" && gvector.allowedNoExtension === false) { nl.push(t); continue; }   else if (ext === ".") { nl.push(t); continue; }   if (ext && gvector.filters.length > 0 && gvector.filters.indexOf(ext) < 0) { nl.push(t); continue; }   if (ext && gvector.reversedFilters.length > 0 && gvector.reversedFilters.indexOf(ext) >= 0) { nl.push(t); continue; } al.push(t); } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = "";
this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function checkEmptyFileInIE10(list) { var al = [], nl = []; var lessThanIE11 = (gbrowser.isIE === true && navigator.userAgent.indexOf(" MSIE ") >= 0); for (var i = 0; i < list.length; i++) { if (list[i].size == 0 && lessThanIE11) { nl.push(list[i]); } else { al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : "");
}); return str; } }; } function checkSmallerThanAllowedSize(list) { var al = [], nl = []; for (var i = 0; i < list.length; i++) { if (gvector.minFileSize >= 0 && gvector.minFileSize > list[i].size) { nl.push(list[i]); } else { al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function checkBiggerThanAllowedSize(list) { var al = [], nl = []; for (var i = 0; i < list.length; i++) {
if (gvector.maxFileSize >= 0 && gvector.maxFileSize < list[i].size) { nl.push(list[i]); } else { al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function checkAllowedTotalSize(list) { var al = [], nl = []; var sum = gfileEngine.ufiles.getTotalSize(!gvector.maxTotalSizeWithVF); for (var i = 0; i < list.length; i++) { sum += list[i].size; if (gvector.maxTotalSize >= 0 && gvector.maxTotalSize < sum) {
nl.push(list[i]); } else { al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function checkAllowedCount(list) { var al = [], nl = []; var clen = gfileEngine.ufiles.getLength(!gvector.maxFileCountWithVF); for (var i = 0; i < list.length; i++) { clen += 1; if (gvector.maxFileCount >= 0 && gvector.maxFileCount < clen) { nl.push(list[i]); } else {
al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function isFileDuplication(file) { for (var i = 0, len = gfileEngine.ufiles.length, t = null; i < len; i++) { t = gfileEngine.ufiles[i]; if (t.name.toLowerCase() == file.name.toLowerCase() && t.size == file.size && t.mdate.getTime() == file.lastModifiedDate.getTime()) { return true; }
} return false; } function checkDuplication(list) { var al = [], nl = []; for (var i = 0, len = list.length; i < len; i++) { if (isFileDuplication(list[i])) { nl.push(list[i]); } else { al.push(list[i]); } } return { allowed: al, not: nl, getNotAllowedNames: function (splitter) { var str = ""; this.not.forEach(function (v, i) { str += v.name + ((i + 1) < this.not.length ? splitter : ""); }); return str; } }; } function isImageFile(file) { if (!file) return false; if (!isFile(file)) return false; var imgPattern = new RegExp("^image\/");
return imgPattern.test(file.type); } function registerLocalFiles(list) {   var clen = 0, rest = 0, alen = 0, ti = -1, rs = null, tempList = null, evret = null;   evret = dispatchDEXTX5Event("beforeItemsAdd", createDEXTX5Event("beforeItemsAdd", { id: gvector.elementId, count: list.length })); if (!evret.go) return false; if (gvector.duplicable === false) { var rs = checkDuplication(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00001", "_총 {0}개의 파일 중, {1}개의 파일이 중복 대상입니다.\n나머지 파일을 추가하시겠습니까?"), [list.length, rs.not.length]))) { list = rs.allowed;
} else return false; } else { alert(gRB.get("TSVG-00009", "_중복된 항목을 삭제하였습니다.\n추가할 항목이 없습니다.")); return false; } } else { errorOut("ESVG-00033", gRB.get("ESVG-00033", "_중복 파일을 허용하지 않습니다.")); return false; } } } rs = checkNotAllowedFileExtension(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00002", "_총 {0}개의 파일 중, {1}개의 파일은 허용하지 않는 파일 형식입니다.\n나머지 파일을 추가하시겠습니까?"), [list.length, rs.not.length]))) { list = rs.allowed; } else return false;
} else { alert(gRB.get("TSVG-00010", "_허가되지 않은 확장자 파일이 삭제 되었습니다.\n추가할 항목이 없습니다.")); return false; } } else { errorOut("ESVG-00010", gRB.get("ESVG-00010", "_허용되지 않는 파일 형식입니다.")); return false; } } rs = checkEmptyFileInIE10(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00002", "_총 {0}개의 파일 중, {1}개의 파일은 허용하지 않는 파일 형식입니다.\n나머지 파일을 추가하시겠습니까?"), [list.length, rs.not.length]))) { list = rs.allowed; } else return false; } else {
alert(gRB.get("TSVG-00011", "_0 바이트 크기를 갖는 파일이 삭제 되었습니다.\n추가할 항목이 없습니다.")); return false; } } else { errorOut("ESVG-00058", gRB.get("ESVG-00058", "_브라우저 제한 조건에 따라 0 바이트 크기를 갖는 파일은 추가할 수 없습니다.")); return false; } } rs = checkSmallerThanAllowedSize(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00006", "_총 {0}개의 파일 중, {1}개의 파일은 개별 최소 크기보다 미만입니다.\n나머지 파일을 추가하시겠습니까?"), [list.length, rs.not.length]))) { list = rs.allowed; } else return false;
} else { alert(sformat(gRB.get("TSVG-00012", "_{0} 보다 작은 파일이 삭제 되었습니다.\n추가할 항목이 없습니다."), [gvector.minFileSize])); return false; } } else { errorOut("ESVG-00015", gRB.get("ESVG-00015", "_{0} 보다 작은 파일은 전송할 수 없습니다."), [gvector.minFileSize]); return false; } } rs = checkBiggerThanAllowedSize(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00003", "_총 {0}개의 파일 중, {1}개의 파일은 개별 최대 크기 제한을 초과했습니다.\n나머지 파일을 추가하시겠습니까?"), [list.length, rs.not.length]))) { list = rs.allowed;
} else return false; } else { alert(sformat(gRB.get("TSVG-00013", "_{0} 보다 큰 파일이 삭제 되었습니다.\n추가할 항목이 없습니다."), [gvector.maxFileSize])); return false; } } else { errorOut("ESVG-00008", gRB.get("ESVG-00008", "_{0} 보다 큰 파일은 전송할 수 없습니다."), [gvector.maxFileSize]); return false; } } rs = checkAllowedTotalSize(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00004", "_전송할 수 있는 전체 파일의 최대 크기를 넘었습니다.\n총 {0}개의 파일 중, {1}개의 파일만 추가하시겠습니까?"), [list.length, rs.allowed.length]))) { list = rs.allowed;
} else return false; } else { alert(sformat(gRB.get("TSVG-00014", "_전송할 수 있는 전체 파일의 최대 크기({0})를 넘었습니다.\n추가할 항목이 없습니다."), [gvector.maxTotalSize])); return false; } } else { errorOut("ESVG-00009", gRB.get("ESVG-00009", "_전송할 수 있는 전체 파일의 최대 크기는 {0}입니다."), [gvector.maxTotalSize]); return false; } } rs = checkAllowedCount(list); if (rs.not.length > 0) { if (!gvector.filterSilence) { if ((list.length - rs.not.length) > 0) { if (confirm(sformat(gRB.get("TSVG-00005", "_전송할 수 있는 최대 파일의 개수를 넘었습니다.\n총 {0}개의 파일 중, {1}개의 파일만 추가하시겠습니까?"), [list.length, rs.allowed.length]))) { list = rs.allowed;
} else return false; } else { alert(sformat(gRB.get("TSVG-00015", "_전송할 수 있는 파일의 최대 개수({0})를 넘었습니다.\n추가할 항목이 없습니다."), [gvector.maxFileCount])); return false; } } else { errorOut("ESVG-00007", gRB.get("ESVG-00007", "_전송할 수 있는 파일의 개수는 최대 {0}개 입니다."), [gvector.maxFileCount]); return false; } }   gui.toggleJobWorking(true);   asyncRegisterOneFile(document.createDocumentFragment(), list, 0, 0); return true; } function asyncRegisterOneFile(fragment, list, index, count) { var evret = null;   evret = dispatchDEXTX5Event("itemAdding", createDEXTX5Event("itemAdding", { id: gvector.elementId, file: list[index] })); if (!evret.go) {
  } else {   var fitem = gfileEngine.addFile(list[index]), uitem = null;   gui.displayJobWorking(fitem.name);   fitem.onUpdated = function (t) { gui.updateUIItem(t); };   if (gvector.uitype == "SINGLE") { gui.createUIItem(fitem); } else { fragment.appendChild(gui.createUIItem(fitem)); }   gsortedList.push(fitem.id);   count++; } index++; if (index < list.length) {   setTimeout(function () { asyncRegisterOneFile(fragment, list, index, count); }, 50); } else {   resetHtmlFiles(); setTimeout(function () { gui.displayJobWorking("Relayout...");
if (gvector.uitype != "SINGLE") { svgh.get("UIC-FILE-AREA").appendChild(fragment);   if (gvector.autoSortingType > 0) { console.log("DX5: auto sorting... type=" + gvector.autoSortingType); sortByName(gvector.autoSortingType == 1); } } gui.updateHeaderChecker(); gui.updateCurrentFilesInfo(); gui.updateUI(); gui.toggleJobWorking(false);   setTimeout(function () { dispatchDEXTX5Event("itemsAdded", createDEXTX5Event("itemsAdded", { id: gvector.elementId, count: count })); }, 100); }, 50); } } function registerVirtualFiles(list) {  
gui.toggleJobWorking(true);   asyncRegisterOneVirtualFile(document.createDocumentFragment(), list, 0); } function asyncRegisterOneVirtualFile(fragment, list, index) {   var fitem = gfileEngine.addFile(list[index]), uitem = null;   gui.displayJobWorking(fitem.name);   uitem = gui.createUIItem(fitem);   fitem.onUpdated = function (t) { gui.updateUIItem(t); };   fragment.appendChild(uitem);   gsortedList.push(fitem.id); index++; if (index < list.length) {   setTimeout(function () { asyncRegisterOneVirtualFile(fragment, list, index); }, 50); } else { 
setTimeout(function () { gui.displayJobWorking("Relayout..."); svgh.get("UIC-FILE-AREA").appendChild(fragment);   if (gvector.autoSortingType > 0) { console.log("DX5: auto sorting... type=" + gvector.autoSortingType); sortByName(gvector.autoSortingType == 1); }   gui.updateHeaderChecker();   gui.updateCurrentFilesInfo(); gui.updateUI(); gui.toggleJobWorking(false); }, 50); } } function removeItems(arr, permanently, fireEvent) { var target, id = "", real = [], count = 0, evret = null, last = -1;   if (fireEvent === true) {
evret = dispatchDEXTX5Event("beforeItemsDelete", createDEXTX5Event("beforeItemsDelete", { id: gvector.elementId, arr: arr })); if (!evret.go) return false; }   while (arr.length > 0) { id = arr.shift();   if (fireEvent === true) { evret = dispatchDEXTX5Event("itemDeleting", createDEXTX5Event("itemDeleting", { id: gvector.elementId, itemId: id }));   if (!evret.go) continue; }   target = gfileEngine.ufiles.getItem(id); if (target && target.lock != true) {   gfileEngine.ufiles.removeById(id);   if (target.type == "VIRTUAL" && permanently === false) { target.type = "DVIRTUAL";
  target.checked = false; gfileEngine.xfiles.push(target); } } else { continue; }   real.push(id);   count++;   gui.deleteUIItem(target); }     if (real.length > 0) last = gsortedList.indexOf(real[0]) - 1;   gselectedList = SETOPS.minus(gselectedList, real);  gsortedList = SETOPS.minus(gsortedList, real);   gui.updateUI();   if (last >= 0) gui.scrollTo(last);   gui.updateHeaderChecker(); gui.updateCurrentFilesInfo();   gui.updateUI(); if (fireEvent === true) {   setTimeout(function () { dispatchDEXTX5Event("itemsDeleted", createDEXTX5Event("itemsDeleted", { id: gvector.elementId, count: count })); }, 100);
} return real.length > 0; } function checkItem(t) {   if (checkStrongDataType(USER_DATA_TYPE.STRING, t)) { t = gfileEngine.ufiles.getItem(t); } if (t) { svgh.get(t.id + "-CHECKER-NOT").style.display = t.checked ? "none" : "block"; svgh.get(t.id + "-CHECKER-CHK").style.display = t.checked ? "block" : "none"; return true; } else { errorOut("ESVG-00011", gRB.get("ESVG-00011", "_파일 항목이 없어 체크/해지 작업을 할 수 없습니다.")); return false; } } function loadParameters(svgParameters) {   var defs = document.getElementsByTagName("defs"); if (defs.length > 0) {
var refs = defs[0].getElementsByTagName("ref"); if (refs.length > 0) { for (var i = 0; i < refs.length; i++) { var defval = refs[i].getAttribute("default"); if (!defval) { defval = refs[i].firstChild ? refs[i].firstChild.nodeValue : ""; } svgParameters[refs[i].getAttribute("param")] = defval; } } }   var tokens = document.defaultView.location.href.split("?"); if (tokens.length == 2) { var p = tokens[1].split(/&|;|#/); if (p.length > 0) { for (var i = 0; i < p.length; i++) { var vals = p[i].split("="); if (vals && vals.length == 2)
svgParameters[unescape(vals[0])] = unescape(vals[1]); } } }   if (document.defaultView.frameElement) { var params = document.defaultView.frameElement.getElementsByTagName("param"); if (params.length > 0) { for (var i = 0; i < params.length; i++) { svgParameters[params[i].getAttribute("name")] = params[i].getAttribute("value"); } } } } function createDEXTX5Event(name, attrs) { var evt = null; if (document.createEvent) { evt = document.createEvent("Event"); evt.initEvent(name, true, true); } else { evt = document.createEventObject();
evt.eventType = name; } for (var n in attrs) { evt[n] = attrs[n]; }   return evt; } function dispatchDEXTX5Event(name, evt) {   var ret = { go: false, value: null }; try { if (document.dispatchEvent) { ret.go = document.dispatchEvent(evt); } else { ret.go = document.fireEvent("on" + name, evt); }   ret.go = ret.go === false ? false : true;   if (evt.funcValue) ret.value = evt.funcValue; } catch (e) {   ret.go = false; errorOut("ESVG-00017", gRB.get("ESVG-00017", "_{0} 이벤트 호출 과정에서 오류가 발생했습니다./n{1}"), [name, e.message]); }
  return ret; } function getIconFilename(filename, isBig) { var ix = filename.lastIndexOf("."), ext = (ix >= 0) ? filename.substring(ix + 1).toLowerCase() : "", svgname = "default"; if (!ext) svgname = "default"; else if (gvector.fileFormats.image.indexOf(ext) != -1) svgname = "image"; else if (gvector.fileFormats.video.indexOf(ext) != -1) svgname = "movie"; else if (gvector.fileFormats.audio.indexOf(ext) != -1) svgname = "music"; else if (gvector.fileFormats.msdoc.indexOf(ext) != -1) svgname = "doc"; else if (gvector.fileFormats.msxls.indexOf(ext) != -1) svgname = "xls";
else if (gvector.fileFormats.msppt.indexOf(ext) != -1) svgname = "ppt"; else if (gvector.fileFormats.archv.indexOf(ext) != -1) svgname = "zip"; else if (gvector.fileFormats.exec.indexOf(ext) != -1) svgname = "exe"; else if (gvector.fileFormats.html.indexOf(ext) != -1) svgname = "htm"; else if (gvector.fileFormats.flash.indexOf(ext) != -1) svgname = "fla"; else if (gvector.fileFormats.outlook.indexOf(ext) != -1) svgname = "pst"; else if (gvector.fileFormats.document.indexOf(ext) != -1) svgname = "txt"; else if (gvector.fileFormats.clang.indexOf(ext) != -1) svgname = "ccp";
else if (gvector.fileFormats.cpplang.indexOf(ext) != -1) svgname = "cpp"; else if (gvector.fileFormats.rubylang.indexOf(ext) != -1) svgname = "rb"; else if (gvector.fileFormats.objclang.indexOf(ext) != -1) svgname = "objc"; else if (gvector.fileFormats.javalang.indexOf(ext) != -1) svgname = "java"; else if (gvector.fileFormats.etclang.indexOf(ext) != -1) svgname = "etclang"; else if (gvector.fileFormats.font.indexOf(ext) != -1) svgname = "font"; else if (gvector.fileFormats.adobePremiere.indexOf(ext) != -1) svgname = "pr"; else if (gvector.fileFormats.adobeAfterEffect.indexOf(ext) != -1) svgname = "ae";
else if (gvector.fileFormats.threeDimension.indexOf(ext) != -1) svgname = "3d"; else if (gvector.fileFormats.asp.indexOf(ext) != -1) svgname = "asp"; else if (gvector.fileFormats.data.indexOf(ext) != -1) svgname = "dat"; else if (gvector.fileFormats.others.indexOf(ext) != -1) svgname = ext; else svgname = "default"; return svgname + "_" + (isBig === true ? "big" : "small") + ".svg"; } function existFileItem(id) { for (var i = 0; i < gselectedList.length; i++) { if (gselectedList[i] == id) return true; }
return false; } function animateTileItem(id) { var svg = svgh.query("#" + id), grp = svgh.query("#" + id + " .css-item-info"), ypos = 0, frameId = 0; function doScrollAnimation(timestamp) { if (ypos < -13) { svgh.attr(svg, "class", "selected", true); cancelAnimationFrame(frameId); return; } ypos--;     grp.transform.baseVal.getItem(0).setTranslate(0, ypos); frameId = requestAnimationFrame(doScrollAnimation); } frameId = requestAnimationFrame(doScrollAnimation); } function selectFileItem(id, stopDrawing) {  
if (gselectedList.indexOf(id) >= 0) return; gselectedList.push(id); var item = svgh.get(id); svgh.attr(item, "class", "selected", true); if (!stopDrawing) { gui.updateUI(); } } function unselectFileItem(id, stopDrawing) { var index = gselectedList.indexOf(id); if (index >= 0) {   gselectedList.splice(index, 1); var items = svgh.queryAll("#" + id); for (var i = 0; i < items.length; i++) { svgh.removeAttr(items[i], "class", "selected"); } if (!stopDrawing) { gui.updateUI(); } } } function selectAllFileItems(stopDrawing) { gselectedList = [];
var items = svgh.queryAll(".css-item"); for (var i = 0, len = items.length, t = null; i < len; i++) { t = items[i]; svgh.attr(t, "class", "selected", true); gselectedList.push(t.id); } if (!stopDrawing) { gui.updateUI(); } } function unselectAllFileItems(stopDrawing) { var items = svgh.queryAll(".css-item"); for (var i = 0; i < items.length; i++) { svgh.removeAttr(items[i], "class", "selected"); } gselectedList = []; if (!stopDrawing) { gui.updateUI(); } } function selectRangeByShift(start, end, isBelow) { var range = false;
selectFileItem(start, true); if (start == end) return;   var fitems = document.querySelectorAll("#UIC-FILE-AREA .css-item"); var current = null; for (var i = 0; i < fitems.length; i++) { current = isBelow ? fitems[i] : fitems[fitems.length - 1 - i]; if (range === false && (current.id == start || current.id == end)) {   range = true; } else if (range === true && (current.id == start || current.id == end)) {   break; } else if (range == true) {   selectFileItem(current.id, true); } } selectFileItem(end, true); }
function sortItems(name, type, dir) {   var items = gui.getAllItems(); var comparer;   if (type == "S") comparer = window.compareString; else if (type == "N") comparer = window.compareNumber; else if (type == "C") comparer = window.compareString; else return;   var selector = type == "C" ? function (t, n) { return t.meta[n] || ""; } : function (t, n) { return t[n]; };   var sorting = (dir == "asc") ? function (a, b) { return comparer(a, b); } : function (a, b) { return comparer(b, a); };   items.sort(function (x1, x2) { var i1 = x1.querySelector("svg>g").dataItem;
var i2 = x2.querySelector("svg>g").dataItem; if (gvector.sortPriorityVF === true) { var at = i1["type"]; var bt = i2["type"]; if (at == "VIRTUAL" && bt == "FILE") return -1; else if (at == "FILE" && bt == "VIRTUAL") return 1; else return sorting(selector(i1, name), selector(i2, name)); } else return sorting(selector(i1, name), selector(i2, name)); });   gui.clearAllItems();   gsortedList = []; for (var i = 0, len = items.length, t = null; i < len; i++) { t = items[i]; gsortedList.push(t.id); gui.attachItem(t, i); }
} function sortByName(asc) { Array.from(svgh.queryAll(".css-header-sort-button")).forEach(function (v) { v.style.display = "none"; }); var btnObj = svgh.get("UIC-HEADER-NAME"); if (btnObj) { if (typeof btnObj["data-sort-asc"] === "undefined") { btnObj["data-sort-asc"] = false; }   btnObj["data-sort-asc"] = isDefined(asc) == false ? !btnObj["data-sort-asc"] : asc; asc = btnObj["data-sort-asc"];   var icoAsc = svgh.get("UIC-SORT-BUTTON-ASC-NAME"), icoDesc = svgh.get("UIC-SORT-BUTTON-DSC-NAME"); if (icoAsc && icoDesc) { icoAsc.style.display = asc ? "block" : "none";
icoDesc.style.display = asc ? "none" : "block"; } } else if (isDefined(asc) == false) {   return; } sortItems("name", "S", asc ? "asc" : "desc"); } function sortBySize(asc) { Array.from(svgh.queryAll(".css-header-sort-button")).forEach(function (v) { v.style.display = "none"; }); var btnObj = svgh.get("UIC-HEADER-SIZE"); if (btnObj) { if (typeof btnObj["data-sort-asc"] === "undefined") { btnObj["data-sort-asc"] = false; }   btnObj["data-sort-asc"] = isDefined(asc) == false ? !btnObj["data-sort-asc"] : asc; asc = btnObj["data-sort-asc"];
  var icoAsc = svgh.get("UIC-SORT-BUTTON-ASC-SIZE"), icoDesc = svgh.get("UIC-SORT-BUTTON-DSC-SIZE"); if (icoAsc && icoDesc) { icoAsc.style.display = asc ? "block" : "none"; icoDesc.style.display = asc ? "none" : "block"; } } else if (isDefined(asc) == false) {   return; } sortItems("size", "N", asc ? "asc" : "desc"); } function sortByColumn(column, asc) { Array.from(svgh.queryAll(".css-header-sort-button")).forEach(function (v) { v.style.display = "none"; }); var encodedkey = column.key.replace(/\s/, "_"); var btnObj = svgh.getAsUnit("UIC-COLS-HEADER-BK-" + encodedkey);
if (btnObj) { var btnSortAsc = svgh.getAsUnit("UIC-COLS-SORT-BUTTON-ASC-" + encodedkey); var btnSortDsc = svgh.getAsUnit("UIC-COLS-SORT-BUTTON-DSC-" + encodedkey); if (!btnObj.has("data-sort-asc")) btnObj.atto("data-sort-asc", false);   asc = isDefined(asc) == false ? !btnObj.atto("data-sort-asc") : asc; btnObj.atto("data-sort-asc", asc);   if (btnSortAsc) btnSortAsc.css("display", asc ? "block" : "none"); if (btnSortDsc) btnSortDsc.css("display", asc ? "none" : "block"); } else if (isDefined(asc) == false) {  
return; } var type = ""; switch (column.key) { case "name": type = "S"; break; case "size": type = "N"; break; default: type = "C"; break; } sortItems(column.key, type, asc ? "asc" : "desc"); } function onSortHeaderColumnHandler(evt) { if (!gvector.enableColumnSorting) return; if (evt.stopPropagation) evt.stopPropagation(); if (evt.preventDefault) evt.preventDefault(); if (gfileEngine.acting) {     errorOut("ESVG-00024", gRB.get("ESVG-00024", "_파일을 전송하고 있는 상태입니다.")); return; } else { var bk = svgh.getAsUnit(evt.currentTarget.id); if (bk) {
sortByColumn(gui.columns[bk.att("data-column-key")]); } } } 