维护入口

This commit is contained in:
Zzzz
2026-04-27 23:38:19 +08:00
parent 4155d5b1ea
commit 63738f108a
21 changed files with 1009 additions and 8 deletions
@@ -0,0 +1,89 @@
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Manage Categories - MZH Library</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css">
</head>
<body>
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
<main class="page-shell">
<section class="dashboard-hero catalog-hero" aria-labelledby="category-title">
<div>
<p class="eyebrow">Book Management</p>
<h1 id="category-title">Manage categories</h1>
<p>Maintain catalog groupings used by book records and search filters.</p>
</div>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/book-categories/new">New category</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Manage books</a>
</div>
</section>
<c:if test="${not empty successMessage}">
<div class="message message-success" role="status">
<c:out value="${successMessage}" />
</div>
</c:if>
<c:if test="${not empty errorMessage}">
<div class="message message-error" role="alert">
<c:out value="${errorMessage}" />
</div>
</c:if>
<section class="table-panel" aria-labelledby="category-results-title">
<h2 id="category-results-title">Category records</h2>
<c:choose>
<c:when test="${empty categories}">
<p class="empty-state">No categories have been created yet.</p>
</c:when>
<c:otherwise>
<div class="table-scroll">
<table class="data-table category-table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<c:forEach var="category" items="${categories}">
<tr>
<td><c:out value="${category.name}" /></td>
<td>
<c:choose>
<c:when test="${empty category.description}">
<span class="muted-text">No description</span>
</c:when>
<c:otherwise>
<c:out value="${category.description}" />
</c:otherwise>
</c:choose>
</td>
<td>
<div class="table-actions">
<a class="button button-secondary"
href="${pageContext.request.contextPath}/book-categories/edit?id=${category.id}">Edit</a>
<form action="${pageContext.request.contextPath}/book-categories/delete"
method="post"
onsubmit="return confirm('Delete this category?');">
<input type="hidden" name="id" value="${category.id}">
<button class="button button-danger" type="submit">Delete</button>
</form>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</c:otherwise>
</c:choose>
</section>
</main>
</body>
</html>
@@ -0,0 +1,66 @@
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><c:out value="${formTitle}" /> - MZH Library</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/app.css">
</head>
<body>
<%@ include file="/WEB-INF/jsp/common/header.jspf" %>
<main class="page-shell">
<section class="form-panel" aria-labelledby="category-form-title">
<p class="eyebrow">Book Management</p>
<h1 id="category-form-title"><c:out value="${formTitle}" /></h1>
<c:if test="${not empty errorMessage}">
<div class="message message-error" role="alert">
<c:out value="${errorMessage}" />
</div>
</c:if>
<c:set var="hasFormValues" value="${not empty formValues}" />
<c:set var="nameValue" value="${hasFormValues ? formValues.name : category.name}" />
<c:set var="descriptionValue" value="${hasFormValues ? formValues.description : category.description}" />
<form class="category-form" action="${pageContext.request.contextPath}${formAction}" method="post" novalidate>
<c:if test="${category.id > 0}">
<input type="hidden" name="id" value="${category.id}">
</c:if>
<div class="form-grid">
<div class="form-field">
<label for="name">Category name</label>
<input id="name" name="name" type="text" value="${fn:escapeXml(nameValue)}" required>
<c:if test="${not empty errors.name}">
<span class="field-error"><c:out value="${errors.name}" /></span>
</c:if>
</div>
<div class="form-field form-field-wide">
<label for="description">Description</label>
<textarea id="description" name="description" rows="4">${fn:escapeXml(descriptionValue)}</textarea>
<c:if test="${not empty errors.description}">
<span class="field-error"><c:out value="${errors.description}" /></span>
</c:if>
</div>
</div>
<c:if test="${not empty errors.category}">
<div class="message message-error" role="alert">
<c:out value="${errors.category}" />
</div>
</c:if>
<div class="form-actions">
<button class="button button-primary" type="submit">Save</button>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">Cancel</a>
</div>
</form>
</section>
</main>
</body>
</html>
+5 -1
View File
@@ -16,7 +16,10 @@
<p class="eyebrow">Book Management</p>
<h1 id="manage-title">Manage books</h1>
<p>Create, update, delete, and review inventory for catalog records.</p>
<a class="button button-primary" href="${pageContext.request.contextPath}/books/new">New book</a>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/books/new">New book</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">Categories</a>
</div>
</section>
<c:if test="${not empty successMessage}">
@@ -65,6 +68,7 @@
<button class="button button-primary" type="submit">Search</button>
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Clear</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/catalog">View catalog</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">Categories</a>
</form>
</section>
@@ -13,6 +13,7 @@
<c:if test="${sessionScope.userRole == 'administrator' or sessionScope.userRole == 'librarian'}">
<a href="${pageContext.request.contextPath}/librarian/home">Librarian</a>
<a href="${pageContext.request.contextPath}/books">Books</a>
<a href="${pageContext.request.contextPath}/book-categories">Categories</a>
<a href="${pageContext.request.contextPath}/readers">Readers</a>
<a href="${pageContext.request.contextPath}/borrowing">Borrowing</a>
<a href="${pageContext.request.contextPath}/reports">Reports</a>
@@ -53,6 +53,12 @@
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Open</a>
</article>
<article class="workspace-card">
<h2>Category Maintenance</h2>
<p>Maintain catalog categories used by book records and search filters.</p>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">Open</a>
</article>
<article class="workspace-card">
<h2>Reader Management</h2>
<p>Create, update, deactivate, and review reader eligibility records.</p>
@@ -48,6 +48,12 @@
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">Manage books</a>
</article>
<article class="workspace-card">
<h2>Category Maintenance</h2>
<p>Create, update, and retire catalog categories used by book records.</p>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">Manage categories</a>
</article>
<article class="workspace-card">
<h2>Reader Management</h2>
<p>Create, update, deactivate, and review eligibility fields for reader records.</p>
+5
View File
@@ -117,6 +117,11 @@
<url-pattern>/books/edit</url-pattern>
<url-pattern>/books/update</url-pattern>
<url-pattern>/books/delete</url-pattern>
<url-pattern>/book-categories</url-pattern>
<url-pattern>/book-categories/new</url-pattern>
<url-pattern>/book-categories/edit</url-pattern>
<url-pattern>/book-categories/update</url-pattern>
<url-pattern>/book-categories/delete</url-pattern>
</servlet-mapping>
<servlet>
+22 -1
View File
@@ -313,6 +313,12 @@ h2 {
margin-top: 0;
}
.hero-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.toolbar-panel,
.table-panel,
.form-panel {
@@ -350,6 +356,8 @@ h2 {
.search-form select,
.book-form input,
.book-form select,
.category-form input,
.category-form textarea,
.reader-form input,
.reader-form select,
.user-form input,
@@ -368,6 +376,8 @@ h2 {
.search-form select:focus,
.book-form input:focus,
.book-form select:focus,
.category-form input:focus,
.category-form textarea:focus,
.reader-form input:focus,
.reader-form select:focus,
.user-form input:focus,
@@ -394,7 +404,8 @@ h2 {
}
.user-table,
.system-log-table {
.system-log-table,
.category-table {
min-width: 980px;
}
@@ -504,6 +515,7 @@ h2 {
}
.book-form,
.category-form,
.reader-form,
.user-form,
.borrow-form {
@@ -522,6 +534,15 @@ h2 {
gap: 6px;
}
.form-field-wide {
grid-column: 1 / -1;
}
.category-form textarea {
min-height: 112px;
resize: vertical;
}
.form-field label {
color: var(--color-muted);
font-size: 14px;