From 7f1af5f14ae5fb97a948bad0eb14bbd864f60531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Thu, 23 Dec 2021 14:21:40 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95.=20=EA=B2=8C=EC=8B=9C=EB=AC=BC?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1=EC=8B=9C=20=EA=B6=8C=ED=95=9C=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kcgfilemanager/controller/BoardController.java | 9 ++++++++- src/main/resources/static/js/board/contentList.js | 9 ++++++++- src/main/resources/static/js/board/contentWrite.js | 11 ++++++++++- src/main/resources/templates/board/contentWrite.html | 12 ++++++++---- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java index a6ac1a9..4e5e30d 100644 --- a/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java +++ b/src/main/java/com/dbnt/kcgfilemanager/controller/BoardController.java @@ -4,6 +4,7 @@ import com.dbnt.kcgfilemanager.config.LogStatus; import com.dbnt.kcgfilemanager.model.*; import com.dbnt.kcgfilemanager.service.BoardCategoryService; import com.dbnt.kcgfilemanager.service.BoardService; +import com.dbnt.kcgfilemanager.service.CategoryRoleService; import lombok.RequiredArgsConstructor; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.annotation.AuthenticationPrincipal; @@ -31,14 +32,15 @@ public class BoardController { private final BoardService boardService; private final BoardCategoryService boardCategoryService; + private final CategoryRoleService categoryRoleService; @GetMapping("/main") public ModelAndView main(Board param) { ModelAndView mav = new ModelAndView("board/main"); param.setStatus("M"); - mav.addObject("contentList", boardService.selectContentList(param)); param.setQueryInfo(); + mav.addObject("contentList", boardService.selectContentList(param)); param.setContentCnt(boardService.selectContentListCnt(param)); param.setPaginationInfo(); mav.addObject("searchParams", param); @@ -56,6 +58,11 @@ public class BoardController { mav.addObject("type", "modify"); mav.addObject("content", boardService.selectContentModifyInfo(content.getContentSeq())); } + + mav.addObject("userRole", loginUser.getUserRole()); + CategoryRole categoryRole = new CategoryRole(); + categoryRole.setUserSeq(loginUser.getUserSeq()); + mav.addObject("categoryRole", categoryRoleService.selectCategorySeqListToUser(categoryRole)); return mav; } diff --git a/src/main/resources/static/js/board/contentList.js b/src/main/resources/static/js/board/contentList.js index 5d6e33a..d14b547 100644 --- a/src/main/resources/static/js/board/contentList.js +++ b/src/main/resources/static/js/board/contentList.js @@ -20,7 +20,14 @@ $(document).on('click', '.contentTr', function (){ getBoardLog(target.value); } }) - +$(document).on('click', '.page-item', function (){ + if(location.pathname.indexOf("contentList")>0){ + $("#pageIndex").val($(this).attr("data-pageindex")); + $("#searchBtn").click(); + }else{ // 메인페이지 + location.href = location.pathname+"?pageIndex="+$(this).attr("data-pageindex"); + } +}) $(document).on('change', '#fileCheckAll', function (){ $(".fileCheckBox").prop("checked", this.checked); }) diff --git a/src/main/resources/static/js/board/contentWrite.js b/src/main/resources/static/js/board/contentWrite.js index a891074..926f0ba 100644 --- a/src/main/resources/static/js/board/contentWrite.js +++ b/src/main/resources/static/js/board/contentWrite.js @@ -98,7 +98,6 @@ $(document).on('click', '#saveBtn', function (){ } } }) - $(document).on('change', '.categorySelector', function (){ const categorySeq = Number(this.value); const depth = Number($(this).attr("data-depth")); @@ -107,8 +106,18 @@ $(document).on('change', '.categorySelector', function (){ }else{ selectorDisabler(depth); } + if(this.id === "categorySeq"){ + categoryRoleCheck($(this).find(":selected")[0].className); + } }) +function categoryRoleCheck(optionClass){ + if(optionClass.indexOf("success")<0){ + // 권한이 없을경우 + alert("해당 분류에 작성 권한이 없습니다. \n관리자에게 요청 권한을 요청해주시기 바랍니다."); + $("#categorySeq").children()[0].selected = true; + } +} function setCategorySelector(depth, categorySeq){ selectorDisabler(depth); $("[data-depth='"+depth+"']").children().each(function (){ diff --git a/src/main/resources/templates/board/contentWrite.html b/src/main/resources/templates/board/contentWrite.html index 52d46f1..2e59cb8 100644 --- a/src/main/resources/templates/board/contentWrite.html +++ b/src/main/resources/templates/board/contentWrite.html @@ -40,7 +40,8 @@ @@ -49,7 +50,8 @@ - + @@ -60,7 +62,8 @@ - + @@ -73,7 +76,8 @@ -