├── web ├── books │ ├── js │ │ ├── index.js │ │ ├── reader.js │ │ ├── exportBook.js │ │ ├── exportReader.js │ │ ├── npm.js │ │ ├── deleteAdmin.js │ │ ├── deleteBookType.js │ │ ├── getBookTypes.js │ │ ├── getReader.js │ │ ├── getAllBookTypes.js │ │ ├── getAllReaderTypes.js │ │ ├── deleteBook.js │ │ ├── deleteReader.js │ │ ├── pay.js │ │ ├── backBook.js │ │ ├── ajax_upload.js │ │ ├── renewBook.js │ │ ├── getReaderBookInfo.js │ │ ├── getBookInfo.js │ │ ├── bootstrap-dropdown.min.js │ │ ├── getForfeitInfo.js │ │ ├── getReaderForfeitInfo.js │ │ ├── borrowBook.js │ │ ├── getBorrowInfo.js │ │ ├── getBackInfo.js │ │ ├── getReaderBackInfo.js │ │ ├── addBookNum.js │ │ ├── addBookType.js │ │ ├── batchAddBook.js │ │ ├── batchAddReader.js │ │ ├── login.js │ │ ├── updateBookType.js │ │ ├── adminLogin.js │ │ ├── updateAuthorization.js │ │ ├── readerUpdateInfo.js │ │ ├── adminUpdateInfo.js │ │ ├── addAdmin.js │ │ ├── readerUpdatePwd.js │ │ ├── adminUpdatePwd.js │ │ ├── updateAdmin.js │ │ ├── addReaderType.js │ │ ├── addReader.js │ │ ├── updateReaderType.js │ │ ├── addBook.js │ │ ├── updateBook.js │ │ ├── updateReader.js │ │ └── dataTables.bootstrap.js │ ├── img │ │ ├── ghz.jpg │ │ ├── head_bg.jpg │ │ ├── login_res_bg.jpg │ │ ├── title-yellow.png │ │ └── title-yellow1.png │ ├── login.jsp │ ├── css │ │ ├── index.css │ │ └── dataTables.bootstrap.css │ └── register.jsp ├── WEB-INF │ ├── lib │ │ ├── jstl.jar │ │ ├── standard.jar │ │ ├── servlet-api.jar │ │ └── mysql-connector-java-5.1.7-bin.jar │ └── web.xml ├── index.jsp ├── static │ ├── js │ │ └── theme.js │ └── css │ │ ├── fullcalendar.print.css │ │ └── admin.css └── login.jsp ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png ├── src └── com │ └── cya │ ├── pojo │ ├── Type.java │ ├── Notice.java │ ├── Book.java │ ├── Admin.java │ └── History.java │ ├── controller │ ├── deleteNoticeServlet.java │ ├── ExitServlet.java │ ├── deleteServlet.java │ ├── deleteTypeServlet.java │ ├── deleteUserServlet.java │ ├── AddBookTypeServlet.java │ ├── updateBookTypeServlet.java │ ├── updateNoticeServlet.java │ ├── AddNoticeServlet.java │ ├── AddBookServlet.java │ ├── RegisterServlet.java │ ├── updateBookServlet.java │ ├── AddUserServlet.java │ ├── updateUserServlet.java │ ├── selectServlet.java │ ├── LoginServlet.java │ ├── borrowServlet.java │ └── AdminServlet.java │ ├── util │ └── DBUtil.java │ └── dao │ ├── NoticeDao.java │ └── TypeDao.java ├── .gitignore └── README.md /web/books/js/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/screenshot/8.png -------------------------------------------------------------------------------- /web/books/img/ghz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/books/img/ghz.jpg -------------------------------------------------------------------------------- /web/WEB-INF/lib/jstl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/WEB-INF/lib/jstl.jar -------------------------------------------------------------------------------- /web/books/img/head_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/books/img/head_bg.jpg -------------------------------------------------------------------------------- /web/WEB-INF/lib/standard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/WEB-INF/lib/standard.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/servlet-api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/WEB-INF/lib/servlet-api.jar -------------------------------------------------------------------------------- /web/books/img/login_res_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/books/img/login_res_bg.jpg -------------------------------------------------------------------------------- /web/books/img/title-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/books/img/title-yellow.png -------------------------------------------------------------------------------- /web/books/img/title-yellow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/books/img/title-yellow1.png -------------------------------------------------------------------------------- /web/books/js/reader.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | $('#btn_login').click(function () { 4 | window.location.href = "login.jsp"; 5 | }); 6 | 7 | }); 8 | 9 | -------------------------------------------------------------------------------- /web/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No66LibraryManagementSystem2/HEAD/web/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: Administrator 4 | Date: 2021/4/27 0027 5 | Time: 下午 8:39 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | $Title$ 12 | 13 | 14 | $END$ 15 | 16 | 17 | -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | books/login.jsp 9 | 10 | -------------------------------------------------------------------------------- /web/books/js/exportBook.js: -------------------------------------------------------------------------------- 1 | function exportBook() { 2 | //获得basePath 3 | basePath = $('#basePath').val(); 4 | ajax( 5 | { 6 | method: 'GET', 7 | url: 'admin/bookManageAction_exportBook.action', 8 | callback: function (data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | ); 13 | 14 | } 15 | 16 | 17 | function showInfo(msg) { 18 | $("#div_info").html(msg); 19 | $("#modal_info").modal('show'); 20 | } 21 | -------------------------------------------------------------------------------- /web/books/js/exportReader.js: -------------------------------------------------------------------------------- 1 | function exportReader() { 2 | //获得basePath 3 | basePath = $('#basePath').val(); 4 | ajax( 5 | { 6 | method: 'GET', 7 | url: 'admin/readerManageAction_exportReader.action', 8 | callback: function (data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | ); 13 | 14 | } 15 | 16 | 17 | function showInfo(msg) { 18 | $("#div_info").html(msg); 19 | $("#modal_info").modal('show'); 20 | } 21 | -------------------------------------------------------------------------------- /web/books/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/com/cya/pojo/Type.java: -------------------------------------------------------------------------------- 1 | package com.cya.pojo; 2 | 3 | public class Type { 4 | /** 5 | * 图书分类的数据表的bean 6 | */ 7 | private int tid;//分类的id 8 | private String name;//分类的名称 9 | 10 | public int getTid() { 11 | return tid; 12 | } 13 | 14 | public void setTid(int tid) { 15 | this.tid = tid; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return "Type [tid=" + tid + ", name=" + name + "]"; 29 | } 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /web/static/js/theme.js: -------------------------------------------------------------------------------- 1 | var saveSelectColor = { 2 | 'Name': 'SelcetColor', 3 | 'Color': 'theme-white' 4 | } 5 | 6 | 7 | // 判断用户是否已有自己选择的模板风格 8 | if (storageLoad('SelcetColor')) { 9 | $('body').attr('class', storageLoad('SelcetColor').Color) 10 | } else { 11 | storageSave(saveSelectColor); 12 | $('body').attr('class', 'theme-white') 13 | } 14 | 15 | 16 | // 本地缓存 17 | function storageSave(objectData) { 18 | localStorage.setItem(objectData.Name, JSON.stringify(objectData)); 19 | } 20 | 21 | function storageLoad(objectName) { 22 | if (localStorage.getItem(objectName)) { 23 | return JSON.parse(localStorage.getItem(objectName)) 24 | } else { 25 | return false 26 | } 27 | } -------------------------------------------------------------------------------- /web/books/js/deleteAdmin.js: -------------------------------------------------------------------------------- 1 | function deleteAdmin(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/adminManageAction_deleteAdmin.action', 6 | params: "id=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else { 11 | showInfo("删除失败"); 12 | } 13 | 14 | } 15 | } 16 | ); 17 | 18 | 19 | } 20 | 21 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 22 | location.reload(); //刷新当前页面 23 | }); 24 | 25 | 26 | function showInfo(msg) { 27 | $("#div_info").text(msg); 28 | $("#modal_info").modal('show'); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /web/books/js/deleteBookType.js: -------------------------------------------------------------------------------- 1 | function deleteBookType(id) { 2 | ajax( 3 | { 4 | method: 'POST', 5 | url: 'admin/bookTypeManageAction_deleteBookType.action', 6 | params: "id=" + id, 7 | callback: function (data) { 8 | if (data == 1) { 9 | showInfo("删除成功"); 10 | } else { 11 | showInfo("删除失败"); 12 | } 13 | 14 | } 15 | } 16 | ); 17 | 18 | 19 | } 20 | 21 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 22 | location.reload(); //刷新当前页面 23 | }); 24 | 25 | 26 | function showInfo(msg) { 27 | $("#div_info").text(msg); 28 | $("#modal_info").modal('show'); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /web/books/js/getBookTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function () { 2 | ajax( 3 | { 4 | url: "bookAction_getAllBookTypes.action", 5 | type: "json", 6 | callback: function (data) { 7 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 8 | for (var index in data) { 9 | var op = document.createElement("option");//创建一个指名名称元素 10 | op.value = data[index].typeId;//设置op的实际值为当前的图书分类编号 11 | var textNode = document.createTextNode(data[index].typeName);//创建文本节点 12 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 13 | 14 | document.getElementById("bookTypeId").appendChild(op); 15 | } 16 | } 17 | } 18 | ); 19 | }; -------------------------------------------------------------------------------- /web/books/js/getAllReaderTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function () { 2 | ajax( 3 | { 4 | url: "admin/readerTypeManageAction_getAllReaderTypes.action", 5 | type: "json", 6 | callback: function (data) { 7 | // 循环遍历每个读者分类,每个名称生成一个option对象,添加到 57 | 58 | 59 |
60 | 61 | 63 | 64 |
65 | 66 | 68 |
69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /web/books/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 5 | 6 | 7 | 图书管理系统登录页面 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 34 | 35 | 36 | 37 | 38 | 39 |
40 |
41 |
42 |
欢 迎 登 录 图 书 管 理 系 统!
43 | 44 | 72 |
73 |
74 |
75 | 76 | 77 | -------------------------------------------------------------------------------- /web/books/css/index.css: -------------------------------------------------------------------------------- 1 | /*head*/ 2 | 3 | *{ 4 | padding: 0; 5 | margin: 0; 6 | } 7 | ul li{ 8 | list-style: none; 9 | } 10 | a{ 11 | text-decoration: none; 12 | } 13 | .head{ 14 | position: absolute; 15 | width: 100%; 16 | height: 310px; 17 | background-image: url(../img/head_bg.jpg); 18 | background-size: 100%; 19 | background-repeat:no-repeat; 20 | } 21 | 22 | .head .img{ 23 | position: relative; 24 | top: 10%; 25 | } 26 | .head .daohang{ 27 | width: 100%; 28 | height: 50px; 29 | position: absolute; 30 | bottom: 0; 31 | left: 0; 32 | background-color: #169fe6; 33 | opacity: 0.85; 34 | } 35 | 36 | .head .daohang ul li{ 37 | float: left; 38 | width: 150px; 39 | height: 50px; 40 | margin-left: 10px; 41 | text-align: center; 42 | line-height: 50px; 43 | font-size: 20px; 44 | color: #fff; 45 | } 46 | .head .daohang ul li a:hover{ 47 | background-color: #fff; 48 | color: #169fe6; 49 | } 50 | .head .daohang ul li a{ 51 | width: 100%; 52 | height: 100%; 53 | display: block; 54 | color: #fff; 55 | text-decoration: none; 56 | } 57 | 58 | .head .userName{ 59 | position: absolute; 60 | z-index: 10; 61 | top: 28%; 62 | font-size: 30px; 63 | color: #fff; 64 | left: 6.8%; 65 | width: 310px; 66 | height: 110px; 67 | text-align: center; 68 | line-height: 110px; 69 | font-weight: bold; 70 | 71 | } 72 | 73 | .head .userName a{ 74 | color: #fff; 75 | width: 100%; 76 | height: 100%; 77 | display: block; 78 | } 79 | 80 | .head .userName a:hover{ 81 | text-decoration:underline; 82 | } 83 | 84 | /*body 开始*/ 85 | 86 | .body{ 87 | 88 | clear: both; 89 | overflow: hidden; 90 | float: left; 91 | top: 0; 92 | width: 100%; 93 | height: 1000px; 94 | background-color: #F0EEF5; 95 | position: relative; 96 | z-index:-3; 97 | } 98 | 99 | .body .content{ 100 | width: 90%; 101 | height: 100%; 102 | float: left; 103 | margin-left: 5%; 104 | /* background-color: #169FE6; */ 105 | position: relative; 106 | z-index:-1; 107 | } 108 | 109 | .body .content .left{ 110 | width: 23%; 111 | height: 100%; 112 | float: left; 113 | /* background-color: red; */ 114 | } 115 | .body .content .right{ 116 | width: 77%; 117 | float: left; 118 | height: 100%; 119 | /* background-color: blue; */ 120 | } 121 | 122 | .body .content .left .gongGao{ 123 | margin-top: 20px; 124 | width: 100%; 125 | float: left; 126 | } 127 | .body .content .left .gongGao .title{ 128 | width: 100%; 129 | height: 40px; 130 | text-align: center; 131 | background-color: #169FE6; 132 | color: #fff; 133 | font-size: 20px; 134 | line-height: 40px; 135 | } 136 | .body .content .left .gongGao .context{ 137 | width: 100%; 138 | min-height: 150px; 139 | background-color: #fff; 140 | color: black; 141 | font-size: 16px; 142 | padding:10px; 143 | } 144 | 145 | .body .content .left .gongGao .import{ 146 | height: 150px; 147 | } 148 | 149 | .body .content .left .gongGao .context marquee label{ 150 | font-size:14px; 151 | font-weight:normal; 152 | } 153 | 154 | .body .content .left .gongGao .context a{ 155 | display: block; 156 | margin-top: 5px; 157 | } 158 | 159 | .daohang ul li .dropdown-menu li a{ 160 | color: #fff; 161 | font-size: 14px; 162 | margin-left: -10px; 163 | width:100%; 164 | } 165 | 166 | .foot{ 167 | width:100%; 168 | height:50px; 169 | background-color:#169FE6; 170 | float:left; 171 | } 172 | .foot .lable{ 173 | display: block; 174 | width:100%; 175 | height:100%; 176 | line-height:50px; 177 | text-align:center; 178 | float:left; 179 | color: #fff; 180 | } 181 | 182 | .table thead tr th{ 183 | background-color:#169FE6; 184 | color: #fff; 185 | } 186 | 187 | 188 | -------------------------------------------------------------------------------- /web/books/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 图书管理系统注册页面 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 |
28 | 75 |
76 |
77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /web/books/js/addAdmin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ajax提交添加管理员的信息 3 | * @param {Object} '#addAdmin' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#addAdmin').click(function () { 9 | 10 | if (!validAddAdmin()) { 11 | return; 12 | } 13 | var postdata = "username=" + $.trim($("#addUsername").val()) + "&name=" + $.trim($("#addName").val()) + "&phone=" + $.trim($("#addPhone").val()); 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/adminManageAction_addAdmin.action', 18 | params: postdata, 19 | callback: function (data) { 20 | if (data == 1) { 21 | $("#addModal").modal("hide");//关闭模糊框 22 | showInfo("添加成功"); 23 | 24 | } else if (data == -1) { 25 | $("#addModal").modal("hide");//关闭模糊框 26 | showInfo("该管理员已存在"); 27 | } else { 28 | $("#addModal").modal("hide");//关闭模糊框 29 | showInfo("添加失败"); 30 | } 31 | 32 | } 33 | } 34 | ); 35 | 36 | 37 | }); 38 | 39 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 40 | location.reload(); //刷新当前页面 41 | }); 42 | 43 | 44 | }); 45 | 46 | 47 | function validAddAdmin() { 48 | var flag = true; 49 | 50 | var username = $.trim($("#addUsername").val()); 51 | if (username == "") { 52 | $('#addUsername').parent().addClass("has-error"); 53 | $('#addUsername').next().text("请输入用户名"); 54 | $("#addUsername").next().show(); 55 | flag = false; 56 | } else if (username.length < 2 || username.length > 15) { 57 | $("#addUsername").parent().addClass("has-error"); 58 | $("#addUsername").next().text("用户名长度必须在2~15之间"); 59 | $("#addUsername").next().show(); 60 | flag = false; 61 | } else { 62 | $('#addUsername').parent().removeClass("has-error"); 63 | $('#addUsername').next().text(""); 64 | $("#addUsername").next().hide(); 65 | } 66 | 67 | 68 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 69 | var name = $.trim($("#addName").val()); 70 | if (name == "") { 71 | $('#addName').parent().addClass("has-error"); 72 | $('#addName').next().text("请输入真实姓名"); 73 | $("#addName").next().show(); 74 | flag = false; 75 | } else if (!reg.test(name)) { 76 | $('#addName').parent().addClass("has-error"); 77 | $('#addName').next().text("真实姓名必须为中文"); 78 | $("#addName").next().show(); 79 | flag = false; 80 | } else { 81 | $('#addName').parent().removeClass("has-error"); 82 | $('#addName').next().text(""); 83 | $("#addName").next().hide(); 84 | } 85 | 86 | var phone = $.trim($("#addPhone").val()); 87 | if (phone == "") { 88 | $('#addPhone').parent().addClass("has-error"); 89 | $('#addPhone').next().text("请输入联系号码"); 90 | $("#addPhone").next().show(); 91 | flag = false; 92 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 93 | //电话号码格式的校验 94 | $('#addPhone').parent().addClass("has-error"); 95 | $('#addPhone').next().text("手机号码有误"); 96 | $("#addPhone").next().show(); 97 | return false; 98 | } else { 99 | $('#addPhone').parent().removeClass("has-error"); 100 | $('#addPhone').next().text(""); 101 | $("#addPhone").next().hide(); 102 | } 103 | 104 | 105 | return flag; 106 | } 107 | 108 | 109 | function showInfo(msg) { 110 | $("#div_info").text(msg); 111 | $("#modal_info").modal('show'); 112 | } 113 | 114 | 115 | -------------------------------------------------------------------------------- /web/books/js/readerUpdatePwd.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#update_readerPwd').click(function () { 5 | 6 | if (!validUpdateReaderPwd()) { 7 | return; 8 | } 9 | 10 | var postdata = "oldPwd=" + $.trim($("#oldPwd").val()) + "&newPwd=" + $.trim($("#newPwd").val()) + "&confirmPwd=" + $.trim($("#confirmPwd").val()); 11 | ajax( 12 | { 13 | method: 'POST', 14 | url: 'reader/readerInfoAction_readerPwd.action', 15 | params: postdata, 16 | callback: function (data) { 17 | if (data == 1) { 18 | $("#updatepwd").modal("hide");//关闭模糊框 19 | showInfo("修改成功"); 20 | 21 | } else if (data == 0) { 22 | showInfo("确认密码不一致"); 23 | } else if (data == -1) { 24 | showInfo("原密码错误"); 25 | } else { 26 | showInfo("修改失败"); 27 | } 28 | 29 | 30 | } 31 | } 32 | ); 33 | 34 | 35 | }); 36 | 37 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 38 | location.reload(); //刷新当前页面 39 | }); 40 | 41 | 42 | }); 43 | 44 | 45 | function validUpdateReaderPwd() { 46 | var flag = true; 47 | 48 | 49 | var oldPwd = $.trim($("#oldPwd").val()); 50 | if (oldPwd == "") { 51 | $('#oldPwd').parent().addClass("has-error"); 52 | $('#oldPwd').next().text("请输入密码"); 53 | $("#oldPwd").next().show(); 54 | flag = false; 55 | } else if (oldPwd.length < 3 || oldPwd.length > 15) { 56 | $("#oldPwd").parent().addClass("has-error"); 57 | $("#oldPwd").next().text("密码长度必须在3~15之间"); 58 | $("#oldPwd").next().show(); 59 | flag = false; 60 | } else { 61 | $('#oldPwd').parent().removeClass("has-error"); 62 | $('#oldPwd').next().text(""); 63 | $("#oldPwd").next().hide(); 64 | } 65 | 66 | 67 | var newPwd = $.trim($("#newPwd").val()); 68 | if (newPwd == "") { 69 | $('#newPwd').parent().addClass("has-error"); 70 | $('#newPwd').next().text("请输入新密码"); 71 | $("#newPwd").next().show(); 72 | flag = false; 73 | } else if (newPwd.length < 3 || newPwd.length > 15) { 74 | $("#newPwd").parent().addClass("has-error"); 75 | $("#newPwd").next().text("新密码长度必须在3~15之间"); 76 | $("#newPwd").next().show(); 77 | flag = false; 78 | } else { 79 | $('#newPwd').parent().removeClass("has-error"); 80 | $('#newPwd').next().text(""); 81 | $("#newPwd").next().hide(); 82 | } 83 | 84 | 85 | var confirmPwd = $.trim($("#confirmPwd").val()); 86 | if (confirmPwd == "") { 87 | $('#confirmPwd').parent().addClass("has-error"); 88 | $('#confirmPwd').next().text("请输入密码"); 89 | $("#confirmPwd").next().show(); 90 | flag = false; 91 | } else if (confirmPwd.length < 3 || confirmPwd.length > 15) { 92 | $("#confirmPwd").parent().addClass("has-error"); 93 | $("#confirmPwd").next().text("密码长度必须在3~15之间"); 94 | $("#confirmPwd").next().show(); 95 | flag = false; 96 | } else if (confirmPwd != newPwd) { 97 | $("#confirmPwd").parent().addClass("has-error"); 98 | $("#confirmPwd").next().text("确认密码不一致"); 99 | $("#confirmPwd").next().show(); 100 | flag = false; 101 | } else { 102 | $('#confirmPwd').parent().removeClass("has-error"); 103 | $('#confirmPwd').next().text(""); 104 | $("#confirmPwd").next().hide(); 105 | } 106 | 107 | 108 | return flag; 109 | } 110 | 111 | 112 | function showInfo(msg) { 113 | $("#div_info").text(msg); 114 | $("#modal_info").modal('show'); 115 | } -------------------------------------------------------------------------------- /web/books/js/adminUpdatePwd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 点击修改按钮之后ajax提交数据修改密码 3 | * @param {Object} '#update_adminPwd' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#update_adminPwd').click(function () { 9 | 10 | 11 | if (!validUpdateAdminPwd()) { 12 | return; 13 | } 14 | 15 | var postdata = "oldPwd=" + $.trim($("#oldPwd").val()) + "&newPwd=" + $.trim($("#newPwd").val()) + "&confirmPwd=" + $.trim($("#confirmPwd").val()); 16 | ajax( 17 | { 18 | method: 'POST', 19 | url: 'admin/adminInfoAction_adminPwd.action', 20 | params: postdata, 21 | callback: function (data) { 22 | if (data == 1) { 23 | $("#updatepwd").modal("hide");//关闭模糊框 24 | showInfo("修改成功"); 25 | 26 | 27 | } else if (data == 0) { 28 | showInfo("确认密码不一致"); 29 | } else if (data == -1) { 30 | showInfo("原密码错误"); 31 | } else { 32 | showInfo("修改失败"); 33 | } 34 | 35 | 36 | } 37 | } 38 | ); 39 | 40 | 41 | }); 42 | 43 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 44 | location.reload(); //刷新当前页面 45 | }); 46 | 47 | 48 | }); 49 | 50 | 51 | function validUpdateAdminPwd() { 52 | var flag = true; 53 | 54 | 55 | var oldPwd = $.trim($("#oldPwd").val()); 56 | if (oldPwd == "") { 57 | $('#oldPwd').parent().addClass("has-error"); 58 | $('#oldPwd').next().text("请输入密码"); 59 | $("#oldPwd").next().show(); 60 | flag = false; 61 | } else if (oldPwd.length < 3 || oldPwd.length > 15) { 62 | $("#oldPwd").parent().addClass("has-error"); 63 | $("#oldPwd").next().text("密码长度必须在3~15之间"); 64 | $("#oldPwd").next().show(); 65 | flag = false; 66 | } else { 67 | $('#oldPwd').parent().removeClass("has-error"); 68 | $('#oldPwd').next().text(""); 69 | $("#oldPwd").next().hide(); 70 | } 71 | 72 | 73 | var newPwd = $.trim($("#newPwd").val()); 74 | if (newPwd == "") { 75 | $('#newPwd').parent().addClass("has-error"); 76 | $('#newPwd').next().text("请输入新密码"); 77 | $("#newPwd").next().show(); 78 | flag = false; 79 | } else if (newPwd.length < 3 || newPwd.length > 15) { 80 | $("#newPwd").parent().addClass("has-error"); 81 | $("#newPwd").next().text("新密码长度必须在3~15之间"); 82 | $("#newPwd").next().show(); 83 | flag = false; 84 | } else { 85 | $('#newPwd').parent().removeClass("has-error"); 86 | $('#newPwd').next().text(""); 87 | $("#newPwd").next().hide(); 88 | } 89 | 90 | 91 | var confirmPwd = $.trim($("#confirmPwd").val()); 92 | if (confirmPwd == "") { 93 | $('#confirmPwd').parent().addClass("has-error"); 94 | $('#confirmPwd').next().text("请输入密码"); 95 | $("#confirmPwd").next().show(); 96 | flag = false; 97 | } else if (confirmPwd.length < 3 || confirmPwd.length > 15) { 98 | $("#confirmPwd").parent().addClass("has-error"); 99 | $("#confirmPwd").next().text("密码长度必须在3~15之间"); 100 | $("#confirmPwd").next().show(); 101 | flag = false; 102 | } else if (confirmPwd != newPwd) { 103 | $("#confirmPwd").parent().addClass("has-error"); 104 | $("#confirmPwd").next().text("确认密码不一致"); 105 | $("#confirmPwd").next().show(); 106 | flag = false; 107 | } else { 108 | $('#confirmPwd').parent().removeClass("has-error"); 109 | $('#confirmPwd').next().text(""); 110 | $("#confirmPwd").next().hide(); 111 | } 112 | 113 | 114 | return flag; 115 | } 116 | 117 | 118 | function showInfo(msg) { 119 | $("#div_info").text(msg); 120 | $("#modal_info").modal('show'); 121 | } -------------------------------------------------------------------------------- /src/com/cya/controller/AdminServlet.java: -------------------------------------------------------------------------------- 1 | package com.cya.controller; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | 13 | import com.cya.dao.AdminDao; 14 | import com.cya.dao.BookDao; 15 | import com.cya.pojo.Admin; 16 | 17 | 18 | /** 19 | * Servlet implementation class AdminServlet 20 | */ 21 | @WebServlet("/AdminServlet") 22 | public class AdminServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | private String id=""; 26 | /** 27 | * @see HttpServlet#HttpServlet() 28 | */ 29 | public AdminServlet() { 30 | super(); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | /** 35 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 36 | */ 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 40 | } 41 | 42 | /** 43 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 44 | */ 45 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 46 | // TODO Auto-generated method stub 47 | // doGet(request, response); 48 | PrintWriter out = response.getWriter(); 49 | //设置编码类型 50 | request.setCharacterEncoding("UTF-8"); 51 | response.setContentType("text/html;charset=UTF-8"); 52 | BookDao bookdao = new BookDao(); 53 | //这里为了简单,设置了tip,用来区分是修改密码功能,还是修改个人资料的功能,tip=1为修改密码 54 | int tip = Integer.parseInt(request.getParameter("tip")); 55 | //获取发起请求页面的文件名称,这个在对应的jsp里面的表单填写,修改完成后就可以直接返回对应的页面 56 | String url = request.getParameter("url"); 57 | System.out.println("url="+url); 58 | HttpSession session = request.getSession(); 59 | Admin adminbean = new Admin(); 60 | if(url.split("/")[0].equals("user")) { 61 | id=(String) session.getAttribute("uid"); 62 | } 63 | else { 64 | id = (String) session.getAttribute("aid"); 65 | } 66 | 67 | AdminDao admindao = new AdminDao(); 68 | //通过aid获取到读者的信息 69 | adminbean = admindao.get_AidInfo2(id); 70 | //修改密码 71 | if (tip == 1) { 72 | //获取到输入的旧密码,新密码 73 | String password = request.getParameter("password"); 74 | String password2 = request.getParameter("password2"); 75 | //获取读者数据表中的密码 76 | String old_password = adminbean.getPassword(); 77 | //对旧密码进行比较,如果相同就修改,不相同就直接退出 78 | if (old_password.equals(password)) { 79 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), password2, adminbean.getName(), 80 | adminbean.getEmail(), adminbean.getPhone(), adminbean.getLend_num(), adminbean.getMax_num()); 81 | response.sendRedirect("/manage_books/books/" + url + ".jsp"); 82 | } else { 83 | out.write(""); 84 | 85 | } 86 | } else { 87 | //修改个人资料 88 | //获取输入的信息 89 | String name = request.getParameter("name"); 90 | String email = request.getParameter("email"); 91 | String phone = request.getParameter("phone"); 92 | //修改输入的信息到数据表中 93 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), adminbean.getPassword(), name, 94 | email, phone, adminbean.getLend_num(), adminbean.getMax_num()); 95 | 96 | response.sendRedirect("/manage_books/books/" + url + ".jsp"); 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /web/books/js/updateAdmin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ajax提交修改管理员的信息 3 | * @param {Object} '#updateAdmin' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#updateAdmin').click(function () { 9 | 10 | 11 | if (!validUpdateAdmin()) { 12 | return; 13 | } 14 | 15 | var postdata = "id=" + $.trim($("#updateId").val()) + "&username=" + $.trim($("#updateUsername").val()) + "&name=" + $.trim($("#updateName").val()) + "&phone=" + $.trim($("#updatePhone").val()); 16 | ajax( 17 | { 18 | method: 'POST', 19 | url: 'admin/adminManageAction_updateAdmin.action', 20 | params: postdata, 21 | callback: function (data) { 22 | if (data == 1) { 23 | $("#updateModal").modal("hide");//关闭模糊框 24 | showInfo("修改成功"); 25 | 26 | } else { 27 | $("#updateinfo").modal("hide");//关闭模糊框 28 | showInfo("修改失败"); 29 | } 30 | 31 | } 32 | } 33 | ); 34 | 35 | 36 | }); 37 | 38 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 39 | location.reload(); //刷新当前页面 40 | }); 41 | 42 | 43 | }); 44 | 45 | 46 | /** 47 | * 获取需要修改用户信息 48 | * @param {Object} username 需要修改的用户名 49 | */ 50 | function updateAdmin(id) { 51 | ajax( 52 | { 53 | method: 'POST', 54 | url: 'admin/adminManageAction_getAdmin.action', 55 | params: "id=" + id, 56 | type: "json", 57 | callback: function (data) { 58 | $("#updateId").val(data.aid); 59 | $("#updateUsername").val(data.username); 60 | $("#updateName").val(data.name); 61 | $("#updatePhone").val(data.phone); 62 | $("#updatePwd").val(data.pwd); 63 | 64 | } 65 | } 66 | ); 67 | 68 | 69 | } 70 | 71 | 72 | function validUpdateAdmin() { 73 | var flag = true; 74 | 75 | var username = $.trim($("#updateUsername").val()); 76 | if (username == "") { 77 | $('#updateUsername').parent().addClass("has-error"); 78 | $('#updateUsername').next().text("请输入用户名"); 79 | $("#updateUsername").next().show(); 80 | flag = false; 81 | } else if (username.length < 2 || username.length > 15) { 82 | $("#updateUsername").parent().addClass("has-error"); 83 | $("#updateUsername").next().text("用户名长度必须在2~15之间"); 84 | $("#updateUsername").next().show(); 85 | flag = false; 86 | } else { 87 | $('#updateUsername').parent().removeClass("has-error"); 88 | $('#updateUsername').next().text(""); 89 | $("#updateUsername").next().hide(); 90 | } 91 | 92 | 93 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 94 | var name = $.trim($("#updateName").val()); 95 | if (name == "") { 96 | $('#updateName').parent().addClass("has-error"); 97 | $('#updateName').next().text("请输入真实姓名"); 98 | $("#updateName").next().show(); 99 | flag = false; 100 | } else if (!reg.test(name)) { 101 | $('#updateName').parent().addClass("has-error"); 102 | $('#updateName').next().text("真实姓名必须为中文"); 103 | $("#updateName").next().show(); 104 | flag = false; 105 | } else { 106 | $('#updateName').parent().removeClass("has-error"); 107 | $('#updateName').next().text(""); 108 | $("#updateName").next().hide(); 109 | } 110 | 111 | var phone = $.trim($("#updatePhone").val()); 112 | if (phone == "") { 113 | $('#updatePhone').parent().addClass("has-error"); 114 | $('#updatePhone').next().text("请输入联系号码"); 115 | $("#updatePhone").next().show(); 116 | flag = false; 117 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 118 | //电话号码格式的校验 119 | $('#updatePhone').parent().addClass("has-error"); 120 | $('#updatePhone').next().text("手机号码有误"); 121 | $("#updatePhone").next().show(); 122 | return false; 123 | } else { 124 | $('#updatePhone').parent().removeClass("has-error"); 125 | $('#updatePhone').next().text(""); 126 | $("#updatePhone").next().hide(); 127 | } 128 | 129 | 130 | return flag; 131 | } 132 | 133 | 134 | function showInfo(msg) { 135 | $("#div_info").text(msg); 136 | $("#modal_info").modal('show'); 137 | } 138 | 139 | 140 | -------------------------------------------------------------------------------- /web/books/js/addReaderType.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#addReaderType').click(function () { 5 | 6 | 7 | if (!validAddReaderType()) { 8 | return; 9 | } 10 | 11 | var postdata = "readerTypeName=" + $.trim($("#addType").val()) + "&maxNum=" + $.trim($("#addMaxNum").val()) + "&bday=" + $.trim($("#addBday").val()) 12 | + "&penalty=" + $.trim($("#addPenalty").val()) + "&renewDays=" + $.trim($("#addrenewDays").val()); 13 | ajax( 14 | { 15 | method: 'POST', 16 | url: 'admin/readerTypeManageAction_addReaderType.action', 17 | params: postdata, 18 | callback: function (data) { 19 | if (data == 1) { 20 | $("#addModal").modal("hide");//关闭模糊框 21 | showInfo("添加成功"); 22 | 23 | } else { 24 | $("#addModal").modal("hide");//关闭模糊框 25 | showInfo("添加失败"); 26 | } 27 | 28 | } 29 | } 30 | ); 31 | 32 | 33 | }); 34 | 35 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 36 | location.reload(); //刷新当前页面 37 | }); 38 | 39 | 40 | }); 41 | 42 | 43 | function validAddReaderType() { 44 | var flag = true; 45 | 46 | 47 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 48 | var typeName = $.trim($("#addType").val()); 49 | if (typeName == "") { 50 | $('#addType').parent().addClass("has-error"); 51 | $('#addType').next().text("请输入读者类型名称"); 52 | $("#addType").next().show(); 53 | flag = false; 54 | } else if (!reg.test(typeName)) { 55 | $('#addType').parent().addClass("has-error"); 56 | $('#addType').next().text("读者类型名称必须为中文"); 57 | $("#addType").next().show(); 58 | flag = false; 59 | } else { 60 | $('#addType').parent().removeClass("has-error"); 61 | $('#addType').next().text(""); 62 | $("#addType").next().hide(); 63 | } 64 | 65 | var maxNum = $.trim($("#addMaxNum").val()); 66 | if (maxNum == "") { 67 | $('#addMaxNum').parent().addClass("has-error"); 68 | $('#addMaxNum').next().text("请输入最大借阅数量"); 69 | $("#addMaxNum").next().show(); 70 | flag = false; 71 | } else if (maxNum <= 0 || maxNum != parseInt(maxNum)) { 72 | $('#addMaxNum').parent().addClass("has-error"); 73 | $('#addMaxNum').next().text("最大借阅数量必须为正整数"); 74 | $("#addMaxNum").next().show(); 75 | flag = false; 76 | } else { 77 | $('#addMaxNum').parent().removeClass("has-error"); 78 | $('#addMaxNum').next().text(""); 79 | $("#addMaxNum").next().hide(); 80 | } 81 | 82 | 83 | var bday = $.trim($("#addBday").val()); 84 | if (bday == "") { 85 | $('#addBday').parent().addClass("has-error"); 86 | $('#addBday').next().text("请输入最大借阅天数"); 87 | $("#addBday").next().show(); 88 | flag = false; 89 | } else if (bday <= 0 || bday != parseInt(bday)) { 90 | $('#addBday').parent().addClass("has-error"); 91 | $('#addBday').next().text("最大借阅天数必须为正整数"); 92 | $("#addBday").next().show(); 93 | flag = false; 94 | } else { 95 | $('#addBday').parent().removeClass("has-error"); 96 | $('#addBday').next().text(""); 97 | $("#addBday").next().hide(); 98 | } 99 | 100 | 101 | var penalty = $.trim($("#addPenalty").val()); 102 | if (penalty == "") { 103 | $('#addPenalty').parent().addClass("has-error"); 104 | $('#addPenalty').next().text("请输入逾期每日罚金"); 105 | $("#addPenalty").next().show(); 106 | flag = false; 107 | } else if (penalty <= 0 || penalty != parseInt(penalty)) { 108 | $('#addPenalty').parent().addClass("has-error"); 109 | $('#addPenalty').next().text("逾期每日罚金必须为正整数"); 110 | $("#addPenalty").next().show(); 111 | flag = false; 112 | } else { 113 | $('#addPenalty').parent().removeClass("has-error"); 114 | $('#addPenalty').next().text(""); 115 | $("#addPenalty").next().hide(); 116 | } 117 | 118 | 119 | var renewDays = $.trim($("#addrenewDays").val()); 120 | if (renewDays == "") { 121 | $('#addrenewDays').parent().addClass("has-error"); 122 | $('#addrenewDays').next().text("请输入续借天数"); 123 | $("#addrenewDays").next().show(); 124 | flag = false; 125 | } else if (renewDays <= 0 || renewDays != parseInt(renewDays)) { 126 | $('#addrenewDays').parent().addClass("has-error"); 127 | $('#addrenewDays').next().text("续借天数必须为正整数"); 128 | $("#addrenewDays").next().show(); 129 | flag = false; 130 | } else { 131 | $('#addrenewDays').parent().removeClass("has-error"); 132 | $('#addrenewDays').next().text(""); 133 | $("#addrenewDays").next().hide(); 134 | } 135 | 136 | 137 | return flag; 138 | } 139 | 140 | 141 | function showInfo(msg) { 142 | $("#div_info").text(msg); 143 | $("#modal_info").modal('show'); 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /web/books/css/dataTables.bootstrap.css: -------------------------------------------------------------------------------- 1 | table.dataTable { 2 | clear: both; 3 | margin-top: 6px !important; 4 | margin-bottom: 6px !important; 5 | max-width: none !important; 6 | } 7 | 8 | table.dataTable td, 9 | table.dataTable th { 10 | -webkit-box-sizing: content-box; 11 | -moz-box-sizing: content-box; 12 | box-sizing: content-box; 13 | } 14 | 15 | table.dataTable.nowrap th, 16 | table.dataTable.nowrap td { 17 | white-space: nowrap; 18 | } 19 | 20 | div.dataTables_wrapper div.dataTables_length label { 21 | font-weight: normal; 22 | text-align: left; 23 | white-space: nowrap; 24 | } 25 | 26 | div.dataTables_wrapper div.dataTables_length select { 27 | width: 75px; 28 | display: inline-block; 29 | } 30 | 31 | div.dataTables_wrapper div.dataTables_filter { 32 | text-align: right; 33 | } 34 | 35 | div.dataTables_wrapper div.dataTables_filter label { 36 | font-weight: normal; 37 | white-space: nowrap; 38 | text-align: left; 39 | } 40 | 41 | div.dataTables_wrapper div.dataTables_filter input { 42 | margin-left: 0.5em; 43 | display: inline-block; 44 | width: auto; 45 | } 46 | 47 | div.dataTables_wrapper div.dataTables_info { 48 | padding-top: 8px; 49 | white-space: nowrap; 50 | } 51 | 52 | div.dataTables_wrapper div.dataTables_paginate { 53 | margin: 0; 54 | white-space: nowrap; 55 | text-align: right; 56 | } 57 | 58 | div.dataTables_wrapper div.dataTables_paginate ul.pagination { 59 | margin: 2px 0; 60 | white-space: nowrap; 61 | } 62 | 63 | table.dataTable thead > tr > th, 64 | table.dataTable thead > tr > td { 65 | padding-right: 30px; 66 | } 67 | 68 | table.dataTable thead > tr > th:active, 69 | table.dataTable thead > tr > td:active { 70 | outline: none; 71 | } 72 | 73 | table.dataTable thead .sorting, 74 | table.dataTable thead .sorting_asc, 75 | table.dataTable thead .sorting_desc, 76 | table.dataTable thead .sorting_asc_disabled, 77 | table.dataTable thead .sorting_desc_disabled { 78 | cursor: pointer; 79 | position: relative; 80 | } 81 | 82 | table.dataTable thead .sorting:after, 83 | table.dataTable thead .sorting_asc:after, 84 | table.dataTable thead .sorting_desc:after, 85 | table.dataTable thead .sorting_asc_disabled:after, 86 | table.dataTable thead .sorting_desc_disabled:after { 87 | position: absolute; 88 | bottom: 8px; 89 | right: 8px; 90 | display: block; 91 | font-family: 'Glyphicons Halflings'; 92 | opacity: 0.5; 93 | } 94 | 95 | table.dataTable thead .sorting:after { 96 | opacity: 0.2; 97 | content: "\e150"; 98 | /* sort */ 99 | } 100 | 101 | table.dataTable thead .sorting_asc:after { 102 | content: "\e155"; 103 | /* sort-by-attributes */ 104 | } 105 | 106 | table.dataTable thead .sorting_desc:after { 107 | content: "\e156"; 108 | /* sort-by-attributes-alt */ 109 | } 110 | 111 | table.dataTable thead .sorting_asc_disabled:after, 112 | table.dataTable thead .sorting_desc_disabled:after { 113 | color: #eee; 114 | } 115 | 116 | div.dataTables_scrollHead table.dataTable { 117 | margin-bottom: 0 !important; 118 | } 119 | 120 | div.dataTables_scrollBody table { 121 | border-top: none; 122 | margin-top: 0 !important; 123 | margin-bottom: 0 !important; 124 | } 125 | 126 | div.dataTables_scrollBody table thead .sorting:after, 127 | div.dataTables_scrollBody table thead .sorting_asc:after, 128 | div.dataTables_scrollBody table thead .sorting_desc:after { 129 | display: none; 130 | } 131 | 132 | div.dataTables_scrollBody table tbody tr:first-child th, 133 | div.dataTables_scrollBody table tbody tr:first-child td { 134 | border-top: none; 135 | } 136 | 137 | div.dataTables_scrollFoot table { 138 | margin-top: 0 !important; 139 | border-top: none; 140 | } 141 | 142 | @media screen and (max-width: 767px) { 143 | div.dataTables_wrapper div.dataTables_length, 144 | div.dataTables_wrapper div.dataTables_filter, 145 | div.dataTables_wrapper div.dataTables_info, 146 | div.dataTables_wrapper div.dataTables_paginate { 147 | text-align: center; 148 | } 149 | } 150 | 151 | table.dataTable.table-condensed > thead > tr > th { 152 | padding-right: 20px; 153 | } 154 | 155 | table.dataTable.table-condensed .sorting:after, 156 | table.dataTable.table-condensed .sorting_asc:after, 157 | table.dataTable.table-condensed .sorting_desc:after { 158 | top: 6px; 159 | right: 6px; 160 | } 161 | 162 | table.table-bordered.dataTable { 163 | border-collapse: separate !important; 164 | } 165 | 166 | table.table-bordered.dataTable th, 167 | table.table-bordered.dataTable td { 168 | border-left-width: 0; 169 | } 170 | 171 | table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, 172 | table.table-bordered.dataTable td:last-child, 173 | table.table-bordered.dataTable td:last-child { 174 | border-right-width: 0; 175 | } 176 | 177 | table.table-bordered.dataTable tbody th, 178 | table.table-bordered.dataTable tbody td { 179 | border-bottom-width: 0; 180 | } 181 | 182 | div.dataTables_scrollHead table.table-bordered { 183 | border-bottom-width: 0; 184 | } 185 | -------------------------------------------------------------------------------- /web/books/js/addReader.js: -------------------------------------------------------------------------------- 1 | window.onload = new function () { 2 | ajax( 3 | { 4 | url: "admin/readerTypeManageAction_getAllReaderTypes.action", 5 | type: "json", 6 | callback: function (data) { 7 | // 循环遍历每个读者分类,每个名称生成一个option对象,添加到中 50 | for (var index in data) { 51 | var op = document.createElement("option");//创建一个指名名称元素 52 | op.value = data[index].typeId;//设置op的实际值为当前的图书分类编号 53 | var textNode = document.createTextNode(data[index].typeName);//创建文本节点 54 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 55 | 56 | document.getElementById("addBookType").appendChild(op); 57 | } 58 | } 59 | } 60 | ); 61 | }); 62 | 63 | 64 | }); 65 | 66 | 67 | function validAddBook() { 68 | var flag = true; 69 | 70 | var ISBN = $.trim($("#addISBN").val()); 71 | if (ISBN == "") { 72 | $('#addISBN').parent().addClass("has-error"); 73 | $('#addISBN').next().text("请输入图书ISBN码"); 74 | $("#addISBN").next().show(); 75 | flag = false; 76 | } else { 77 | $('#addISBN').parent().removeClass("has-error"); 78 | $('#addISBN').next().text(""); 79 | $("#addISBN").next().hide(); 80 | } 81 | 82 | var bookName = $.trim($("#addBookName").val()); 83 | if (bookName == "") { 84 | $('#addBookName').parent().addClass("has-error"); 85 | $('#addBookName').next().text("请输入图书名称"); 86 | $("#addBookName").next().show(); 87 | flag = false; 88 | } else { 89 | $('#addBookName').parent().removeClass("has-error"); 90 | $('#addBookName').next().text(""); 91 | $("#addBookName").next().hide(); 92 | } 93 | 94 | 95 | var bookType = $.trim($("#addBookType").val()); 96 | if (bookType == -1) { 97 | $('#addBookType').parent().addClass("has-error"); 98 | $('#addBookType').next().text("请选择图书分类"); 99 | $("#addBookType").next().show(); 100 | flag = false; 101 | } else { 102 | $('#addBookType').parent().removeClass("has-error"); 103 | $('#addBookType').next().text(""); 104 | $("#addBookType").next().hide(); 105 | } 106 | 107 | var autho = $.trim($("#addAutho").val()); 108 | if (autho == "") { 109 | $('#addAutho').parent().addClass("has-error"); 110 | $('#addAutho').next().text("请输入作者名称"); 111 | $("#addAutho").next().show(); 112 | flag = false; 113 | } else { 114 | $('#addAutho').parent().removeClass("has-error"); 115 | $('#addAutho').next().text(""); 116 | $("#addAutho").next().hide(); 117 | } 118 | 119 | 120 | var press = $.trim($("#addPress").val()); 121 | if (press == "") { 122 | $('#addPress').parent().addClass("has-error"); 123 | $('#addPress').next().text("请输入出版社名称"); 124 | $("#addPress").next().show(); 125 | flag = false; 126 | } else { 127 | $('#addPress').parent().removeClass("has-error"); 128 | $('#addPress').next().text(""); 129 | $("#addPress").next().hide(); 130 | } 131 | 132 | var num = $.trim($("#addNum").val()); 133 | if (num == "") { 134 | $('#addNum').parent().addClass("has-error"); 135 | $('#addNum').next().text("请输入总数量"); 136 | $("#addNum").next().show(); 137 | flag = false; 138 | } else if (num <= 0 || num != parseInt(num)) { 139 | $('#addNum').parent().addClass("has-error"); 140 | $('#addNum').next().text("数量必须为正整数"); 141 | $("#addNum").next().show(); 142 | flag = false; 143 | } else { 144 | $('#addNum').parent().removeClass("has-error"); 145 | $('#addNum').next().text(""); 146 | $("#addNum").next().hide(); 147 | } 148 | 149 | 150 | var price = $.trim($("#addPrice").val()); 151 | if (price == "") { 152 | $('#addPrice').parent().addClass("has-error"); 153 | $('#addPrice').next().text("请输入总数量"); 154 | $("#addPrice").next().show(); 155 | flag = false; 156 | } else if (price <= 0 || price != parseInt(price)) { 157 | $('#addPrice').parent().addClass("has-error"); 158 | $('#addPrice').next().text("数量必须为正整数"); 159 | $("#addPrice").next().show(); 160 | flag = false; 161 | } else { 162 | $('#addPrice').parent().removeClass("has-error"); 163 | $('#addPrice').next().text(""); 164 | $("#addPrice").next().hide(); 165 | } 166 | 167 | 168 | return flag; 169 | } 170 | 171 | 172 | function showInfo(msg) { 173 | $("#div_info").text(msg); 174 | $("#modal_info").modal('show'); 175 | } 176 | 177 | 178 | -------------------------------------------------------------------------------- /web/books/js/updateBook.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#updateBook').click(function () { 5 | 6 | 7 | if (!validUpdateBook()) { 8 | return; 9 | } 10 | 11 | var postdata = "bookId=" + $.trim($("#updateBookId").val()) + "&bookName=" + $.trim($("#updateBookName").val()) + "&bookTypeId=" + $.trim($("#updateBookType").val()) 12 | + "&autho=" + $.trim($("#updateAutho").val()) + "&press=" + $.trim($("#updatePress").val()) + "&price=" + $.trim($("#updatePrice").val()) 13 | + "&description=" + $.trim($("#updateDescription").val()) + "&ISBN=" + $.trim($("#updateISBN").val()); 14 | ajax( 15 | { 16 | method: 'POST', 17 | url: 'admin/bookManageAction_updateBook.action', 18 | params: postdata, 19 | callback: function (data) { 20 | if (data == 1) { 21 | $("#updateModal").modal("hide");//关闭模糊框 22 | showInfo("修改成功"); 23 | 24 | } else { 25 | $("#updateinfo").modal("hide");//关闭模糊框 26 | showInfo("修改失败"); 27 | } 28 | 29 | } 30 | } 31 | ); 32 | 33 | 34 | }); 35 | 36 | 37 | $('#modal_info').on('hide.bs.modal', function () {//提示模糊框隐藏时候触发 38 | location.reload(); //刷新当前页面 39 | }); 40 | 41 | 42 | }); 43 | 44 | 45 | function updateBook(id) { 46 | $("#updateBookType option[value!=-1]").remove();//移除先前的选项 47 | ajax( 48 | { 49 | url: "admin/bookManageAction_getAllBookTypes.action", 50 | type: "json", 51 | callback: function (data) { 52 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 60 | for (var index in data) { 61 | var op = document.createElement("option");//创建一个指名名称元素 62 | op.value = data[index].readerTypeId;//设置op的实际值为当前的读者分类编号 63 | var textNode = document.createTextNode(data[index].readerTypeName);//创建文本节点 64 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 65 | 66 | document.getElementById("updateReaderType").appendChild(op); 67 | } 68 | ajax( 69 | { 70 | method: 'POST', 71 | url: 'admin/readerManageAction_getReader.action', 72 | params: "readerId=" + id, 73 | type: "json", 74 | callback: function (data) { 75 | $("#updateReaderID").val(data.readerId); 76 | $("#updatePaperNO").val(data.paperNO); 77 | $("#updateName").val(data.name); 78 | $("#updateEmail").val(data.email); 79 | $("#updatePhone").val(data.phone); 80 | $("#updateReaderType").val(data.readerType.readerTypeId); 81 | } 82 | } 83 | ); 84 | } 85 | 86 | 87 | } 88 | ); 89 | 90 | 91 | } 92 | 93 | 94 | function validUpdateReader() { 95 | var flag = true; 96 | 97 | var paperNO = $.trim($("#updatePaperNO").val()); 98 | if (paperNO == "") { 99 | $('#updatePaperNO').parent().addClass("has-error"); 100 | $('#updatePaperNO').next().text("请输入读者证件号"); 101 | $("#updatePaperNO").next().show(); 102 | flag = false; 103 | } else { 104 | $('#updatePaperNO').parent().removeClass("has-error"); 105 | $('#updatePaperNO').next().text(""); 106 | $("#updatePaperNO").next().hide(); 107 | } 108 | 109 | 110 | var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g"); 111 | var name = $.trim($("#updateName").val()); 112 | if (name == "") { 113 | $('#updateName').parent().addClass("has-error"); 114 | $('#updateName').next().text("请输入真实姓名"); 115 | $("#updateName").next().show(); 116 | flag = false; 117 | } else if (!reg.test(name)) { 118 | $('#updateName').parent().addClass("has-error"); 119 | $('#updateName').next().text("真实姓名必须为中文"); 120 | $("#updateName").next().show(); 121 | flag = false; 122 | } else { 123 | $('#updateName').parent().removeClass("has-error"); 124 | $('#updateName').next().text(""); 125 | $("#updateName").next().hide(); 126 | } 127 | 128 | var phone = $.trim($("#updatePhone").val()); 129 | if (phone == "") { 130 | $('#updatePhone').parent().addClass("has-error"); 131 | $('#updatePhone').next().text("请输入联系号码"); 132 | $("#updatePhone").next().show(); 133 | flag = false; 134 | } else if (!(/^1[34578]\d{9}$/.test(phone))) { 135 | //电话号码格式的校验 136 | $('#updatePhone').parent().addClass("has-error"); 137 | $('#updatePhone').next().text("手机号码有误"); 138 | $("#updatePhone").next().show(); 139 | return false; 140 | } else { 141 | $('#updatePhone').parent().removeClass("has-error"); 142 | $('#updatePhone').next().text(""); 143 | $("#updatePhone").next().hide(); 144 | } 145 | 146 | var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 147 | var email = $.trim($("#updateEmail").val()); 148 | if (email == "") { 149 | $('#updateEmail').parent().addClass("has-error"); 150 | $('#updateEmail').next().text("请输入邮箱"); 151 | $("#updateEmail").next().show(); 152 | flag = false; 153 | } else if (!reg.test(email)) { 154 | //邮箱格式的校验 155 | $('#updateEmail').parent().addClass("has-error"); 156 | $('#updateEmail').next().text("邮箱格式有误"); 157 | $("#updateEmail").next().show(); 158 | return false; 159 | } else { 160 | $('#updateEmail').parent().removeClass("has-error"); 161 | $('#updateEmail').next().text(""); 162 | $("#updateEmail").next().hide(); 163 | } 164 | 165 | 166 | var readerType = $.trim($("#updateReaderType").val()); 167 | if (readerType == -1) { 168 | $('#updateReaderType').parent().addClass("has-error"); 169 | $('#updateReaderType').next().text("请选择读者类型"); 170 | $("#updateReaderType").next().show(); 171 | flag = false; 172 | } else { 173 | $('#updateReaderType').parent().removeClass("has-error"); 174 | $('#updateReaderType').next().text(""); 175 | $("#updateReaderType").next().hide(); 176 | } 177 | 178 | return flag; 179 | } 180 | 181 | 182 | function showInfo(msg) { 183 | $("#div_info").text(msg); 184 | $("#modal_info").modal('show'); 185 | } 186 | 187 | 188 | -------------------------------------------------------------------------------- /web/static/css/admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * admin.css 3 | */ 4 | 5 | 6 | /* 7 | fixed-layout 固定头部和边栏布局 8 | */ 9 | 10 | html, 11 | body { 12 | height: 100%; 13 | overflow: hidden; 14 | } 15 | 16 | ul { 17 | margin-top: 0; 18 | } 19 | 20 | .admin-icon-yellow { 21 | color: #ffbe40; 22 | } 23 | 24 | .admin-header { 25 | position: fixed; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | z-index: 1500; 30 | font-size: 1.4rem; 31 | margin-bottom: 0; 32 | } 33 | 34 | .admin-header-list a:hover :after { 35 | content: none; 36 | } 37 | 38 | .admin-main { 39 | position: relative; 40 | height: 100%; 41 | padding-top: 51px; 42 | background: #f3f3f3; 43 | } 44 | 45 | .admin-menu { 46 | position: fixed; 47 | z-index: 10; 48 | bottom: 30px; 49 | right: 20px; 50 | } 51 | 52 | .admin-sidebar { 53 | width: 260px; 54 | min-height: 100%; 55 | float: left; 56 | border-right: 1px solid #cecece; 57 | } 58 | 59 | .admin-sidebar.am-active { 60 | z-index: 1600; 61 | } 62 | 63 | .admin-sidebar-list { 64 | margin-bottom: 0; 65 | } 66 | 67 | .admin-sidebar-list li a { 68 | color: #5c5c5c; 69 | padding-left: 24px; 70 | } 71 | 72 | .admin-sidebar-list li:first-child { 73 | border-top: none; 74 | } 75 | 76 | .admin-sidebar-sub { 77 | margin-top: 0; 78 | margin-bottom: 0; 79 | box-shadow: 0 16px 8px -15px #e2e2e2 inset; 80 | background: #ececec; 81 | padding-left: 24px; 82 | } 83 | 84 | .admin-sidebar-sub li:first-child { 85 | border-top: 1px solid #dedede; 86 | } 87 | 88 | .admin-sidebar-panel { 89 | margin: 10px; 90 | } 91 | 92 | .admin-content { 93 | display: -webkit-box; 94 | display: -webkit-flex; 95 | display: -ms-flexbox; 96 | display: flex; 97 | -webkit-box-orient: vertical; 98 | -webkit-box-direction: normal; 99 | -webkit-flex-direction: column; 100 | -ms-flex-direction: column; 101 | flex-direction: column; 102 | background: #fff; 103 | } 104 | 105 | .admin-content, 106 | .admin-sidebar { 107 | height: 100%; 108 | overflow-x: hidden; 109 | overflow-y: scroll; 110 | -webkit-overflow-scrolling: touch; 111 | } 112 | 113 | .admin-content-body { 114 | -webkit-box-flex: 1; 115 | -webkit-flex: 1 0 auto; 116 | -ms-flex: 1 0 auto; 117 | flex: 1 0 auto; 118 | } 119 | 120 | .admin-content-footer { 121 | font-size: 85%; 122 | color: #777; 123 | } 124 | 125 | .admin-content-list { 126 | border: 1px solid #e9ecf1; 127 | margin-top: 0; 128 | } 129 | 130 | .admin-content-list li { 131 | border: 1px solid #e9ecf1; 132 | border-width: 0 1px; 133 | margin-left: -1px; 134 | } 135 | 136 | .admin-content-list li:first-child { 137 | border-left: none; 138 | } 139 | 140 | .admin-content-list li:last-child { 141 | border-right: none; 142 | } 143 | 144 | .admin-content-table a { 145 | color: #535353; 146 | } 147 | 148 | .admin-content-file { 149 | margin-bottom: 0; 150 | color: #666; 151 | } 152 | 153 | .admin-content-file p { 154 | margin: 0 0 5px 0; 155 | font-size: 1.4rem; 156 | } 157 | 158 | .admin-content-file li { 159 | padding: 10px 0; 160 | } 161 | 162 | .admin-content-file li:first-child { 163 | border-top: none; 164 | } 165 | 166 | .admin-content-file li:last-child { 167 | border-bottom: none; 168 | } 169 | 170 | .admin-content-file li .am-progress { 171 | margin-bottom: 4px; 172 | } 173 | 174 | .admin-content-file li .am-progress-bar { 175 | line-height: 14px; 176 | } 177 | 178 | .admin-content-task { 179 | margin-bottom: 0; 180 | } 181 | 182 | .admin-content-task li { 183 | padding: 5px 0; 184 | border-color: #eee; 185 | } 186 | 187 | .admin-content-task li:first-child { 188 | border-top: none; 189 | } 190 | 191 | .admin-content-task li:last-child { 192 | border-bottom: none; 193 | } 194 | 195 | .admin-task-meta { 196 | font-size: 1.2rem; 197 | color: #999; 198 | } 199 | 200 | .admin-task-bd { 201 | font-size: 1.4rem; 202 | margin-bottom: 5px; 203 | } 204 | 205 | .admin-content-comment { 206 | margin-bottom: 0; 207 | } 208 | 209 | .admin-content-comment .am-comment-bd { 210 | font-size: 1.4rem; 211 | } 212 | 213 | .admin-content-pagination { 214 | margin-bottom: 0; 215 | } 216 | 217 | .admin-content-pagination li a { 218 | padding: 4px 8px; 219 | } 220 | 221 | @media only screen and (min-width: 641px) { 222 | .admin-sidebar { 223 | display: block; 224 | position: static; 225 | background: none; 226 | } 227 | 228 | .admin-offcanvas-bar { 229 | position: static; 230 | width: auto; 231 | background: none; 232 | -webkit-transform: translate3d(0, 0, 0); 233 | -ms-transform: translate3d(0, 0, 0); 234 | transform: translate3d(0, 0, 0); 235 | overflow-y: visible; 236 | min-height: 100%; 237 | } 238 | 239 | .admin-offcanvas-bar:after { 240 | content: none; 241 | } 242 | } 243 | 244 | @media only screen and (max-width: 640px) { 245 | .admin-sidebar { 246 | width: inherit; 247 | } 248 | 249 | .admin-offcanvas-bar { 250 | background: #f3f3f3; 251 | } 252 | 253 | .admin-offcanvas-bar:after { 254 | background: #BABABA; 255 | } 256 | 257 | .admin-sidebar-list a:hover, .admin-sidebar-list a:active { 258 | -webkit-transition: background-color .3s ease; 259 | -moz-transition: background-color .3s ease; 260 | -ms-transition: background-color .3s ease; 261 | -o-transition: background-color .3s ease; 262 | transition: background-color .3s ease; 263 | background: #E4E4E4; 264 | } 265 | 266 | .admin-content-list li { 267 | padding: 10px; 268 | border-width: 1px 0; 269 | margin-top: -1px; 270 | } 271 | 272 | .admin-content-list li:first-child { 273 | border-top: none; 274 | } 275 | 276 | .admin-content-list li:last-child { 277 | border-bottom: none; 278 | } 279 | 280 | .admin-form-text { 281 | text-align: left !important; 282 | } 283 | 284 | } 285 | 286 | /* 287 | * user.html css 288 | */ 289 | .user-info { 290 | margin-bottom: 15px; 291 | } 292 | 293 | .user-info .am-progress { 294 | margin-bottom: 4px; 295 | } 296 | 297 | .user-info p { 298 | margin: 5px; 299 | } 300 | 301 | .user-info-order { 302 | font-size: 1.4rem; 303 | } 304 | 305 | /* 306 | * errorLog.html css 307 | */ 308 | 309 | .error-log .am-pre-scrollable { 310 | max-height: 40rem; 311 | } 312 | 313 | /* 314 | * table.html css 315 | */ 316 | 317 | .table-main { 318 | font-size: 1.4rem; 319 | padding: .5rem; 320 | } 321 | 322 | .table-main button { 323 | background: #fff; 324 | } 325 | 326 | .table-check { 327 | width: 30px; 328 | } 329 | 330 | .table-id { 331 | width: 50px; 332 | } 333 | 334 | @media only screen and (max-width: 640px) { 335 | .table-select { 336 | margin-top: 10px; 337 | margin-left: 5px; 338 | } 339 | } 340 | 341 | /* 342 | gallery.html css 343 | */ 344 | 345 | .gallery-list li { 346 | padding: 10px; 347 | } 348 | 349 | .gallery-list a { 350 | color: #666; 351 | } 352 | 353 | .gallery-list a:hover { 354 | color: #3bb4f2; 355 | } 356 | 357 | .gallery-title { 358 | margin-top: 6px; 359 | font-size: 1.4rem; 360 | } 361 | 362 | .gallery-desc { 363 | font-size: 1.2rem; 364 | margin-top: 4px; 365 | } 366 | 367 | /* 368 | 404.html css 369 | */ 370 | 371 | .page-404 { 372 | background: #fff; 373 | border: none; 374 | width: 200px; 375 | margin: 0 auto; 376 | } 377 | -------------------------------------------------------------------------------- /web/books/js/dataTables.bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 3 integration 2 | * ©2011-2014 SpryMedia Ltd - datatables.net/license 3 | */ 4 | 5 | /** 6 | * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and 7 | * DataTables 1.10 or newer. 8 | * 9 | * This file sets the defaults and adds options to DataTables to style its 10 | * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap 11 | * for further information. 12 | */ 13 | (function (window, document, undefined) { 14 | 15 | var factory = function ($, DataTable) { 16 | "use strict"; 17 | 18 | 19 | /* Set the defaults for DataTables initialisation */ 20 | $.extend(true, DataTable.defaults, { 21 | dom: 22 | "<'row'<'col-sm-6'l><'col-sm-6'f>>" + 23 | "<'row'<'col-sm-12'tr>>" + 24 | "<'row'<'col-sm-5'i><'col-sm-7'p>>", 25 | renderer: 'bootstrap' 26 | }); 27 | 28 | 29 | /* Default class modification */ 30 | $.extend(DataTable.ext.classes, { 31 | sWrapper: "dataTables_wrapper form-inline dt-bootstrap", 32 | sFilterInput: "form-control input-sm", 33 | sLengthSelect: "form-control input-sm" 34 | }); 35 | 36 | 37 | /* Bootstrap paging button renderer */ 38 | DataTable.ext.renderer.pageButton.bootstrap = function (settings, host, idx, buttons, page, pages) { 39 | var api = new DataTable.Api(settings); 40 | var classes = settings.oClasses; 41 | var lang = settings.oLanguage.oPaginate; 42 | var btnDisplay, btnClass, counter = 0; 43 | 44 | var attach = function (container, buttons) { 45 | var i, ien, node, button; 46 | var clickHandler = function (e) { 47 | e.preventDefault(); 48 | if (!$(e.currentTarget).hasClass('disabled')) { 49 | api.page(e.data.action).draw('page'); 50 | } 51 | }; 52 | 53 | for (i = 0, ien = buttons.length; i < ien; i++) { 54 | button = buttons[i]; 55 | 56 | if ($.isArray(button)) { 57 | attach(container, button); 58 | } else { 59 | btnDisplay = ''; 60 | btnClass = ''; 61 | 62 | switch (button) { 63 | case 'ellipsis': 64 | btnDisplay = '…'; 65 | btnClass = 'disabled'; 66 | break; 67 | 68 | case 'first': 69 | btnDisplay = lang.sFirst; 70 | btnClass = button + (page > 0 ? 71 | '' : ' disabled'); 72 | break; 73 | 74 | case 'previous': 75 | btnDisplay = lang.sPrevious; 76 | btnClass = button + (page > 0 ? 77 | '' : ' disabled'); 78 | break; 79 | 80 | case 'next': 81 | btnDisplay = lang.sNext; 82 | btnClass = button + (page < pages - 1 ? 83 | '' : ' disabled'); 84 | break; 85 | 86 | case 'last': 87 | btnDisplay = lang.sLast; 88 | btnClass = button + (page < pages - 1 ? 89 | '' : ' disabled'); 90 | break; 91 | 92 | default: 93 | btnDisplay = button + 1; 94 | btnClass = page === button ? 95 | 'active' : ''; 96 | break; 97 | } 98 | 99 | if (btnDisplay) { 100 | node = $('
  • ', { 101 | 'class': classes.sPageButton + ' ' + btnClass, 102 | 'id': idx === 0 && typeof button === 'string' ? 103 | settings.sTableId + '_' + button : 104 | null 105 | }) 106 | .append($('', { 107 | 'href': '#', 108 | 'aria-controls': settings.sTableId, 109 | 'data-dt-idx': counter, 110 | 'tabindex': settings.iTabIndex 111 | }) 112 | .html(btnDisplay) 113 | ) 114 | .appendTo(container); 115 | 116 | settings.oApi._fnBindAction( 117 | node, {action: button}, clickHandler 118 | ); 119 | 120 | counter++; 121 | } 122 | } 123 | } 124 | }; 125 | 126 | // IE9 throws an 'unknown error' if document.activeElement is used 127 | // inside an iframe or frame. 128 | var activeEl; 129 | 130 | try { 131 | // Because this approach is destroying and recreating the paging 132 | // elements, focus is lost on the select button which is bad for 133 | // accessibility. So we want to restore focus once the draw has 134 | // completed 135 | activeEl = $(host).find(document.activeElement).data('dt-idx'); 136 | } catch (e) { 137 | } 138 | 139 | attach( 140 | $(host).empty().html('