Index: arms/html/detail_total_pdservice/content-container.html =================================================================== diff -u -r2fea2df524d487ec3221e520404e4a52aec1eb62 -rceace9e288847cb2aebd8b4125491db467f813e2 --- arms/html/detail_total_pdservice/content-container.html (.../content-container.html) (revision 2fea2df524d487ec3221e520404e4a52aec1eb62) +++ arms/html/detail_total_pdservice/content-container.html (.../content-container.html) (revision ceace9e288847cb2aebd8b4125491db467f813e2) @@ -1,168 +1,248 @@ -
-
-
-
-

- +
+
+

+ - - 제품(서비스)관련 이미지, 문서, 기타 파일 등을 확인할 수 있습니다. - -

-
-
-
+ 제품(서비스) 산출물 조회 + +

+ +
+
+
+
+ 제품(서비스) : + + 선택되지 않음 + +
+
+
+
+
+
+ +
+
+
+

+ + + 제품(서비스) 산출물 보기 + +

+ +
+
+
-
- 제품(서비스) 컨텐츠 -
-
-
-
-
- 기획 문서 -
-
-
-
-
-

- - - 문서 - -

- -
+ 선택한 제품(서비스) 산출물 : + + 선택되지 않음 + + +
+
+
+
+
+
+
+
+ +
+ + + + +
+
-
-
-
    -
  • - All -
  • -
  • - Image -
  • -
  • - Document -
  • -
  • - Etc -
  • -
+
+ +
+
+
+
+
+
+
-
-
-
-
-
-

- - - 파일 - -

- -
- -
-
-
+
+
+ +
+
+
+ + Drop files here +
+
+
+
+
+ +
+
+
+ +
 
+
+
+
+ + + Add files... + + + + +
+
+ +
+ + + + +
-
-
+
+
-
-
-
+ + + \ No newline at end of file Index: arms/js/detail_total_pdservice.js =================================================================== diff -u -re6e12437d164831eb360b9d40a029057f4778399 -rceace9e288847cb2aebd8b4125491db467f813e2 --- arms/js/detail_total_pdservice.js (.../detail_total_pdservice.js) (revision e6e12437d164831eb360b9d40a029057f4778399) +++ arms/js/detail_total_pdservice.js (.../detail_total_pdservice.js) (revision ceace9e288847cb2aebd8b4125491db467f813e2) @@ -52,6 +52,11 @@ "../reference/light-blue/lib/vendor/jquery.ui.widget.js", "../reference/lightblue4/docs/lib/widgster/widgster.js", "../reference/lightblue4/docs/lib/slimScroll/jquery.slimscroll.min.js" + ], + [ + "../reference/light-blue/lib/jquery.fileupload.js", + "../reference/light-blue/lib/jquery.fileupload-fp.js", + "../reference/light-blue/lib/jquery.fileupload-ui.js" ] // 추가적인 플러그인 그룹들을 이곳에 추가하면 됩니다. ]; @@ -66,23 +71,23 @@ $(".widget").widgster(); setSideMenu("sidebar_menu_product", "sidebar_menu_total_pdservice"); + file_upload_setting(); + init_pdDetailList(); + dataLoad(); + // --- 에디터 설정 --- // var waitCKEDITOR = setInterval(function () { try { if (window.CKEDITOR) { if(window.CKEDITOR.status == "loaded"){ - CKEDITOR.replace("detail_pdservice_contents",{ skin: "office2013" });//상세보기 + CKEDITOR.replace("pdservice_detail_contents",{ skin: "office2013" });//상세보기 clearInterval(waitCKEDITOR); } } } catch (err) { console.log("CKEDITOR 로드가 완료되지 않아서 초기화 재시도 중..."); } }, 313 /*milli*/); - - // 스크립트 실행 로직을 이곳에 추가합니다. - getNodeInfo(); - fileLoadByPdService(); }) .catch(function () { console.error("플러그인 로드 중 오류 발생"); @@ -98,139 +103,133 @@ selectedJiraProject = urlParams.get("jiraProject"); } -function fileLoadByPdService() { - console.log("File Tab ::::"); - - // if (callAPI("fileAPI")) { - // return; - // } - - // $("#fileIdlink").val(selectedPdService); - $(".spinner").html(' 데이터를 로드 중입니다...'); - $.ajax({ - url: "/auth-user/api/arms/fileRepository/getFilesByNode.do", - data: { fileIdLink: selectedPdService }, - async: false, - dataType: "json" - }).done(function (result) { - console.log(result.files); - - bindFileList(result); - - jSuccess("기획서 조회가 완료 되었습니다."); +function file_upload_setting() { + var $fileupload = $("#fileupload"); + $fileupload.fileupload({ + autoUpload: false, + sequentialUploads: true, + url: "/auth-user/api/arms/pdServiceDetail/uploadFileToNode.do", + dropZone: $("#dropzone") }); -} -function getNodeInfo() { - $.ajax({ - url: "/auth-user/api/arms/pdServicePure/getNode.do", - data: { c_id: selectedPdService }, - async: false, - dataType: "json" - }).done(function (result) { - //document.getElementById("file_description").innerHTML = result.c_pdservice_contents; - - // CKEditor 로드된 후, 기획 정보 세팅 - CKEDITOR.on('instanceReady', function(event) { - var editor = event.editor; - if(editor.name === 'detail_pdservice_contents'){ - editor.setData(result.c_pdservice_contents); - } - }); + $("#fileupload").bind("fileuploadsubmit", function (e, data) { + var input = $("#fileIdlink"); + data.formData = { pdServiceDetailId: input.val() }; + if (!data.formData.pdServiceDetailId) { + data.context.find("button").prop("disabled", false); + input.focus(); + return false; + } }); } -function bindFileList(result) { - if (result.files.length === 0) { - noFileMessage(); - return; - } - - getFiles = result.files; - - createFileList(result.files); +function init_pdDetailList() { + var menu; + $.fn.jsonMenu = function (action, items, options) { + $(this).addClass("json-menu"); + if (action == "add") { + menu.body.push(items); + draw($(this), menu); + } else if (action == "set") { + menu = items; + draw($(this), menu); + } + return this; + }; } -function formatBytes(bytes, decimals = 2) { - if (bytes === 0) return "0 Bytes"; +function dataLoad() { + console.log("dataLoad :: getSelectedID → " + selectedPdService); + $.ajax({ + url: "/auth-user/api/arms/pdServicePure/getNode.do", + data: { c_id: selectedPdService }, + method: "GET", + dataType: "json", + }).done(function (json) { + $("#selected_pdservice").text(json.c_title); // sender 이름 바인딩 + }); - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i]; + $.ajax("/auth-user/api/arms/pdServiceDetail/getNodes.do/" + selectedPdService).done(function (json) { + console.log("dataLoad :: success → ", json); + $("#pdservice_detail_accordion").jsonMenu("set", json.response, { speed: 5000 }); + }); } -function noFileMessage() { - let $container = $("#files-container"); +function draw(main, menu) { + main.html(""); - var $noDataHtml = $(`

-
- 등록된 파일이 없습니다. -

`); - $container.append($noDataHtml); -} + var data = ""; + for (var i = 0; i < menu.length; i++) { + data += ` +
+
+ +
+
`; + } -function filteredFiles(type) { - if (!type) return getFiles; - return getFiles.filter((file) => type.some((t) => file.contentType.includes(type))); + main.html(data); } -function createFileList(files) { - const $portfolioContainer = $("#filter-files"); - $portfolioContainer.empty(); +function detailClick(element, c_id) { + console.log("detailClick:: c_id -> ", c_id); - files.forEach(function (file) { - var filterClass; - if (file.contentType.includes("image")) { - filterClass = "filter-image"; - } else if (file.contentType.includes("text")) { - filterClass = "filter-doc"; - } else if (file.contentType.includes("application")) { - filterClass = "filter-doc"; - } else { - filterClass = "filter-etc"; + $("a[id^='pdservice_detail_link_']").each(function() { + this.style.background = ""; + if (c_id == this.id.split("_")[3]) { + this.style.background = "rgba(229, 96, 59, 0.3)"; + this.style.color = "rgb(164, 198, 255)"; + this.style.textDecoration = "none"; + this.style.cursor = "pointer"; } + }); - var imgSrc = iconsMap[file.contentType] || prefix + "Default.png"; - var title = file.fileName; - var downloadUrl = file.url; - var thumbnailUrl = file.thumbnailUrl; - var fileSize = formatBytes(file.size, 3); - var imageLinkHtml = ""; + $.ajax({ + url: "/auth-user/api/arms/pdServiceDetail/getNode.do", // 클라이언트가 HTTP 요청을 보낼 서버의 URL 주소 + data: { c_id: c_id }, + method: "GET", + dataType: "json" + }).done(function (json) { + console.log(json); - var $newHtml = $(` -
-
- -
-

${title}

-

${fileSize}

- -
-
-
- `); + selectedDetailId = json.c_id; + selectedDetailName = json.c_title; - const imgLoadCheck = new Image(); - imgLoadCheck.src = imgSrc; + $("#fileIdlink").val(selectedDetailId); - imgLoadCheck.onload = function () { - $portfolioContainer.append($newHtml); - }; - }); -} + $("#selected_pdservice_detail").text(selectedDetailName); -$(".filter-option").click(function () { - $(this).siblings().removeClass("filter-active"); - $(this).addClass("filter-active"); + CKEDITOR.instances.pdservice_detail_contents.setData(json.c_contents); // 상세 보기 - console.log($(this).data("filter")); + if (json.c_drawio_image_raw != null && json.c_drawio_image_raw != "") { + $("#pdservice_detail_drawio_image_raw").attr("src", json.c_drawio_image_raw); + $("#pdservice_detail_drawio_image_raw").removeClass('hidden'); + } - createFileList(filteredFiles($(this).data("filter").split(","))); -}); + var $fileupload = $("#fileupload"); + + $.ajax({ + url: "/auth-user/api/arms/pdServiceDetail/getFilesByNode.do", + data: { fileIdLink: selectedDetailId }, + dataType: "json", + context: $fileupload[0] + }).done(function(result) { + $(this).fileupload("option", "done").call(this, null, { result: result.response }); + $(".file-delete-btn").hide(); // 파일 리스트에서 delete 버튼 display none 처리 -> 편집하기 tab 에서만 보여준다. + }); + + jSuccess("기획서 조회가 완료 되었습니다."); + }).fail(function(xhr, status, errorThrown) { + console.log(xhr + status + errorThrown); + }).always(function(xhr, status) { + $("#text").html("요청이 완료되었습니다!"); + console.log(xhr + status); + }); +} \ No newline at end of file