diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java index 8532d6a..4344193 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java @@ -48,7 +48,7 @@ public class BoardController { } @GetMapping("/contentWrite") - public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content) { + public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content, Integer categorySeq) { ModelAndView mav = new ModelAndView("board/contentWrite"); if(content.getContentSeq() == null) { mav.addObject("type", "new"); @@ -58,7 +58,7 @@ public class BoardController { mav.addObject("type", "modify"); mav.addObject("content", boardService.selectContentModifyInfo(content.getContentSeq())); } - + mav.addObject("categorySeq", categorySeq); mav.addObject("userRole", loginUser.getUserRole()); CategoryRole categoryRole = new CategoryRole(); categoryRole.setUserSeq(loginUser.getUserSeq()); diff --git a/src/main/resources/mybatisMapper/BoardMapper.xml b/src/main/resources/mybatisMapper/BoardMapper.xml index a622d7f..ca0bdc5 100644 --- a/src/main/resources/mybatisMapper/BoardMapper.xml +++ b/src/main/resources/mybatisMapper/BoardMapper.xml @@ -27,7 +27,7 @@ INNER JOIN CONTENT_POSITION D ON A.CATEGORY_SEQ = D.CATEGORY_SEQ - + WHERE A.STATUS != 'D' AND A.STATUS = #{status} @@ -71,7 +71,6 @@ WHERE ORIGINAL_NAME LIKE CONCAT('%', #{originalName}, '%') ) - ORDER BY A.VIEW_CNT DESC @@ -96,7 +95,7 @@ INNER JOIN CONTENT_POSITION D ON A.CATEGORY_SEQ = D.CATEGORY_SEQ - + WHERE A.STATUS != 'D' AND A.STATUS = #{status} @@ -140,7 +139,6 @@ WHERE ORIGINAL_NAME LIKE CONCAT('%', #{originalName}, '%') ) - diff --git a/src/main/resources/static/js/admin/userMgt.js b/src/main/resources/static/js/admin/userMgt.js index 555c8e1..6a7104d 100644 --- a/src/main/resources/static/js/admin/userMgt.js +++ b/src/main/resources/static/js/admin/userMgt.js @@ -1,6 +1,4 @@ $(function(){ - setSearchCondition(); - $("#dateSelectorDiv").datepicker({ format: "yyyy-mm-dd", language: "ko" diff --git a/src/main/resources/static/js/board/contentList.js b/src/main/resources/static/js/board/contentList.js index 38bb073..9caee70 100644 --- a/src/main/resources/static/js/board/contentList.js +++ b/src/main/resources/static/js/board/contentList.js @@ -130,24 +130,3 @@ function getBoardLog(contentSeq){ }); } } - -function setMenu(){ - const categorySeq = getParam("categorySeq"); - openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq")); -} - -function getParam(sname) { - const paramAry = location.search.substr(1).split("&"); - for (let i = 0; i < paramAry.length; i++) { - const param = paramAry[i].split("="); - if (param[0] === sname) { return param[1]; } - } -} - -function openMenu(parentSeq){ - if(parentSeq){ - const target = $("[data-categoryseq='"+parentSeq+"']") - target.click(); - openMenu(target.attr("data-parentseq")); - } -} \ No newline at end of file diff --git a/src/main/resources/static/js/board/contentWrite.js b/src/main/resources/static/js/board/contentWrite.js index 0535e7d..73d7ac0 100644 --- a/src/main/resources/static/js/board/contentWrite.js +++ b/src/main/resources/static/js/board/contentWrite.js @@ -5,6 +5,13 @@ $(function(){ $(".categorySelector").removeAttr("disabled"); setParentCategory(4, $("#categorySeq").find("[selected]").attr("data-parentseq")); } + if(categorySeq !== undefined){ + setMenu(); + $(".categorySelector").removeAttr("disabled"); + const selector = $("#categorySeq").find("[value='"+categorySeq+"']") + selector[0].selected = true; + setParentCategory(4, selector.attr("data-parentseq")); + } $("#uploadDiv").on("dragenter", function(e) { // $(this).addClass('drag-over'); diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index aeb163c..6c52137 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -1,12 +1,36 @@ +let categorySeq; + $(document).on('click', '#moveRightBtn', function (){ moveCategorySelectBody(1); }) $(document).on('click', '#moveLeftBtn', function (){ moveCategorySelectBody(-1); }) - +$(document).on('click', '#contentWriteBtn', function (){ + location.href="/board/contentWrite"+(categorySeq!==undefined?("?categorySeq="+categorySeq):""); +}) function moveCategorySelectBody(direction){ const categorySelectBody = $("#categorySelectBody"); const nowX = categorySelectBody.scrollLeft(); categorySelectBody.animate({scrollLeft:(direction*200+nowX)},200); +} +function setMenu(){ + const categorySeq = getParam("categorySeq"); + openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq")); +} + +function getParam(sname) { + const paramAry = location.search.substr(1).split("&"); + for (let i = 0; i < paramAry.length; i++) { + const param = paramAry[i].split("="); + if (param[0] === sname) { return param[1]; } + } +} + +function openMenu(parentSeq){ + if(parentSeq){ + const target = $("[data-categoryseq='"+parentSeq+"']") + target.click(); + openMenu(target.attr("data-parentseq")); + } } \ No newline at end of file diff --git a/src/main/resources/templates/board/contentList.html b/src/main/resources/templates/board/contentList.html index b15fb5d..65c76fb 100644 --- a/src/main/resources/templates/board/contentList.html +++ b/src/main/resources/templates/board/contentList.html @@ -3,6 +3,9 @@ xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/layout}"> + diff --git a/src/main/resources/templates/board/contentWrite.html b/src/main/resources/templates/board/contentWrite.html index 2e59cb8..78f1822 100644 --- a/src/main/resources/templates/board/contentWrite.html +++ b/src/main/resources/templates/board/contentWrite.html @@ -12,6 +12,7 @@ diff --git a/src/main/resources/templates/fragments/leftMenu.html b/src/main/resources/templates/fragments/leftMenu.html index 6d1b584..6efdb94 100644 --- a/src/main/resources/templates/fragments/leftMenu.html +++ b/src/main/resources/templates/fragments/leftMenu.html @@ -17,7 +17,7 @@ 통합 검색 - 자료 등록 + 자료 등록