최초 커밋!
This commit is contained in:
120
admin/src/main/resources/templates/admin/adminCreateForm.html
Normal file
120
admin/src/main/resources/templates/admin/adminCreateForm.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section class="fw-bold" layout:fragment="content">
|
||||
|
||||
<form
|
||||
method="post"
|
||||
th:action="@{/settings/admins/create}"
|
||||
th:object="${bindingVO}">
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="id" th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||
th:field="*{id}"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{id}" th:if="${#fields.hasErrors('id')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
<input class="form-control" id="password" th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'" th:field="*{password}"
|
||||
type="password"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{password}"
|
||||
th:if="${#fields.hasErrors('password')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
||||
type="email"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||
th:if="${#fields.hasErrors('email')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||
th:field="*{roleIds}">
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 활성화 -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||
<div class="col-sm-4 pt-1">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="inlineRadio1" name="accountDisabled"
|
||||
type="radio" value="true">
|
||||
<label class="form-check-label" for="inlineRadio1">비활성화</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input checked class="form-check-input" id="inlineRadio2"
|
||||
name="accountDisabled" type="radio" value="false">
|
||||
<label class="form-check-label" for="inlineRadio2">활성화</label>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 계정잠김 -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
|
||||
<div class="col-sm-4 pt-1">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="accountLocked1" name="accountLocked"
|
||||
type="radio" value="true">
|
||||
<label class="form-check-label" for="accountLocked1">Locked</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input checked class="form-check-input" id="accountLocked2"
|
||||
name="accountLocked" type="radio" value="false">
|
||||
<label class="form-check-label" for="accountLocked2">Unlocked</label>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function gotoList() {
|
||||
document.prevAdminParamForm ? document.prevAdminParamForm.submit()
|
||||
: location.href = '/settings/admins';
|
||||
}
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
202
admin/src/main/resources/templates/admin/adminList.html
Normal file
202
admin/src/main/resources/templates/admin/adminList.html
Normal file
@@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form method="post" name="adminParamForm" onsubmit="goSearch();"
|
||||
th:action="@{/settings/admins}"
|
||||
th:object="${listStatus}">
|
||||
|
||||
<!-- hidden parameters -->
|
||||
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
|
||||
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
|
||||
|
||||
<div class="row bg-secondary p-2 mb-2" style="--bs-bg-opacity: .2;">
|
||||
<div class="col-5">
|
||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-25" id="searchField" th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="id">ID</option>
|
||||
<option value="email">Email</option>
|
||||
</select>
|
||||
<label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요." style="width: 250px;"
|
||||
th:field="*{searchValue}" type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="col-sm-2 col-form-label" for="searchRole">권한</label>
|
||||
<select class="form-select d-inline w-50" id="searchRole" th:field="*{searchRole}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-secondary" onclick="goSearch();"
|
||||
type="button">검색
|
||||
</button>
|
||||
<button class="btn btn-light" onclick="goInit();"
|
||||
type="button">초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">Total: <span
|
||||
th:text="${listOutput.totalElements}"></span></div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i>
|
||||
<label>
|
||||
<select class="form-select form-select-sm" id="pageSize" name="pageSize"
|
||||
onchange="goSearch()">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}" th:text="${item.codeText}"
|
||||
th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">
|
||||
<label><input class="form-check-input" onchange="toggleCheckbox(this);" type="checkbox"/></label>
|
||||
</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
||||
<th class="text-secondary" scope="col">권한</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">활성화</a>
|
||||
</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="accountLocked" href="#">계정잠김</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="item, status : ${listOutput.content}">
|
||||
<th scope="row"
|
||||
th:text="${status.count + (listOutput.pageable.pageNumber * listOutput.pageable.pageSize)}">
|
||||
게시물번호
|
||||
</th>
|
||||
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
|
||||
type="checkbox"/></label>
|
||||
</td>
|
||||
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a></td>
|
||||
<td>
|
||||
<span th:each="role, status : ${item.roles}"
|
||||
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
|
||||
</td>
|
||||
<td th:text="${item.email}">이메일</td>
|
||||
<td th:text="${item.accountDisabled == null || !item.accountDisabled ? 'Y' : 'N' }"></td>
|
||||
<td th:text="${item.accountLocked == null || !item.accountLocked ? 'N' : 'Y' }"></td>
|
||||
<td th:text="${#temporals.format(item.createdAt, 'yyyy-MM-dd hh:mm')}">등록일</td>
|
||||
<td th:text="${#temporals.format(item.updatedAt, 'yyyy-MM-dd hh:mm')}">수정일</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
|
||||
</div>
|
||||
<div class="col text-end mb-2">
|
||||
<button class="btn btn-primary" onclick="location.href='/settings/admins/create';"
|
||||
type="button">등록
|
||||
</button>
|
||||
<button class="btn btn-danger" onclick="goRemove();" type="button">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
// 목록 정렬 표기 및 갱신 기능 적용
|
||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||
[[${listOutput.pageable.sort.toString()}]]);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
function goSearch() {
|
||||
const f = document.adminParamForm;
|
||||
f.action = '/settings/admins';
|
||||
f.page.value = 0;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.adminParamForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchRole.value = '';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
function goUpdate(adminId) {
|
||||
const f = document.adminParamForm;
|
||||
f.action = '/settings/admins/update/' + adminId;
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 체크박스 선택/해제
|
||||
function toggleCheckbox(oj) {
|
||||
$('input[name=checkedIds]').prop("checked", oj.checked);
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
if (!$('input[name=checkedIds]').is(':checked')) {
|
||||
alert(/*[[#{operation.common.remove.choose}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
|
||||
const f = document.adminParamForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
'method': 'DELETE',
|
||||
'url': '/api/settings/admin/remove',
|
||||
'data': {
|
||||
'checkedIds': data.checkedIds
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
alert('선택한 관리자가 삭제되었습니다.');
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.adminParamForm;
|
||||
f.action = '/settings/admins/excel';
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.method = 'post';
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
145
admin/src/main/resources/templates/admin/adminUpdateForm.html
Normal file
145
admin/src/main/resources/templates/admin/adminUpdateForm.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section class="fw-bold" layout:fragment="content">
|
||||
|
||||
<form
|
||||
method="post"
|
||||
th:action="${'/settings/admins/update/' + bindingVO.id}"
|
||||
th:object="${bindingVO}">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="id" readonly="readonly"
|
||||
th:field="*{id}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" placeholder="암호를 변경하고 싶다면 입력하세요" th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
|
||||
th:field="*{updatePassword}"
|
||||
type="password"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
|
||||
th:if="${#fields.hasErrors('updatePassword')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
||||
type="email"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||
th:if="${#fields.hasErrors('email')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||
th:field="*{roleIds}">
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 활성화 -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||
<div class="col-sm-4 pt-1">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="inlineRadio1" th:field="*{accountDisabled}"
|
||||
type="radio" value="true">
|
||||
<label class="form-check-label" for="inlineRadio1">비활성화</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="inlineRadio2" th:field="*{accountDisabled}"
|
||||
type="radio" value="false">
|
||||
<label class="form-check-label" for="inlineRadio2">활성화</label>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 계정잠김 -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="accountLocked1">계정잠김 여부*</label>
|
||||
<div class="col-sm-4 pt-1">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="accountLocked1" th:field="*{accountLocked}"
|
||||
type="radio" value="true">
|
||||
<label class="form-check-label" for="accountLocked1">Locked</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" id="accountLocked2" th:field="*{accountLocked}"
|
||||
type="radio" value="false">
|
||||
<label class="form-check-label" for="accountLocked2">Unlocked</label>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row w-50">
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
||||
</form>
|
||||
|
||||
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
||||
<form method="get" name="prevAdminParamForm"
|
||||
th:action="@{/settings/admins}"
|
||||
th:object="${listStatus}">
|
||||
<input th:field="*{searchField}" type="hidden">
|
||||
<input th:field="*{searchValue}" type="hidden">
|
||||
<input th:field="*{searchRole}" type="hidden">
|
||||
<th:block th:if="${pageable != null}">
|
||||
<input name="page" th:value="${pageable.page}" type="hidden"/>
|
||||
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
|
||||
</th:block>
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
function gotoList() {
|
||||
if (document.prevParamForm) {
|
||||
const f = document.prevParamForm;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.submit();
|
||||
} else {
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
|
||||
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
|
||||
[[${bindingVO.updatedBy}]],
|
||||
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
|
||||
});
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
402
admin/src/main/resources/templates/adminRole/adminRoleList.html
Normal file
402
admin/src/main/resources/templates/adminRole/adminRoleList.html
Normal file
@@ -0,0 +1,402 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="역할 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"></div>
|
||||
<div class="col fw-bold ms-4">
|
||||
|
||||
<form name="formDto" action="" method="post">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">역할 ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control"
|
||||
placeholder="ROLE_ 로 시작하는 역할 ID 입력"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="description">설명</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="description" name="description" class="form-control"
|
||||
placeholder="설명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-description"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="privilegeIds">권한</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select text-secondary" id="privilegeIds" name="privilegeIds"
|
||||
multiple style="height: 200px;">
|
||||
<option th:each="privilege : ${privileges}" th:value="${privilege.id}"
|
||||
class="fw-bold"
|
||||
th:text="${privilege.id + ' (' + privilege.description + ')'}"></option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold field-privilegeIds"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary mt-1" onclick="addChildNode();">역할 추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/adminRole/get/recursiveItems',
|
||||
cache: false,
|
||||
success: function (response) {
|
||||
let jsonData = response.items;
|
||||
$(jsonData).each(function (idx, oj) {
|
||||
oj['text'] = !oj.description ? oj.id : oj.id + ' (' + oj.description + ')';
|
||||
oj['value'] = oj.description;
|
||||
});
|
||||
renderTree({
|
||||
text: '관리자 역할',
|
||||
value: '',
|
||||
nodes: jsonData
|
||||
}, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
tree.treeview({
|
||||
data: [nodes],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
|
||||
cleanFormFields();
|
||||
|
||||
$(f.id).removeAttr('readonly');
|
||||
|
||||
f.id.value = currentNode.text;
|
||||
f.description.value = currentNode.value ? currentNode.value : '';
|
||||
f.id.focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentNode.id) {
|
||||
getInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getNodes')[0];
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
const f = document.formDto;
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
cleanFormFields();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/adminRole/get/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
200: function (response) {
|
||||
const item = response.item;
|
||||
f.id.value = item.id;
|
||||
f.description.value = item.description;
|
||||
f.orderNo.value = item.orderNo;
|
||||
|
||||
$('#privilegeIds').val(item.privilegeIds);
|
||||
|
||||
showAudit(item.id, item.createdBy, item.createdAt, item.updatedBy, item.updatedAt);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
$(f.id).attr('readonly', 'readonly');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert(/*[[#{operation.role.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminRole/save',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree(response.item.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const f = document.formDto;
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.remove.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' " + [[#{operation.uri.remove.ask(info.text)}]])) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert([[#{operation.common.remove.done}]]);
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminRole/remove',
|
||||
data: {id: info.id},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree();
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.description.value = '';
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$('.audit-area').hide();
|
||||
$('#privilegeIds').val([]);
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert([[#{operation.uri.move.choose}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (info.id === 'code.new.temp') {
|
||||
alert([[#{operation.uri.move.save.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
const f = document.formDto;
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminRole/switchOrderNo',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(updateList),
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('search', [
|
||||
searchVal, {ignoreCase: true, revealResults: true}
|
||||
]);
|
||||
if (searchNode.length) {
|
||||
tree.treeview('selectNode', [searchNode[0], {silent: false}]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
333
admin/src/main/resources/templates/board/articles.html
Normal file
333
admin/src/main/resources/templates/board/articles.html
Normal file
@@ -0,0 +1,333 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form autocomplete="off" method="get" name="reqForm" th:action="@{/board/articles}"
|
||||
th:object="${reqVO}">
|
||||
|
||||
<!-- hidden parameters -->
|
||||
<input name="sort" th:field="*{sort}" type="hidden"/>
|
||||
<input name="page" th:field="*{page}" type="hidden"/>
|
||||
|
||||
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
||||
<div class="col-5">
|
||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-25" id="searchField"
|
||||
th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="title">제목</option>
|
||||
<option value="updatedBy">작성자</option>
|
||||
</select> <label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||
style="width: 250px;" th:field="*{searchValue}"
|
||||
type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="col-sm-3 col-form-label" for="searchOpen">공개여부</label>
|
||||
<select class="form-select d-inline w-25" id="searchOpen"
|
||||
th:field="*{searchOpen}">
|
||||
<option selected value="">전체</option>
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-outline-secondary" onclick="goSearch();"
|
||||
type="button">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="goInit();" type="button">
|
||||
초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">
|
||||
TOTAL. <span id="totalElements"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i> <label>
|
||||
<select
|
||||
class="form-select form-select-sm" id="pageSize" name="size"
|
||||
onchange="goSearch()"
|
||||
th:field="*{size}">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:text="${item.codeText}" th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col" style="width:40px;"><label>
|
||||
<input class="form-check-input"
|
||||
onchange="toggleCheckbox(this);" type="checkbox"/></label>
|
||||
</th>
|
||||
<th scope="col" style="width:60px;"></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="title"
|
||||
href="#">제목</a>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<a class="order-able text-center d-inline-block w-100" data-sort-field="visible"
|
||||
href="#">공개여부</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="startDate"
|
||||
href="#">게시일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="endDate"
|
||||
href="#">종료일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="updatedBy"
|
||||
href="#">최근 수정자</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="updatedAt"
|
||||
href="#">최근 수정일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="orderNo"
|
||||
href="#">정렬번호</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable" id="listTBody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="row paging"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<button class="btn btn-outline-secondary" onclick="goExcel();" type="button">
|
||||
<i class="bi bi-file-earmark-spreadsheet"></i> 엑셀 다운로드
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-outline-secondary" onclick="goSave();"
|
||||
type="button">
|
||||
<i class="bi bi-save2"></i> 등록
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="goRemove();" type="button">
|
||||
<i class="bi bi-ui-checks-grid"></i> 삭제
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="uiUtil.sortable.update();" type="button">
|
||||
<i class="bi bi-distribute-vertical"></i> 정렬 변경
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
const INIT_SORT = 'orderNo,DESC';
|
||||
|
||||
const getArticles = (pageNo) => {
|
||||
const f = document.reqForm;
|
||||
f.page.value = pageNo;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/api/board/articles',
|
||||
data: dataOj,
|
||||
success(response) {
|
||||
console.log(response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
// List 구성하기
|
||||
const tbody = $('#listTBody');
|
||||
tbody.empty();
|
||||
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-order-no="${ct.orderNo}"
|
||||
data-id="${ct.id}">
|
||||
<th
|
||||
scope="row">${idx + (pageNo * f.size.value) + 1}</th>
|
||||
<td><label>
|
||||
<input class="form-check-input"
|
||||
name="selectIds" type="checkbox" value="${ct.id}"/></label></td>
|
||||
<td><img
|
||||
src="${ct.uploadFile ? uiUtil.getFileReferURL('inline', ct.uploadFile)
|
||||
: '/static/ui/img/default-img.jpg'}"
|
||||
style="width: 25px;"
|
||||
class="img-thumbnail"/></td>
|
||||
<td><a href="javascript:goUpdate(${ct.id})">${ct.title}</a></td>
|
||||
<td class="text-secondary text-center">${ct.visible ? 'Y' : 'N'}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.startDate)}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.endDate)}</td>
|
||||
<td>${ct.updatedBy}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.updatedAt)}</td>
|
||||
<td class="text-center">${ct.orderNo} <i
|
||||
class="bi bi-distribute-vertical handle float-end fw-bold"
|
||||
style="cursor: move"></i></td>
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
if (!$(response.content).length) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td colspan="10" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
// Pagination 구성하기
|
||||
const paging = $('.paging');
|
||||
paging.empty();
|
||||
paging.append(
|
||||
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
||||
(movePageNo) => {
|
||||
f.page.value = movePageNo;
|
||||
goSearch();
|
||||
}));
|
||||
|
||||
// 리스트 상단 정렬 notation 및 갱신 기능 적용
|
||||
uiUtil.addSortNotation(f.sort.value, (targetPage, targetSort) => {
|
||||
f.page.value = targetPage;
|
||||
f.sort.value = targetSort;
|
||||
goSearch();
|
||||
});
|
||||
|
||||
// sort 기능 적용
|
||||
uiUtil.sortable.init(
|
||||
// 드래그 가능 범위 지정 셀렉터
|
||||
'.sortable',
|
||||
// 드래그 핸들바 지정 셀렉터
|
||||
'.handle',
|
||||
// 현재 정렬이 orderNo,DESC 여부 검사 로직
|
||||
() => {
|
||||
return $('input[name=sort]').val() === INIT_SORT
|
||||
},
|
||||
// orderNo,DESC 로 정렬 변경 로직
|
||||
() => {
|
||||
f.sort.value = INIT_SORT;
|
||||
getArticles(0);
|
||||
},
|
||||
// 정렬변경 수행 로직
|
||||
(updateData) => {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
url: '/api/board/articles/sort',
|
||||
data: JSON.stringify(updateData),
|
||||
contentType: "application/json; charset=utf-8;",
|
||||
dataType: "json",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
alert('[[#{operation.orderNo.updated}]]');
|
||||
getArticles(f.page.value);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 최초 리스트 로드
|
||||
getArticles(document.reqForm.page.value);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const goSearch = () => {
|
||||
const f = document.reqForm;
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.reqForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchOpen.value = '';
|
||||
}
|
||||
|
||||
// 저장페이지 이동
|
||||
function goSave() {
|
||||
location.href = '/board/articles/create';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
function goUpdate(itemId) {
|
||||
location.href = '/board/articles/' + itemId;
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
// size 를 제거하면 전체 목록을 가져온다.
|
||||
delete data.size;
|
||||
|
||||
location.href = '/api/board/articles/excel?' + new URLSearchParams(data).toString();
|
||||
}
|
||||
|
||||
// 체크박스 선택/해제
|
||||
function toggleCheckbox(oj) {
|
||||
$('input[name=selectIds]').prop("checked", oj.checked);
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
if (!$('input[name=selectIds]').is(':checked')) {
|
||||
alert(/*[[#{operation.common.remove.choose}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
'method': 'DELETE',
|
||||
'url': '/api/board/articles/remove',
|
||||
'data': {
|
||||
'selectIds': data.selectIds
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
alert('선택한 아이템이 삭제되었습니다.');
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
193
admin/src/main/resources/templates/board/articles/create.html
Normal file
193
admin/src/main/resources/templates/board/articles/create.html
Normal file
@@ -0,0 +1,193 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form
|
||||
class="fw-bold"
|
||||
method="post" name="reqForm" th:action="@{/board/articles/create}">
|
||||
|
||||
<div class="container">
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="title">제목 *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control unescapeText" id="title" name="title"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="boardStartDate">게시일 *</label>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardStartDate" name="startDate"
|
||||
placeholder="게시일을 선택하세요" type="text"/>
|
||||
<a class="input-button" data-toggle title="toggle">
|
||||
<i class="icon-calendar"></i>
|
||||
</a>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardEndDate" name="endDate"
|
||||
placeholder="종료일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="open">공개여부</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" id="open" name="visible">
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="content">내용 *</label>
|
||||
<div class="input-group w-100">
|
||||
<textarea class="form-control" id="content" name="content" rows="10"></textarea>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4">
|
||||
<label class="form-label d-block" for="representImgFile">대표 이미지</label>
|
||||
<div class="input-group w-50" style="float: left">
|
||||
<input accept="image/*" class="form-control" id="representImgFile"
|
||||
name="representImgFile"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_REP', this);" type="file">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="input-group w-50" style="float: right; padding-left:10px;">-->
|
||||
<!-- <input type="text" class="form-control" name="repImgAlt"-->
|
||||
<!-- placeholder="이미지 대체 텍스트를 입력해주세요"/>-->
|
||||
<!-- </div>-->
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4 publicFileInputs">
|
||||
<label class="form-label d-block" for="formFile1">다건 파일 첨부</label>
|
||||
<button class="btn btn-outline-secondary d-inline-block align-top mb-2" onclick="addFileInput();"
|
||||
type="button"><i class="bi bi-plus-circle"></i> 파일 추가
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary" onclick="goPrev();" title="이전 화면으로 이동">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="gotoList();" title="목록 화면으로 이동">
|
||||
<i class="bi bi-justify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-primary float-end" onclick="goSave();" type="button">
|
||||
<i class="bi bi-save2"></i> 저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<!-- web editor - tinymce -->
|
||||
<script referrerpolicy="origin" src="/static/library/tinymce/6.0.3/tinymce.min.js"></script>
|
||||
<script src="/static/ui/editorImageUpload.js"></script>
|
||||
|
||||
<script>
|
||||
const goSave = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
// tinymce 는 사용자 입력을 받는 순간 몇몇 문자(&)를 escaping 한다.
|
||||
// xss 방지를 위한 html escape 는 필터를 통해 자동처리되니 전달시에는 원문 그대로를 던진다.
|
||||
f.content.value = uiUtil.unescapeHtml(tinymce.get('content').getContent());
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
'method': 'POST',
|
||||
'url': '/api/board/articles/create',
|
||||
'data': obj,
|
||||
success: (res) => {
|
||||
alert(`'${f.title.value}' 게시물이 생성되었습니다.\n이전 화면으로 이동합니다.`);
|
||||
history.back();
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (res) {
|
||||
const resJson = res.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (res) {
|
||||
$(res.responseJSON).each((idx, oj) => {
|
||||
let target = $(f).find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function addFileInput() {
|
||||
$('.publicFileInputs').append(`
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_PUBLIC', this);">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script th:inline="javascript">
|
||||
// init tinymce editor
|
||||
initEditor('#content');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// date time picker
|
||||
$(".flatpickr").flatpickr({
|
||||
dateFormat: "Y-m-d\\TH:i",
|
||||
// altInput: true,
|
||||
// altFormat: "Y-m-d H:i",
|
||||
monthSelectorType: 'static',
|
||||
enableTime: true,
|
||||
time_24hr: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const goPrev = () => {
|
||||
history.back();
|
||||
}
|
||||
|
||||
const gotoList = () => {
|
||||
location.href = '/board/articles';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
249
admin/src/main/resources/templates/board/articles/{id}.html
Normal file
249
admin/src/main/resources/templates/board/articles/{id}.html
Normal file
@@ -0,0 +1,249 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form
|
||||
class="fw-bold"
|
||||
method="post" name="reqForm" th:action="@{/board/articles/update}">
|
||||
<input name="id" th:value="${id}" type="hidden">
|
||||
<input name="orderNo" type="hidden">
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="title">제목 *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control unescapeText" id="title" name="title"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="boardStartDate">게시일 *</label>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardStartDate" name="startDate"
|
||||
placeholder="게시일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardEndDate" name="endDate"
|
||||
placeholder="종료일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="open">공개여부</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" id="open" name="visible">
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="content">내용 *</label>
|
||||
<div class="input-group w-100">
|
||||
<textarea class="form-control" id="content" name="content" rows="10"></textarea>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4">
|
||||
<label class="form-label d-block" for="representImgFile">대표 이미지</label>
|
||||
<div class="input-group w-50" style="float: left">
|
||||
<input accept="image/*" class="form-control"
|
||||
id="representImgFile"
|
||||
name="representImgFile"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_REP', this);"
|
||||
type="file">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="input-group w-50" style="float: right; padding-left:10px;">-->
|
||||
<!-- <input type="text" class="form-control" name="repImgAlt"-->
|
||||
<!-- placeholder="이미지 대체 텍스트를 입력해주세요"/>-->
|
||||
<!-- </div>-->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4 publicFileInputs">
|
||||
<label class="form-label d-block" for="formFile1">다건 파일 첨부</label>
|
||||
<button class="btn btn-outline-secondary d-inline-block align-top mb-2" onclick="addFileInput();"
|
||||
type="button"><i class="bi bi-plus-circle"></i> 파일 추가
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary" onclick="goPrev();" title="이전 화면으로 이동">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="gotoList();" title="목록 화면으로 이동">
|
||||
<i class="bi bi-justify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-primary float-end" onclick="goSave();" type="button">
|
||||
<i class="bi bi-save2"></i> 저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<!-- web editor - tinymce -->
|
||||
<script referrerpolicy="origin" src="/static/library/tinymce/6.0.3/tinymce.min.js"></script>
|
||||
<script src="/static/ui/editorImageUpload.js"></script>
|
||||
|
||||
<script>
|
||||
const goPrev = () => {
|
||||
history.back();
|
||||
}
|
||||
|
||||
const gotoList = () => {
|
||||
location.href = '/board/articles';
|
||||
}
|
||||
|
||||
function addFileInput() {
|
||||
const inputGroup = $(`
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_PUBLIC', this);">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
$('.publicFileInputs').append(inputGroup);
|
||||
|
||||
return inputGroup;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// date time picker
|
||||
$(".flatpickr").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: "Y-m-d\\TH:i",
|
||||
monthSelectorType: 'static',
|
||||
time_24hr: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const getArticle = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/api/board/articles/' + f.id.value,
|
||||
success(res) {
|
||||
console.log(res);
|
||||
|
||||
showAudit(res.title, res.createdBy, uiUtil.isoStrToReadable(res.createdAt)
|
||||
, res.updatedBy, uiUtil.isoStrToReadable(res.updatedAt));
|
||||
|
||||
initEditor('#content', (editor) => {
|
||||
editor.on('init', function () {
|
||||
setTimeout(() => {
|
||||
tinymce.get('content').setContent(uiUtil.unescapeHtml(res.content));
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
|
||||
f.title.value = uiUtil.unescapeHtml(res.title);
|
||||
f.startDate.value = res.startDate.substring(0, 16);
|
||||
f.endDate.value = res.endDate.substring(0, 16);
|
||||
f.visible.value = res.visible;
|
||||
f.orderNo.value = res.orderNo;
|
||||
|
||||
res.uploadFiles.forEach((uploadFile) => {
|
||||
switch (uploadFile.type.name) {
|
||||
// 대표 이미지
|
||||
case 'EXAMPLE_REP':
|
||||
const input = $(f.representImgFile);
|
||||
input.parent().append(
|
||||
`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
||||
uiUtil.showFileInfo(input, uploadFile, true);
|
||||
break;
|
||||
// 다건 첨부 파일
|
||||
case 'EXAMPLE_PUBLIC':
|
||||
let inputGroup = addFileInput();
|
||||
inputGroup.append(
|
||||
`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
||||
uiUtil.showFileInfo(inputGroup.find('input[type=file]'), uploadFile, false);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 상세정보 얻기
|
||||
getArticle();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const goSave = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
// tinymce 는 사용자 입력을 받는 순간 몇몇 문자(&)를 escaping 한다.
|
||||
// xss 방지를 위한 html escape 는 필터를 통해 자동처리되니 전달시에는 원문 그대로를 던진다.
|
||||
f.content.value = uiUtil.unescapeHtml(tinymce.get('content').getContent());
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
// 기존 에러 메세지 초기화
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
'method': 'PUT',
|
||||
'url': '/api/board/articles/update',
|
||||
'data': obj,
|
||||
success: (res) => {
|
||||
if (confirm(`'${uiUtil.unescapeHtml(res.title)}' 게시물이 수정되었습니다.\n이전 화면으로 이동하시겠습니까?`)) {
|
||||
history.back();
|
||||
}
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (res) {
|
||||
const resJson = res.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (res) {
|
||||
$(res.responseJSON).each((idx, oj) => {
|
||||
let target = $(f).find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
333
admin/src/main/resources/templates/board/secArticles.html
Normal file
333
admin/src/main/resources/templates/board/secArticles.html
Normal file
@@ -0,0 +1,333 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form autocomplete="off" method="get" name="reqForm" th:action="@{/board/secArticles}"
|
||||
th:object="${reqVO}">
|
||||
|
||||
<!-- hidden parameters -->
|
||||
<input name="sort" th:field="*{sort}" type="hidden"/>
|
||||
<input name="page" th:field="*{page}" type="hidden"/>
|
||||
|
||||
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
||||
<div class="col-5">
|
||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-25" id="searchField"
|
||||
th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="title">제목</option>
|
||||
<option value="updatedBy">작성자</option>
|
||||
</select> <label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||
style="width: 250px;" th:field="*{searchValue}"
|
||||
type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="col-sm-3 col-form-label" for="searchOpen">공개여부</label>
|
||||
<select class="form-select d-inline w-25" id="searchOpen"
|
||||
th:field="*{searchOpen}">
|
||||
<option selected value="">전체</option>
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-outline-secondary" onclick="goSearch();"
|
||||
type="button">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="goInit();" type="button">
|
||||
초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">
|
||||
TOTAL. <span id="totalElements"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i> <label>
|
||||
<select
|
||||
class="form-select form-select-sm" id="pageSize" name="size"
|
||||
onchange="goSearch()"
|
||||
th:field="*{size}">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:text="${item.codeText}" th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col" style="width:40px;"><label>
|
||||
<input class="form-check-input"
|
||||
onchange="toggleCheckbox(this);" type="checkbox"/></label>
|
||||
</th>
|
||||
<th scope="col" style="width:60px;"></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="title"
|
||||
href="#">제목</a>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<a class="order-able text-center d-inline-block w-100" data-sort-field="visible"
|
||||
href="#">공개여부</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="startDate"
|
||||
href="#">게시일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="endDate"
|
||||
href="#">종료일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="updatedBy"
|
||||
href="#">최근 수정자</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="updatedAt"
|
||||
href="#">최근 수정일</a></th>
|
||||
<th scope="col">
|
||||
<a class="order-able" data-sort-field="orderNo"
|
||||
href="#">정렬번호</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable" id="listTBody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="row paging"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<button class="btn btn-outline-secondary" onclick="goExcel();" type="button">
|
||||
<i class="bi bi-file-earmark-spreadsheet"></i> 엑셀 다운로드
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-outline-secondary" onclick="goSave();"
|
||||
type="button">
|
||||
<i class="bi bi-save2"></i> 등록
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="goRemove();" type="button">
|
||||
<i class="bi bi-ui-checks-grid"></i> 삭제
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="uiUtil.sortable.update();" type="button">
|
||||
<i class="bi bi-distribute-vertical"></i> 정렬 변경
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
const INIT_SORT = 'orderNo,DESC';
|
||||
|
||||
const getArticles = (pageNo) => {
|
||||
const f = document.reqForm;
|
||||
f.page.value = pageNo;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/api/board/secArticles',
|
||||
data: dataOj,
|
||||
success(response) {
|
||||
console.log(response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
// List 구성하기
|
||||
const tbody = $('#listTBody');
|
||||
tbody.empty();
|
||||
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-order-no="${ct.orderNo}"
|
||||
data-id="${ct.id}">
|
||||
<th
|
||||
scope="row">${idx + (pageNo * f.size.value) + 1}</th>
|
||||
<td><label>
|
||||
<input class="form-check-input"
|
||||
name="selectIds" type="checkbox" value="${ct.id}"/></label></td>
|
||||
<td><img
|
||||
src="${ct.uploadFile ? uiUtil.getFileReferURL('inline', ct.uploadFile)
|
||||
: '/static/ui/img/default-img.jpg'}"
|
||||
style="width: 25px;"
|
||||
class="img-thumbnail"/></td>
|
||||
<td><a href="javascript:goUpdate(${ct.id})">${ct.title}</a></td>
|
||||
<td class="text-secondary text-center">${ct.visible ? 'Y' : 'N'}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.startDate)}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.endDate)}</td>
|
||||
<td>${ct.updatedBy}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.updatedAt)}</td>
|
||||
<td class="text-center">${ct.orderNo} <i
|
||||
class="bi bi-distribute-vertical handle float-end fw-bold"
|
||||
style="cursor: move"></i></td>
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
if (!$(response.content).length) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td colspan="10" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
// Pagination 구성하기
|
||||
const paging = $('.paging');
|
||||
paging.empty();
|
||||
paging.append(
|
||||
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
||||
(movePageNo) => {
|
||||
f.page.value = movePageNo;
|
||||
goSearch();
|
||||
}));
|
||||
|
||||
// 리스트 상단 정렬 notation 및 갱신 기능 적용
|
||||
uiUtil.addSortNotation(f.sort.value, (targetPage, targetSort) => {
|
||||
f.page.value = targetPage;
|
||||
f.sort.value = targetSort;
|
||||
goSearch();
|
||||
});
|
||||
|
||||
// sort 기능 적용
|
||||
uiUtil.sortable.init(
|
||||
// 드래그 가능 범위 지정 셀렉터
|
||||
'.sortable',
|
||||
// 드래그 핸들바 지정 셀렉터
|
||||
'.handle',
|
||||
// 현재 정렬이 orderNo,DESC 여부 검사 로직
|
||||
() => {
|
||||
return $('input[name=sort]').val() === INIT_SORT
|
||||
},
|
||||
// orderNo,DESC 로 정렬 변경 로직
|
||||
() => {
|
||||
f.sort.value = INIT_SORT;
|
||||
getArticles(0);
|
||||
},
|
||||
// 정렬변경 수행 로직
|
||||
(updateData) => {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
url: '/api/board/secArticles/sort',
|
||||
data: JSON.stringify(updateData),
|
||||
contentType: "application/json; charset=utf-8;",
|
||||
dataType: "json",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
alert('[[#{operation.orderNo.updated}]]');
|
||||
getArticles(f.page.value);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 최초 리스트 로드
|
||||
getArticles(document.reqForm.page.value);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const goSearch = () => {
|
||||
const f = document.reqForm;
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.reqForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchOpen.value = '';
|
||||
}
|
||||
|
||||
// 저장페이지 이동
|
||||
function goSave() {
|
||||
location.href = '/board/secArticles/create';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
function goUpdate(itemId) {
|
||||
location.href = '/board/secArticles/' + itemId;
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
// size 를 제거하면 전체 목록을 가져온다.
|
||||
delete data.size;
|
||||
|
||||
location.href = '/api/board/secArticles/excel?' + new URLSearchParams(data).toString();
|
||||
}
|
||||
|
||||
// 체크박스 선택/해제
|
||||
function toggleCheckbox(oj) {
|
||||
$('input[name=selectIds]').prop("checked", oj.checked);
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
if (!$('input[name=selectIds]').is(':checked')) {
|
||||
alert(/*[[#{operation.common.remove.choose}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
'method': 'DELETE',
|
||||
'url': '/api/board/secArticles/remove',
|
||||
'data': {
|
||||
'selectIds': data.selectIds
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
alert('선택한 아이템이 삭제되었습니다.');
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
193
admin/src/main/resources/templates/board/secArticles/create.html
Normal file
193
admin/src/main/resources/templates/board/secArticles/create.html
Normal file
@@ -0,0 +1,193 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form
|
||||
class="fw-bold"
|
||||
method="post" name="reqForm" th:action="@{/board/secArticles/create}">
|
||||
|
||||
<div class="container">
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="title">제목 *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control unescapeText" id="title" name="title"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="boardStartDate">게시일 *</label>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardStartDate" name="startDate"
|
||||
placeholder="게시일을 선택하세요" type="text"/>
|
||||
<a class="input-button" data-toggle title="toggle">
|
||||
<i class="icon-calendar"></i>
|
||||
</a>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardEndDate" name="endDate"
|
||||
placeholder="종료일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="open">공개여부</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" id="open" name="visible">
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="content">내용 *</label>
|
||||
<div class="input-group w-100">
|
||||
<textarea class="form-control" id="content" name="content" rows="10"></textarea>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4">
|
||||
<label class="form-label d-block" for="representImgFile">대표 이미지</label>
|
||||
<div class="input-group w-50" style="float: left">
|
||||
<input accept="image/*" class="form-control" id="representImgFile"
|
||||
name="representImgFile"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_REP', this);" type="file">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="input-group w-50" style="float: right; padding-left:10px;">-->
|
||||
<!-- <input type="text" class="form-control" name="repImgAlt"-->
|
||||
<!-- placeholder="이미지 대체 텍스트를 입력해주세요"/>-->
|
||||
<!-- </div>-->
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4 publicFileInputs">
|
||||
<label class="form-label d-block" for="formFile1">다건 파일 첨부</label>
|
||||
<button class="btn btn-outline-secondary d-inline-block align-top mb-2" onclick="addFileInput();"
|
||||
type="button"><i class="bi bi-plus-circle"></i> 파일 추가
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary" onclick="goPrev();" title="이전 화면으로 이동">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="gotoList();" title="목록 화면으로 이동">
|
||||
<i class="bi bi-justify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-primary float-end" onclick="goSave();" type="button">
|
||||
<i class="bi bi-save2"></i> 저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<!-- web editor - tinymce -->
|
||||
<script referrerpolicy="origin" src="/static/library/tinymce/6.0.3/tinymce.min.js"></script>
|
||||
<script src="/static/ui/editorImageUpload.js"></script>
|
||||
|
||||
<script>
|
||||
const goSave = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
// tinymce 는 사용자 입력을 받는 순간 몇몇 문자(&)를 escaping 한다.
|
||||
// xss 방지를 위한 html escape 는 필터를 통해 자동처리되니 전달시에는 원문 그대로를 던진다.
|
||||
f.content.value = uiUtil.unescapeHtml(tinymce.get('content').getContent());
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
'method': 'POST',
|
||||
'url': '/api/board/secArticles/create',
|
||||
'data': obj,
|
||||
success: (res) => {
|
||||
alert(`'${f.title.value}' 게시물이 생성되었습니다.\n이전 화면으로 이동합니다.`);
|
||||
history.back();
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (res) {
|
||||
const resJson = res.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (res) {
|
||||
$(res.responseJSON).each((idx, oj) => {
|
||||
let target = $(f).find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function addFileInput() {
|
||||
$('.publicFileInputs').append(`
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_PUBLIC', this);">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script th:inline="javascript">
|
||||
// init tinymce editor
|
||||
initEditor('#content');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// date time picker
|
||||
$(".flatpickr").flatpickr({
|
||||
dateFormat: "Y-m-d\\TH:i",
|
||||
// altInput: true,
|
||||
// altFormat: "Y-m-d H:i",
|
||||
monthSelectorType: 'static',
|
||||
enableTime: true,
|
||||
time_24hr: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const goPrev = () => {
|
||||
history.back();
|
||||
}
|
||||
|
||||
const gotoList = () => {
|
||||
location.href = '/board/secArticles';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
253
admin/src/main/resources/templates/board/secArticles/{id}.html
Normal file
253
admin/src/main/resources/templates/board/secArticles/{id}.html
Normal file
@@ -0,0 +1,253 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form
|
||||
class="fw-bold"
|
||||
method="post" name="reqForm" th:action="@{/board/secArticles/update}">
|
||||
<input name="id" th:value="${id}" type="hidden">
|
||||
<input name="orderNo" type="hidden">
|
||||
<input name="createdAt" type="hidden">
|
||||
<input name="createdBy" type="hidden">
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="title">제목 *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control unescapeText" id="title" name="title"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="boardStartDate">게시일 *</label>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardStartDate" name="startDate"
|
||||
placeholder="게시일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control flatpickr" id="boardEndDate" name="endDate"
|
||||
placeholder="종료일을 선택하세요" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="open">공개여부</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" id="open" name="visible">
|
||||
<option value="true">Y</option>
|
||||
<option value="false">N</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="content">내용 *</label>
|
||||
<div class="input-group w-100">
|
||||
<textarea class="form-control" id="content" name="content" rows="10"></textarea>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4">
|
||||
<label class="form-label d-block" for="representImgFile">대표 이미지</label>
|
||||
<div class="input-group w-50" style="float: left">
|
||||
<input accept="image/*" class="form-control"
|
||||
id="representImgFile"
|
||||
name="representImgFile"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_REP', this);"
|
||||
type="file">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="input-group w-50" style="float: right; padding-left:10px;">-->
|
||||
<!-- <input type="text" class="form-control" name="repImgAlt"-->
|
||||
<!-- placeholder="이미지 대체 텍스트를 입력해주세요"/>-->
|
||||
<!-- </div>-->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-4 publicFileInputs">
|
||||
<label class="form-label d-block" for="formFile1">다건 파일 첨부</label>
|
||||
<button class="btn btn-outline-secondary d-inline-block align-top mb-2" onclick="addFileInput();"
|
||||
type="button"><i class="bi bi-plus-circle"></i> 파일 추가
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary" onclick="goPrev();" title="이전 화면으로 이동">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="gotoList();" title="목록 화면으로 이동">
|
||||
<i class="bi bi-justify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-primary float-end" onclick="goSave();" type="button">
|
||||
<i class="bi bi-save2"></i> 저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<!-- web editor - tinymce -->
|
||||
<script referrerpolicy="origin" src="/static/library/tinymce/6.0.3/tinymce.min.js"></script>
|
||||
<script src="/static/ui/editorImageUpload.js"></script>
|
||||
|
||||
<script>
|
||||
const goPrev = () => {
|
||||
history.back();
|
||||
}
|
||||
|
||||
const gotoList = () => {
|
||||
location.href = '/board/secArticles';
|
||||
}
|
||||
|
||||
function addFileInput() {
|
||||
const inputGroup = $(`
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control mb-2" type="file" name="multipartAttachments"
|
||||
onchange="uiUtil.uploadFile('EXAMPLE_PUBLIC', this);">
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
$('.publicFileInputs').append(inputGroup);
|
||||
|
||||
return inputGroup;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// date time picker
|
||||
$(".flatpickr").flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: "Y-m-d\\TH:i",
|
||||
monthSelectorType: 'static',
|
||||
time_24hr: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const getArticle = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/api/board/secArticles/' + f.id.value,
|
||||
success(res) {
|
||||
console.log(res);
|
||||
|
||||
showAudit(res.title, res.createdBy, uiUtil.isoStrToReadable(res.createdAt)
|
||||
, res.updatedBy, uiUtil.isoStrToReadable(res.updatedAt));
|
||||
|
||||
initEditor('#content', (editor) => {
|
||||
editor.on('init', function () {
|
||||
setTimeout(() => {
|
||||
tinymce.get('content').setContent(uiUtil.unescapeHtml(res.content));
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
|
||||
f.title.value = uiUtil.unescapeHtml(res.title);
|
||||
f.startDate.value = res.startDate.substring(0, 16);
|
||||
f.endDate.value = res.endDate.substring(0, 16);
|
||||
f.visible.value = res.visible;
|
||||
f.orderNo.value = res.orderNo;
|
||||
f.createdAt.value = res.createdAt;
|
||||
f.createdBy.value = res.createdBy;
|
||||
|
||||
res.uploadFiles.forEach((uploadFile) => {
|
||||
switch (uploadFile.type.name) {
|
||||
// 대표 이미지
|
||||
case 'EXAMPLE_REP':
|
||||
const input = $(f.representImgFile);
|
||||
input.parent().append(
|
||||
`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
||||
uiUtil.showFileInfo(input, uploadFile, true);
|
||||
break;
|
||||
// 다건 첨부 파일
|
||||
case 'EXAMPLE_PUBLIC':
|
||||
let inputGroup = addFileInput();
|
||||
inputGroup.append(
|
||||
`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
||||
uiUtil.showFileInfo(inputGroup.find('input[type=file]'), uploadFile, false);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 상세정보 얻기
|
||||
getArticle();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const goSave = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
// tinymce 는 사용자 입력을 받는 순간 몇몇 문자(&)를 escaping 한다.
|
||||
// xss 방지를 위한 html escape 는 필터를 통해 자동처리되니 전달시에는 원문 그대로를 던진다.
|
||||
f.content.value = uiUtil.unescapeHtml(tinymce.get('content').getContent());
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
// 기존 에러 메세지 초기화
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
'method': 'PUT',
|
||||
'url': '/api/board/secArticles/update',
|
||||
'data': obj,
|
||||
success: (res) => {
|
||||
if (confirm(`'${uiUtil.unescapeHtml(res.title)}' 게시물이 수정되었습니다.\n이전 화면으로 이동하시겠습니까?`)) {
|
||||
history.back();
|
||||
}
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (res) {
|
||||
const resJson = res.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (res) {
|
||||
$(res.responseJSON).each((idx, oj) => {
|
||||
let target = $(f).find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
247
admin/src/main/resources/templates/common/components.html
Normal file
247
admin/src/main/resources/templates/common/components.html
Normal file
@@ -0,0 +1,247 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns:sec="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<!--
|
||||
██ ██ ██ ███████ █████ ██████ ██
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ███████ █████ ███████ ██ ██ ██
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ██ ███████ ██ ██ ██████ ██
|
||||
-->
|
||||
<head th:fragment="head">
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||
<meta name="_csrf" th:content="${_csrf.token}"/>
|
||||
<meta name="_csrf_header" th:content="${_csrf.headerName}"/>
|
||||
<meta content="noindex, nofollow" name="robots"/>
|
||||
|
||||
<title th:if="${currentURI != null}" th:text="${currentURI.ogTitle}"></title>
|
||||
<meta name="title" th:content="${currentURI.ogTitle}" th:if="${currentURI != null}"/>
|
||||
<meta name="description" th:content="${currentURI.ogDesc}" th:if="${currentURI != null}"/>
|
||||
<meta name="keywords" th:content="${currentURI.ogKeywords}" th:if="${currentURI != null}"/>
|
||||
<meta property="og:title" th:content="${currentURI.ogTitle}" th:if="${currentURI != null}"/>
|
||||
<meta property="og:description" th:content="${currentURI.ogDesc}" th:if="${currentURI != null}"/>
|
||||
<meta property="og:keywords" th:content="${currentURI.ogKeywords}" th:if="${currentURI != null}"/>
|
||||
<meta property="og:image" th:content="${currentURI.ogImage}" th:if="${currentURI != null}"/>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap.min.css}"/>
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap-icons.css}"/>
|
||||
<script th:src="@{/static/library/jquery/jquery-3.6.0.min.js}"></script>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/static/library/jquery-ui/jquery-ui.min.css}"/>
|
||||
<script th:src="@{/static/library/jquery-ui/jquery-ui.min.js}"></script>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.css}">
|
||||
<script th:src="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.js}"
|
||||
type="text/javascript"></script>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.dark.css}">
|
||||
<script th:src="@{/static/library/flatpickr/flatpickr.min.js}"></script>
|
||||
|
||||
<script th:src="@{/static/ui/navbar/recycle-navbar.js}"></script>
|
||||
<link rel="stylesheet" th:href="@{/static/ui/navbar/recycle-navbar.css}"/>
|
||||
|
||||
<script th:src="@{/static/library/jsUri/Uri.js}"></script>
|
||||
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
|
||||
<script th:src="@{/static/library/bootstrap/bootstrap.min.js}"></script>
|
||||
<script th:src="@{/static/ui/uiUtil.js}"></script>
|
||||
<script th:src="@{/static/library/jquery/jquery-serializeObject.min.js}"></script>
|
||||
|
||||
<script th:each="flashMsg : ${session.flashAlertMessages}" th:if="${session.flashAlertMessages != null}"
|
||||
th:inline="javascript">
|
||||
$(function () {
|
||||
const flashAlertMessage = [[${flashMsg}]];
|
||||
if (flashAlertMessage) {
|
||||
alert(flashAlertMessage);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script th:if="${session.flashAlertMessages != null}" th:inline="javascript">
|
||||
[[${#session.removeAttribute('flashAlertMessages')}]]
|
||||
</script>
|
||||
|
||||
<script th:if="${S3URL != null}" th:inline="javascript">
|
||||
// AWS - S3 Bucket 을 사용하는 경우, 인라인 경로 참조를 위해 선언
|
||||
const S3URL = [[${S3URL}]];
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!--
|
||||
██ ███ ██ █████ ██ ██ ██ ██ ██ ███████ █████ ██████ ███████ ██████
|
||||
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ██ ██ ███████ ██ ██ ██ █████ ███████ █████ ███████ ██ ██ █████ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ████ ██ ██ ████ ██ ██ ██ ███████ ██ ██ ██████ ███████ ██ ██
|
||||
-->
|
||||
<nav class="navbar navbar-dark bg-dark navbar-expand-lg mb-3" th:fragment="header">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#"><i class="bi bi-server fs-4"></i></a>
|
||||
<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"
|
||||
class="navbar-toggler" data-bs-target="#navbarSupportedContent"
|
||||
data-bs-toggle="collapse"
|
||||
type="button">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0" th:if="${topNode != null}">
|
||||
<li class="nav-item">
|
||||
<a aria-current="page" class="nav-link active" th:href="${topNode.uri}" th:text="#{uri}">Home</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item" th:classappend="${#lists.size(menu.children) > 0} ? 'dropdown'" th:each="menu : ${topNode.children}"
|
||||
th:if="${menu.showOnNavi}">
|
||||
|
||||
<!-- 자식 children 가 없는 경우 -->
|
||||
<a class="nav-link" th:classappend="${currentURI.id == menu.id}? 'active'"
|
||||
th:href="${menu.uri}" th:if="${#lists.size(menu.children) == 0}"
|
||||
th:text="${#messages.msg(menu.id)}">메뉴명</a>
|
||||
|
||||
<!-- 자식 children 가 있는 경우 -->
|
||||
<th:block th:if="${#lists.size(menu.children) > 0}">
|
||||
<a aria-expanded="false"
|
||||
class="nav-link dropdown-toggle"
|
||||
data-bs-toggle="dropdown" roleDto="button"
|
||||
th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, menu.id)}? 'active'"
|
||||
th:href="${menu.uri}" th:text="${#messages.msg(menu.id)}">메뉴명</a>
|
||||
|
||||
<th:block th:insert="~{this :: subMenuFrag}"
|
||||
th:with="subMenus = ${menu.children}, addSubMenuClass = false">
|
||||
</th:block>
|
||||
</th:block>
|
||||
</li>
|
||||
|
||||
<!-- submenu fragment -->
|
||||
<th:block th:fragment="subMenuFrag">
|
||||
<ul aria-labelledby="navbarDropdown" class="dropdown-menu"
|
||||
th:classappend="${addSubMenuClass ? 'submenu' : ''}" th:if="${@adminUtil.shouldDisplaySubNodes(subMenus)}">
|
||||
<li th:each="child : ${subMenus}" th:if="${child.showOnNavi}">
|
||||
<a class="dropdown-item"
|
||||
th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, child.id)}? 'active'"
|
||||
th:href="${@adminUtil.shouldDisplaySubNodes(child.children) ? 'javascript:void(0)' : child.uri}">
|
||||
[[${#messages.msg(child.id)}]]
|
||||
<i class="bi bi-arrow-right-circle-fill"
|
||||
th:if="${@adminUtil.shouldDisplaySubNodes(child.children)}"></i>
|
||||
</a>
|
||||
|
||||
<th:block th:insert="~{this :: subMenuFrag}"
|
||||
th:with="subMenus = ${child.children}, addSubMenuClass = true">
|
||||
</th:block>
|
||||
</li>
|
||||
</ul>
|
||||
</th:block>
|
||||
</ul>
|
||||
<div class="d-flex">
|
||||
<span class="text-white me-1" th:text="#{greeting} + ','">안녕하세요</span>
|
||||
<a aria-expanded="false"
|
||||
class="d-flex align-items-center text-white link-dark text-decoration-none dropdown-toggle"
|
||||
data-bs-toggle="dropdown" href="#" id="dropdownUser2">
|
||||
<strong sec:authentication="name">로그인 사용자명</strong>
|
||||
</a>
|
||||
<ul aria-labelledby="dropdownUser2" class="dropdown-menu text-small shadow"
|
||||
style="left:auto;right:0;">
|
||||
<li th:each="authority : ${#authentication.getAuthorities()}">
|
||||
<span class="dropdown-item text-muted" th:text="${authority}"></span>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="/logout">Sign out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!--
|
||||
██████ ██████ ███████ █████ ██████ ██████ ██████ ██ ██ ███ ███ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██
|
||||
██████ ██████ █████ ███████ ██ ██ ██ ██████ ██ ██ ██ ████ ██ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██████ ██ ██ ███████ ██ ██ ██████ ██████ ██ ██ ██████ ██ ██ ██████
|
||||
-->
|
||||
<div class="row" th:fragment="breadcrumb">
|
||||
<div class="col">
|
||||
<nav aria-label="breadcrumb" class="float-end" style="--bs-breadcrumb-divider: '>';">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item" th:classappend="${item.id == currentURI.id}? 'active'"
|
||||
th:each="item, status : ${menuHierarchy}">
|
||||
<a class="text-decoration-none" th:href="${item.uri}" th:if="${item.id != currentURI.id}">
|
||||
<span th:if="${status.first}" th:remove="tag"><i class="bi bi-house-fill"></i></span>
|
||||
<span th:if="${!status.first}" th:remove="tag"
|
||||
th:text="${@coreUtil.getUriTitle(item)}"></span>
|
||||
</a>
|
||||
<span th:if="${item.id == currentURI.id}" th:remove="tag"
|
||||
th:text="${@coreUtil.getUriTitle(item)}"></span>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
██████ █████ ██████ ███████ ██ ██ ███████ █████ ██████ ██ ███ ██ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
|
||||
██████ ███████ ██ ███ █████ ███████ █████ ███████ ██ ██ ██ ██ ██ ██ ██ ███
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ██ ██████ ███████ ██ ██ ███████ ██ ██ ██████ ██ ██ ████ ██████
|
||||
-->
|
||||
<div class="bd-title mb-3 row fs-3" th:fragment="pageHeading">
|
||||
<div class="col"><i class="bi bi-list"></i> <span
|
||||
th:text="${#messages.msg(currentURI.id)}"></span></div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
██████ ██████ ███████ ██████ █████ ████████ ██ ██████ ███ ██ ███ ███ ███████ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ████ ████ ██ ██
|
||||
██ ██ ██████ █████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ███████ ██ ███
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██████ ██ ███████ ██ ██ ██ ██ ██ ██ ██████ ██ ████ ██ ██ ███████ ██████
|
||||
-->
|
||||
<div class="row" th:fragment="operationMessage" th:if="${not #strings.isEmpty(operationMessage)}">
|
||||
<div class="alert alert-info fw-bold" th:utext="${operationMessage}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
███████ ██████ ██████ ████████ ███████ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
█████ ██ ██ ██ ██ ██ █████ ██████
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██████ ██████ ██ ███████ ██ ██
|
||||
-->
|
||||
<div class="container" th:fragment="footer">
|
||||
<footer class="py-3 my-4 border-top">
|
||||
<div class="text-center">
|
||||
<span class="text-muted">© 2022 All rights reserved</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- AUDIT area -->
|
||||
<div class="alert alert-info audit-area" role="alert" style="visibility:hidden;"
|
||||
th:fragment="auditArea">
|
||||
<p class="mb-0">
|
||||
<i class="bi bi-info-circle-fill"></i>
|
||||
<mark class="audit-target">Role</mark>
|
||||
<small class="text-body-secondary">is</small>
|
||||
<small class="text-body-secondary">created by</small> <u class="createdBy">someone</u>
|
||||
<small
|
||||
class="text-body-secondary">at</small> <small
|
||||
class="text-body-secondary createdAt">YYYY-MM-DD HH:mm</small>
|
||||
<small class="text-body-secondary">and lastly updated by</small> <u
|
||||
class="updatedBy">someone</u>
|
||||
<small
|
||||
class="text-body-secondary">at</small> <small
|
||||
class="text-body-secondary updatedAt">YYYY-MM-DD HH:mm</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<body>
|
||||
|
||||
<!--
|
||||
██████ █████ ██████ ██ ███ ██ █████ ████████ ██ ██████ ███ ██
|
||||
██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ████ ██
|
||||
██████ ███████ ██ ███ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ██ ██ ██████ ██ ██ ████ ██ ██ ██ ██ ██████ ██ ████
|
||||
-->
|
||||
<div th:fragment="pagination(items)">
|
||||
<div class="row">
|
||||
<nav aria-label="Page navigation example">
|
||||
<ul class="pagination justify-content-center">
|
||||
<li class="page-item" th:classappend="${!items.pageable.hasPrevious} ? 'disabled'">
|
||||
<a class="page-link"
|
||||
th:href="|javascript:goPageable(${items.pageable.pageNumber - 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">이전</a>
|
||||
</li>
|
||||
<li class="page-item"
|
||||
th:classappend="${idx == items.pageable.pageNumber} ? 'disabled'"
|
||||
th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}">
|
||||
<a class="page-link"
|
||||
th:href="|javascript:goPageable(${idx}, ${items.pageable.pageSize}, '${items.pageable.sort}')|"
|
||||
th:text="${idx+1}">페이지넘버</a>
|
||||
</li>
|
||||
<li class="page-item"
|
||||
th:classappend="${items.pageable.pageNumber == items.totalPages - 1 or items.totalPages == 0} ? 'disabled'">
|
||||
<a class="page-link"
|
||||
th:href="|javascript:goPageable(${items.pageable.pageNumber + 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|">다음</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
88
admin/src/main/resources/templates/email/emailForm.html
Normal file
88
admin/src/main/resources/templates/email/emailForm.html
Normal file
@@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form class="fw-bold" enctype="multipart/form-data" method="post"
|
||||
th:action="@{/addons/email/form}" th:object="${formDto}">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="id">To *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="id" th:classappend="${#fields.hasErrors('to')} ? 'is-invalid'" th:field="*{to}"
|
||||
type="email"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{to}" th:if="${#fields.hasErrors('to')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="subject">Subject *</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="subject" th:classappend="${#fields.hasErrors('subject')} ? 'is-invalid'"
|
||||
th:field="*{subject}"/>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{subject}"
|
||||
th:if="${#fields.hasErrors('subject')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="msgType">Message Type *</label>
|
||||
<div class="col-sm-4">
|
||||
<input checked class="form-check-input" id="msgType" name="msgType" type="radio"
|
||||
value="HTML"/>
|
||||
<label class="form-check-label" for="msgType">HTML</label>
|
||||
<input class="form-check-input" id="msgType2" name="msgType" type="radio" value="TEXT"/>
|
||||
<label class="form-check-label" for="msgType2">TEXT</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-2 col-form-label" for="message">Message *</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="message" th:classappend="${#fields.hasErrors('message')} ? 'is-invalid'" th:field="*{message}"
|
||||
type="text"></textarea>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{message}"
|
||||
th:if="${#fields.hasErrors('message')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 publicFileInputs">
|
||||
<label class="form-label d-block" for="formFile1">파일 첨부</label>
|
||||
<input class="form-control w-50 d-inline-block mb-2" id="formFile1" name="multipartFiles"
|
||||
type="file">
|
||||
<button class="btn btn-success d-inline-block align-top" onclick="addFileInput('public');"
|
||||
type="button">추가
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" type="submit">발송</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function addFileInput(type) {
|
||||
let tmpl = $.templates('#fileInputTmpl');
|
||||
switch (type) {
|
||||
case 'public':
|
||||
$('.publicFileInputs').append(tmpl.render({'name': 'multipartFiles'}));
|
||||
break;
|
||||
case 'private':
|
||||
$('.privateFileInputs').append(tmpl.render({'name': 'privateFiles'}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fileInputTmpl" type="text/x-jsrender">
|
||||
<input class="form-control w-50 mb-2" type="file" name="{{:name}}"/>
|
||||
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
35
admin/src/main/resources/templates/error/403.html
Normal file
35
admin/src/main/resources/templates/error/403.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-error}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:sec="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<section layout:fragment="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold"><i class="bi bi-shield-shaded"></i>
|
||||
Oops, 403 Forbidden :-(</h1>
|
||||
<p class="col-md-8 fs-4">
|
||||
<span th:text="${message}"></span> <br/>
|
||||
<span class="text-muted" sec:authentication="name"></span> 님이 가진 권한 (<span
|
||||
class="text-muted" sec:authentication="principal.authorities"></span>)으로 이용할 수 없는
|
||||
기능입니다.
|
||||
</p>
|
||||
<button class="btn btn-primary btn-lg" onclick="location.href='/'" type="button">홈으로 이동
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
37
admin/src/main/resources/templates/error/404.html
Normal file
37
admin/src/main/resources/templates/error/404.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-error}"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>404</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<section layout:fragment="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold"><i class="bi bi-eye-slash-fill"></i>
|
||||
Oops, 404 Not Found :-(</h1>
|
||||
<p class="col-md-8 fs-4">
|
||||
존재하지 않는 URI 주소 혹은 페이지가 없는 주소로 접근했습니다. 다시 확인해주세요.
|
||||
</p>
|
||||
<p class="col-md-8 fs-5">
|
||||
<span>Error</span> <span class="text-muted" th:text="${error}"></span>
|
||||
<br/>
|
||||
<span>Message</span> <span class="text-muted" th:text="${message}"></span>
|
||||
</p>
|
||||
<button class="btn btn-primary btn-lg" onclick="location.href='/'" type="button">홈으로 이동
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
43
admin/src/main/resources/templates/error/500.html
Normal file
43
admin/src/main/resources/templates/error/500.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-error}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<title>500 - 에러발생</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<section layout:fragment="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold"><i class="bi bi-cone-striped"></i>
|
||||
Oops, <span class="text-muted">에러가 발생했습니다!</span> :-(</h1>
|
||||
<p class="col-md-8 fs-4">
|
||||
아래 에러 메세지를 담당자에게 전달해주세요.
|
||||
</p>
|
||||
<p class="col-md-8 fs-5">
|
||||
<span>Error</span> <span class="text-muted" th:text="${error}"></span>
|
||||
<br/>
|
||||
<span>Message</span> <span class="text-muted" th:text="${message}"></span>
|
||||
<!-- <br/>-->
|
||||
<!-- <span>Status</span> <span th:text="${status}" class="text-muted"></span>-->
|
||||
<!-- <br/>-->
|
||||
<!-- <span>Path</span> <span th:text="${path}" class="text-muted"></span>-->
|
||||
<!-- <br/>-->
|
||||
<!-- <span>Timestamp</span> <span th:text="${timestamp}" class="text-muted"></span>-->
|
||||
</p>
|
||||
<hr>
|
||||
<button class="btn btn-primary btn-lg" onclick="history.go(-1)" type="button">이전으로 이동
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
35
admin/src/main/resources/templates/home.html
Normal file
35
admin/src/main/resources/templates/home.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-home}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:sec="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<title>관리자 수정</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold">안녕하세요, <span class="text-muted"
|
||||
sec:authentication="name"></span> :-)</h1>
|
||||
<p class="col-md-8 fs-4">
|
||||
관리자 메인에 오신걸 환영합니다. <span class="text-muted" sec:authentication="name"></span> 님께 부여된 역할에 따라
|
||||
메뉴이용이
|
||||
제한되는 점에 유의해주세요.
|
||||
</p>
|
||||
|
||||
<p class="col-md-8 fs-5">
|
||||
<span>역할</span>
|
||||
<span class="text-muted"
|
||||
th:each="role, status : ${loginUserRoles}"
|
||||
th:text="${role.getId()} + ' (' + ${role.description} + ')' + ${!status.last ? ', ': ''}"></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
21
admin/src/main/resources/templates/layout/layout-error.html
Normal file
21
admin/src/main/resources/templates/layout/layout-error.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<section layout:fragment="content">
|
||||
<p>Page content goes here</p>
|
||||
</section>
|
||||
|
||||
<div class="container">
|
||||
<footer class="py-3 my-4 border-top">
|
||||
<div class="text-center">
|
||||
<span class="text-muted">© 2022 All rights reserved</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
19
admin/src/main/resources/templates/layout/layout-home.html
Normal file
19
admin/src/main/resources/templates/layout/layout-home.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head th:replace="~{common/components :: head}"></head>
|
||||
|
||||
<body>
|
||||
<header th:replace="~{common/components :: header}"></header>
|
||||
|
||||
<div class="container">
|
||||
<div th:replace="~{common/components :: operationMessage}"></div>
|
||||
|
||||
<section class="container" layout:fragment="content">
|
||||
page content
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{common/components :: footer}"></div>
|
||||
</body>
|
||||
</html>
|
||||
22
admin/src/main/resources/templates/layout/layout-login.html
Normal file
22
admin/src/main/resources/templates/layout/layout-login.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||
<meta content="noindex, nofollow" name="robots"/>
|
||||
<title>layout 타이틀</title>
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap.min.css}"/>
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap-icons.css}"/>
|
||||
<script th:src="@{/static/library/jquery/jquery-3.6.0.min.js}"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<section class="container" layout:fragment="content">
|
||||
<p>Page content goes here</p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
admin/src/main/resources/templates/layout/layout.html
Normal file
25
admin/src/main/resources/templates/layout/layout.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html th:label="${currentURI != null ? currentURI.id + '-label' : ''}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head th:replace="~{common/components :: head}"></head>
|
||||
|
||||
<body>
|
||||
<header th:replace="~{common/components :: header}"></header>
|
||||
|
||||
<div class="container">
|
||||
<div th:replace="~{common/components :: breadcrumb}"></div>
|
||||
<div th:replace="~{common/components :: pageHeading}"></div>
|
||||
<div th:replace="~{common/components :: operationMessage}"></div>
|
||||
|
||||
<section class="container" layout:fragment="content">
|
||||
page content
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div th:replace="~{common/components :: footer}"></div>
|
||||
|
||||
<section layout:fragment="script"></section>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,185 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form method="get" name="paramForm" onsubmit="goSearch();"
|
||||
th:action="@{/analysis/operationlog}" th:object="${paramDto}">
|
||||
<!-- hidden parameters -->
|
||||
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
|
||||
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
|
||||
|
||||
<div class="row bg-secondary p-2 mb-2" style="--bs-bg-opacity: .2;">
|
||||
<div class="col">
|
||||
<label class="col-form-label" for="searchAppType">App Type</label>
|
||||
<select class="form-select d-inline" id="searchAppType" style="width: 110px;"
|
||||
th:field="*{searchAppType}">
|
||||
<option selected value="">전체</option>
|
||||
<option
|
||||
th:each="appType : ${T(app.module.core.config.application.enums.AppType).values()}"
|
||||
th:value="${appType.name}">
|
||||
[[${appType.name}]]
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<label class="col-form-label" for="searchOperationType">Operation Type</label>
|
||||
<select class="form-select d-inline" id="searchOperationType" style="width: 110px;"
|
||||
th:field="*{searchOperationType}">
|
||||
<option selected value="">전체</option>
|
||||
<option
|
||||
th:each="operationType : ${T(app.module.core.config.application.enums.OperationLogType).values()}"
|
||||
th:value="${operationType.name}">[[${operationType.name}]] ([[${operationType.desc}]])
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<label class="col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-auto" id="searchField"
|
||||
th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="id">로그 ID</option>
|
||||
<option value="operatorId">수행자</option>
|
||||
<option value="targetId">피수행자</option>
|
||||
</select>
|
||||
<label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||
style="" th:field="*{searchValue}"
|
||||
type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-secondary" onclick="goSearch();"
|
||||
type="button">검색
|
||||
</button>
|
||||
<button class="btn btn-light" onclick="goInit();" type="button">초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">
|
||||
Total: <span th:text="${listOutput.totalElements}"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i> <label> <select
|
||||
class="form-select form-select-sm" id="pageSize" name="pageSize"
|
||||
onchange="goSearch()">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:text="${item.codeText}" th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id"
|
||||
href="#">로그 ID</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="appType"
|
||||
href="#">App Type</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="operationLogType"
|
||||
href="#">Operation Type</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="ip"
|
||||
href="#">IP</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="createdAt"
|
||||
href="#">수행일</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="createdBy"
|
||||
href="#">수행자</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="targetId"
|
||||
href="#">피수행자</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable">
|
||||
|
||||
<div th:each="item, status : ${listOutput.content}" th:remove="tag">
|
||||
<tr>
|
||||
<td class="row">[[${status.count + (listOutput.pageable.pageNumber *
|
||||
listOutput.pageable.pageSize)}]]
|
||||
</td>
|
||||
<th class="bg-info">[[${item.id}]]</th>
|
||||
<td>[[${item.appType}]]</td>
|
||||
<td>[[${item.operationLogType}]]</td>
|
||||
<td>
|
||||
<span th:if="${not #strings.isEmpty(item.ip)}" th:remove="tag">[[${item.ip}]]</span>
|
||||
<span th:if="${#strings.isEmpty(item.ip)}" th:remove="tag"><i
|
||||
class="bi bi-slash-circle"></i></span>
|
||||
</td>
|
||||
<td>[[${#temporals.format(item.createdAt, 'yyyy-MM-dd HH:mm')}]]</td>
|
||||
<td>[[${item.createdBy}]]</td>
|
||||
<td>
|
||||
<span th:if="${not #strings.isEmpty(item.targetId)}" th:remove="tag">[[${item.targetId}]]</span>
|
||||
<span th:if="${#strings.isEmpty(item.targetId)}" th:remove="tag"><i
|
||||
class="bi bi-slash-circle"></i></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="8"><i class="bi bi-arrow-right"></i> [[${item.taskDesc}]]</td>
|
||||
</tr>
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
// 목록 정렬 표기 및 갱신 기능 적용
|
||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||
[[${listOutput.pageable.sort.toString()}]]);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
function goSearch() {
|
||||
const f = document.paramForm;
|
||||
f.action = '/analysis/operationlog';
|
||||
f.page.value = 0;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.paramForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchAppType.value = '';
|
||||
f.searchOperationType.value = '';
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.paramForm;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.action = '/analysis/operationlog/excel';
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
</html>
|
||||
386
admin/src/main/resources/templates/privilege/privilegeList.html
Normal file
386
admin/src/main/resources/templates/privilege/privilegeList.html
Normal file
@@ -0,0 +1,386 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="권한 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"></div>
|
||||
<div class="col fw-bold ms-4">
|
||||
|
||||
<form name="formDto" action="" method="post">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">권한 ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control" placeholder="공백없이 권한 ID 입력"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="description">설명</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="description" name="description" class="form-control"
|
||||
placeholder="설명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-description"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary mt-1" onclick="addChildNode();">권한 추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/adminPrivilege/get/recursiveItems',
|
||||
cache: false,
|
||||
success: function (response) {
|
||||
let jsonData = response.items;
|
||||
$(jsonData).each(function (idx, oj) {
|
||||
oj['text'] = !oj.description ? oj.id : oj.id + ' (' + oj.description + ')';
|
||||
oj['value'] = oj.description;
|
||||
});
|
||||
renderTree({
|
||||
text: '관리자 권한',
|
||||
value: '',
|
||||
nodes: jsonData
|
||||
}, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
tree.treeview({
|
||||
data: [nodes],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
|
||||
cleanFormFields();
|
||||
|
||||
$(f.id).removeAttr('readonly');
|
||||
|
||||
f.id.value = currentNode.text;
|
||||
f.description.value = currentNode.value ? currentNode.value : '';
|
||||
f.id.focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentNode.id) {
|
||||
getInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getNodes')[0];
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
const f = document.formDto;
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
cleanFormFields();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/adminPrivilege/get/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
200: function (response) {
|
||||
const item = response.item;
|
||||
f.id.value = item.id;
|
||||
f.description.value = item.description;
|
||||
f.orderNo.value = item.orderNo;
|
||||
|
||||
showAudit(item.id, item.createdBy, item.createdAt, item.updatedBy, item.updatedAt);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
$(f.id).attr('readonly', 'readonly');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminPrivilege/save',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree(response.item.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const f = document.formDto;
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.remove.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' " + [[#{operation.uri.remove.ask(info.text)}]])) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert([[#{operation.common.remove.done}]]);
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminPrivilege/remove',
|
||||
data: {id: info.id},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree();
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.description.value = '';
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$('.audit-area').hide();
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert([[#{operation.uri.move.choose}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (info.id === 'code.new.temp') {
|
||||
alert([[#{operation.uri.move.save.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
const f = document.formDto;
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/adminPrivilege/switchOrderNo',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(updateList),
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('search', [
|
||||
searchVal, {ignoreCase: true, revealResults: true}
|
||||
]);
|
||||
if (searchNode.length) {
|
||||
tree.treeview('selectNode', [searchNode[0], {silent: false}]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
105
admin/src/main/resources/templates/security/login.html
Normal file
105
admin/src/main/resources/templates/security/login.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-login}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<title>Sign in</title>
|
||||
<style>
|
||||
.bd-placeholder-img {
|
||||
font-size: 1.125rem;
|
||||
text-anchor: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.bd-placeholder-img-lg {
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-signin {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-signin .checkbox {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.form-signin .form-floating:focus-within {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-signin input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-signin input[type="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="text-center">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<main class="form-signin">
|
||||
<form method="post" th:action="@{/login}">
|
||||
<i class="bi bi-server fs-1"></i>
|
||||
<h1 class="h3 mb-3 fw-normal">관리자 로그인</h1>
|
||||
|
||||
<div class="row" th:if="${session['SPRING_SECURITY_LAST_EXCEPTION']} != null">
|
||||
<div class="alert alert-danger fw-bold"
|
||||
th:utext="${session['SPRING_SECURITY_LAST_EXCEPTION'].message}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-floating">
|
||||
<input autofocus class="form-control" id="floatingInput" name="username" placeholder="ID를 입력해주세요"
|
||||
type="text">
|
||||
<label for="floatingInput">ID</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input class="form-control" id="floatingPassword" name="password" placeholder="Password"
|
||||
type="password">
|
||||
<label for="floatingPassword">Password</label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<div aria-label="Basic checkbox toggle button group" class="btn-group" roleDto="group">
|
||||
<input autocomplete="off" class="btn-check" id="btn_ck1" name="remember-me"
|
||||
type="checkbox">
|
||||
<label class="btn btn-outline-primary" for="btn_ck1">로그인 상태 유지하기</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="w-100 btn btn-lg btn-primary" type="submit">Sign in</button>
|
||||
</form>
|
||||
</main>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
388
admin/src/main/resources/templates/settings/userPrivilege.html
Normal file
388
admin/src/main/resources/templates/settings/userPrivilege.html
Normal file
@@ -0,0 +1,388 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="권한 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"></div>
|
||||
<div class="col fw-bold ms-4">
|
||||
|
||||
<form name="formDto" action="" method="post">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">권한 ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control" placeholder="공백없이 권한 ID 입력"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="description">설명</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="description" name="description" class="form-control"
|
||||
placeholder="설명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-description"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary mt-1" onclick="addChildNode();">권한 추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/userPrivileges',
|
||||
cache: false,
|
||||
success: function (response) {
|
||||
let jsonData = response.userPrivileges;
|
||||
$(jsonData).each(function (idx, oj) {
|
||||
oj['text'] = !oj.description ? oj.id : oj.id + ' (' + oj.description + ')';
|
||||
oj['value'] = oj.description;
|
||||
});
|
||||
renderTree({
|
||||
text: '사용자 권한',
|
||||
value: '',
|
||||
nodes: jsonData
|
||||
}, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
tree.treeview({
|
||||
data: [nodes],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
|
||||
cleanFormFields();
|
||||
|
||||
$(f.id).removeAttr('readonly');
|
||||
|
||||
f.id.value = currentNode.text;
|
||||
f.description.value = currentNode.value ? currentNode.value : '';
|
||||
f.id.focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentNode.id) {
|
||||
getInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getNodes')[0];
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
const f = document.formDto;
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
cleanFormFields();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/userPrivileges/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
200: function (response) {
|
||||
const item = response.userPrivilege;
|
||||
f.id.value = item.id;
|
||||
f.description.value = item.description;
|
||||
f.orderNo.value = item.orderNo;
|
||||
|
||||
showAudit(item.id, item.createdBy, item.createdAt, item.updatedBy, item.updatedAt);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
$(f.id).attr('readonly', 'readonly');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/userPrivileges/save',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.msg);
|
||||
refreshTree(response.userPrivilege.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const f = document.formDto;
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.remove.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' " + [[#{operation.uri.remove.ask(info.text)}]])) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert([[#{operation.common.remove.done}]]);
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: '/api/userPrivileges/remove',
|
||||
data: {id: info.id},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.msg);
|
||||
refreshTree();
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.description.value = '';
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$('.audit-area').hide();
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert([[#{operation.uri.move.choose}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (info.id === 'code.new.temp') {
|
||||
alert([[#{operation.uri.move.save.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
const f = document.formDto;
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'PATCH',
|
||||
url: '/api/userPrivileges/sort',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify({
|
||||
sortUserPrivileges: updateList
|
||||
}),
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('search', [
|
||||
searchVal, {ignoreCase: true, revealResults: true}
|
||||
]);
|
||||
if (searchNode.length) {
|
||||
tree.treeview('selectNode', [searchNode[0], {silent: false}]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
404
admin/src/main/resources/templates/settings/userRoles.html
Normal file
404
admin/src/main/resources/templates/settings/userRoles.html
Normal file
@@ -0,0 +1,404 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="역할 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"></div>
|
||||
<div class="col fw-bold ms-4">
|
||||
|
||||
<form name="formDto" action="" method="post">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">역할 ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control"
|
||||
placeholder="ROLE_ 로 시작하는 역할 ID 입력"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="description">설명</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="description" name="description" class="form-control"
|
||||
placeholder="설명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-description"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="privilegeIds">권한</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select text-secondary" id="privilegeIds" name="privilegeIds"
|
||||
multiple style="height: 200px;">
|
||||
<option th:each="privilege : ${privileges}" th:value="${privilege.id}"
|
||||
class="fw-bold"
|
||||
th:text="${privilege.id + ' (' + privilege.description + ')'}"></option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold field-privilegeIds"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary mt-1" onclick="addChildNode();">역할 추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/userRoles',
|
||||
cache: false,
|
||||
success: function (response) {
|
||||
let jsonData = response.userRoles;
|
||||
$(jsonData).each(function (idx, oj) {
|
||||
oj['text'] = !oj.description ? oj.id : oj.id + ' (' + oj.description + ')';
|
||||
oj['value'] = oj.description;
|
||||
});
|
||||
renderTree({
|
||||
text: '사용자 역할',
|
||||
value: '',
|
||||
nodes: jsonData
|
||||
}, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
tree.treeview({
|
||||
data: [nodes],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
|
||||
cleanFormFields();
|
||||
|
||||
$(f.id).removeAttr('readonly');
|
||||
|
||||
f.id.value = currentNode.text;
|
||||
f.description.value = currentNode.value ? currentNode.value : '';
|
||||
f.id.focus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentNode.id) {
|
||||
getInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getNodes')[0];
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
const f = document.formDto;
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
cleanFormFields();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/userRoles/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
200: function (response) {
|
||||
const item = response.userRole;
|
||||
f.id.value = item.id;
|
||||
f.description.value = item.description;
|
||||
f.orderNo.value = item.orderNo;
|
||||
|
||||
$('#privilegeIds').val(item.privileges);
|
||||
|
||||
showAudit(item.id, item.createdBy, item.createdAt, item.updatedBy, item.updatedAt);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
$(f.id).attr('readonly', 'readonly');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/userRoles/save',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.msg);
|
||||
refreshTree(response.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const f = document.formDto;
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.remove.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' " + [[#{operation.uri.remove.ask(info.text)}]])) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert([[#{operation.common.remove.done}]]);
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: '/api/userRole/remove',
|
||||
data: {id: info.id},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.msg);
|
||||
refreshTree();
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.description.value = '';
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$('.audit-area').hide();
|
||||
$('#privilegeIds').val([]);
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert([[#{operation.uri.move.choose}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (info.id === 'code.new.temp') {
|
||||
alert([[#{operation.uri.move.save.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
const f = document.formDto;
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'PATCH',
|
||||
url: '/api/userRoles/sort',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify({
|
||||
sortUserRoles: updateList
|
||||
}),
|
||||
beforeSend: function (xhr) {
|
||||
// csrf 토큰
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('search', [
|
||||
searchVal, {ignoreCase: true, revealResults: true}
|
||||
]);
|
||||
if (searchNode.length) {
|
||||
tree.treeview('selectNode', [searchNode[0], {silent: false}]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
216
admin/src/main/resources/templates/settings/users.html
Normal file
216
admin/src/main/resources/templates/settings/users.html
Normal file
@@ -0,0 +1,216 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form method="post" name="reqForm" th:action="@{/settings/users}" th:object="${reqVO}">
|
||||
|
||||
<!-- hidden parameters -->
|
||||
<input name="sort" th:field="*{sort}" type="hidden"/>
|
||||
<input name="page" th:field="*{page}" type="hidden"/>
|
||||
|
||||
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
||||
<div class="col-5">
|
||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-25" id="searchField" th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="id">ID</option>
|
||||
<option value="email">Email</option>
|
||||
</select>
|
||||
<label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요." style="width: 250px;"
|
||||
th:field="*{searchValue}" type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="col-sm-2 col-form-label" for="searchRole">권한</label>
|
||||
<select class="form-select d-inline w-50" id="searchRole" th:field="*{searchRole}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-outline-secondary" onclick="goSearch();"
|
||||
type="button">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="goInit();"
|
||||
type="button">초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">
|
||||
TOTAL. <span id="totalElements"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i>
|
||||
<label>
|
||||
<select class="form-select form-select-sm" id="pageSize" name="size"
|
||||
onchange="goSearch()"
|
||||
th:field="*{size}">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:text="${item.codeText}" th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
||||
<th class="text-secondary" scope="col">권한</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="nickname" href="#">닉네임</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="signUpType" href="#">가입유형</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">활성화</a>
|
||||
</th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="accountLocked" href="#">계정잠김</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="listTBody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="row paging"></div>
|
||||
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
const getUsers = (pageNo) => {
|
||||
const f = document.reqForm;
|
||||
f.page.value = pageNo;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/api/settings/users',
|
||||
data: dataOj,
|
||||
success(response) {
|
||||
console.log(response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
// List 구성하기
|
||||
const tbody = $('#listTBody');
|
||||
tbody.empty();
|
||||
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-id="${ct.id}">
|
||||
<th scope="row">
|
||||
${idx + (pageNo * f.size.value) + 1}
|
||||
</th>
|
||||
<td><a href="javascript:goUpdate('${ct.id}')">${ct.id}</a></td>
|
||||
<td>
|
||||
${ct.roles.map(r => r.id).join(', ')}
|
||||
</td>
|
||||
<td>${ct.nickname}</td>
|
||||
<td>${ct.signUpType}</td>
|
||||
<td>${ct.email}</td>
|
||||
<td>${ct.accountDisabled ? 'N' : 'Y'}</td>
|
||||
<td>${ct.accountLocked ? 'Y' : 'N'}</td>
|
||||
<td>${uiUtil.isoStrToReadable(ct.createdAt)}</td>
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
if (!$(response.content).length) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td colspan="8" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
|
||||
// Pagination 구성하기
|
||||
const paging = $('.paging');
|
||||
paging.empty();
|
||||
paging.append(
|
||||
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
||||
(movePageNo) => {
|
||||
f.page.value = movePageNo;
|
||||
goSearch();
|
||||
}));
|
||||
|
||||
// 리스트 상단 정렬 notation 및 갱신 기능 적용
|
||||
uiUtil.addSortNotation(f.sort.value, (targetPage, targetSort) => {
|
||||
f.page.value = targetPage;
|
||||
f.sort.value = targetSort;
|
||||
goSearch();
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 최초 리스트 로드
|
||||
getUsers(0);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
function goSearch() {
|
||||
const f = document.reqForm;
|
||||
f.method = 'GET';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.reqForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchRole.value = '';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
function goUpdate(id) {
|
||||
location.href = '/settings/users/' + id;
|
||||
}
|
||||
|
||||
// 체크박스 선택/해제
|
||||
function toggleCheckbox(oj) {
|
||||
$('input[name=checkedIds]').prop("checked", oj.checked);
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
if (!$('input[name=checkedIds]').is(':checked')) {
|
||||
alert(/*[[#{operation.common.remove.choose}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(/*[[#{operation.common.remove.ask}]]*/)) {
|
||||
const f = document.reqForm;
|
||||
f.action = '/settings/admins/delete';
|
||||
f.method = 'post';
|
||||
f.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.reqForm;
|
||||
f.action = '/settings/admins/excel';
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.method = 'post';
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
165
admin/src/main/resources/templates/settings/users/{id}.html
Normal file
165
admin/src/main/resources/templates/settings/users/{id}.html
Normal file
@@ -0,0 +1,165 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form class="fw-bold"
|
||||
method="post"
|
||||
name="reqForm"
|
||||
th:action="@{/settings/users/update}">
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<!-- audit area -->
|
||||
<div th:replace="common/components :: auditArea"></div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="id">ID *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control" id="id" name="id" readonly="readonly"
|
||||
th:value="${id}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="email">Email *</label>
|
||||
<div class="input-group w-50">
|
||||
<input class="form-control" id="email" name="email" type="email"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="roleIds">권한 *</label>
|
||||
<div class="input-group w-50">
|
||||
<select class="form-control" multiple name="roles">
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 활성화 -->
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" name="accountDisabled">
|
||||
<option value="true">비활성화</option>
|
||||
<option value="false">활성화</option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 계정잠김 -->
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="accountLocked1">계정잠김 여부 *</label>
|
||||
<div class="input-group w-25">
|
||||
<select class="form-select" name="accountLocked">
|
||||
<option value="true">Locked</option>
|
||||
<option value="false">Unlocked</option>
|
||||
</select>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="form-label" for="loginFailCnt">로그인 실패 회수</label>
|
||||
<div class="input-group w-25">
|
||||
<input class="form-control" id="loginFailCnt" name="loginFailCnt" type="text"/>
|
||||
<div class="invalid-feedback fw-bold">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary" onclick="goPrev();" title="이전 화면으로 이동">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" onclick="gotoList();" title="목록 화면으로 이동">
|
||||
<i class="bi bi-justify"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-primary float-end" onclick="updateUser();" type="button">
|
||||
<i class="bi bi-save2"></i> 저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
const getUser = () => {
|
||||
const f = document.reqForm;
|
||||
|
||||
$.ajax({
|
||||
'method': 'GET',
|
||||
'url': '/api/settings/users/' + f.id.value,
|
||||
success(res) {
|
||||
console.log(res);
|
||||
|
||||
showAudit(res.id, res.createdBy, uiUtil.isoStrToReadable(res.createdAt)
|
||||
, res.updatedBy, uiUtil.isoStrToReadable(res.updatedAt));
|
||||
|
||||
f.email.value = res.email;
|
||||
f.roles.value = res.roles.map((el) => el.id);
|
||||
f.accountDisabled.value = res.accountDisabled;
|
||||
f.accountLocked.value = res.accountLocked;
|
||||
f.loginFailCnt.value = res.loginFailCnt;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 상세정보 얻기
|
||||
getUser();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const updateUser = () => {
|
||||
const f = document.reqForm;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
// 기존 에러 메세지 초기화
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
'method': 'PATCH',
|
||||
'url': '/api/settings/users/update',
|
||||
'data': obj,
|
||||
success(res) {
|
||||
if (confirm(`'${res.id}' 정보가 수정되었습니다.\n이전 화면으로 이동하시겠습니까?`)) {
|
||||
history.back();
|
||||
}
|
||||
},
|
||||
statusCode: {
|
||||
'422': (res) => {
|
||||
$(res.responseJSON).each((idx, oj) => {
|
||||
let target = $(f).find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
410
admin/src/main/resources/templates/uiCode/uiCodeList.html
Normal file
410
admin/src/main/resources/templates/uiCode/uiCodeList.html
Normal file
@@ -0,0 +1,410 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="노드 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"
|
||||
style="height:450px;"></div>
|
||||
<div class="col fw-bold ms-4" style="height:450px;">
|
||||
|
||||
<form name="formDto" th:action="@{/settings/uri/update}" method="post">
|
||||
<input type="hidden" name="parentId" value="">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
<input type="hidden" name="mode" value="create"/>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">코드ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control" placeholder="코드 ID 를 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="text">Text *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeText" name="codeText" class="form-control"
|
||||
placeholder="코드명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-codeText"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="codeValue">Value</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeValue" name="codeValue" class="form-control"
|
||||
placeholder="코드값을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-codeValue"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="msgCode">메세지 코드</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="msgCode" name="msgCode" class="form-control"
|
||||
placeholder="메세지 코드를 입력하세요"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="inUse">사용여부</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select" id="inUse" name="inUse">
|
||||
<option value="true">사용</option>
|
||||
<option value="false">미사용</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary mt-1" onclick="addChildNode();">하위 노드
|
||||
추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/uicode/topTier',
|
||||
cache: false,
|
||||
success: function (data) {
|
||||
renderTree(data, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function convertToTreeValue(data) {
|
||||
data.text = data.codeText;
|
||||
data.value = data.codeValue;
|
||||
$(data.nodes).each(function (idx, el) {
|
||||
convertToTreeValue(el);
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
let json = nodes;
|
||||
convertToTreeValue(json);
|
||||
|
||||
tree.treeview({
|
||||
data: [json],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
// nodeIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
const parentNode = tree.treeview('getParents', currentNode)[0];
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
cleanFormFields();
|
||||
f.mode.value = 'create';
|
||||
|
||||
f.codeText.value = currentNode.text;
|
||||
f.parentId.value = parentNode.id;
|
||||
f.id.value = f.parentId.value + '.';
|
||||
f.id.focus();
|
||||
|
||||
return;
|
||||
} else {
|
||||
f.mode.value = 'update';
|
||||
}
|
||||
getInfo(data);
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getSelected');
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/uicode/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
// success
|
||||
200: function (data) {
|
||||
f.id.value = data.id;
|
||||
f.codeText.value = data.codeText;
|
||||
f.codeValue.value = data.codeValue;
|
||||
f.msgCode.value = data.msgCode;
|
||||
f.orderNo.value = data.orderNo;
|
||||
f.parentId.value = data.parentId;
|
||||
f.inUse.value = data.inUse;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
const obj = $(f).serializeObject();
|
||||
delete obj._csrf;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
url: '/api/uicode/save',
|
||||
data: JSON.stringify(obj),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
alert('저장되었습니다.');
|
||||
refreshTree(data.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert('삭제할 노드를 선택하세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' 메뉴를 정말 삭제하시겠습니까?")) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert('삭제되었습니다.');
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uicode/remove',
|
||||
data: {id: info.id},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
alert('삭제되었습니다.');
|
||||
refreshTree();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.parentId.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.codeText.value = '';
|
||||
f.codeValue.value = '';
|
||||
f.msgCode.value = '';
|
||||
f.inUse.value = 'true';
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert('이동할 아이템을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (!info.id) {
|
||||
alert('먼저 아이템을 저장한 후 이동해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
console.log('nextNode is ', item);
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uicode/sort',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(updateList),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 1});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('findNodes', [searchVal, 'text']);
|
||||
tree.treeview('selectNode', [searchNode, {silent: false}]);
|
||||
tree.treeview('revealNode', [searchNode, {silent: true}]);
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
516
admin/src/main/resources/templates/uri/uriList.html
Normal file
516
admin/src/main/resources/templates/uri/uriList.html
Normal file
@@ -0,0 +1,516 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="노드 검색">
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"></div>
|
||||
<div class="col fw-bold ms-4">
|
||||
|
||||
<form name="formDto" th:action="@{/settings/uri/update}" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" name="appType" th:value="${appType}">
|
||||
<input type="hidden" name="parentId" value="">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
<input type="hidden" name="saveType"
|
||||
th:value="${T(app.module.core.config.application.enums.SaveType).CREATE}"/>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="uri">URI *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="uri" name="uri" class="form-control"
|
||||
placeholder="/path 경로를 입력하세요"
|
||||
onkeyup="uriKeyup(this);"/>
|
||||
<div class="invalid-feedback fw-bold field-uri"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label " for="id">ID</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control" placeholder="메세지 코드를 입력하세요"
|
||||
readonly="readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="text">Text *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="text" name="text" class="form-control" placeholder="메뉴명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-text"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="showOnNavi">메뉴로 노출하기</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select" id="showOnNavi" name="showOnNavi">
|
||||
<option value="true">노출</option>
|
||||
<option value="false">비노출</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="roles">역할</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select" id="roles" name="roles" multiple>
|
||||
<option th:each="role : ${roles}" th:value="${role.id}"
|
||||
th:text="${role.id + ' (' + role.description + ')'}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label fw-normal" for="ogTitle">og:title</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="ogTitle" name="ogTitle" class="form-control" placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label fw-normal" for="ogDesc">og:desc</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="ogDesc" name="ogDesc" class="form-control" placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label fw-normal" for="ogKeywords">og:keywords</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="ogKeywords" name="ogKeywords" class="form-control"
|
||||
placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label fw-normal" for="ogImage">og:image</label>
|
||||
<div class="col-sm-9 ogImageText">
|
||||
<input type="text" id="ogImage" name="ogImage" class="form-control"
|
||||
placeholder="이미지 URL 을 입력하세요."/>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1"
|
||||
onclick="switchOgImage('ogImageFile');">
|
||||
파일 올리기
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-9 ogImageFile" style="display: none;">
|
||||
<input type="file" name="ogImageFile" class="form-control"/>
|
||||
<div class="invalid-feedback fw-bold field-ogImageFile"></div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1"
|
||||
onclick="switchOgImage('ogImageText');">
|
||||
파일 URL 입력하기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary mt-1" onclick="addChildNode();">하위 노드
|
||||
추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end mt-2">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값
|
||||
let globalLevels = 2;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadTree();
|
||||
});
|
||||
|
||||
function loadTree(currentId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/uri/topTier/' + document.formDto.appType.value,
|
||||
cache: false,
|
||||
success: function (data) {
|
||||
renderTree(data, currentId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
tree.treeview({
|
||||
data: [nodes],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
// nodeIcon: 'bi bi-dot',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
const parentNode = tree.treeview('getParents', currentNode)[0];
|
||||
|
||||
if (data.id === 'code.new.temp') { // 신규 노드일 경우 id가 없다.
|
||||
cleanFormFields();
|
||||
|
||||
f.text.value = currentNode.text;
|
||||
f.parentId.value = parentNode.id;
|
||||
|
||||
switchOgImage('ogImageText');
|
||||
|
||||
f.saveType.value = [[${T(app.module.core.config.application.enums.SaveType).CREATE}]];
|
||||
|
||||
return;
|
||||
} else {
|
||||
f.saveType.value = [[${T(app.module.core.config.application.enums.SaveType).UPDATE}]];
|
||||
}
|
||||
getInfo(data);
|
||||
});
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getSelected');
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
if (data.id === 'code.new.temp') {
|
||||
return;
|
||||
}
|
||||
|
||||
cleanFormFields();
|
||||
|
||||
const f = document.formDto;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/uri/' + f.appType.value + '/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
}
|
||||
},
|
||||
success: function (response) {
|
||||
const item = response.item;
|
||||
f.id.value = item.id;
|
||||
f.text.value = item.text;
|
||||
f.uri.value = item.uri;
|
||||
f.orderNo.value = item.orderNo;
|
||||
f.parentId.value = item.parentId;
|
||||
f.showOnNavi.value = item.showOnNavi;
|
||||
f.ogTitle.value = item.ogTitle;
|
||||
f.ogDesc.value = item.ogDesc;
|
||||
f.ogKeywords.value = item.ogKeywords;
|
||||
f.ogImage.value = item.ogImage;
|
||||
|
||||
let roleIds = [];
|
||||
$(item.roles).each(function (idx, role) {
|
||||
roleIds.push(role);
|
||||
});
|
||||
$(f.roles).val(roleIds);
|
||||
|
||||
switchOgImage('ogImageText');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.save.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
url: '/api/uri/save',
|
||||
data: new FormData(f),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree(response.item);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
if (error.field === 'parentId') {
|
||||
alert(error.message);
|
||||
} else {
|
||||
$(form[error.field]).addClass('is-invalid');
|
||||
$('.field-' + error.field).text(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function switchOgImage(type) {
|
||||
switch (type) {
|
||||
case 'ogImageText':
|
||||
$('.ogImageText').show();
|
||||
$('.ogImageFile').hide();
|
||||
break;
|
||||
case 'ogImageFile':
|
||||
$('.ogImageText').hide();
|
||||
$('.ogImageFile').show();
|
||||
break;
|
||||
}
|
||||
|
||||
$('input[name=ogImageFile]').val('');
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
alert([[#{operation.uri.remove.choose.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
|
||||
if (confirm("'" + info.text + "' " + [[#{operation.uri.remove.ask(info.text)}]])) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
alert([[#{operation.common.remove.done}]]);
|
||||
refreshTree();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uri/remove',
|
||||
data: {id: info.id, parentId: document.formDto.parentId.value},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
refreshTree();
|
||||
},
|
||||
statusCode: {
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
// object error 핸들링 (not field error!)
|
||||
const objectErrors = response.responseJSON.objectErrors;
|
||||
$(objectErrors).each(function (idx, error) {
|
||||
alert(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function cleanFormFields() {
|
||||
const f = document.formDto;
|
||||
f.id.value = '';
|
||||
f.parentId.value = '';
|
||||
f.orderNo.value = '';
|
||||
f.text.value = '';
|
||||
f.uri.value = '';
|
||||
f.ogTitle.value = '';
|
||||
f.ogDesc.value = '';
|
||||
f.ogKeywords.value = '';
|
||||
f.ogImage.value = '';
|
||||
|
||||
switchOgImage('ogImageText');
|
||||
|
||||
$(f).find('.is-invalid').removeClass('is-invalid');
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
alert([[#{operation.uri.move.choose}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (!info.id) {
|
||||
alert([[#{operation.uri.move.save.first}]]);
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
let updateList = [];
|
||||
let targetItem;
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
console.log('nextNode is ', item);
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uri/switchOrderNo',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(updateList),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
refreshTree(info.id);
|
||||
},
|
||||
statusCode: {
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const objectErrors = response.responseJSON.objectErrors;
|
||||
alert(objectErrors[0].message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 1});
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('search', [
|
||||
searchVal, {ignoreCase: true, revealResults: true}
|
||||
]);
|
||||
if (searchNode.length) {
|
||||
tree.treeview('selectNode', [searchNode[0], {silent: false}]);
|
||||
}
|
||||
}
|
||||
|
||||
function uriKeyup(oj) {
|
||||
let v = $.trim(oj.value);
|
||||
if (!v) {
|
||||
$('#id').val('');
|
||||
return;
|
||||
}
|
||||
v = 'uri.' + document.formDto.appType.value.toLowerCase() + v;
|
||||
v = v.replaceAll('/', '.');
|
||||
|
||||
$('#id').val(v);
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user