|
@@ -47,16 +47,18 @@
|
|
|
<div onclick="menuOpen(event, 'upload-items')">
|
|
|
<div>업로드</div>
|
|
|
<div class="upload-items click-menu">
|
|
|
- <div style="width: 160px;">폴더</div>
|
|
|
- <div style="width: 160px;">파일</div>
|
|
|
+ <div style="width: 160px;" onclick="openFolder(event)">폴더</div>
|
|
|
+ <div style="width: 160px;" onclick="openFile(event)">파일</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <input type="file" style="display: none;" id="folder-upload" name="folder" onchange="uploadFolders(event)" webkitdirectory multiple >
|
|
|
+ <input type="file" style="display: none;" id="file-upload" name="file" onchange="uploadFiles(event)" multiple >
|
|
|
<div onclick="refreshDrive()">새로고침</div>
|
|
|
<div class="one-drive-button">OneDrive에서 열기</div>
|
|
|
</div>
|
|
|
<div class="panel"></div>
|
|
|
<div class="file-title">
|
|
|
- <div><img src="/static/images/file.png" width="20" alt="파일"></div>
|
|
|
+ <div><input type="checkbox" id="all-check" onchange="allSelect(event)"><img src="/static/images/file.png" width="20" alt="파일"></div>
|
|
|
<div class="head-name" onclick="sorting('name')">이름</div>
|
|
|
<div class="head-size" onclick="sorting('size')">용량</div>
|
|
|
<div class="head-lastModifiedDateTime" onclick="sorting('lastModifiedDateTime')">수정된 날짜</div>
|
|
@@ -70,6 +72,7 @@
|
|
|
</body>
|
|
|
</html>
|
|
|
<script>
|
|
|
+ let _formData = new FormData($('<form enctype="multipart/form-data"></form>')[0]);
|
|
|
const groupId = '3df73dac-a8bc-4dd0-9159-fdb2c696c067';
|
|
|
const groupMap = new Map();
|
|
|
let _selectedData = [];
|
|
@@ -86,13 +89,113 @@
|
|
|
})
|
|
|
|
|
|
});
|
|
|
+ function openFolder(event) {
|
|
|
+ if (!$('.panel-item.on')[0]) return;
|
|
|
+ $('#folder-upload').click();
|
|
|
+ }
|
|
|
+
|
|
|
+ function openFile(event) {
|
|
|
+ if (!$('.panel-item.on')[0]) return;
|
|
|
+ $('#file-upload').click();
|
|
|
+ }
|
|
|
+ function allSelect(event) {
|
|
|
+ const isChecked = $(event.target).is(':checked');
|
|
|
+ $('.file-content input[type="checkbox"]').prop('checked', isChecked);
|
|
|
+ }
|
|
|
+
|
|
|
+ function uploadFiles(event) {
|
|
|
+ const files = event.target.files;
|
|
|
+ const alertTitle = '파일 업로드';
|
|
|
+ _formData = new FormData($('<form enctype="multipart/form-data"></form>')[0]);
|
|
|
+ if (files && files.length > 100) {
|
|
|
+ return alertMessage(alertTitle, '업로드 파일은 최대 100개 까지 가능합니다.<br>업로드 파일 수 : '+ files.length, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ let siteId = getSitesId();
|
|
|
+
|
|
|
+ if (siteId === null) {
|
|
|
+ return alertMessage(alertTitle, '선택된 그룹 정보를 찾을 수 없습니다. 생성할 그룹을 선택해주세요.', null);
|
|
|
+ }
|
|
|
+
|
|
|
+ const groupIndex = _listData.joinedTeams.teams.findIndex(obj => obj.sharePoint.siteId === siteId);
|
|
|
+ const pathArr = $('.panel').children();
|
|
|
+
|
|
|
+ if (groupIndex >= 0 && $('.panel').children().length === 1) {
|
|
|
+ return alertMessage(alertTitle,'채널에는 업로드 할 수 없습니다. 채널 리스트를 먼저 선택해 주세요.');
|
|
|
+ }
|
|
|
+
|
|
|
+ let sitePath = '/drive/root';
|
|
|
+ let filePath = '';
|
|
|
+ if (pathArr.length > 1) {
|
|
|
+ sitePath += ':';
|
|
|
+ for (let ii = 0; ii < pathArr.length; ii++) {
|
|
|
+ const path = pathArr.eq(ii).text();
|
|
|
+ if (ii !== 0 && path !== " > ") {
|
|
|
+ sitePath += "/" + path;
|
|
|
+ filePath += "/" +path;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (let file of files) {
|
|
|
+
|
|
|
+ let fileName = file.name;
|
|
|
+ if (file.name.indexOf('.') > 0) {
|
|
|
+ fileName = file.name.substring(0, file.name.lastIndexOf('.'));
|
|
|
+ }
|
|
|
+
|
|
|
+ _formData.append('file', file);
|
|
|
+ _formData.append(fileName + '_path', filePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ _formData.append('siteId', siteId);
|
|
|
+ _formData.append('path', sitePath);
|
|
|
+ // _formData.getAll()
|
|
|
+ $('body').append(`<div id="load">
|
|
|
+ <img src="/static/images/Settings.gif" alt="loading">
|
|
|
+ </div>`);
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ method: 'post',
|
|
|
+ processData : false,
|
|
|
+ contentType : false,
|
|
|
+ data : _formData,
|
|
|
+ url : '/uploadItems',
|
|
|
+ success: (res) => {
|
|
|
+ $('#load').remove();
|
|
|
+ let str = res.message;
|
|
|
+
|
|
|
+ if (res.error) {
|
|
|
+ str += '<br>오류 : ' + res.error;
|
|
|
+ }
|
|
|
+
|
|
|
+ alertMessage(alertTitle, str, null);
|
|
|
+ const selectDrive = $('.panel-item.on');
|
|
|
+ selectDrive.removeClass('on');
|
|
|
+ selectDrive.click();
|
|
|
+
|
|
|
+ },
|
|
|
+ error: (error) => {
|
|
|
+ $('#load').remove();
|
|
|
+ alertMessage(alertTitle, error, null);
|
|
|
+ // console.log('==============error=============\n');
|
|
|
+ // console.log(error);
|
|
|
+ },
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ function uploadFolders(event) {
|
|
|
+ console.log(event);
|
|
|
+ event.file;
|
|
|
+ }
|
|
|
|
|
|
function menuOpen(event, className) {
|
|
|
event.preventDefault();
|
|
|
event.stopPropagation();
|
|
|
$('.click-menu:not(.'+className+')').css('display', 'none');
|
|
|
$('.' + className).toggle();
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
function drawDriveFiles(jsonData, parentData, name) {
|
|
|
_selectedData = [];
|
|
@@ -121,7 +224,7 @@
|
|
|
}
|
|
|
let str = "";
|
|
|
jsonData.value.forEach((obj, idx)=>{
|
|
|
- dragAndDrop(obj.id);
|
|
|
+ dragAndDrop();
|
|
|
let images = "/static/images/";
|
|
|
|
|
|
|
|
@@ -135,10 +238,15 @@
|
|
|
else if (obj.file && obj.name) {
|
|
|
let ext = obj.name.substring(obj.name.lastIndexOf('.') + 1);
|
|
|
let imageExt = ".svg";
|
|
|
- if (obj.file.mimeType && obj.file.mimeType.includes('image')){
|
|
|
+ //photo
|
|
|
+ // if (obj.file.mimeType && obj.file.mimeType.includes('image')){
|
|
|
+ if (['psd', 'bmp', 'rle', 'dib', 'jpeg', 'jpg', 'gif', 'png', 'tiff', 'raw', 'ico'].includes(ext)){
|
|
|
ext = 'photo';
|
|
|
}
|
|
|
- else if (['txt'].includes(ext)) {
|
|
|
+ else if (['ai', 'eps', 'svg'].includes(ext)) {
|
|
|
+ ext = 'vector';
|
|
|
+ }
|
|
|
+ else if (['txt', 'properties'].includes(ext)) {
|
|
|
ext = 'txt';
|
|
|
}
|
|
|
else if (['pptx', 'ppt', 'pptm'].includes(ext)) {
|
|
@@ -162,18 +270,35 @@
|
|
|
else if (['zip', 'apk', 'rar', '7z', 'tar'].includes(ext)) {
|
|
|
ext = 'zip';
|
|
|
}
|
|
|
+ else if (['jsp', 'js', 'css', 'php', 'config', 'ini', 'yml', 'json'].includes(ext)) {
|
|
|
+ ext = 'code';
|
|
|
+ }
|
|
|
+ else if (['html'].includes(ext)) {
|
|
|
+ ext = 'html';
|
|
|
+ }
|
|
|
+ else if (['exe', 'msi'].includes(ext)) {
|
|
|
+ ext = 'exe';
|
|
|
+ }
|
|
|
+ else if (['jar', 'war', 'cab', 'dll', ].includes(ext)) {
|
|
|
+ ext = 'sysfile';
|
|
|
+ }
|
|
|
else if (['mp4', 'mov', 'Webm', 'mp3','wav', 'Ogg'].includes(ext)) {
|
|
|
ext = 'clipchamp';
|
|
|
}
|
|
|
+ else if (['bdf', 'chr', 'dfont', 'eot','etx', 'fnt', 'gdr', 'gf', 'mcf', 'xft', 'ttf', 'woff2',
|
|
|
+ 'mf', 'otf', 'pfa', 'pfb', 'pfr', 'sfd', 'suit', 'tfm', 'ttc', 'vlw', 'woff', 'xfn'].includes(ext)) {
|
|
|
+ ext = 'font';
|
|
|
+ }
|
|
|
+ else if (['xml'].includes(ext)) {
|
|
|
+ ext = 'xml';
|
|
|
+ }
|
|
|
else {
|
|
|
- ext = 'file';
|
|
|
- imageExt = '.png';
|
|
|
+ ext = 'genericfile';
|
|
|
}
|
|
|
-
|
|
|
images += ext + imageExt;
|
|
|
}
|
|
|
else {
|
|
|
- images += "file.png";
|
|
|
+ images += "genericfile.svg";
|
|
|
}
|
|
|
let amount = '0 Bytes';
|
|
|
if (obj.size) {
|
|
@@ -194,7 +319,7 @@
|
|
|
<div id="row_${idx}">
|
|
|
<div>
|
|
|
<input type="checkbox" name="row_${idx}" value="${obj.id}" onclick="event.stopPropagation()">
|
|
|
- <img src="${images}" width="20" height="20" alt="폴더 이미지">
|
|
|
+ <img src="${images}" width="32" height="32" alt="폴더 이미지">
|
|
|
</div>
|
|
|
<div class="file_name"><span class="sp-name" onclick="${method}">${obj.name}</span></div>
|
|
|
<div>${amount}</div>
|
|
@@ -288,8 +413,9 @@
|
|
|
const checkedArr = [];
|
|
|
let siteId = getSitesId();
|
|
|
|
|
|
- if (!siteId) return alert('그룹 정보를 확인 할 수 없습니다.');
|
|
|
-
|
|
|
+ if (!siteId) {
|
|
|
+ return alertMessage('파일 삭제','그룹 정보를 확인 할 수 없습니다.');
|
|
|
+ }
|
|
|
if (checkArr.length > 0) {
|
|
|
for (let ii = 0; ii < checkArr.length; ii++) {
|
|
|
if (checkArr.eq(ii).is(':checked')) {
|
|
@@ -299,7 +425,7 @@
|
|
|
if (idx >= 0) {
|
|
|
const sameIndex = team.items[team.teams[idx].id].findIndex(obj => obj.id === checkArr.eq(ii).val());
|
|
|
if (sameIndex >= 0) {
|
|
|
- return alert('채널 정보는 삭제하실수 없습니다.');
|
|
|
+ return alertMessage('파일 삭제', '채널 정보는 삭제하실수 없습니다.');
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -307,11 +433,11 @@
|
|
|
}
|
|
|
}
|
|
|
if (checkedArr.length === 0) {
|
|
|
- alert('선택된 정보가 없습니다. 삭제하실 파일을 먼저 선택해주세요.');
|
|
|
+ alertMessage('파일 삭제', '선택된 정보가 없습니다. 삭제하실 파일을 먼저 선택해주세요.');
|
|
|
}
|
|
|
else {
|
|
|
- if (confirm('선택된 파일을 삭제하시겠습니까?')) {
|
|
|
- $.ajax({
|
|
|
+ confirmMessage('파일 삭제', '선택된 파일을 삭제하시겠습니까?', ()=>{
|
|
|
+ $.ajax({
|
|
|
method:'post',
|
|
|
url : "/deleteItems",
|
|
|
data: {
|
|
@@ -324,16 +450,14 @@
|
|
|
selectedDrive.removeClass('on');
|
|
|
selectedDrive.click();
|
|
|
}
|
|
|
- alert(res.message);
|
|
|
+ $('.modal').remove();
|
|
|
+ alertMessage('파일 삭제', res.message);
|
|
|
},
|
|
|
error: (error)=> {
|
|
|
console.log(error);
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
- else {
|
|
|
- alert('선택된 그룹 정보가 없습니다. 선택 그룹을 확인해 주세요.');
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -390,7 +514,8 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function dragAndDrop(driveId) {
|
|
|
+
|
|
|
+ function dragAndDrop() {
|
|
|
const $fileContent = $('.file-content');
|
|
|
$fileContent.off('dragover');
|
|
|
$fileContent.off('dragleave');
|
|
@@ -405,23 +530,222 @@
|
|
|
|
|
|
})
|
|
|
|
|
|
- $fileContent.on("drop", function(e){
|
|
|
- e.preventDefault();
|
|
|
- $(this).css('background-color', '#f5f5f5');
|
|
|
- const transfer = e.originalEvent.dataTransfer;
|
|
|
- if (transfer && transfer.files && transfer.files.length > 0) {
|
|
|
- for (let ii = 0; ii < transfer.files.length; ii++) {
|
|
|
- console.log(transfer.files[ii]);
|
|
|
- }
|
|
|
+ $fileContent.on("drop", async function(e){
|
|
|
+ const transfer = e.originalEvent.dataTransfer;
|
|
|
+ e.preventDefault();
|
|
|
+
|
|
|
+ $(this).css('background-color', '#f5f5f5');
|
|
|
+ const items = transfer.items;
|
|
|
+ _formData = new FormData($('<form enctype="multipart/form-data"></form>')[0]);
|
|
|
+ await getFilesDataTransferItems(items);
|
|
|
+ const folders = _formData.getAll('folder');
|
|
|
+ const files = _formData.getAll('folder');
|
|
|
+ const alertTitle = '파일 업로드';
|
|
|
+ if (folders && folders.length > 100) {
|
|
|
+ return alertMessage(alertTitle, '업로드 폴더는 최대 100개 까지 가능합니다.<br>업로드 폴더 수 : '+ folders.length, null);
|
|
|
+ // return alert('업로드 폴더는 최대 100개 까지 가능합니다.\n업로드 폴더 수 : '+ folders.length);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (files && files.length > 100) {
|
|
|
+ return alertMessage(alertTitle, '업로드 파일은 최대 100개 까지 가능합니다.\n업로드 파일 수 : '+ files.length, null);
|
|
|
+ }
|
|
|
+ let siteId = getSitesId();
|
|
|
+ if (siteId === null) {
|
|
|
+ return alertMessage(alertTitle, '선택된 그룹 정보를 찾을 수 없습니다. 생성할 그룹을 선택해주세요.', null);
|
|
|
+ }
|
|
|
+
|
|
|
+ const groupIndex = _listData.joinedTeams.teams.findIndex(obj => obj.sharePoint.siteId === siteId);
|
|
|
+ const pathArr = $('.panel').children();
|
|
|
+
|
|
|
+ if (groupIndex >= 0 && $('.panel').children().length === 1) {
|
|
|
+ return alertMessage(alertTitle,'채널에는 업로드 할 수 없습니다. 채널 리스트를 먼저 선택해 주세요.');
|
|
|
+ }
|
|
|
+
|
|
|
+ let sitePath = '/drive/root';
|
|
|
+ if (pathArr.length > 1) {
|
|
|
+ sitePath += ':';
|
|
|
+ for (let ii = 0; ii < pathArr.length; ii++) {
|
|
|
+ const path = pathArr.eq(ii).text();
|
|
|
+ if (ii !== 0 && path !== " > ") {
|
|
|
+ sitePath += "/" + path;
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ _formData.append('siteId', siteId);
|
|
|
+ _formData.append('path', sitePath);
|
|
|
+ // _formData.getAll()
|
|
|
+ $('body').append(`<div id="load">
|
|
|
+ <img src="/static/images/Settings.gif" alt="loading">
|
|
|
+ </div>`)
|
|
|
+ $.ajax({
|
|
|
+ method: 'post',
|
|
|
+ processData : false,
|
|
|
+ contentType : false,
|
|
|
+ data : _formData,
|
|
|
+ url : '/uploadItems',
|
|
|
+ success: (res) => {
|
|
|
+ $('#load').remove();
|
|
|
+ let str = res.message;
|
|
|
+ if (res.error) {
|
|
|
+ str += '<br>오류 : ' + res.error;
|
|
|
+ }
|
|
|
+ alertMessage(alertTitle, str, null);
|
|
|
+ // alert(res.message);
|
|
|
+ // console.log(res.error);
|
|
|
+ const selectDrive = $('.panel-item.on');
|
|
|
+ selectDrive.removeClass('on');
|
|
|
+ selectDrive.click();
|
|
|
+
|
|
|
+ },
|
|
|
+ error: (error) => {
|
|
|
+ $('#load').remove();
|
|
|
+ alertMessage(alertTitle, error, null);
|
|
|
+ // console.log('==============error=============\n');
|
|
|
+ // console.log(error);
|
|
|
+ },
|
|
|
+
|
|
|
+ });
|
|
|
// const file = e.originalEvent.dataTransfer.files[0];
|
|
|
- // encryptFile(file, driveId);
|
|
|
+ // encryptFile(file, driveId);
|
|
|
// if (file && file.type.startsWith("image")) {
|
|
|
- // displayImage(file);
|
|
|
+ // displayImage(file);
|
|
|
// }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function alertMessage(title, message, color) {
|
|
|
+ $('body').append($(`<div class="modal" style="display:flex;">
|
|
|
+ <div class="modal-box">
|
|
|
+ <div class="header">
|
|
|
+ <div class="title">${title}</div>
|
|
|
+ <div class="x-button">
|
|
|
+ <span><img src="/static/images/x-button.png" width="15" height="15" alt="닫기 버튼" onclick="modalClose()"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-content">
|
|
|
+ ${message}
|
|
|
+ </div>
|
|
|
+ <div class="button-box">
|
|
|
+ <div class="name-btn" onclick="modalClose()">확인</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>`));
|
|
|
+ }
|
|
|
+
|
|
|
+ function confirmMessage(title, message, method) {
|
|
|
+ $('body').append($(`<div class="modal" style="display:flex;">
|
|
|
+ <div class="modal-box">
|
|
|
+ <div class="header">
|
|
|
+ <div class="title">${title}</div>
|
|
|
+ <div class="x-button">
|
|
|
+ <span><img src="/static/images/x-button.png" width="15" height="15" alt="닫기 버튼" onclick="modalClose()"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-content">
|
|
|
+ ${message}
|
|
|
+ </div>
|
|
|
+ <div class="button-box">
|
|
|
+ <div class="success-button" >확인</div>
|
|
|
+ <div class="name-btn" onclick="modalClose()">취소</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>`));
|
|
|
+ $('.success-button').on('click', ()=>{
|
|
|
+ method();
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function confirmMethod(method) {
|
|
|
+ method();
|
|
|
+ }
|
|
|
+
|
|
|
+ function getUploadItems(dataTransferItems) {
|
|
|
+ for (let item of dataTransferItems) {
|
|
|
+ if (item.isFile) {
|
|
|
+ item.file(file => {
|
|
|
+ _formData.append('file', file);
|
|
|
+ _formData.append(file.name + '_path', item.fullPath);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else if (item.isDirectory) {
|
|
|
+ _formData.append('folder', JSON.stringify({name : item.name, path : item.fullPath}));
|
|
|
+ // _formData.append('path', item.fullPath);
|
|
|
+ let dirReader = item.createReader();
|
|
|
+ dirReader.readEntries(entries => {
|
|
|
+ for (let entry of entries) {
|
|
|
+ getUploadItems(entry);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function getFilesDataTransferItems(dataTransferItems) {
|
|
|
+ function traverseFileTreePromise(item, folder) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let subfolder = [];
|
|
|
+ let files = [];
|
|
|
+ let fileObj = {};
|
|
|
+
|
|
|
+ if (item.isFile) {
|
|
|
+ item.file(file => {
|
|
|
+ let fileName = file.name;
|
|
|
+ if (file.name.indexOf('.') > 0) {
|
|
|
+ fileName = file.name.substring(0, file.name.lastIndexOf('.'));
|
|
|
+ }
|
|
|
+ let path = item.fullPath.substring(0, item.fullPath.lastIndexOf('/'));
|
|
|
+ if (!path) {
|
|
|
+ path = '';
|
|
|
+ }
|
|
|
+ _formData.append('file', file);
|
|
|
+ _formData.append(fileName + '_path', path);
|
|
|
+ resolve(fileObj);
|
|
|
+ });
|
|
|
+ } else if (item.isDirectory) {
|
|
|
+ let dirReader = item.createReader();
|
|
|
+ const path = item.fullPath.substring(0, item.fullPath.lastIndexOf('/'));
|
|
|
+ _formData.append('folder', JSON.stringify({name : item.name, path : path}));
|
|
|
+ dirReader.readEntries(entries => {
|
|
|
+ let entriesPromises = [];
|
|
|
+ fileObj = {
|
|
|
+ path : item.fullPath,
|
|
|
+ param : {
|
|
|
+ name: item.name,
|
|
|
+ folder: {},
|
|
|
+ '@microsoft.graph.conflictBehavior': 'rename'
|
|
|
+ },
|
|
|
+ subfolder : subfolder,
|
|
|
+ };
|
|
|
+ folder.push(fileObj);
|
|
|
+
|
|
|
+ for (let entr of entries) {
|
|
|
+
|
|
|
+ entriesPromises.push(
|
|
|
+ traverseFileTreePromise(entr, subfolder)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ resolve(Promise.all(entriesPromises));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ let files = [];
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let entriesPromises = [];
|
|
|
+ for (let it of dataTransferItems)
|
|
|
+ entriesPromises.push(
|
|
|
+ traverseFileTreePromise(it.webkitGetAsEntry(), files)
|
|
|
+ );
|
|
|
+ Promise.all(entriesPromises).then(entries => {
|
|
|
+ resolve(files);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function encryptFile(file, driveId) {
|
|
|
const extArr = [
|
|
|
'lnk', 'exe', 'com', 'cmd', 'bat', 'dll', 'ini',
|
|
@@ -444,11 +768,11 @@
|
|
|
</div>
|
|
|
</div>`;
|
|
|
$('body').append($(modal));
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- uploadFiles(itemId)
|
|
|
+ uploadFiles(driveId)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function modalClose() {
|
|
@@ -478,6 +802,9 @@
|
|
|
function siteDriveChildrenItems(siteId, path, name, value, event) {
|
|
|
event.preventDefault();
|
|
|
event.stopPropagation();
|
|
|
+ if ($('#all-check').is(':checked')) {
|
|
|
+ $('#all-check').prop('checked', false);
|
|
|
+ }
|
|
|
if ($(event.target).hasClass('on')) {
|
|
|
return;
|
|
|
}
|
|
@@ -488,7 +815,7 @@
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- console.log('/sites/' +siteId + path);
|
|
|
+
|
|
|
callApi('get', '/sites/' +siteId + path, (jsonData)=>{
|
|
|
if (jsonData && jsonData.id) {
|
|
|
if (jsonData.folder && jsonData.folder.childCount === 0) {
|
|
@@ -511,6 +838,7 @@
|
|
|
<div>이 폴더는 비어 있습니다.</div>
|
|
|
</div>`);
|
|
|
$panel.html(panelStr);
|
|
|
+ dragAndDrop();
|
|
|
return;
|
|
|
}
|
|
|
callApi('get', '/sites/' +siteId +'/drive/items/'+jsonData.id+'/children', (childrenData)=>{
|
|
@@ -546,25 +874,25 @@
|
|
|
return amount;
|
|
|
}
|
|
|
|
|
|
- function uploadFiles(itemId) {
|
|
|
- //
|
|
|
+ // function uploadFiles(itemId) {
|
|
|
+ // //
|
|
|
|
|
|
- $.ajax({
|
|
|
- method: 'post',
|
|
|
- url : "/api-post",
|
|
|
- data: {
|
|
|
- api_uri: '/groups/'+groupId+'/drive/items/'+itemId+'/content',
|
|
|
- scopes : 'Files.ReadWrite',
|
|
|
- param : params,
|
|
|
- },
|
|
|
- success: (res)=> {
|
|
|
- callBackMethod(res, args);
|
|
|
- },
|
|
|
- error: (error)=> {
|
|
|
- console.log(error);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ // $.ajax({
|
|
|
+ // method: 'post',
|
|
|
+ // url : "/api-post",
|
|
|
+ // data: {
|
|
|
+ // api_uri: '/groups/'+groupId+'/drive/items/'+itemId+'/content',
|
|
|
+ // scopes : 'Files.ReadWrite',
|
|
|
+ // param : params,
|
|
|
+ // },
|
|
|
+ // success: (res)=> {
|
|
|
+ // callBackMethod(res, args);
|
|
|
+ // },
|
|
|
+ // error: (error)=> {
|
|
|
+ // console.log(error);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
|
|
|
function getGroupList() {
|
|
|
$.ajax({
|
|
@@ -712,18 +1040,18 @@
|
|
|
const name = $folderName.val();
|
|
|
if (!name || !name.trim()) {
|
|
|
$folderName.focus();
|
|
|
- return alert("폴더명을 입력해주세요.");
|
|
|
+ return alertMessage("폴더 생성", "폴더명을 입력해주세요.");
|
|
|
}
|
|
|
let siteId = getSitesId();
|
|
|
if (siteId === null) {
|
|
|
- return alert('선택된 그룹 정보를 찾을 수 없습니다. 생성할 그룹을 선택해주세요.');
|
|
|
+ return alertMessage("폴더 생성", '선택된 그룹 정보를 찾을 수 없습니다. 생성할 그룹을 선택해주세요.');
|
|
|
}
|
|
|
|
|
|
const groupIndex = _listData.joinedTeams.teams.findIndex(obj => obj.sharePoint.siteId === siteId);
|
|
|
const pathArr = $('.panel').children();
|
|
|
|
|
|
if (groupIndex >= 0 && $('.panel').children().length === 1) {
|
|
|
- return alert('채널 리스트를 먼저 선택해 주세요.');
|
|
|
+ return alertMessage("폴더 생성", '채널 리스트를 먼저 선택해 주세요.');
|
|
|
}
|
|
|
let sitePath = '/drive/root'
|
|
|
if (pathArr.length > 1) {
|
|
@@ -749,12 +1077,11 @@
|
|
|
},
|
|
|
url : '/makeFolder',
|
|
|
success: (res) => {
|
|
|
- alert('폴더가 생성되었습니다.\n폴더명 : '+ res.name);
|
|
|
$('.modal').remove();
|
|
|
+ alertMessage("폴더 생성", '폴더가 생성되었습니다.<br>폴더명 : '+ res.name);
|
|
|
const selectDrive = $('.panel-item.on');
|
|
|
selectDrive.removeClass('on');
|
|
|
selectDrive.click();
|
|
|
-
|
|
|
},
|
|
|
error: (error) => {
|
|
|
console.log('==============error=============\n');
|
|
@@ -786,11 +1113,6 @@
|
|
|
</div>`);
|
|
|
$('body').append(modalContainer);
|
|
|
|
|
|
- // callApi('post', '/sites/' +siteId +'/drive/items/'++'/children', (jsonData)=>{
|
|
|
- // console.log(jsonData);
|
|
|
- // callApi('post', '')
|
|
|
- // })
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function modalClose(){
|