|
@@ -333,17 +333,44 @@
|
|
|
|
|
|
const teamId = $('section .panel .panel-item').eq(0).attr('id');
|
|
|
const teamList = document.querySelector('#my-team').nextElementSibling.nextElementSibling;
|
|
|
+ let bindId = '';
|
|
|
let isTeam = false;
|
|
|
+ const fileName = $('section .file-content div.on .sp-name').text();
|
|
|
+
|
|
|
+ if (checkCnt === 1 && fileName) {
|
|
|
+ const frontId = 'com.microsoft.teamspace.tab.file.staticviewer.';
|
|
|
+ if (fileName.includes('.xlsx')) {
|
|
|
+ bindId = frontId + 'excel';
|
|
|
+ }
|
|
|
+ else if (fileName.includes('.pdf')){
|
|
|
+ bindId = frontId + 'pdf';
|
|
|
+ }
|
|
|
+ else if (fileName.includes('.pptx')) {
|
|
|
+ bindId = frontId + 'powerpoint';
|
|
|
+ }
|
|
|
+ else if (fileName.includes('.docx')) {
|
|
|
+ bindId = frontId + 'word';
|
|
|
+ }
|
|
|
+ else if (fileName.includes('.vsdx')) {
|
|
|
+ bindId = frontId + 'visio';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (teamList && $(teamList).find('#'+teamId+'_li').length > 0) {
|
|
|
isTeam = true;
|
|
|
- }
|
|
|
- let str = `<div>편집</div>`;
|
|
|
+ }
|
|
|
+
|
|
|
+ let str = '';
|
|
|
+ if (bindId) {
|
|
|
+ str += `<div>편집</div>`;
|
|
|
+ }
|
|
|
const selectImage = $('section .file-content div.on').find('img');
|
|
|
if (checkCnt === 1 &&
|
|
|
selectImage.length &&
|
|
|
isTeam === true &&
|
|
|
- selectImage.attr('src') !== '/static/images/folder.png') {
|
|
|
- str += `<div onclick="addTabs()">탭으로 설정</div>`;
|
|
|
+ selectImage.attr('src') !== '/static/images/folder.png'&&
|
|
|
+ bindId) {
|
|
|
+ str += `<div onclick="addTabs('${bindId}')">탭으로 설정</div>`;
|
|
|
}
|
|
|
str += `<div onclick="download()">다운로드</div>
|
|
|
<div onclick="deleteItem()">삭제</div>`;
|
|
@@ -391,10 +418,21 @@
|
|
|
}
|
|
|
|
|
|
function openWebUrl(url, name, event) {
|
|
|
- window.open(url);
|
|
|
+ //window.open(url);
|
|
|
+ $.ajax({
|
|
|
+ method: 'get',
|
|
|
+ url : url,
|
|
|
+ type : 'json',
|
|
|
+ success : (res)=>{
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
+ error : (error)=>{
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- function addTabs() {
|
|
|
+ function addTabs(bindId) {
|
|
|
const fileName = $('section .file-content div.on .file_name').text();
|
|
|
const siteId = $('section .panel .panel-item').eq(0).attr('id');
|
|
|
const path = getDrivePath() + '/' + fileName;
|
|
@@ -408,9 +446,9 @@
|
|
|
teamId = teamData[idx].id;
|
|
|
}
|
|
|
}
|
|
|
- console.log(fileName , siteId , teamId , path, teamName, channelName);
|
|
|
- if (fileName && siteId && teamId && path && teamName && channelName) {
|
|
|
- //teams/a677e58b-0812-4abb-887f-4c49f5adfa3d/channels
|
|
|
+
|
|
|
+ if (fileName && siteId && teamId && path && teamName && channelName && bindId) {
|
|
|
+
|
|
|
$.ajax({
|
|
|
method : 'post',
|
|
|
url : '/api/add-tab',
|
|
@@ -421,45 +459,25 @@
|
|
|
teamId : teamId,
|
|
|
teamName : teamName,
|
|
|
channelName : channelName,
|
|
|
+ bindId : bindId,
|
|
|
},
|
|
|
success : (res) => {
|
|
|
- console.log(res);
|
|
|
+ let color = '';
|
|
|
+ if (res.success === 'F') {
|
|
|
+ color = 'red';
|
|
|
+ }
|
|
|
+ alertMessage('탭으로 설정', res.message, null, color);
|
|
|
+
|
|
|
},
|
|
|
error : (error) => {
|
|
|
console.log(error);
|
|
|
+ alertMessage('탭으로 설정', error.message, null, 'red');
|
|
|
}
|
|
|
})
|
|
|
- // callApi('get', '/sites/' + siteId + path + '/'+ fileName, (jsonData)=>{
|
|
|
- // console.log(jsonData);
|
|
|
- // });
|
|
|
- // const param = {
|
|
|
- // displayName: fileName,
|
|
|
- // webUrl : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/06805b9e-77e3-4b93-ac81-525eb87513b8",
|
|
|
- // "configuration": {
|
|
|
- // "entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
|
|
|
- // "contentUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/tabView",
|
|
|
- // "websiteUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154",
|
|
|
- // "removeUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/uninstallTab"
|
|
|
- // }
|
|
|
- // }
|
|
|
}
|
|
|
else {
|
|
|
alertMessage('탭으로 설정', '탭으로 설정 할 파일 정보를 확인 해주세요.');
|
|
|
}
|
|
|
- // const param = {
|
|
|
- // "displayName": "My Contoso Tab",
|
|
|
- // "teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/06805b9e-77e3-4b93-ac81-525eb87513b8",
|
|
|
- // "configuration": {
|
|
|
- // "entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
|
|
|
- // "contentUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/tabView",
|
|
|
- // "websiteUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154",
|
|
|
- // "removeUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/uninstallTab"
|
|
|
- // }
|
|
|
- // }
|
|
|
- // $.ajax({
|
|
|
- // url : '/api/add-tabs'
|
|
|
-
|
|
|
- // })
|
|
|
}
|
|
|
|
|
|
//파일별 이미지 세팅
|