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 @@ -