parent
0bd96565ed
commit
7f1af5f14a
|
|
@ -4,6 +4,7 @@ import com.dbnt.kcgfilemanager.config.LogStatus;
|
||||||
import com.dbnt.kcgfilemanager.model.*;
|
import com.dbnt.kcgfilemanager.model.*;
|
||||||
import com.dbnt.kcgfilemanager.service.BoardCategoryService;
|
import com.dbnt.kcgfilemanager.service.BoardCategoryService;
|
||||||
import com.dbnt.kcgfilemanager.service.BoardService;
|
import com.dbnt.kcgfilemanager.service.BoardService;
|
||||||
|
import com.dbnt.kcgfilemanager.service.CategoryRoleService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
|
|
@ -31,14 +32,15 @@ public class BoardController {
|
||||||
|
|
||||||
private final BoardService boardService;
|
private final BoardService boardService;
|
||||||
private final BoardCategoryService boardCategoryService;
|
private final BoardCategoryService boardCategoryService;
|
||||||
|
private final CategoryRoleService categoryRoleService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/main")
|
@GetMapping("/main")
|
||||||
public ModelAndView main(Board param) {
|
public ModelAndView main(Board param) {
|
||||||
ModelAndView mav = new ModelAndView("board/main");
|
ModelAndView mav = new ModelAndView("board/main");
|
||||||
param.setStatus("M");
|
param.setStatus("M");
|
||||||
mav.addObject("contentList", boardService.selectContentList(param));
|
|
||||||
param.setQueryInfo();
|
param.setQueryInfo();
|
||||||
|
mav.addObject("contentList", boardService.selectContentList(param));
|
||||||
param.setContentCnt(boardService.selectContentListCnt(param));
|
param.setContentCnt(boardService.selectContentListCnt(param));
|
||||||
param.setPaginationInfo();
|
param.setPaginationInfo();
|
||||||
mav.addObject("searchParams", param);
|
mav.addObject("searchParams", param);
|
||||||
|
|
@ -56,6 +58,11 @@ public class BoardController {
|
||||||
mav.addObject("type", "modify");
|
mav.addObject("type", "modify");
|
||||||
mav.addObject("content", boardService.selectContentModifyInfo(content.getContentSeq()));
|
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;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,14 @@ $(document).on('click', '.contentTr', function (){
|
||||||
getBoardLog(target.value);
|
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 (){
|
$(document).on('change', '#fileCheckAll', function (){
|
||||||
$(".fileCheckBox").prop("checked", this.checked);
|
$(".fileCheckBox").prop("checked", this.checked);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ $(document).on('click', '#saveBtn', function (){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on('change', '.categorySelector', function (){
|
$(document).on('change', '.categorySelector', function (){
|
||||||
const categorySeq = Number(this.value);
|
const categorySeq = Number(this.value);
|
||||||
const depth = Number($(this).attr("data-depth"));
|
const depth = Number($(this).attr("data-depth"));
|
||||||
|
|
@ -107,8 +106,18 @@ $(document).on('change', '.categorySelector', function (){
|
||||||
}else{
|
}else{
|
||||||
selectorDisabler(depth);
|
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){
|
function setCategorySelector(depth, categorySeq){
|
||||||
selectorDisabler(depth);
|
selectorDisabler(depth);
|
||||||
$("[data-depth='"+depth+"']").children().each(function (){
|
$("[data-depth='"+depth+"']").children().each(function (){
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
<select class="form-select categorySelector" data-depth="1">
|
<select class="form-select categorySelector" data-depth="1">
|
||||||
<option value="" selected>분류를 선택해주세요</option>
|
<option value="" selected>분류를 선택해주세요</option>
|
||||||
<th:block th:each="depth1:${session.categoryList}">
|
<th:block th:each="depth1:${session.categoryList}">
|
||||||
<option th:value="${depth1.categorySeq}" th:text="${depth1.categoryName}"></option>
|
<option th:class="${#strings.contains(userRole,'ADMIN')?'bg-success bg-opacity-25':(#lists.contains(categoryRole, depth1.categorySeq)?'bg-success bg-opacity-25':'')}"
|
||||||
|
th:value="${depth1.categorySeq}" th:text="${depth1.categoryName}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -49,7 +50,8 @@
|
||||||
<option value="" selected>분류를 선택해주세요</option>
|
<option value="" selected>분류를 선택해주세요</option>
|
||||||
<th:block th:each="depth1:${session.categoryList}">
|
<th:block th:each="depth1:${session.categoryList}">
|
||||||
<th:block th:each="depth2:${depth1.childCategoryList}">
|
<th:block th:each="depth2:${depth1.childCategoryList}">
|
||||||
<option th:value="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}" th:text="${depth2.categoryName}"></option>
|
<option th:class="${#strings.contains(userRole,'ADMIN')?'bg-success bg-opacity-25':(#lists.contains(categoryRole, depth2.categorySeq)?'bg-success bg-opacity-25':'')}"
|
||||||
|
th:value="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}" th:text="${depth2.categoryName}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -60,7 +62,8 @@
|
||||||
<th:block th:each="depth1:${session.categoryList}">
|
<th:block th:each="depth1:${session.categoryList}">
|
||||||
<th:block th:each="depth2:${depth1.childCategoryList}">
|
<th:block th:each="depth2:${depth1.childCategoryList}">
|
||||||
<th:block th:each="depth3:${depth2.childCategoryList}">
|
<th:block th:each="depth3:${depth2.childCategoryList}">
|
||||||
<option th:value="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}" th:text="${depth3.categoryName}"></option>
|
<option th:class="${#strings.contains(userRole,'ADMIN')?'bg-success bg-opacity-25':(#lists.contains(categoryRole, depth3.categorySeq)?'bg-success bg-opacity-25':'')}"
|
||||||
|
th:value="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}" th:text="${depth3.categoryName}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</th:block>
|
</th:block>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
@ -73,7 +76,8 @@
|
||||||
<th:block th:each="depth2:${depth1.childCategoryList}">
|
<th:block th:each="depth2:${depth1.childCategoryList}">
|
||||||
<th:block th:each="depth3:${depth2.childCategoryList}">
|
<th:block th:each="depth3:${depth2.childCategoryList}">
|
||||||
<th:block th:each="depth4:${depth3.childCategoryList}">
|
<th:block th:each="depth4:${depth3.childCategoryList}">
|
||||||
<option th:value="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
|
<option class="bg-opacity-25" th:value="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
|
||||||
|
th:classappend="${#strings.contains(userRole,'ADMIN')?'bg-success':(#lists.contains(categoryRole, depth4.categorySeq)?'bg-success':'bg-danger')}"
|
||||||
th:text="${depth4.categoryName}" th:selected="${type=='modify' && content.categorySeq == depth4.categorySeq}"></option>
|
th:text="${depth4.categoryName}" th:selected="${type=='modify' && content.categorySeq == depth4.categorySeq}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue