├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── .jsdtscope └── org.eclipse.core.resources.prefs ├── WebContent ├── META-INF │ ├── MANIFEST.MF │ └── context.xml ├── img │ ├── logo.png │ ├── loading.gif │ ├── panner.jpg │ ├── icon │ │ ├── doc.png │ │ ├── pdf.png │ │ ├── ppt.png │ │ ├── txt.png │ │ ├── xls.png │ │ ├── zip.png │ │ ├── folder.png │ │ ├── image.png │ │ ├── music.png │ │ ├── other.png │ │ └── video.png │ ├── icon1 │ │ ├── doc.png │ │ ├── pdf.png │ │ ├── ppt.png │ │ ├── txt.png │ │ ├── xls.png │ │ ├── zip.png │ │ ├── folder.png │ │ ├── image.png │ │ ├── music.png │ │ ├── other.png │ │ └── video.png │ └── loading-sm.gif ├── WEB-INF │ ├── lib │ │ ├── jstl.jar │ │ ├── standard.jar │ │ ├── commons-io-2.5.jar │ │ ├── ezmorph-1.0.6.jar │ │ ├── commons-lang-2.6.jar │ │ ├── fastjson-1.2.54.jar │ │ ├── commons-logging-1.2.jar │ │ ├── commons-beanutils-1.9.3.jar │ │ ├── commons-collections4-4.2.jar │ │ ├── commons-fileupload-1.3.2.jar │ │ ├── taglibs-standard-compat-1.2.5.jar │ │ ├── taglibs-standard-impl-1.2.5.jar │ │ ├── taglibs-standard-jstlel-1.2.5.jar │ │ ├── taglibs-standard-spec-1.2.5.jar │ │ └── mysql-connector-java-5.1.36-bin.jar │ └── web.xml ├── css │ ├── login.css │ ├── checkbox.css │ ├── main.css │ └── fileinput.css ├── js │ ├── ajax.js │ ├── home.js │ ├── myShare.js │ ├── signupcheck.js │ ├── checkbox.js │ ├── drive.js │ ├── mkfoldercheck.js │ ├── inbox.js │ ├── logincheck.js │ ├── locales │ │ └── zh.js │ ├── echars │ │ ├── dark.js │ │ ├── shine.js │ │ └── macarons.js │ ├── adminEntry.js │ ├── mustache.min.js │ └── clipboard.min.js ├── themes │ └── fa │ │ ├── theme.min.js │ │ ├── theme.js │ │ └── theme.min.css ├── share.jsp └── auth │ ├── myShare.jsp │ └── drive.jsp ├── screenshots ├── img_1.png └── img_2.png ├── src └── com │ └── clouddrive │ ├── dao │ ├── FileDao.java │ ├── ShareDao.java │ ├── MessageDao.java │ ├── RSProcessor.java │ ├── UserDao.java │ ├── impl │ │ ├── MessageDaoImpl.java │ │ ├── UserDaoImpl.java │ │ ├── FileDaoImpl.java │ │ └── ShareDaoImpl.java │ └── BaseDao.java │ ├── biz │ ├── CountDataBiz.java │ ├── FileManageBiz.java │ ├── impl │ │ ├── FileListBizImpl.java │ │ ├── FileManageBizImpl.java │ │ ├── ShareManageBizImpl.java │ │ ├── MessageBizImpl.java │ │ ├── RegisterBizImpl.java │ │ ├── LoginBizImpl.java │ │ └── CountDataBizImpl.java │ ├── InboxBiz.java │ ├── RegisterBiz.java │ ├── LoginBiz.java │ ├── MessageBiz.java │ ├── ShareManageBiz.java │ └── FileListBiz.java │ ├── servlet │ ├── LeaveMessageServlet.java │ ├── InitServlet.java │ ├── LogoutServlet.java │ ├── ShareServlet.java │ ├── EcharsDataServlet.java │ ├── DelShareServlet.java │ ├── ShareListServlet.java │ ├── RegisterServlet.java │ ├── MkDirServlet.java │ ├── HomeListServlet.java │ ├── ShareFileServlet.java │ ├── DelFileServlet.java │ ├── LoginServlet.java │ ├── DownLoadServlet.java │ ├── ListFilesServlet.java │ └── UpLoadServlet.java │ ├── entity │ ├── CurrentTime.java │ ├── Conversion.java │ ├── Message.java │ ├── CreateKey.java │ ├── User.java │ ├── FileMessage.java │ ├── Share.java │ └── Type.java │ └── filter │ └── LoginFilter.java ├── README.md ├── .classpath ├── .project └── clouddrive.sql /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /screenshots/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/screenshots/img_1.png -------------------------------------------------------------------------------- /screenshots/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/screenshots/img_2.png -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /WebContent/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/logo.png -------------------------------------------------------------------------------- /WebContent/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/loading.gif -------------------------------------------------------------------------------- /WebContent/img/panner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/panner.jpg -------------------------------------------------------------------------------- /WebContent/img/icon/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/doc.png -------------------------------------------------------------------------------- /WebContent/img/icon/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/pdf.png -------------------------------------------------------------------------------- /WebContent/img/icon/ppt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/ppt.png -------------------------------------------------------------------------------- /WebContent/img/icon/txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/txt.png -------------------------------------------------------------------------------- /WebContent/img/icon/xls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/xls.png -------------------------------------------------------------------------------- /WebContent/img/icon/zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/zip.png -------------------------------------------------------------------------------- /WebContent/img/icon1/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/doc.png -------------------------------------------------------------------------------- /WebContent/img/icon1/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/pdf.png -------------------------------------------------------------------------------- /WebContent/img/icon1/ppt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/ppt.png -------------------------------------------------------------------------------- /WebContent/img/icon1/txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/txt.png -------------------------------------------------------------------------------- /WebContent/img/icon1/xls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/xls.png -------------------------------------------------------------------------------- /WebContent/img/icon1/zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/zip.png -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/jstl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/jstl.jar -------------------------------------------------------------------------------- /WebContent/img/icon/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/folder.png -------------------------------------------------------------------------------- /WebContent/img/icon/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/image.png -------------------------------------------------------------------------------- /WebContent/img/icon/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/music.png -------------------------------------------------------------------------------- /WebContent/img/icon/other.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/other.png -------------------------------------------------------------------------------- /WebContent/img/icon/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon/video.png -------------------------------------------------------------------------------- /WebContent/img/icon1/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/folder.png -------------------------------------------------------------------------------- /WebContent/img/icon1/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/image.png -------------------------------------------------------------------------------- /WebContent/img/icon1/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/music.png -------------------------------------------------------------------------------- /WebContent/img/icon1/other.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/other.png -------------------------------------------------------------------------------- /WebContent/img/icon1/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/icon1/video.png -------------------------------------------------------------------------------- /WebContent/img/loading-sm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/img/loading-sm.gif -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/standard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/standard.jar -------------------------------------------------------------------------------- /src/com/clouddrive/dao/FileDao.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/dao/FileDao.java -------------------------------------------------------------------------------- /src/com/clouddrive/dao/ShareDao.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/dao/ShareDao.java -------------------------------------------------------------------------------- /src/com/clouddrive/dao/MessageDao.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/dao/MessageDao.java -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-io-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-io-2.5.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/ezmorph-1.0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/ezmorph-1.0.6.jar -------------------------------------------------------------------------------- /src/com/clouddrive/biz/CountDataBiz.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/biz/CountDataBiz.java -------------------------------------------------------------------------------- /src/com/clouddrive/biz/FileManageBiz.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/biz/FileManageBiz.java -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-lang-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-lang-2.6.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/fastjson-1.2.54.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/fastjson-1.2.54.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-logging-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-logging-1.2.jar -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/FileListBizImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/biz/impl/FileListBizImpl.java -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-beanutils-1.9.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-beanutils-1.9.3.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-collections4-4.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-collections4-4.2.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-fileupload-1.3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/commons-fileupload-1.3.2.jar -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/FileManageBizImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/biz/impl/FileManageBizImpl.java -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/ShareManageBizImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/biz/impl/ShareManageBizImpl.java -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/LeaveMessageServlet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/src/com/clouddrive/servlet/LeaveMessageServlet.java -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/taglibs-standard-compat-1.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/taglibs-standard-compat-1.2.5.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/taglibs-standard-jstlel-1.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/taglibs-standard-jstlel-1.2.5.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/taglibs-standard-spec-1.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/taglibs-standard-spec-1.2.5.jar -------------------------------------------------------------------------------- /src/com/clouddrive/biz/InboxBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | public interface InboxBiz { 4 | public boolean delInbox(String path, String key); 5 | } 6 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/mysql-connector-java-5.1.36-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magentaLi/CloudDrive/HEAD/WebContent/WEB-INF/lib/mysql-connector-java-5.1.36-bin.jar -------------------------------------------------------------------------------- /src/com/clouddrive/biz/RegisterBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | public interface RegisterBiz { 4 | public boolean register(String username, String password); 5 | } 6 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/LoginBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | import com.clouddrive.entity.User; 4 | 5 | public interface LoginBiz { 6 | public User login(String username, String password); 7 | } 8 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/MessageBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | import com.clouddrive.entity.Message; 4 | 5 | public interface MessageBiz { 6 | public boolean leaveMessage(Message message); 7 | } 8 | -------------------------------------------------------------------------------- /WebContent/css/login.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | body { 7 | margin: 0 auto; 8 | padding: 0; 9 | background-color: #fdfcf8; 10 | } 11 | 12 | #errorInfo { 13 | color: red; 14 | } -------------------------------------------------------------------------------- /src/com/clouddrive/dao/RSProcessor.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | 6 | public interface RSProcessor { 7 | Object process(ResultSet rs) throws SQLException; 8 | } 9 | -------------------------------------------------------------------------------- /WebContent/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /WebContent/js/ajax.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | 5 | var isIE = false; 6 | function getXMLHttpRequest() { 7 | if (window.XMLHttpRequest) { 8 | if (navigator.userAgent.indexOf('MSIE') != -1) { 9 | isIE = true; 10 | } 11 | return new XMLHttpRequest(); 12 | } else if (window.ActiveXObject) { 13 | isIE = true; 14 | return new ActiveXObject("Microsoft.XMLHTTP"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /WebContent/js/home.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | if ($("#loginError")[0]) { 3 | $("#login").modal("show"); 4 | } 5 | if ($("#registerError")[0]) { 6 | $("#signup").modal("show"); 7 | } 8 | $("#login").on("hide.bs.modal", function() { 9 | window.location.href = "Home"; 10 | }); 11 | $("#signup").on("hide.bs.modal", function() { 12 | window.location.href = "Home"; 13 | }); 14 | }) 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CloudDrive 2 | * 本系统是一个基于javaweb的仿照百度网盘做的小型云盘系统 3 | * 前端使用**bootstrap**框架构建,后台未使用框架,使用的是最基本的*servlet*实现。 4 | * 访问这个链接可查看[项目实际运行情况](http://47.107.160.68:8080/CloudDrive/)。 5 | * 下为部分运行时截图: 6 | 7 | ![image](https://github.com/magentaLi/CloudDrive/blob/master/screenshots/img_1.png) 8 | 9 | ![image](https://github.com/magentaLi/CloudDrive/blob/master/screenshots/img_2.png) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/ShareManageBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | import com.clouddrive.entity.Share; 4 | 5 | public interface ShareManageBiz { 6 | public String insertShare(String userName, String uuidName, String url, long size); 7 | 8 | public Share getShareByKey(String key); 9 | 10 | public boolean delShareByKey(String key); 11 | 12 | public int delShareByUuidName(String uuidName); 13 | } 14 | -------------------------------------------------------------------------------- /src/com/clouddrive/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao; 2 | 3 | import java.util.Vector; 4 | 5 | import com.clouddrive.entity.User; 6 | 7 | public interface UserDao { 8 | 9 | public int countUser(); 10 | 11 | public int countUserByName(String name); 12 | 13 | public User findUserByName(String name); 14 | 15 | public Vector findUsersByName(String name); 16 | 17 | public int insert(User user); 18 | } 19 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/CurrentTime.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | public class CurrentTime { 7 | private Date date; 8 | private String dateString; 9 | 10 | public CurrentTime() { 11 | date = new Date(); 12 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); 13 | dateString = format.format(date); 14 | } 15 | 16 | public String getDateString() { 17 | return dateString; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/FileListBiz.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Vector; 5 | 6 | import com.clouddrive.entity.FileMessage; 7 | 8 | public interface FileListBiz { 9 | public Vector getFilesByTypeAndUser(String userName, String type); 10 | 11 | public Vector getFilesByPathAndUser(String path, String userName); 12 | 13 | public String getLastPath(String path); 14 | 15 | public LinkedHashMap getPaths(String path); 16 | } 17 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/com/clouddrive/dao/impl/MessageDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao.impl; 2 | 3 | import com.clouddrive.dao.BaseDao; 4 | import com.clouddrive.dao.MessageDao; 5 | import com.clouddrive.entity.CurrentTime; 6 | import com.clouddrive.entity.Message; 7 | 8 | public class MessageDaoImpl extends BaseDao implements MessageDao { 9 | 10 | @Override 11 | public int insert(Message message) { 12 | String sql = "insert into message (username, message, time) values(?,?,?)"; 13 | Object[] params = { message.getUserName(), message.getMessage(), new CurrentTime().getDateString() }; 14 | return this.executeUpdate(sql, params); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /WebContent/js/myShare.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | $("#confirmDeletion").click( 4 | function() { 5 | var keys = new Array(); 6 | $("tbody input[type='checkbox']:checked").each( 7 | function() { 8 | keys.push($(this).parent().parent().parent().find( 9 | ".param .key").text()); 10 | }); 11 | $.ajax({ 12 | url : 'DelShare', 13 | data : { 14 | "keys" : keys 15 | }, 16 | dataType : "json", 17 | type : "POST", 18 | traditional : true, 19 | success : handleDelShares 20 | }); 21 | }); 22 | }); 23 | 24 | function handleDelShares(data) { 25 | window.location.reload(); 26 | } 27 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/MessageBizImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz.impl; 2 | 3 | import com.clouddrive.biz.MessageBiz; 4 | import com.clouddrive.dao.MessageDao; 5 | import com.clouddrive.dao.impl.MessageDaoImpl; 6 | import com.clouddrive.entity.Message; 7 | 8 | public class MessageBizImpl implements MessageBiz { 9 | 10 | private MessageDao messageDao; 11 | 12 | @Override 13 | public boolean leaveMessage(Message message) { 14 | System.out.println("messageBiz:"); 15 | messageDao = new MessageDaoImpl(); 16 | int res = messageDao.insert(message); 17 | if (res != 0) { 18 | return true; 19 | } else { 20 | return false; 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/Conversion.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | public class Conversion { 4 | public static String conversion(long size) { 5 | String showSize; 6 | String unit; 7 | String units[] = { "B", "KB", "M", "G", "T" }; 8 | double sizeNum = size; 9 | for (int i = 0; i < units.length; i++) { 10 | if (sizeNum < 1024) { 11 | unit = units[i]; 12 | showSize = String.format("%.2f", sizeNum); 13 | return showSize + " " + unit; 14 | } 15 | sizeNum = sizeNum / 1024; 16 | } 17 | sizeNum = sizeNum * 1024; 18 | showSize = String.format("%.2f", sizeNum); 19 | unit = "T"; 20 | return showSize + " " + unit; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/RegisterBizImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz.impl; 2 | 3 | import com.clouddrive.biz.RegisterBiz; 4 | import com.clouddrive.dao.impl.UserDaoImpl; 5 | import com.clouddrive.entity.User; 6 | 7 | public class RegisterBizImpl implements RegisterBiz { 8 | 9 | private UserDaoImpl userDaoImpl = new UserDaoImpl(); 10 | 11 | @Override 12 | public boolean register(String username, String password) { 13 | int userCount = userDaoImpl.countUserByName(username); 14 | if (userCount == 0) { 15 | User user = new User(username, password); 16 | if (userDaoImpl.insert(user) != 0) { 17 | return true; 18 | } 19 | return false; 20 | } 21 | return false; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/LoginBizImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz.impl; 2 | 3 | import com.clouddrive.biz.LoginBiz; 4 | import com.clouddrive.dao.impl.UserDaoImpl; 5 | import com.clouddrive.entity.User; 6 | 7 | public class LoginBizImpl implements LoginBiz { 8 | private UserDaoImpl userDao = new UserDaoImpl(); 9 | 10 | @Override 11 | public User login(String userName, String pwd) { 12 | System.out.println("loginbiz:"); 13 | System.out.println("userName:" + userName); 14 | User user = userDao.findUserByName(userName); 15 | if (user != null && user.getPwd().equals(pwd)) { 16 | System.out.println(user.getPwd()); 17 | System.out.println(pwd); 18 | return user; 19 | } 20 | return null; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /WebContent/js/signupcheck.js: -------------------------------------------------------------------------------- 1 | $("#signupForm").validate({ 2 | submitHandler : function(form) { 3 | form.submit(); 4 | } 5 | }); 6 | $(document).ready(function() { 7 | $("#signupForm").validate({ 8 | rules : { 9 | ruserName : { 10 | required : true, 11 | minlength : 5 12 | }, 13 | rpwd : { 14 | required : true, 15 | minlength : 8 16 | }, 17 | rrepwd : { 18 | required : true, 19 | minlength : 8, 20 | equalTo : "#rpwd" 21 | } 22 | }, 23 | messages : { 24 | ruserName : { 25 | required : "请输入用户名", 26 | minlength : "用户名至少5个字符" 27 | }, 28 | rpwd : { 29 | required : "请输入密码", 30 | minlength : "密码长度不能小于 8 个字母" 31 | }, 32 | rrepwd : { 33 | required : "请输入密码", 34 | minlength : "密码长度不能小于 8 个字母", 35 | equalTo : "两次密码输入不一致" 36 | } 37 | } 38 | }) 39 | }); -------------------------------------------------------------------------------- /src/com/clouddrive/entity/Message.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | public class Message { 4 | private int id; 5 | private String userName; 6 | private String message; 7 | 8 | public int getId() { 9 | return id; 10 | } 11 | 12 | public void setId(int id) { 13 | this.id = id; 14 | } 15 | 16 | public String getUserName() { 17 | return userName; 18 | } 19 | 20 | public void setUserName(String userName) { 21 | this.userName = userName; 22 | } 23 | 24 | public Message(String userName, String message) { 25 | super(); 26 | this.userName = userName; 27 | this.message = message; 28 | } 29 | 30 | public String getMessage() { 31 | return message; 32 | } 33 | 34 | public Message() { 35 | super(); 36 | } 37 | 38 | public void setMessage(String message) { 39 | this.message = message; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /WebContent/css/checkbox.css: -------------------------------------------------------------------------------- 1 | .main-checkbox { 2 | float: left; 3 | width: 20px; 4 | height: 20px; 5 | border-radius: 50%; 6 | position: relative; 7 | margin: 5px 0 0 5px; 8 | border: 1px solid #11a3fc; 9 | } 10 | 11 | .main-checkbox label { 12 | width: 20px; 13 | height: 20px; 14 | position: absolute; 15 | top: 0; 16 | left: 0; 17 | cursor: pointer; 18 | } 19 | 20 | .main-checkbox label:after { 21 | content: ""; 22 | width: 10px; 23 | height: 5px; 24 | position: absolute; 25 | top: 5px; 26 | left: 4px; 27 | border: 3px solid #11a3fc; 28 | border-top: none; 29 | border-right: none; 30 | background: transparent; 31 | opacity: 0; 32 | -webkit-transform: rotate(-45deg); 33 | transform: rotate(-45deg); 34 | } 35 | 36 | .main-checkbox input[type=checkbox] { 37 | visibility: hidden; 38 | } 39 | 40 | .main-checkbox input[type=checkbox]:checked+label:after { 41 | opacity: 1; 42 | } -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CloudDrive 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.jem.workbench.JavaEMFNature 26 | org.eclipse.wst.common.modulecore.ModuleCoreNature 27 | org.eclipse.wst.common.project.facet.core.nature 28 | org.eclipse.jdt.core.javanature 29 | org.eclipse.wst.jsdt.core.jsNature 30 | 31 | 32 | -------------------------------------------------------------------------------- /WebContent/js/checkbox.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $('#CheckAll').click(function() { 3 | if (this.checked) { 4 | $('tbody :checkbox').prop('checked', true); 5 | } else { 6 | $('tbody :checkbox').prop('checked', false); 7 | } 8 | }); 9 | 10 | $('tbody :checkbox').click(function() { 11 | var checkArry = document.getElementsByName("subBox"); 12 | for (var i = 0; i < checkArry.length; i++) { 13 | if (checkArry[i].checked == false) { 14 | $('#CheckAll').prop('checked', false); 15 | return; 16 | } 17 | } 18 | $('#CheckAll').prop('checked', true); 19 | }); 20 | 21 | $('table :checkbox').click(function() { 22 | var checkArry = document.getElementsByName("subBox"); 23 | for (var i = 0; i < checkArry.length; i++) { 24 | if (checkArry[i].checked == true) { 25 | $(".checkShow").show(); 26 | return; 27 | } 28 | } 29 | $(".checkShow").hide(); 30 | }); 31 | 32 | $("tbody tr").bind({ 33 | mouseover : function() { 34 | $(this).find(".disabled").show(); 35 | }, 36 | mouseout : function() { 37 | $(this).find(".disabled").hide(); 38 | } 39 | }); 40 | }) 41 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/InitServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import javax.servlet.ServletConfig; 4 | import javax.servlet.ServletContext; 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | 9 | import com.clouddrive.dao.BaseDao; 10 | 11 | /** 12 | * Servlet implementation class InitServlet 13 | */ 14 | @WebServlet("/InitServlet") 15 | public class InitServlet extends HttpServlet { 16 | private static final long serialVersionUID = 1L; 17 | 18 | @Override 19 | public void init(ServletConfig config) throws ServletException { 20 | super.init(config); 21 | ServletContext context = config.getServletContext(); 22 | String sqlDialect = context.getInitParameter("sql_dialect"); 23 | BaseDao.sqlDialect = sqlDialect; 24 | 25 | String dataSource = context.getInitParameter("data_source"); 26 | BaseDao.dataSource = dataSource; 27 | 28 | System.out.println("The sql dialect is set to " + sqlDialect); 29 | System.out.println("The data source is set to " + dataSource); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/com/clouddrive/biz/impl/CountDataBizImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.biz.impl; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.clouddrive.biz.CountDataBiz; 6 | import com.clouddrive.dao.FileDao; 7 | import com.clouddrive.dao.ShareDao; 8 | import com.clouddrive.dao.UserDao; 9 | import com.clouddrive.dao.impl.FileDaoImpl; 10 | import com.clouddrive.dao.impl.ShareDaoImpl; 11 | import com.clouddrive.dao.impl.UserDaoImpl; 12 | 13 | public class CountDataBizImpl implements CountDataBiz { 14 | 15 | private UserDao userDao; 16 | private ShareDao shareDao; 17 | private FileDao fileDao; 18 | 19 | @Override 20 | public ArrayList echarsData() { 21 | ArrayList list = new ArrayList<>(); 22 | userDao = new UserDaoImpl(); 23 | shareDao = new ShareDaoImpl(); 24 | fileDao = new FileDaoImpl(); 25 | int countUsers = userDao.countUser(); 26 | list.add(countUsers); 27 | int countFiles = fileDao.countFiles(); 28 | list.add(countFiles); 29 | int countShares = shareDao.countShare(); 30 | list.add(countShares); 31 | int countDownloads = shareDao.countDownloads(); 32 | list.add(countDownloads); 33 | return list; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/CreateKey.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | import java.util.Random; 4 | 5 | public class CreateKey { 6 | public String createPassWord(int len) { 7 | int random = this.createRandomInt(); 8 | return this.createPassWord(random, len); 9 | } 10 | 11 | public String createPassWord(int random, int len) { 12 | Random rd = new Random(random); 13 | final int maxNum = 62; 14 | StringBuffer sb = new StringBuffer(); 15 | int rdGet;// 取得随机数 16 | char[] str = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 17 | 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 18 | 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', 19 | '9' }; 20 | 21 | int count = 0; 22 | while (count < len) { 23 | rdGet = Math.abs(rd.nextInt(maxNum));// 生成的数最大为62-1 24 | if (rdGet >= 0 && rdGet < str.length) { 25 | sb.append(str[rdGet]); 26 | count++; 27 | } 28 | } 29 | return sb.toString(); 30 | } 31 | 32 | public int createRandomInt() { 33 | // 得到0.0到1.0之间的数字,并扩大100000倍 34 | double temp = Math.random() * 100000; 35 | // 如果数据等于100000,则减少1 36 | if (temp >= 100000) { 37 | temp = 99999; 38 | } 39 | int tempint = (int) Math.ceil(temp); 40 | return tempint; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | public class User { 7 | private String userName; 8 | private String pwd; 9 | 10 | public User(String userName, String pwd) { 11 | super(); 12 | this.userName = userName; 13 | this.pwd = pwd; 14 | } 15 | 16 | public static String md5Password(String password) { 17 | 18 | try { 19 | // 得到一个信息摘要器 20 | MessageDigest digest = MessageDigest.getInstance("md5"); 21 | byte[] result = digest.digest(password.getBytes()); 22 | StringBuffer buffer = new StringBuffer(); 23 | // 把每一个byte 做一个与运算 0xff; 24 | for (byte b : result) { 25 | // 与运算 26 | int number = b & 0xff;// 加盐 27 | String str = Integer.toHexString(number); 28 | if (str.length() == 1) { 29 | buffer.append("0"); 30 | } 31 | buffer.append(str); 32 | } 33 | 34 | // 标准的md5加密后的结果 35 | return buffer.toString(); 36 | } catch (NoSuchAlgorithmException e) { 37 | e.printStackTrace(); 38 | return ""; 39 | } 40 | 41 | } 42 | 43 | public String getUserName() { 44 | return userName; 45 | } 46 | 47 | public void setUserName(String userName) { 48 | this.userName = userName; 49 | } 50 | 51 | public String getPwd() { 52 | return pwd; 53 | } 54 | 55 | public void setPwd(String pwd) { 56 | this.pwd = pwd; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//WebContent/home.jsp=UTF-8 3 | encoding//WebContent/share.jsp=UTF-8 4 | encoding//src/com/clouddrive/biz/impl/FileManageBizImpl.java=UTF-8 5 | encoding//src/com/clouddrive/dao/BaseDao.java=UTF-8 6 | encoding//src/com/clouddrive/dao/ShareDao.java=GBK 7 | encoding//src/com/clouddrive/dao/UserDao.java=UTF-8 8 | encoding//src/com/clouddrive/entity/CreateKey.java=UTF-8 9 | encoding//src/com/clouddrive/entity/FileMessage.java=UTF-8 10 | encoding//src/com/clouddrive/entity/User.java=UTF-8 11 | encoding//src/com/clouddrive/filter/LoginFilter.java=UTF-8 12 | encoding//src/com/clouddrive/servlet/DelFileServlet.java=UTF-8 13 | encoding//src/com/clouddrive/servlet/DelShareServlet.java=UTF-8 14 | encoding//src/com/clouddrive/servlet/DownLoadServlet.java=UTF-8 15 | encoding//src/com/clouddrive/servlet/EcharsDataServlet.java=UTF-8 16 | encoding//src/com/clouddrive/servlet/HomeListServlet.java=UTF-8 17 | encoding//src/com/clouddrive/servlet/InitServlet.java=UTF-8 18 | encoding//src/com/clouddrive/servlet/ListFilesServlet.java=UTF-8 19 | encoding//src/com/clouddrive/servlet/LoginServlet.java=UTF-8 20 | encoding//src/com/clouddrive/servlet/LogoutServlet.java=UTF-8 21 | encoding//src/com/clouddrive/servlet/MkDirServlet.java=GBK 22 | encoding//src/com/clouddrive/servlet/RegisterServlet.java=UTF-8 23 | encoding//src/com/clouddrive/servlet/ShareFileServlet.java=UTF-8 24 | encoding//src/com/clouddrive/servlet/ShareListServlet.java=UTF-8 25 | encoding//src/com/clouddrive/servlet/ShareServlet.java=UTF-8 26 | encoding//src/com/clouddrive/servlet/UpLoadServlet.java=UTF-8 27 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CloudDrive 4 | 5 | / 6 | Home 7 | index.html 8 | index.htm 9 | index.jsp 10 | default.html 11 | default.htm 12 | default.jsp 13 | 14 | 15 | InitServlet 16 | com.clouddrive.servlet.InitServlet 17 | 1 18 | 19 | 20 | sql_dialect 21 | mysql 22 | 23 | 24 | data_source 25 | clouddrive 26 | 27 | 28 | loginFilter 29 | com.clouddrive.filter.LoginFilter 30 | 31 | LOGIN_PATH 32 | /CloudDrive/Home 33 | 34 | 35 | 36 | loginFilter 37 | /auth/* 38 | 39 | 40 | jdbc/clouddrive 41 | Container 42 | 43 | -------------------------------------------------------------------------------- /WebContent/themes/fa/theme.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-fileinput v4.4.7 3 | * http://plugins.krajee.com/file-input 4 | * 5 | * Font Awesome icon theme configuration for bootstrap-fileinput. Requires font awesome assets to be loaded. 6 | * 7 | * Author: Kartik Visweswaran 8 | * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com 9 | * 10 | * Licensed under the BSD 3-Clause 11 | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md 12 | */!function(a) { 13 | "use strict"; 14 | a.fn.fileinputThemes.fa = { 15 | fileActionSettings : { 16 | removeIcon : '', 17 | uploadIcon : '', 18 | uploadRetryIcon : '', 19 | zoomIcon : '', 20 | dragIcon : '', 21 | indicatorNew : '', 22 | indicatorSuccess : '', 23 | indicatorError : '', 24 | indicatorLoading : '' 25 | }, 26 | layoutTemplates : { 27 | fileIcon : ' ' 28 | }, 29 | previewZoomButtonIcons : { 30 | prev : '', 31 | next : '', 32 | toggleheader : '', 33 | fullscreen : '', 34 | borderless : '', 35 | close : '' 36 | }, 37 | previewFileIcon : '', 38 | browseIcon : '', 39 | removeIcon : '', 40 | cancelIcon : '', 41 | uploadIcon : '', 42 | msgValidationErrorIcon : ' ' 43 | } 44 | }(window.jQuery); -------------------------------------------------------------------------------- /src/com/clouddrive/filter/LoginFilter.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.filter; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.Filter; 5 | import javax.servlet.FilterChain; 6 | import javax.servlet.FilterConfig; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.ServletRequest; 9 | import javax.servlet.ServletResponse; 10 | import javax.servlet.annotation.WebFilter; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import javax.servlet.http.HttpSession; 14 | 15 | /** 16 | * Servlet Filter implementation class LoginFilter 17 | */ 18 | @WebFilter("/LoginFilter") 19 | public class LoginFilter implements Filter { 20 | 21 | private static final String LOGIN_PATH = "LOGIN_PATH"; // 显示登录页面 22 | private String loginPath; 23 | 24 | /** 25 | * Default constructor. 26 | */ 27 | public LoginFilter() { 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | /** 32 | * @see Filter#destroy() 33 | */ 34 | public void destroy() { 35 | // TODO Auto-generated method stub 36 | } 37 | 38 | /** 39 | * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) 40 | */ 41 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 42 | throws IOException, ServletException { 43 | // place your code here 44 | HttpServletRequest httpReq = (HttpServletRequest) request; 45 | HttpServletResponse httpResp = (HttpServletResponse) response; 46 | 47 | HttpSession session = httpReq.getSession(); 48 | 49 | String userName = (String) session.getAttribute("name"); 50 | if (userName == null) { 51 | System.out.println(loginPath); 52 | request.setAttribute("message", "请登录"); 53 | request.getRequestDispatcher("Home").forward(httpReq, httpResp); 54 | } 55 | chain.doFilter(request, response); 56 | } 57 | 58 | /** 59 | * @see Filter#init(FilterConfig) 60 | */ 61 | public void init(FilterConfig fConfig) throws ServletException { 62 | loginPath = fConfig.getInitParameter(LOGIN_PATH); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/LogoutServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.Cookie; 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 | /** 14 | * Servlet implementation class LogoutServlet 15 | */ 16 | @WebServlet("/DoLogout") 17 | public class LogoutServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public LogoutServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 30 | * response) 31 | */ 32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 33 | throws ServletException, IOException { 34 | // TODO Auto-generated method stub 35 | request.setCharacterEncoding("UTF-8"); 36 | response.setCharacterEncoding("UTF-8"); 37 | HttpSession session = request.getSession(); 38 | // 清除cookie 39 | Cookie[] cookies = request.getCookies(); 40 | if (cookies != null) { 41 | for (Cookie cookie : cookies) { 42 | if (cookie.getName().equals("saveName")) { 43 | cookie.setValue(null); 44 | cookie.setMaxAge(0); 45 | response.addCookie(cookie); 46 | } 47 | } 48 | } 49 | session.invalidate(); 50 | response.sendRedirect("Home"); 51 | } 52 | 53 | /** 54 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 55 | * response) 56 | */ 57 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 58 | throws ServletException, IOException { 59 | // TODO Auto-generated method stub 60 | request.setCharacterEncoding("UTF-8"); 61 | response.setCharacterEncoding("UTF-8"); 62 | doGet(request, response); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /WebContent/themes/fa/theme.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-fileinput v4.4.7 3 | * http://plugins.krajee.com/file-input 4 | * 5 | * Font Awesome icon theme configuration for bootstrap-fileinput. Requires font awesome assets to be loaded. 6 | * 7 | * Author: Kartik Visweswaran 8 | * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com 9 | * 10 | * Licensed under the BSD 3-Clause 11 | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md 12 | */ 13 | (function ($) { 14 | "use strict"; 15 | 16 | $.fn.fileinputThemes.fa = { 17 | fileActionSettings: { 18 | removeIcon: '', 19 | uploadIcon: '', 20 | uploadRetryIcon: '', 21 | zoomIcon: '', 22 | dragIcon: '', 23 | indicatorNew: '', 24 | indicatorSuccess: '', 25 | indicatorError: '', 26 | indicatorLoading: '' 27 | }, 28 | layoutTemplates: { 29 | fileIcon: ' ' 30 | }, 31 | previewZoomButtonIcons: { 32 | prev: '', 33 | next: '', 34 | toggleheader: '', 35 | fullscreen: '', 36 | borderless: '', 37 | close: '' 38 | }, 39 | previewFileIcon: '', 40 | browseIcon: '', 41 | removeIcon: '', 42 | cancelIcon: '', 43 | uploadIcon: '', 44 | msgValidationErrorIcon: ' ' 45 | }; 46 | })(window.jQuery); 47 | -------------------------------------------------------------------------------- /WebContent/js/drive.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("#uploadFile").fileinput({ 3 | theme : 'fa', 4 | language : 'zh', 5 | uploadUrl : "UpLoad", 6 | allowedPreviewTypes : [ 'image', 'html', 'text', 'video', 'audio' ],// 预览类型 7 | // allowedFileExtensions: ['jpg', 'gif', 'png'], //文件上传类型 8 | maxFileSize : 0, 9 | maxFileCount : 10 10 | }); 11 | 12 | $('#uploadFile') 13 | .on( 14 | 'filebatchuploadcomplete', 15 | function(event, files, extra) { 16 | $("#uploadModal").find(".modal-footer").find(".btn") 17 | .text("确定"); 18 | console.log('File batch upload complete'); 19 | }); 20 | $('#uploadModal') 21 | .on( 22 | "hide.bs.modal", 23 | function() { 24 | if ($("#uploadModal").find(".modal-footer") 25 | .find(".btn").text() == "确定") { 26 | window.location.reload(); 27 | } 28 | }); 29 | 30 | $("#shareModal").on("hide.bs.modal", function() { 31 | window.location.reload(); 32 | }); 33 | 34 | $(".share").click(function() { 35 | $.get($(this).attr("url"), {}, handleShowLink); 36 | }); 37 | var clipboard = new Clipboard('#copyLink'); 38 | clipboard.on('success', function(e) { 39 | $("#copySuccess").show(); 40 | e.clearSelection(); 41 | }); 42 | clipboard.on('error', function(e) { 43 | $("#copyError").show(); 44 | }); 45 | 46 | $("#confirmDeletion").click( 47 | function() { 48 | var fileNames = new Array(); 49 | var paths = new Array(); 50 | $("tbody input[type='checkbox']:checked").each( 51 | function() { 52 | fileNames.push($(this).parent().parent().parent() 53 | .find(".param .fileName").text()); 54 | paths.push($(this).parent().parent().parent().find( 55 | ".param .path").text()); 56 | }); 57 | $.ajax({ 58 | url : 'DelFile', 59 | data : { 60 | "fileName" : fileNames, 61 | "path" : paths 62 | }, 63 | dataType : "json", 64 | type : "POST", 65 | traditional : true, 66 | success : handleDelFiles 67 | }); 68 | }); 69 | }); 70 | function handleShowLink(data) { 71 | $("#linkText").val(data); 72 | $("#shareModal").modal("show"); 73 | }; 74 | 75 | function handleDelFiles(data) { 76 | window.location.reload(); 77 | } 78 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/ShareServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Vector; 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 | 12 | import com.clouddrive.biz.impl.ShareManageBizImpl; 13 | import com.clouddrive.dao.impl.ShareDaoImpl; 14 | import com.clouddrive.entity.Share; 15 | 16 | /** 17 | * Servlet implementation class ShareServlet 18 | */ 19 | @WebServlet("/Share") 20 | public class ShareServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * @see HttpServlet#HttpServlet() 25 | */ 26 | public ShareServlet() { 27 | super(); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | /** 32 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 33 | * response) 34 | */ 35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 36 | throws ServletException, IOException { 37 | // TODO Auto-generated method stub 38 | request.setCharacterEncoding("UTF-8"); 39 | response.setCharacterEncoding("UTF-8"); 40 | 41 | 42 | System.out.println("ShareServlet:"); 43 | 44 | String key = request.getParameter("key"); 45 | 46 | ShareManageBizImpl shareManage = new ShareManageBizImpl(); 47 | Share share = shareManage.getShareByKey(key); 48 | 49 | ShareDaoImpl shareDaoImpl = new ShareDaoImpl(); 50 | Vector shares = shareDaoImpl.getHotShare(); 51 | request.setAttribute("shares", shares); 52 | request.setAttribute("share", share); 53 | request.getRequestDispatcher("share.jsp").forward(request, response); 54 | } 55 | 56 | /** 57 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 58 | * response) 59 | */ 60 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 61 | throws ServletException, IOException { 62 | // TODO Auto-generated method stub 63 | request.setCharacterEncoding("UTF-8"); 64 | response.setCharacterEncoding("UTF-8"); 65 | doGet(request, response); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/EcharsDataServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.ArrayList; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import com.alibaba.fastjson.JSONObject; 14 | import com.clouddrive.biz.CountDataBiz; 15 | import com.clouddrive.biz.impl.CountDataBizImpl; 16 | 17 | /** 18 | * Servlet implementation class EcharsDataServlet 19 | */ 20 | @WebServlet("/EcharsData") 21 | public class EcharsDataServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | private CountDataBiz countDataBiz; 24 | 25 | /** 26 | * @see HttpServlet#HttpServlet() 27 | */ 28 | public EcharsDataServlet() { 29 | super(); 30 | // TODO Auto-generated constructor stub 31 | } 32 | 33 | /** 34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 35 | * response) 36 | */ 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | // TODO Auto-generated method stub 40 | response.setCharacterEncoding("utf-8"); 41 | request.setCharacterEncoding("utf-8"); 42 | response.setContentType("application/json"); 43 | 44 | countDataBiz = new CountDataBizImpl(); 45 | ArrayList list = countDataBiz.echarsData(); 46 | JSONObject json = new JSONObject(); 47 | if (list.get(0) == 0) { 48 | json.put("isEmpty", true); 49 | } else { 50 | json.put("isEmpty", false); 51 | json.put("data", list); 52 | } 53 | PrintWriter out = response.getWriter(); 54 | out.println(json); 55 | out.close(); 56 | } 57 | 58 | /** 59 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 60 | * response) 61 | */ 62 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 63 | throws ServletException, IOException { 64 | // TODO Auto-generated method stub 65 | response.setCharacterEncoding("utf-8"); 66 | request.setCharacterEncoding("utf-8"); 67 | doGet(request, response); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/FileMessage.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | public class FileMessage { 4 | private String fileName = ""; 5 | private String uuidName = ""; 6 | private String updateTime = ""; 7 | private String type = ""; 8 | private String path = ""; 9 | private String user = ""; 10 | private long size = 0; 11 | private String showSize; 12 | 13 | public FileMessage(String fileName, String uuidName, String updateTime, String type, String path, String user, 14 | long size) { 15 | super(); 16 | this.fileName = fileName; 17 | this.uuidName = uuidName; 18 | this.updateTime = updateTime; 19 | this.type = type; 20 | this.path = path; 21 | this.user = user; 22 | this.size = size; 23 | showSize = Conversion.conversion(size); 24 | } 25 | 26 | public FileMessage(String fileName, String updateTime, String type, String path, String user) { 27 | super(); 28 | this.fileName = fileName; 29 | this.updateTime = updateTime; 30 | this.type = type; 31 | this.path = path; 32 | this.user = user; 33 | } 34 | 35 | public String getShowSize() { 36 | return showSize; 37 | } 38 | 39 | public void setShowSize(String showSize) { 40 | this.showSize = showSize; 41 | } 42 | 43 | public String getFileName() { 44 | return fileName; 45 | } 46 | 47 | public void setFileName(String fileName) { 48 | this.fileName = fileName; 49 | } 50 | 51 | public String getUuidName() { 52 | return uuidName; 53 | } 54 | 55 | public void setUuidName(String uuidName) { 56 | this.uuidName = uuidName; 57 | } 58 | 59 | public String getUpdateTime() { 60 | return updateTime; 61 | } 62 | 63 | public void setUpdateTime(String updateTime) { 64 | this.updateTime = updateTime; 65 | } 66 | 67 | public String getType() { 68 | return type; 69 | } 70 | 71 | public void setType(String type) { 72 | this.type = type; 73 | } 74 | 75 | public String getPath() { 76 | return path; 77 | } 78 | 79 | public void setPath(String path) { 80 | this.path = path; 81 | } 82 | 83 | public String getUser() { 84 | return user; 85 | } 86 | 87 | public void setUser(String user) { 88 | this.user = user; 89 | } 90 | 91 | public long getSize() { 92 | return size; 93 | } 94 | 95 | public void setSize(long size) { 96 | this.size = size; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/DelShareServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 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 | 12 | import com.alibaba.fastjson.JSONObject; 13 | import com.clouddrive.biz.impl.ShareManageBizImpl; 14 | 15 | /** 16 | * Servlet implementation class DelShareServlet 17 | */ 18 | @WebServlet("/DelShare") 19 | public class DelShareServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public DelShareServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | request.setCharacterEncoding("UTF-8"); 37 | response.setCharacterEncoding("UTF-8"); 38 | response.setContentType("application/json"); 39 | 40 | System.out.println("DelShareServlet"); 41 | 42 | String[] keys = request.getParameterValues("keys"); 43 | ShareManageBizImpl shareManage = new ShareManageBizImpl(); 44 | if (keys != null) { 45 | for (String key : keys) { 46 | shareManage.delShareByKey(key); 47 | } 48 | } else { 49 | String key = request.getParameter("key"); 50 | shareManage.delShareByKey(key); 51 | } 52 | JSONObject json = new JSONObject(); 53 | json.put("success", "删除成功"); 54 | response.setCharacterEncoding("UTF-8"); 55 | PrintWriter out = response.getWriter(); 56 | out.println(json); 57 | out.close(); 58 | } 59 | 60 | /** 61 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 62 | * response) 63 | */ 64 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 65 | throws ServletException, IOException { 66 | // TODO Auto-generated method stub 67 | request.setCharacterEncoding("UTF-8"); 68 | response.setCharacterEncoding("UTF-8"); 69 | doGet(request, response); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /WebContent/js/mkfoldercheck.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("#mkfolder") 3 | .validate( 4 | { 5 | rules : { 6 | folderName : { 7 | required : true, 8 | minlength : 1 9 | } 10 | }, 11 | messages : { 12 | folderName : { 13 | required : "文件夹名不能为空", 14 | minlength : "文件夹名最少一位" 15 | } 16 | }, 17 | errorElement : "em", 18 | errorPlacement : function(error, element) { 19 | // Add the `help-block` class to the error element 20 | error.addClass("help-block"); 21 | 22 | // Add `has-feedback` class to the parent 23 | // div.form-group 24 | // in order to add icons to inputs 25 | element.parents(".col-sm-5").addClass( 26 | "has-feedback"); 27 | 28 | if (element.prop("type") === "checkbox") { 29 | error.insertAfter(element.parent("label")); 30 | } else { 31 | error.insertAfter(element); 32 | } 33 | 34 | // Add the span element, if doesn't exists, and 35 | // apply the icon classes to it. 36 | if (!element.next("span")[0]) { 37 | $( 38 | "") 39 | .insertAfter(element); 40 | } 41 | }, 42 | success : function(label, element) { 43 | // Add the span element, if doesn't exists, and 44 | // apply the icon classes to it. 45 | if (!$(element).next("span")[0]) { 46 | $( 47 | "") 48 | .insertAfter($(element)); 49 | } 50 | }, 51 | highlight : function(element, errorClass, validClass) { 52 | $(element).parents(".col-sm-5").addClass( 53 | "has-error").removeClass("has-success"); 54 | $(element).next("span") 55 | .addClass("glyphicon-remove").removeClass( 56 | "glyphicon-ok"); 57 | }, 58 | unhighlight : function(element, errorClass, validClass) { 59 | $(element).parents(".col-sm-5").addClass( 60 | "has-success").removeClass("has-error"); 61 | $(element).next("span").addClass("glyphicon-ok") 62 | .removeClass("glyphicon-remove"); 63 | } 64 | }) 65 | }) 66 | $("#mkfolder").validate({ 67 | submitHandler : function(form) { 68 | form.submit(); 69 | } 70 | }); 71 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/ShareListServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Vector; 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.clouddrive.dao.impl.ShareDaoImpl; 14 | import com.clouddrive.entity.Share; 15 | 16 | /** 17 | * Servlet implementation class ShareListServlet 18 | */ 19 | @WebServlet("/ShareManage") 20 | public class ShareListServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * @see HttpServlet#HttpServlet() 25 | */ 26 | public ShareListServlet() { 27 | super(); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | /** 32 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 33 | * response) 34 | */ 35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 36 | throws ServletException, IOException { 37 | // TODO Auto-generated method stub 38 | request.setCharacterEncoding("UTF-8"); 39 | response.setCharacterEncoding("UTF-8"); 40 | 41 | HttpSession session = request.getSession(); 42 | String userName = (String) session.getAttribute("name"); 43 | 44 | System.out.println("ShareManage:"); 45 | 46 | if (userName == null) { 47 | request.setAttribute("message", "登录后才能访问哦!"); 48 | request.getRequestDispatcher("Home").forward(request, response); 49 | /* resp.sendRedirect("DoLogin"); */ 50 | return; 51 | } 52 | 53 | ShareDaoImpl shareImpl = new ShareDaoImpl(); 54 | Vector shares = shareImpl.findShareByUser(userName); 55 | 56 | request.setAttribute("shares", shares); 57 | 58 | request.getRequestDispatcher("/auth/myShare.jsp").forward(request, response); 59 | } 60 | 61 | /** 62 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 63 | * response) 64 | */ 65 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 66 | throws ServletException, IOException { 67 | // TODO Auto-generated method stub 68 | request.setCharacterEncoding("UTF-8"); 69 | response.setCharacterEncoding("UTF-8"); 70 | doGet(request, response); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/RegisterServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import javax.servlet.http.HttpSession; 11 | 12 | import com.clouddrive.biz.impl.RegisterBizImpl; 13 | import com.clouddrive.entity.User; 14 | 15 | /** 16 | * Servlet implementation class RegisterServlet 17 | */ 18 | @WebServlet("/DoRegister") 19 | public class RegisterServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public RegisterServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | request.setCharacterEncoding("UTF-8"); 38 | response.setCharacterEncoding("UTF-8"); 39 | String userName = request.getParameter("ruserName"); 40 | String pwd = request.getParameter("rpwd"); 41 | 42 | System.out.println("Registering"); 43 | System.out.println("userName:" + userName); 44 | System.out.println("password:" + pwd); 45 | 46 | RegisterBizImpl registerBizImpl = new RegisterBizImpl(); 47 | if (registerBizImpl.register(userName, User.md5Password(pwd))) { 48 | HttpSession session = request.getSession(); 49 | session.setAttribute("name", userName); 50 | response.sendRedirect("ListFiles"); 51 | return; 52 | } else { 53 | String message = "用户名已存在"; 54 | request.setAttribute("rmessage", message); 55 | request.getRequestDispatcher("Home").forward(request, response); 56 | return; 57 | } 58 | } 59 | 60 | /** 61 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 62 | * response) 63 | */ 64 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 65 | throws ServletException, IOException { 66 | // TODO Auto-generated method stub 67 | request.setCharacterEncoding("UTF-8"); 68 | response.setCharacterEncoding("UTF-8"); 69 | doGet(request, response); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/MkDirServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 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.clouddrive.biz.impl.FileManageBizImpl; 14 | 15 | /** 16 | * Servlet implementation class MkDirServlet 17 | */ 18 | @WebServlet("/MkDir") 19 | public class MkDirServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public MkDirServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | request.setCharacterEncoding("UTF-8"); 38 | response.setCharacterEncoding("UTF-8"); 39 | String fileName = request.getParameter("folderName"); 40 | System.out.println("MkDir:"); 41 | HttpSession session = request.getSession(); 42 | String path = (String) session.getAttribute("path"); 43 | String userName = (String) session.getAttribute("name"); 44 | String savePath = this.getServletContext() 45 | .getRealPath("/WEB-INF/Drive/" + userName + "/" + path + "/" + fileName); 46 | System.out.println(savePath); 47 | File folder = new File(savePath); 48 | 49 | if (!folder.exists() || !folder.isDirectory()) { 50 | System.out.println(savePath + "目录不存在,需要创建"); 51 | folder.mkdirs(); 52 | } 53 | 54 | FileManageBizImpl fileManage = new FileManageBizImpl(); 55 | if (fileManage.mkdirFolder(path, fileName, userName)) { 56 | // 创建成功 57 | } 58 | 59 | response.sendRedirect("ListFiles"); 60 | } 61 | 62 | /** 63 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 64 | * response) 65 | */ 66 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 67 | throws ServletException, IOException { 68 | // TODO Auto-generated method stub 69 | request.setCharacterEncoding("UTF-8"); 70 | response.setCharacterEncoding("UTF-8"); 71 | doGet(request, response); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/Share.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | public class Share { 4 | private String user; 5 | private String fileName; 6 | private String uuidName; 7 | private String url; 8 | private String shareTime; 9 | private String key; 10 | private int downloads; 11 | private long size; 12 | private String type; 13 | private String showSize; 14 | 15 | public Share(String user, String uuidName, String url, String shareTime, String key, int downloads, long size) { 16 | super(); 17 | this.user = user; 18 | this.uuidName = uuidName; 19 | this.fileName = uuidName.substring(uuidName.indexOf("_") + 1); 20 | this.url = url; 21 | this.shareTime = shareTime; 22 | this.key = key; 23 | this.downloads = downloads; 24 | this.size = size; 25 | this.type = Type.getType(this.fileName); 26 | this.showSize = Conversion.conversion(size); 27 | } 28 | 29 | public String getShowSize() { 30 | return showSize; 31 | } 32 | 33 | public void setShowSize(String showSize) { 34 | this.showSize = showSize; 35 | } 36 | 37 | public String getType() { 38 | return type; 39 | } 40 | 41 | public void setType(String type) { 42 | this.type = type; 43 | } 44 | 45 | public String getUuidName() { 46 | return uuidName; 47 | } 48 | 49 | public void setUuidName(String uuidName) { 50 | this.uuidName = uuidName; 51 | } 52 | 53 | public int getDownloads() { 54 | return downloads; 55 | } 56 | 57 | public void setDownloads(int downloads) { 58 | this.downloads = downloads; 59 | } 60 | 61 | public long getSize() { 62 | return size; 63 | } 64 | 65 | public void setSize(long size) { 66 | this.size = size; 67 | } 68 | 69 | public String getUser() { 70 | return user; 71 | } 72 | 73 | public void setUser(String user) { 74 | this.user = user; 75 | } 76 | 77 | public String getFileName() { 78 | return fileName; 79 | } 80 | 81 | public void setFileName(String fileName) { 82 | this.fileName = fileName; 83 | } 84 | 85 | public String getUrl() { 86 | return url; 87 | } 88 | 89 | public void setUrl(String url) { 90 | this.url = url; 91 | } 92 | 93 | public String getShareTime() { 94 | return shareTime; 95 | } 96 | 97 | public void setShareTime(String shareTime) { 98 | this.shareTime = shareTime; 99 | } 100 | 101 | public String getKey() { 102 | return key; 103 | } 104 | 105 | public void setKey(String key) { 106 | this.key = key; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/HomeListServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Vector; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.Cookie; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import javax.servlet.http.HttpSession; 13 | 14 | import com.clouddrive.dao.impl.ShareDaoImpl; 15 | import com.clouddrive.entity.Share; 16 | 17 | /** 18 | * Servlet implementation class HomeListServlet 19 | */ 20 | @WebServlet("/Home") 21 | public class HomeListServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public HomeListServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 34 | * response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 37 | throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | request.setCharacterEncoding("UTF-8"); 40 | response.setCharacterEncoding("UTF-8"); 41 | HttpSession session = request.getSession(); 42 | String userName = (String) session.getAttribute("name"); 43 | if (userName == null) { 44 | Cookie[] cookies = request.getCookies(); 45 | if (cookies != null) { 46 | for (Cookie cookie : cookies) { 47 | if (cookie.getName().equals("saveName")) { 48 | userName = cookie.getValue(); 49 | session.setAttribute("name", userName); 50 | response.sendRedirect("Home"); 51 | return; 52 | } 53 | } 54 | } 55 | } 56 | 57 | String message = (String) request.getAttribute("message"); 58 | 59 | ShareDaoImpl shareDaoImpl = new ShareDaoImpl(); 60 | Vector shares = shareDaoImpl.getHotShare(); 61 | request.setAttribute("message", message); 62 | request.setAttribute("shares", shares); 63 | request.getRequestDispatcher("home.jsp").forward(request, response); 64 | } 65 | 66 | /** 67 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 68 | * response) 69 | */ 70 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | // TODO Auto-generated method stub 73 | request.setCharacterEncoding("UTF-8"); 74 | response.setCharacterEncoding("UTF-8"); 75 | doGet(request, response); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/ShareFileServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 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.clouddrive.biz.impl.ShareManageBizImpl; 14 | 15 | /** 16 | * Servlet implementation class ShareFileServlet 17 | */ 18 | @WebServlet("/ShareFile") 19 | public class ShareFileServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public ShareFileServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | request.setCharacterEncoding("UTF-8"); 38 | response.setCharacterEncoding("UTF-8"); 39 | HttpSession session = request.getSession(); 40 | String userName = (String) session.getAttribute("name"); 41 | String uuidName = request.getParameter("fileName"); 42 | String path = request.getParameter("path"); 43 | long size = Long.parseLong(request.getParameter("size")); 44 | // String url = this.getServletContext().getRealPath("/WEB-INF/Drive/" + userName + "/" + path + "/" + uuidName); 45 | 46 | System.out.println("ShareFile"); 47 | 48 | ShareManageBizImpl shareManage = new ShareManageBizImpl(); 49 | String key = shareManage.insertShare(userName, uuidName, path, size); 50 | String link = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() 51 | + request.getContextPath() + "/Share" + "?key=" + key; 52 | 53 | // JSONObject json = new JSONObject(); 54 | System.out.println(link); 55 | PrintWriter out = response.getWriter(); 56 | out.write(link); 57 | out.close(); 58 | } 59 | 60 | /** 61 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 62 | * response) 63 | */ 64 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 65 | throws ServletException, IOException { 66 | // TODO Auto-generated method stub 67 | request.setCharacterEncoding("UTF-8"); 68 | response.setCharacterEncoding("UTF-8"); 69 | doGet(request, response); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/DelFileServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 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.alibaba.fastjson.JSONObject; 14 | import com.clouddrive.biz.impl.FileManageBizImpl; 15 | 16 | /** 17 | * Servlet implementation class DelFileServlet 18 | */ 19 | @WebServlet("/DelFiles") 20 | public class DelFileServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * @see HttpServlet#HttpServlet() 25 | */ 26 | public DelFileServlet() { 27 | super(); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | /** 32 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 33 | * response) 34 | */ 35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 36 | throws ServletException, IOException { 37 | // TODO Auto-generated method stub 38 | request.setCharacterEncoding("UTF-8"); 39 | response.setCharacterEncoding("UTF-8"); 40 | response.setContentType("application/json"); 41 | 42 | HttpSession session = request.getSession(); 43 | String userName = (String) session.getAttribute("name"); 44 | String uuidNames[] = request.getParameterValues("fileName"); 45 | String paths[] = request.getParameterValues("path"); 46 | System.out.println("delFileServlet:"); 47 | for (int i = 0; i < paths.length; i++) { 48 | String path = paths[i]; 49 | String url = this.getServletContext() 50 | .getRealPath("/WEB-INF/Drive/" + userName + "/" + path + "/" + uuidNames[i]); 51 | FileManageBizImpl fileManage = new FileManageBizImpl(); 52 | if (fileManage.delFile(url, path)) { 53 | // 删除成功 54 | System.out.println("删除成功"); 55 | } 56 | } 57 | JSONObject json = new JSONObject(); 58 | json.put("success", "删除成功"); 59 | response.setCharacterEncoding("UTF-8"); 60 | PrintWriter out = response.getWriter(); 61 | out.println(json); 62 | out.close(); 63 | } 64 | 65 | /** 66 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 67 | * response) 68 | */ 69 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 70 | throws ServletException, IOException { 71 | // TODO Auto-generated method stub 72 | request.setCharacterEncoding("UTF-8"); 73 | response.setCharacterEncoding("UTF-8"); 74 | doGet(request, response); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /WebContent/js/inbox.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("#inboxUpload").fileinput({ 3 | theme : 'fa', 4 | language : 'zh', 5 | uploadUrl : "UpLoad", 6 | allowedPreviewTypes : [ 'image', 'html', 'text', 'video', 'audio' ],// 预览类型 7 | // allowedFileExtensions: ['jpg', 'gif', 'png'], //文件上传类型 8 | maxFileSize : 0, 9 | maxFileCount : 10, 10 | uploadExtraData : function() { 11 | var obj = {}; 12 | $('form').find('.form-control-inline').each(function() { 13 | var id = $(this).attr('id'), val = $(this).val(); 14 | obj[id] = val; 15 | }); 16 | obj["path"] = $("#inboxName").text(); 17 | obj["userName"] = $("#inboxName").attr("user"); 18 | return obj; 19 | } 20 | }); 21 | 22 | $("#mkInbox").click(function() { 23 | $.get("CreateInbox", { 24 | inboxName : $("#inboxName").val(), 25 | illustrate : $("#illustrate").val() 26 | }, handleShowLink); 27 | }); 28 | $('#inboxLinkModal').on("hide.bs.modal", function() { 29 | window.location.href = "InboxManage"; 30 | }); 31 | var clipboard = new Clipboard('#copyLink'); 32 | clipboard.on('success', function(e) { 33 | $("#copySuccess").show(); 34 | e.clearSelection(); 35 | }); 36 | 37 | clipboard.on('error', function(e) { 38 | $("#copyError").show(); 39 | }); 40 | $('[data-toggle="popover"]').popover(); 41 | 42 | $("#confirmDeletion").click( 43 | function() { 44 | var fileNames = new Array(); 45 | var paths = new Array(); 46 | $("tbody input[type='checkbox']:checked").each( 47 | function() { 48 | fileNames.push($(this).parent().parent().parent() 49 | .find(".param .fileName").text()); 50 | paths.push($(this).parent().parent().parent().find( 51 | ".param .path").text()); 52 | }); 53 | $.ajax({ 54 | url : 'DelFile', 55 | data : { 56 | "fileName" : fileNames, 57 | "path" : paths 58 | }, 59 | dataType : "json", 60 | type : "POST", 61 | traditional : true, 62 | success : handleDelFiles 63 | }); 64 | }); 65 | $(".delInbox").click(function() { 66 | var key = $(this).next().find(".key").text(); 67 | var inboxName = $(this).next().find(".inboxName").text(); 68 | $("#subkey").val(key); 69 | $("#subInboxName").val(inboxName); 70 | $("#delInboxModal").modal("show"); 71 | }); 72 | }); 73 | 74 | function handleShowLink(results) { 75 | var json = jQuery.parseJSON(results); 76 | if (json.message != null) { 77 | $("#createInboxInfo strong").text(json.message); 78 | $("#createInboxInfo").show(); 79 | } else { 80 | $("#newFolder").modal("hide"); 81 | $("#linkText").val(json.link); 82 | $("#inboxLinkModal").modal("show"); 83 | } 84 | }; 85 | 86 | function handleDelFiles(data) { 87 | window.location.reload(); 88 | } 89 | -------------------------------------------------------------------------------- /WebContent/themes/fa/theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-fileinput v4.4.7 3 | * http://plugins.krajee.com/file-input 4 | * 5 | * Krajee Explorer Font Awesome theme style for bootstrap-fileinput. Load this theme file after loading `fileinput.css`. 6 | * 7 | * Author: Kartik Visweswaran 8 | * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com 9 | * 10 | * Licensed under the BSD 3-Clause 11 | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md 12 | */.explorer-frame .file-preview-other,.theme-explorer-fa .explorer-frame .kv-file-content,.theme-explorer-fa .file-actions,.theme-explorer-fa .file-drag-handle,.theme-explorer-fa .file-upload-indicator{text-align:center}.theme-explorer-fa .file-thumb-progress .progress,.theme-explorer-fa .file-thumb-progress .progress-bar{height:13px;font-size:11px;line-height:13px}.theme-explorer-fa .file-drag-handle,.theme-explorer-fa .file-upload-indicator{position:absolute;display:inline-block;top:0;right:3px;width:16px;height:16px;font-size:16px}.theme-explorer-fa .explorer-caption,.theme-explorer-fa .file-thumb-progress .progress{display:block}.theme-explorer-fa .explorer-frame td{vertical-align:middle;text-align:left}.theme-explorer-fa .explorer-frame .kv-file-content{width:80px;height:80px;padding:5px}.theme-explorer-fa .file-actions-cell{position:relative;width:120px;padding:0}.theme-explorer-fa .file-thumb-progress .progress{margin-top:5px}.theme-explorer-fa .explorer-caption{color:#777}.theme-explorer-fa .kvsortable-ghost{opacity:.6;background:#e1edf7;border:2px solid #a1abff}.theme-explorer-fa .file-preview .table{margin:0}.theme-explorer-fa .file-error-message ul{padding:5px 0 0 20px}.explorer-frame .file-preview-text{display:inline-block;color:#428bca;border:1px solid #ddd;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;outline:0;padding:8px;resize:none}.explorer-frame .file-preview-html{display:inline-block;border:1px solid #ddd;padding:8px;overflow:auto}.explorer-frame .file-other-icon{font-size:2.6em}@media only screen and (max-width:767px){.theme-explorer-fa .table,.theme-explorer-fa .table tbody,.theme-explorer-fa .table td,.theme-explorer-fa .table tr{display:block;width:100%!important}.theme-explorer-fa .table{border:none}.theme-explorer-fa .table tr{margin-top:5px}.theme-explorer-fa .table tr:first-child{margin-top:0}.theme-explorer-fa .table td{text-align:center}.theme-explorer-fa .table .kv-file-content{border-bottom:none;padding:4px;margin:0}.theme-explorer-fa .table .kv-file-content .file-preview-image{max-width:100%;font-size:20px}.theme-explorer-fa .file-details-cell{border-top:none;border-bottom:none;padding-top:0;margin:0}.theme-explorer-fa .file-actions-cell{border-top:none;padding-bottom:4px}.theme-explorer-fa .explorer-frame .explorer-caption{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;left:0;right:0;margin:auto}}.file-zoom-dialog .explorer-frame .file-other-icon{font-size:22em;font-size:50vmin} -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.Cookie; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import com.clouddrive.biz.impl.LoginBizImpl; 13 | import com.clouddrive.entity.User; 14 | 15 | /** 16 | * Servlet implementation class LoginServlet 17 | */ 18 | @WebServlet("/DoLogin") 19 | public class LoginServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public LoginServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | request.setCharacterEncoding("UTF-8"); 38 | response.setCharacterEncoding("UTF-8"); 39 | String[] isSaveArr = request.getParameterValues("isSave"); 40 | 41 | String message = (String) request.getAttribute("message"); 42 | if (message != null && message.equals("noPrimse")) { 43 | request.setAttribute("message", "登录后才能访问哦!"); 44 | request.getRequestDispatcher("Home").forward(request, response); 45 | } 46 | 47 | String userName = request.getParameter("userName"); 48 | String pwd = request.getParameter("pwd"); 49 | 50 | System.out.println("DoLogin"); 51 | System.out.println("userName:" + userName); 52 | System.out.println("password:" + pwd); 53 | 54 | LoginBizImpl loginBiz = new LoginBizImpl(); 55 | User user = loginBiz.login(userName, User.md5Password(pwd)); 56 | 57 | if (user == null) { 58 | request.setAttribute("message", "用户名或密码错误!"); 59 | request.getRequestDispatcher("Home").forward(request, response); 60 | } else {// 登录成功 61 | // 添加cookie 62 | if (isSaveArr != null) { 63 | System.out.println("yes"); 64 | Cookie userNameCookie = new Cookie("saveName", userName); 65 | userNameCookie.setMaxAge(30 * 60); 66 | response.addCookie(userNameCookie); 67 | } 68 | request.getSession().setAttribute("name", userName); 69 | response.sendRedirect("ListFiles"); 70 | } 71 | } 72 | 73 | /** 74 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 75 | * response) 76 | */ 77 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 78 | throws ServletException, IOException { 79 | // TODO Auto-generated method stub 80 | request.setCharacterEncoding("UTF-8"); 81 | response.setCharacterEncoding("UTF-8"); 82 | doGet(request, response); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /WebContent/js/logincheck.js: -------------------------------------------------------------------------------- 1 | $(document) 2 | .ready( 3 | function() { 4 | $("#loginForm") 5 | .validate( 6 | { 7 | rules : { 8 | userName : { 9 | required : true, 10 | minlength : 4 11 | }, 12 | pwd : { 13 | required : true, 14 | minlength : 4 15 | } 16 | }, 17 | messages : { 18 | userName : { 19 | required : "请输入用户名", 20 | minlength : "用户名至少4个字符" 21 | }, 22 | pwd : { 23 | required : "请输入密码", 24 | minlength : "密码长度不能小于4 个字母" 25 | } 26 | }, 27 | errorElement : "em", 28 | errorPlacement : function(error, 29 | element) { 30 | // Add the `help-block` class to the 31 | // error element 32 | error.addClass("help-block"); 33 | 34 | // Add `has-feedback` class to the 35 | // parent div.form-group 36 | // in order to add icons to inputs 37 | element.parents(".col-sm-5") 38 | .addClass("has-feedback"); 39 | 40 | if (element.prop("type") === "checkbox") { 41 | error.insertAfter(element 42 | .parent("label")); 43 | } else { 44 | error.insertAfter(element); 45 | } 46 | 47 | // Add the span element, if doesn't 48 | // exists, and apply the icon 49 | // classes to it. 50 | if (!element.next("span")[0]) { 51 | $( 52 | "") 53 | .insertAfter(element); 54 | } 55 | }, 56 | success : function(label, element) { 57 | // Add the span element, if doesn't 58 | // exists, and apply the icon 59 | // classes to it. 60 | if (!$(element).next("span")[0]) { 61 | $( 62 | "") 63 | .insertAfter($(element)); 64 | } 65 | }, 66 | highlight : function(element, 67 | errorClass, validClass) { 68 | $(element).parents(".col-sm-5") 69 | .addClass("has-error") 70 | .removeClass("has-success"); 71 | $(element) 72 | .next("span") 73 | .addClass( 74 | "glyphicon-remove") 75 | .removeClass("glyphicon-ok"); 76 | }, 77 | unhighlight : function(element, 78 | errorClass, validClass) { 79 | $(element).parents(".col-sm-5") 80 | .addClass("has-success") 81 | .removeClass("has-error"); 82 | $(element).next("span").addClass( 83 | "glyphicon-ok") 84 | .removeClass( 85 | "glyphicon-remove"); 86 | } 87 | }) 88 | }) 89 | $("#loginForm").validate({ 90 | submitHandler : function(form) { 91 | form.submit(); 92 | } 93 | }); -------------------------------------------------------------------------------- /clouddrive.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : local 5 | Source Server Type : MySQL 6 | Source Server Version : 50626 7 | Source Host : localhost:3306 8 | Source Schema : clouddrive 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50626 12 | File Encoding : 65001 13 | 14 | Date: 29/12/2018 18:20:23 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for file 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `file`; 24 | CREATE TABLE `file` ( 25 | `id` int(11) NOT NULL AUTO_INCREMENT, 26 | `fileName` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 27 | `uuidName` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 28 | `updateTime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 29 | `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 30 | `path` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 31 | `user` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 32 | `size` bigint(20) NOT NULL, 33 | PRIMARY KEY (`id`) USING BTREE 34 | ) ENGINE = InnoDB AUTO_INCREMENT = 286 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Compact; 35 | 36 | -- ---------------------------- 37 | -- Table structure for message 38 | -- ---------------------------- 39 | DROP TABLE IF EXISTS `message`; 40 | CREATE TABLE `message` ( 41 | `id` int(11) NOT NULL AUTO_INCREMENT, 42 | `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, 43 | `message` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, 44 | `time` datetime(0) NULL DEFAULT NULL, 45 | PRIMARY KEY (`id`) USING BTREE 46 | ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Compact; 47 | 48 | -- ---------------------------- 49 | -- Table structure for share 50 | -- ---------------------------- 51 | DROP TABLE IF EXISTS `share`; 52 | CREATE TABLE `share` ( 53 | `id` int(11) NOT NULL AUTO_INCREMENT, 54 | `user` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 55 | `uuidName` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 56 | `url` varchar(300) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 57 | `shareTime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 58 | `keyword` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 59 | `downloads` int(11) NOT NULL, 60 | `size` bigint(20) NOT NULL, 61 | PRIMARY KEY (`id`) USING BTREE, 62 | UNIQUE INDEX `unique`(`keyword`) USING BTREE 63 | ) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Compact; 64 | 65 | -- ---------------------------- 66 | -- Table structure for user 67 | -- ---------------------------- 68 | DROP TABLE IF EXISTS `user`; 69 | CREATE TABLE `user` ( 70 | `id` int(11) NOT NULL AUTO_INCREMENT, 71 | `userName` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 72 | `pwd` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, 73 | PRIMARY KEY (`id`) USING BTREE, 74 | UNIQUE INDEX `userName`(`userName`) USING BTREE 75 | ) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Compact; 76 | 77 | SET FOREIGN_KEY_CHECKS = 1; 78 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/DownLoadServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.IOException; 6 | import java.io.OutputStream; 7 | import java.net.URLEncoder; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import javax.servlet.http.HttpSession; 15 | 16 | import com.clouddrive.dao.impl.ShareDaoImpl; 17 | 18 | /** 19 | * Servlet implementation class DownLoadServlet 20 | */ 21 | @WebServlet("/DownLoad") 22 | public class DownLoadServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * @see HttpServlet#HttpServlet() 27 | */ 28 | public DownLoadServlet() { 29 | super(); 30 | // TODO Auto-generated constructor stub 31 | } 32 | 33 | /** 34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 35 | * response) 36 | */ 37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | // TODO Auto-generated method stub 40 | request.setCharacterEncoding("UTF-8"); 41 | response.setCharacterEncoding("UTF-8"); 42 | HttpSession session = request.getSession(); 43 | String userName = (String) session.getAttribute("name"); 44 | String fileName = request.getParameter("fileName"); 45 | String path = request.getParameter("path"); 46 | String url = request.getParameter("url"); 47 | 48 | if (url == null) { 49 | // 下载文件 50 | url = this.getServletContext().getRealPath("/WEB-INF/Drive/" + userName + "/" + path + "/" + fileName); 51 | } else { 52 | System.out.println("下载分享文件"); 53 | userName = request.getParameter("userName"); 54 | url = this.getServletContext().getRealPath("/WEB-INF/Drive/" + userName + "/" + url + "/" + fileName); 55 | String key = request.getParameter("key"); 56 | ShareDaoImpl shareDaoImpl = new ShareDaoImpl(); 57 | shareDaoImpl.updateDownloadByKey(key); 58 | } 59 | System.out.println("url:" + url); 60 | File file = new File(url); 61 | if (!file.exists()) { 62 | request.setAttribute("message", "资源已被删除"); 63 | request.getRequestDispatcher("/message.jsp").forward(request, response); 64 | return; 65 | } 66 | String realName = fileName.substring(fileName.indexOf("_") + 1); 67 | response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(realName, "UTF-8")); 68 | 69 | FileInputStream in = new FileInputStream(url); 70 | OutputStream out = response.getOutputStream(); 71 | 72 | byte buffer[] = new byte[1024]; 73 | int len = 0; 74 | 75 | while ((len = in.read(buffer)) > 0) { 76 | out.write(buffer, 0, len); 77 | } 78 | in.close(); 79 | out.close(); 80 | 81 | } 82 | 83 | /** 84 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 85 | * response) 86 | */ 87 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 88 | throws ServletException, IOException { 89 | // TODO Auto-generated method stub 90 | request.setCharacterEncoding("UTF-8"); 91 | response.setCharacterEncoding("UTF-8"); 92 | doGet(request, response); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/com/clouddrive/dao/impl/UserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao.impl; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.util.Vector; 6 | 7 | import com.clouddrive.dao.BaseDao; 8 | import com.clouddrive.dao.RSProcessor; 9 | import com.clouddrive.dao.UserDao; 10 | import com.clouddrive.entity.User; 11 | 12 | public class UserDaoImpl extends BaseDao implements UserDao { 13 | 14 | @Override 15 | public int countUserByName(String name) { 16 | String sql = "select count(*) as user_count from user where userName=?"; 17 | Object[] params = { name }; 18 | 19 | RSProcessor getResultProcessor = new RSProcessor() { 20 | 21 | public Object process(ResultSet rs) throws SQLException { 22 | int count = 0; 23 | if (rs != null) { 24 | if (rs.next()) { 25 | count = rs.getInt("user_count"); 26 | } 27 | } 28 | return new Integer(count); 29 | } 30 | 31 | }; 32 | 33 | return (Integer) this.executeQuery(getResultProcessor, sql, params); 34 | } 35 | 36 | @Override 37 | public User findUserByName(String name) { 38 | String sql = "select * from user where userName = ?"; 39 | Object[] params = { name }; 40 | 41 | RSProcessor getResultProcessor = new RSProcessor() { 42 | 43 | public Object process(ResultSet rs) throws SQLException { 44 | User user = null; 45 | 46 | if (rs != null) { 47 | if (rs.next()) { 48 | String userName = rs.getString("userName"); 49 | String pwd = rs.getString("pwd"); 50 | user = new User(userName, pwd); 51 | } 52 | } 53 | 54 | return user; 55 | 56 | } 57 | }; 58 | 59 | return (User) this.executeQuery(getResultProcessor, sql, params); 60 | } 61 | 62 | @SuppressWarnings("unchecked") 63 | @Override 64 | public Vector findUsersByName(String name) { 65 | String sql = "select * from user where userName = ?"; 66 | Object[] params = { name }; 67 | 68 | RSProcessor getResultProcessor = new RSProcessor() { 69 | 70 | public Object process(ResultSet rs) throws SQLException { 71 | Vector users = new Vector(); 72 | 73 | while (rs.next()) { 74 | String userName = rs.getString("userName"); 75 | String pwd = rs.getString("pwd"); 76 | 77 | User user = new User(userName, pwd); 78 | users.add(user); 79 | } 80 | 81 | return users; 82 | 83 | } 84 | }; 85 | 86 | return (Vector) this.executeQuery(getResultProcessor, sql, params); 87 | } 88 | 89 | @Override 90 | public int insert(User user) { 91 | String sql = "insert user (userName, pwd) values(?,?)"; 92 | Object[] params = { user.getUserName(), user.getPwd() }; 93 | return this.executeUpdate(sql, params); 94 | } 95 | 96 | @Override 97 | public int countUser() { 98 | String sql = "select count(*) as user_count from user"; 99 | 100 | RSProcessor getResultProcessor = new RSProcessor() { 101 | 102 | public Object process(ResultSet rs) throws SQLException { 103 | int count = 0; 104 | if (rs != null) { 105 | if (rs.next()) { 106 | count = rs.getInt("user_count"); 107 | } 108 | } 109 | return new Integer(count); 110 | } 111 | 112 | }; 113 | 114 | return (Integer) this.executeQuery(getResultProcessor, sql); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/com/clouddrive/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Statement; 8 | 9 | import javax.naming.Context; 10 | import javax.naming.InitialContext; 11 | import javax.sql.DataSource; 12 | 13 | public abstract class BaseDao { 14 | public static String sqlDialect; 15 | public static String dataSource; 16 | 17 | /** 18 | * 获取数据库连接对象。 19 | */ 20 | public Connection getConnection() { 21 | Connection conn = null;// 数据连接对象 22 | Context ctx = null; 23 | // 获取连接并捕获异常 24 | try { 25 | ctx = new InitialContext(); 26 | DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/" + dataSource); 27 | conn = ds.getConnection(); 28 | } catch (Exception e) { 29 | e.printStackTrace();// 异常处理 30 | } 31 | return conn;// 返回连接对象 32 | } 33 | 34 | /** 35 | * 关闭数据库连接。 36 | * 37 | * @param conn 数据库连接 38 | * @param stmt Statement对象 39 | * @param rs 结果集 40 | */ 41 | public void closeAll(Connection conn, Statement stmt, ResultSet rs) { 42 | // 若结果集对象不为空,则关闭 43 | if (rs != null) { 44 | try { 45 | rs.close(); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | // 若Statement对象不为空,则关闭 51 | if (stmt != null) { 52 | try { 53 | stmt.close(); 54 | } catch (Exception e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | // 若数据库连接对象不为空,则关闭 59 | if (conn != null) { 60 | try { 61 | conn.close(); 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | } 66 | } 67 | 68 | public void closeAll(Connection conn, Statement stmt) { 69 | closeAll(conn, stmt, null); 70 | } 71 | 72 | /** 73 | * 增、删、改操作 74 | * 75 | * @param sql sql语句 76 | * @param params 参数数组 77 | * @return 执行结果 78 | */ 79 | public int executeUpdate(String sql, Object... params) { 80 | int result = 0; 81 | Connection conn = null; 82 | PreparedStatement pstmt = null; 83 | try { 84 | conn = this.getConnection(); 85 | if (conn != null && !conn.isClosed()) { 86 | pstmt = conn.prepareStatement(sql); 87 | if (params != null) { 88 | for (int i = 0; i < params.length; i++) { 89 | pstmt.setObject(i + 1, params[i]); 90 | } 91 | } 92 | System.out.println(pstmt); 93 | result = pstmt.executeUpdate(); 94 | } 95 | } catch (SQLException e) { 96 | e.printStackTrace(); 97 | } finally { 98 | closeAll(conn, pstmt); 99 | } 100 | return result; 101 | } 102 | 103 | public Object executeQuery(RSProcessor processor, String sql, Object... params) { 104 | Object result = null; 105 | Connection conn = null; 106 | PreparedStatement pstmt = null; 107 | ResultSet rs = null; 108 | try { 109 | conn = this.getConnection(); 110 | if (conn != null && conn.isClosed() == false) { 111 | pstmt = conn.prepareStatement(sql); 112 | if (params != null) { 113 | for (int i = 0; i < params.length; i++) { 114 | pstmt.setObject(i + 1, params[i]); 115 | } 116 | } 117 | // System.out.println(pstmt); 118 | rs = pstmt.executeQuery(); 119 | result = processor.process(rs); 120 | } 121 | } catch (SQLException e) { 122 | e.printStackTrace(); 123 | } finally { 124 | closeAll(conn, pstmt, rs); 125 | } 126 | return result; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/ListFilesServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | import java.util.Vector; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import javax.servlet.http.HttpSession; 13 | 14 | import com.clouddrive.biz.impl.FileListBizImpl; 15 | import com.clouddrive.entity.FileMessage; 16 | 17 | /** 18 | * Servlet implementation class ListFilesServlet 19 | */ 20 | @WebServlet("/ListFiles") 21 | public class ListFilesServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public ListFilesServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 34 | * response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 37 | throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | request.setCharacterEncoding("UTF-8"); 40 | response.setCharacterEncoding("UTF-8"); 41 | HttpSession session = request.getSession(); 42 | 43 | String userName = (String) session.getAttribute("name"); 44 | // 用户名失效 45 | if (userName == null) { 46 | request.setAttribute("message", "登录后才能访问哦!"); 47 | request.getRequestDispatcher("Home").forward(request, response); 48 | /* resp.sendRedirect("DoLogin"); */ 49 | return; 50 | } 51 | 52 | String path = (String) request.getParameter("path"); 53 | if (path == null) { 54 | path = (String) session.getAttribute("path"); 55 | if (path == null) { 56 | System.out.println("找不到路径,默认为root"); 57 | path = "root"; 58 | session.setAttribute("path", path); 59 | } 60 | } else { 61 | session.setAttribute("path", path); 62 | } 63 | 64 | System.out.println("-----ListFiles:"); 65 | System.out.println("path:"); 66 | System.out.println(path); 67 | 68 | // 业务逻辑 69 | FileListBizImpl fileListBizImpl = new FileListBizImpl(); 70 | 71 | // 通过文件类型获取fileList 72 | Vector files = fileListBizImpl.getFilesByTypeAndUser(userName, path); 73 | if (files != null) { 74 | request.setAttribute("files", files); 75 | request.setAttribute("path", path); 76 | request.getRequestDispatcher("/auth/drive.jsp").forward(request, response); 77 | return; 78 | } 79 | 80 | // String uploadFilePath = this.getServletContext().getRealPath("/WEB-INF/Drive/"+userName+"/"+path); 81 | // 通过路径获取fileList 82 | files = fileListBizImpl.getFilesByPathAndUser(path, userName); 83 | 84 | Map paths = fileListBizImpl.getPaths(path); 85 | String lastPath = fileListBizImpl.getLastPath(path); 86 | request.setAttribute("lastPath", lastPath); 87 | request.setAttribute("files", files); 88 | request.setAttribute("paths", paths); 89 | request.setAttribute("path", path); 90 | request.getRequestDispatcher("/auth/drive.jsp").forward(request, response); 91 | } 92 | 93 | /** 94 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 95 | * response) 96 | */ 97 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 98 | throws ServletException, IOException { 99 | // TODO Auto-generated method stub 100 | request.setCharacterEncoding("UTF-8"); 101 | response.setCharacterEncoding("UTF-8"); 102 | doGet(request, response); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /WebContent/js/locales/zh.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * FileInput Chinese Translations 3 | * 4 | * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * @see http://github.com/kartik-v/bootstrap-fileinput 8 | * @author kangqf 9 | * 10 | * NOTE: this file must be saved in UTF-8 encoding. 11 | */ 12 | (function($) { 13 | "use strict"; 14 | 15 | $.fn.fileinputLocales['zh'] = { 16 | fileSingle : '文件', 17 | filePlural : '个文件', 18 | browseLabel : '选择 …', 19 | removeLabel : '移除', 20 | removeTitle : '清除选中文件', 21 | cancelLabel : '取消', 22 | cancelTitle : '取消进行中的上传', 23 | uploadLabel : '上传', 24 | uploadTitle : '上传选中文件', 25 | msgNo : '没有', 26 | msgNoFilesSelected : '', 27 | msgCancelled : '取消', 28 | msgPlaceholder : 'Select {files}...', 29 | msgZoomModalHeading : '详细预览', 30 | msgFileRequired : '必须选择一个文件上传.', 31 | msgSizeTooSmall : '文件 "{name}" ({size} KB) 必须大于限定大小 {minSize} KB.', 32 | msgSizeTooLarge : '文件 "{name}" ({size} KB) 超过了允许大小 {maxSize} KB.', 33 | msgFilesTooLess : '你必须选择最少 {n} {files} 来上传. ', 34 | msgFilesTooMany : '选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.', 35 | msgFileNotFound : '文件 "{name}" 未找到!', 36 | msgFileSecured : '安全限制,为了防止读取文件 "{name}".', 37 | msgFileNotReadable : '文件 "{name}" 不可读.', 38 | msgFilePreviewAborted : '取消 "{name}" 的预览.', 39 | msgFilePreviewError : '读取 "{name}" 时出现了一个错误.', 40 | msgInvalidFileName : '文件名 "{name}" 包含非法字符.', 41 | msgInvalidFileType : '不正确的类型 "{name}". 只支持 "{types}" 类型的文件.', 42 | msgInvalidFileExtension : '不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.', 43 | msgFileTypes : { 44 | 'image' : 'image', 45 | 'html' : 'HTML', 46 | 'text' : 'text', 47 | 'video' : 'video', 48 | 'audio' : 'audio', 49 | 'flash' : 'flash', 50 | 'pdf' : 'PDF', 51 | 'object' : 'object' 52 | }, 53 | msgUploadAborted : '该文件上传被中止', 54 | msgUploadThreshold : '处理中...', 55 | msgUploadBegin : '正在初始化...', 56 | msgUploadEnd : '完成', 57 | msgUploadEmpty : '无效的文件上传.', 58 | msgUploadError : 'Error', 59 | msgValidationError : '验证错误', 60 | msgLoading : '加载第 {index} 文件 共 {files} …', 61 | msgProgress : '加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.', 62 | msgSelected : '{n} {files} 选中', 63 | msgFoldersNotAllowed : '只支持拖拽文件! 跳过 {n} 拖拽的文件夹.', 64 | msgImageWidthSmall : '图像文件的"{name}"的宽度必须是至少{size}像素.', 65 | msgImageHeightSmall : '图像文件的"{name}"的高度必须至少为{size}像素.', 66 | msgImageWidthLarge : '图像文件"{name}"的宽度不能超过{size}像素.', 67 | msgImageHeightLarge : '图像文件"{name}"的高度不能超过{size}像素.', 68 | msgImageResizeError : '无法获取的图像尺寸调整。', 69 | msgImageResizeException : '调整图像大小时发生错误。
{errors}
', 70 | msgAjaxError : '{operation} 发生错误. 请重试!', 71 | msgAjaxProgressError : '{operation} 失败', 72 | ajaxOperations : { 73 | deleteThumb : '删除文件', 74 | uploadThumb : '上传文件', 75 | uploadBatch : '批量上传', 76 | uploadExtra : '表单数据上传' 77 | }, 78 | dropZoneTitle : '拖拽文件到这里 …
支持多文件同时上传', 79 | dropZoneClickTitle : '
(或点击{files}按钮选择文件)', 80 | fileActionSettings : { 81 | removeTitle : '删除文件', 82 | uploadTitle : '上传文件', 83 | uploadRetryTitle : 'Retry upload', 84 | zoomTitle : '查看详情', 85 | dragTitle : '移动 / 重置', 86 | indicatorNewTitle : '没有上传', 87 | indicatorSuccessTitle : '上传', 88 | indicatorErrorTitle : '上传错误', 89 | indicatorLoadingTitle : '上传 ...' 90 | }, 91 | previewZoomButtonTitles : { 92 | prev : '预览上一个文件', 93 | next : '预览下一个文件', 94 | toggleheader : '缩放', 95 | fullscreen : '全屏', 96 | borderless : '无边界模式', 97 | close : '关闭当前预览' 98 | } 99 | }; 100 | })(window.jQuery); 101 | -------------------------------------------------------------------------------- /src/com/clouddrive/entity/Type.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.entity; 2 | 3 | public class Type { 4 | 5 | public static String getType(String name) { 6 | if (isImage(name)) { 7 | return "image"; 8 | } else if (isVideo(name)) { 9 | return "video"; 10 | } else if (isMusic(name)) { 11 | return "music"; 12 | } else if (isDoc(name)) { 13 | return "doc"; 14 | } else if (isXls(name)) { 15 | return "xls"; 16 | } else if (isPpt(name)) { 17 | return "ppt"; 18 | } else if (isTxt(name)) { 19 | return "txt"; 20 | } else if (isZip(name)) { 21 | return "zip"; 22 | } else if (isPdf(name)) { 23 | return "pdf"; 24 | } 25 | return "other"; 26 | } 27 | 28 | public static boolean isImage(String name) { 29 | String suffix = name.substring(name.lastIndexOf(".") + 1); 30 | String imageSuffixs[] = { "bmp", "jpg", "jpeg", "png", "gif" }; 31 | 32 | for (String i : imageSuffixs) { 33 | if (i.equalsIgnoreCase(suffix)) { 34 | return true; 35 | } 36 | } 37 | 38 | return false; 39 | } 40 | 41 | public static boolean isVideo(String name) { 42 | String suffix = name.substring(name.lastIndexOf(".") + 1); 43 | String imageSuffixs[] = { "rm", "rmvb", "wmv", "avi", "mp4", "3gp", "mkv" }; 44 | 45 | for (String i : imageSuffixs) { 46 | if (i.equalsIgnoreCase(suffix)) { 47 | return true; 48 | } 49 | } 50 | 51 | return false; 52 | } 53 | 54 | public static boolean isMusic(String name) { 55 | String suffix = name.substring(name.lastIndexOf(".") + 1); 56 | String imageSuffixs[] = { "WAV", "MP3", "AIF", "MIDI", "WMA" }; 57 | 58 | for (String i : imageSuffixs) { 59 | if (i.equalsIgnoreCase(suffix)) { 60 | return true; 61 | } 62 | } 63 | 64 | return false; 65 | } 66 | 67 | public static boolean isDoc(String name) { 68 | String suffix = name.substring(name.lastIndexOf(".") + 1); 69 | String imageSuffixs[] = { "doc", "docx" }; 70 | 71 | for (String i : imageSuffixs) { 72 | if (i.equalsIgnoreCase(suffix)) { 73 | return true; 74 | } 75 | } 76 | 77 | return false; 78 | } 79 | 80 | public static boolean isXls(String name) { 81 | String suffix = name.substring(name.lastIndexOf(".") + 1); 82 | String imageSuffixs[] = { "xls", "xlsx" }; 83 | 84 | for (String i : imageSuffixs) { 85 | if (i.equalsIgnoreCase(suffix)) { 86 | return true; 87 | } 88 | } 89 | 90 | return false; 91 | } 92 | 93 | public static boolean isPpt(String name) { 94 | String suffix = name.substring(name.lastIndexOf(".") + 1); 95 | String imageSuffixs[] = { "ppt", "pptx" }; 96 | 97 | for (String i : imageSuffixs) { 98 | if (i.equalsIgnoreCase(suffix)) { 99 | return true; 100 | } 101 | } 102 | 103 | return false; 104 | } 105 | 106 | public static boolean isZip(String name) { 107 | String suffix = name.substring(name.lastIndexOf(".") + 1); 108 | String imageSuffixs[] = { "rar", "tar", "zip", "gzip", "7z" }; 109 | 110 | for (String i : imageSuffixs) { 111 | if (i.equalsIgnoreCase(suffix)) { 112 | return true; 113 | } 114 | } 115 | 116 | return false; 117 | } 118 | 119 | public static boolean isTxt(String name) { 120 | String suffix = name.substring(name.lastIndexOf(".") + 1); 121 | String imageSuffixs[] = { "txt" }; 122 | 123 | for (String i : imageSuffixs) { 124 | if (i.equalsIgnoreCase(suffix)) { 125 | return true; 126 | } 127 | } 128 | 129 | return false; 130 | } 131 | 132 | public static boolean isPdf(String name) { 133 | String suffix = name.substring(name.lastIndexOf(".") + 1); 134 | String imageSuffixs[] = { "pdf" }; 135 | 136 | for (String i : imageSuffixs) { 137 | if (i.equalsIgnoreCase(suffix)) { 138 | return true; 139 | } 140 | } 141 | 142 | return false; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /WebContent/css/main.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | body { 7 | margin: 0 auto; 8 | padding: 0; 9 | background-color: #f3f3f3; 10 | } 11 | 12 | footer { 13 | margin-top: 35px; 14 | font-size: 13px; 15 | text-align: center; 16 | color: #555555; 17 | padding-top: 28px; 18 | padding-bottom: 28px; 19 | border-top: 1px solid #303030; 20 | padding: 35px 0 0; 21 | } 22 | 23 | .gt { 24 | color: #c5d8f3; 25 | padding: 0 5px; 26 | } 27 | 28 | .pathText { 29 | display: none; 30 | } 31 | 32 | .nav-current { 33 | border-bottom: 2px solid #e67e22; 34 | margin-bottom: -2px; 35 | } 36 | 37 | .main-navigation { 38 | text-align: center; 39 | background: #ffffff; 40 | border-top: 1px solid #ebebeb; 41 | margin-bottom: 35px; 42 | border-bottom: 2px solid #e1e1e1; 43 | } 44 | 45 | a.fileName { 46 | text-decoration: none; 47 | color: #424e67; 48 | } 49 | 50 | a.fileName:hover { 51 | text-decoration: none; 52 | color: #06c; 53 | } 54 | 55 | .form-bg { 56 | background: #00b4ef; 57 | } 58 | 59 | .form-horizontal { 60 | background: #fff; 61 | padding-bottom: 40px; 62 | border-radius: 15px; 63 | text-align: center; 64 | } 65 | 66 | .form-horizontal .heading { 67 | display: block; 68 | font-size: 20px; 69 | font-weight: 700; 70 | padding: 20px 0; 71 | border-bottom: 1px solid #f0f0f0; 72 | margin-bottom: 30px; 73 | } 74 | 75 | .form-horizontal .form-group { 76 | padding: 0 40px; 77 | margin: 0 0 25px 0; 78 | position: relative; 79 | } 80 | 81 | .form-horizontal .form-control { 82 | background: #f0f0f0; 83 | border: none; 84 | border-radius: 20px; 85 | box-shadow: none; 86 | padding: 0 20px 0 45px; 87 | height: 40px; 88 | transition: all 0.3s ease 0s; 89 | } 90 | 91 | .form-horizontal .form-control:focus { 92 | background: #e0e0e0; 93 | box-shadow: none; 94 | outline: 0 none; 95 | } 96 | 97 | .form-horizontal .form-group i { 98 | position: absolute; 99 | top: 12px; 100 | left: 60px; 101 | font-size: 17px; 102 | color: #c8c8c8; 103 | transition: all 0.5s ease 0s; 104 | } 105 | 106 | .form-horizontal .form-control:focus+i { 107 | color: #00b4ef; 108 | } 109 | 110 | .form-horizontal .text { 111 | float: left; 112 | margin-left: 7px; 113 | line-height: 20px; 114 | padding-top: 5px; 115 | text-transform: capitalize; 116 | } 117 | 118 | .form-horizontal .btn { 119 | float: right; 120 | font-size: 14px; 121 | color: #fff; 122 | background: #00b4ef; 123 | border-radius: 30px; 124 | padding: 10px 25px; 125 | border: none; 126 | text-transform: capitalize; 127 | transition: all 0.5s ease 0s; 128 | } 129 | 130 | @media only screen and (max-width: 479px) { 131 | .form-horizontal .form-group { 132 | padding: 0 25px; 133 | } 134 | .form-horizontal .form-group i { 135 | left: 45px; 136 | } 137 | .form-horizontal .btn { 138 | padding: 10px 20px; 139 | } 140 | } 141 | 142 | .card-container { 143 | padding: 15px 15px; 144 | } 145 | 146 | .disabled { 147 | display: none; 148 | } 149 | 150 | .fileIcon { 151 | margin: 5px; 152 | width: 35px; 153 | } 154 | 155 | .home_icon { 156 | width: 120px; 157 | } 158 | 159 | #copyInfo .alert { 160 | display: none 161 | } 162 | 163 | .ellipsis { 164 | white-space: nowrap; 165 | text-overflow: ellipsis; 166 | overflow: hidden; 167 | } 168 | 169 | .icon25 { 170 | width: 25px; 171 | margin: 5px; 172 | } 173 | 174 | .item { 175 | padding: 5px 5px; 176 | } 177 | 178 | .commend-desc { 179 | padding-left: 5px; 180 | font-size: 10px; 181 | } 182 | 183 | .breadcrumb { 184 | background-color: white; 185 | } 186 | 187 | .topsharetitle { 188 | font-size: 25px; 189 | } 190 | 191 | img.logo { 192 | width: 55px; 193 | } 194 | 195 | #createInboxInfo { 196 | display: none; 197 | } 198 | 199 | .checkShow { 200 | display: none; 201 | } 202 | 203 | table td { 204 | vertical-align: middle; 205 | } 206 | 207 | #sidebar i { 208 | margin-right: 10px; 209 | } 210 | 211 | .param { 212 | display: none; 213 | } 214 | 215 | .nav-button { 216 | margin-left: 15px; 217 | } -------------------------------------------------------------------------------- /src/com/clouddrive/dao/impl/FileDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao.impl; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.util.Vector; 6 | 7 | import com.clouddrive.dao.BaseDao; 8 | import com.clouddrive.dao.FileDao; 9 | import com.clouddrive.dao.RSProcessor; 10 | import com.clouddrive.entity.FileMessage; 11 | 12 | public class FileDaoImpl extends BaseDao implements FileDao { 13 | 14 | @SuppressWarnings("unchecked") 15 | @Override 16 | public Vector findFilesByPathAndUser(String path, String userName) { 17 | String sql = "select * from file where path = ? and user = ? order by updateTime desc"; 18 | Object[] params = { path, userName }; 19 | 20 | RSProcessor getResultProcessor = new RSProcessor() { 21 | 22 | public Object process(ResultSet rs) throws SQLException { 23 | Vector files = new Vector(); 24 | 25 | while (rs.next()) { 26 | String fileName = rs.getString("fileName"); 27 | String uuidName = rs.getString("uuidName"); 28 | String updateTime = rs.getString("updateTime"); 29 | String type = rs.getString("type"); 30 | String path = rs.getString("path"); 31 | String user = rs.getString("user"); 32 | long size = rs.getLong("size"); 33 | 34 | FileMessage fileMessage = new FileMessage(fileName, uuidName, updateTime, type, path, user, size); 35 | files.add(fileMessage); 36 | } 37 | return files; 38 | 39 | } 40 | }; 41 | 42 | return (Vector) this.executeQuery(getResultProcessor, sql, params); 43 | } 44 | 45 | @Override 46 | public int insert(FileMessage file) { 47 | System.out.println("yes"); 48 | String sql = "insert file (fileName,uuidName,updateTime,type,path,user,size) values(?,?,?,?,?,?,?)"; 49 | Object[] params = { file.getFileName(), file.getUuidName(), file.getUpdateTime(), file.getType(), 50 | file.getPath(), file.getUser(), file.getSize() }; 51 | return this.executeUpdate(sql, params); 52 | } 53 | 54 | @SuppressWarnings("unchecked") 55 | @Override 56 | public Vector findFilesByTypeAndUser(String type, String user) { 57 | String sql = "select * from file where type = ? and user = ? order by updateTime desc"; 58 | Object[] params = { type, user }; 59 | 60 | RSProcessor getResultProcessor = new RSProcessor() { 61 | 62 | public Object process(ResultSet rs) throws SQLException { 63 | Vector files = new Vector(); 64 | 65 | while (rs.next()) { 66 | String fileName = rs.getString("fileName"); 67 | String uuidName = rs.getString("uuidName"); 68 | String updateTime = rs.getString("updateTime"); 69 | String type = rs.getString("type"); 70 | String path = rs.getString("path"); 71 | String user = rs.getString("user"); 72 | long size = rs.getLong("size"); 73 | 74 | FileMessage fileMessage = new FileMessage(fileName, uuidName, updateTime, type, path, user, size); 75 | files.add(fileMessage); 76 | } 77 | return files; 78 | } 79 | }; 80 | 81 | return (Vector) this.executeQuery(getResultProcessor, sql, params); 82 | } 83 | 84 | @Override 85 | public int delFileByUuidName(String uuidName) { 86 | String sql = "delete from file where uuidName = ?"; 87 | Object[] params = { uuidName }; 88 | return this.executeUpdate(sql, params); 89 | } 90 | 91 | @Override 92 | public int delFolder(String path, String fileName) { 93 | String sql = "delete from file where fileName = ? and type = 'folder' and path = ?"; 94 | Object[] params = { fileName, path }; 95 | return this.executeUpdate(sql, params); 96 | } 97 | 98 | @Override 99 | public int countFiles() { 100 | String sql = "select count(*) as file_count from file"; 101 | 102 | RSProcessor getResultProcessor = new RSProcessor() { 103 | 104 | public Object process(ResultSet rs) throws SQLException { 105 | int count = 0; 106 | if (rs != null) { 107 | if (rs.next()) { 108 | count = rs.getInt("file_count"); 109 | } 110 | } 111 | return new Integer(count); 112 | } 113 | 114 | }; 115 | 116 | return (Integer) this.executeQuery(getResultProcessor, sql); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /WebContent/share.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 云盘 9 | 10 | 11 | 12 | 13 | 15 | 17 | 20 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 46 | 47 |
48 |
49 |
50 |
51 | 52 | 53 | 找不到资源 54 | 55 | 56 |
57 |

来自 { share.user }的分享

58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 73 | 74 | 75 | 86 | 87 | 88 |
文件名大小分享时间
logo ${share.fileName}${share.showSize }${share.shareTime } 76 | 77 | 78 | 79 | 80 | 81 | 85 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 网盘热门资源:
96 | 97 | 98 |
99 |
100 | logo 101 | ${share.fileName} 103 |
104 |
105 | 下载量:${share.downloads } 106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | 114 | -------------------------------------------------------------------------------- /WebContent/js/echars/dark.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module. 4 | define(['exports', 'echarts'], factory); 5 | } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { 6 | // CommonJS 7 | factory(exports, require('echarts')); 8 | } else { 9 | // Browser globals 10 | factory({}, root.echarts); 11 | } 12 | }(this, function (exports, echarts) { 13 | var log = function (msg) { 14 | if (typeof console !== 'undefined') { 15 | console && console.error && console.error(msg); 16 | } 17 | }; 18 | if (!echarts) { 19 | log('ECharts is not Loaded'); 20 | return; 21 | } 22 | var contrastColor = '#eee'; 23 | var axisCommon = function () { 24 | return { 25 | axisLine: { 26 | lineStyle: { 27 | color: contrastColor 28 | } 29 | }, 30 | axisTick: { 31 | lineStyle: { 32 | color: contrastColor 33 | } 34 | }, 35 | axisLabel: { 36 | textStyle: { 37 | color: contrastColor 38 | } 39 | }, 40 | splitLine: { 41 | lineStyle: { 42 | type: 'dashed', 43 | color: '#aaa' 44 | } 45 | }, 46 | splitArea: { 47 | areaStyle: { 48 | color: contrastColor 49 | } 50 | } 51 | }; 52 | }; 53 | 54 | var colorPalette = ['#dd6b66','#759aa0','#e69d87','#8dc1a9','#ea7e53','#eedd78','#73a373','#73b9bc','#7289ab', '#91ca8c','#f49f42']; 55 | var theme = { 56 | color: colorPalette, 57 | backgroundColor: '#333', 58 | tooltip: { 59 | axisPointer: { 60 | lineStyle: { 61 | color: contrastColor 62 | }, 63 | crossStyle: { 64 | color: contrastColor 65 | } 66 | } 67 | }, 68 | legend: { 69 | textStyle: { 70 | color: contrastColor 71 | } 72 | }, 73 | textStyle: { 74 | color: contrastColor 75 | }, 76 | title: { 77 | textStyle: { 78 | color: contrastColor 79 | } 80 | }, 81 | toolbox: { 82 | iconStyle: { 83 | normal: { 84 | borderColor: contrastColor 85 | } 86 | } 87 | }, 88 | dataZoom: { 89 | textStyle: { 90 | color: contrastColor 91 | } 92 | }, 93 | timeline: { 94 | lineStyle: { 95 | color: contrastColor 96 | }, 97 | itemStyle: { 98 | normal: { 99 | color: colorPalette[1] 100 | } 101 | }, 102 | label: { 103 | normal: { 104 | textStyle: { 105 | color: contrastColor 106 | } 107 | } 108 | }, 109 | controlStyle: { 110 | normal: { 111 | color: contrastColor, 112 | borderColor: contrastColor 113 | } 114 | } 115 | }, 116 | timeAxis: axisCommon(), 117 | logAxis: axisCommon(), 118 | valueAxis: axisCommon(), 119 | categoryAxis: axisCommon(), 120 | 121 | line: { 122 | symbol: 'circle' 123 | }, 124 | graph: { 125 | color: colorPalette 126 | }, 127 | gauge: { 128 | title: { 129 | textStyle: { 130 | color: contrastColor 131 | } 132 | } 133 | }, 134 | candlestick: { 135 | itemStyle: { 136 | normal: { 137 | color: '#FD1050', 138 | color0: '#0CF49B', 139 | borderColor: '#FD1050', 140 | borderColor0: '#0CF49B' 141 | } 142 | } 143 | } 144 | }; 145 | theme.categoryAxis.splitLine.show = false; 146 | echarts.registerTheme('dark', theme); 147 | })); -------------------------------------------------------------------------------- /WebContent/js/echars/shine.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) {if (typeof define === 'function' && define.amd) { 2 | // AMD. Register as an anonymous module. 3 | define(['exports', 'echarts'], factory); 4 | } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { 5 | // CommonJS 6 | factory(exports, require('echarts')); 7 | } else { 8 | // Browser globals 9 | factory({}, root.echarts); 10 | } 11 | }(this, function (exports, echarts) { 12 | var log = function (msg) { 13 | if (typeof console !== 'undefined') { 14 | console && console.error && console.error(msg); 15 | } 16 | }; 17 | if (!echarts) { 18 | log('ECharts is not Loaded'); 19 | return; 20 | } 21 | 22 | var colorPalette = [ 23 | '#c12e34','#e6b600','#0098d9','#2b821d', 24 | '#005eaa','#339ca8','#cda819','#32a487' 25 | ]; 26 | 27 | var theme = { 28 | 29 | color: colorPalette, 30 | 31 | title: { 32 | textStyle: { 33 | fontWeight: 'normal' 34 | } 35 | }, 36 | 37 | visualMap: { 38 | color:['#1790cf','#a2d4e6'] 39 | }, 40 | 41 | toolbox: { 42 | iconStyle: { 43 | normal: { 44 | borderColor: '#06467c' 45 | } 46 | } 47 | }, 48 | 49 | tooltip: { 50 | backgroundColor: 'rgba(0,0,0,0.6)' 51 | }, 52 | 53 | dataZoom: { 54 | dataBackgroundColor: '#dedede', 55 | fillerColor: 'rgba(154,217,247,0.2)', 56 | handleColor: '#005eaa' 57 | }, 58 | 59 | timeline: { 60 | lineStyle: { 61 | color: '#005eaa' 62 | }, 63 | controlStyle: { 64 | normal: { 65 | color: '#005eaa', 66 | borderColor: '#005eaa' 67 | } 68 | } 69 | }, 70 | 71 | candlestick: { 72 | itemStyle: { 73 | normal: { 74 | color: '#c12e34', 75 | color0: '#2b821d', 76 | lineStyle: { 77 | width: 1, 78 | color: '#c12e34', 79 | color0: '#2b821d' 80 | } 81 | } 82 | } 83 | }, 84 | 85 | graph: { 86 | color: colorPalette 87 | }, 88 | 89 | map: { 90 | label: { 91 | normal: { 92 | textStyle: { 93 | color: '#c12e34' 94 | } 95 | }, 96 | emphasis: { 97 | textStyle: { 98 | color: '#c12e34' 99 | } 100 | } 101 | }, 102 | itemStyle: { 103 | normal: { 104 | borderColor: '#eee', 105 | areaColor: '#ddd' 106 | }, 107 | emphasis: { 108 | areaColor: '#e6b600' 109 | } 110 | } 111 | }, 112 | 113 | gauge: { 114 | axisLine: { 115 | show: true, 116 | lineStyle: { 117 | color: [[0.2, '#2b821d'],[0.8, '#005eaa'],[1, '#c12e34']], 118 | width: 5 119 | } 120 | }, 121 | axisTick: { 122 | splitNumber: 10, 123 | length:8, 124 | lineStyle: { 125 | color: 'auto' 126 | } 127 | }, 128 | axisLabel: { 129 | textStyle: { 130 | color: 'auto' 131 | } 132 | }, 133 | splitLine: { 134 | length: 12, 135 | lineStyle: { 136 | color: 'auto' 137 | } 138 | }, 139 | pointer: { 140 | length: '90%', 141 | width: 3, 142 | color: 'auto' 143 | }, 144 | title: { 145 | textStyle: { 146 | color: '#333' 147 | } 148 | }, 149 | detail: { 150 | textStyle: { 151 | color: 'auto' 152 | } 153 | } 154 | } 155 | }; 156 | echarts.registerTheme('shine', theme); 157 | })); -------------------------------------------------------------------------------- /WebContent/js/adminEntry.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | // 全高度 3 | function set_layout_height_100(){ 4 | let winHeights =[$(window).height(),$(document).height(),$(document.body).height(),$(document.body).outerHeight(true)]; 5 | var maxHeight = winHeights.sort((one,two)=> one < two)[0]; 6 | //maxHeight = $(window).height() ; 7 | $('.layout-height-100').height(maxHeight); 8 | return maxHeight; 9 | } 10 | $(window).on('resize',null,null,set_layout_height_100); 11 | set_layout_height_100(); 12 | 13 | $(document).on('DOMSubtreeModified',null,null,set_layout_height_100); 14 | 15 | /* 设置高度 */ 16 | $('[data-height]').height(function(index, height){ 17 | let dom = $(this); 18 | return dom.attr('data-height'); 19 | }); 20 | /* 设置宽度 */ 21 | $('[data-width]').width(function(index, width){ 22 | let dom = $(this); 23 | return dom.attr('data-width'); 24 | }); 25 | /* 设置最小宽度 */ 26 | $('[data-min-width]').css('min-width',function(index,width){ 27 | return `${$(this).attr('data-min-width')}px`; 28 | }); 29 | /* 设置最大宽度 */ 30 | $('[data-max-width]').css('max-width',function(index,width){ 31 | return `${$(this).attr('data-max-width')}px`; 32 | }); 33 | 34 | /* 设置最小高度 */ 35 | $('[data-min-height]').css('min-height',function(index,width){ 36 | return `${$(this).attr('data-min-height')}px`; 37 | }); 38 | /* 设置最大高度 */ 39 | $('[data-max-height]').css('max-height',function(index,width){ 40 | return `${$(this).attr('data-max-height')}px`; 41 | }); 42 | 43 | 44 | $('[data-margin-top]').css('margin-top',function(index,width){ 45 | return `${$(this).attr('data-margin-top')}px`; 46 | }); 47 | 48 | $('[data-margin-bottom]').css('margin-bottom',function(index,width){ 49 | return `${$(this).attr('data-margin-bottom')}px`; 50 | }); 51 | 52 | $(window).on('resize',null,null,function(){ 53 | $('[data-height-all]').css('height',function(index,width){ 54 | let val = set_layout_height_100() - $('.admin-narbar-top').height() - 20; 55 | return `${val}px`; 56 | }); 57 | }); 58 | 59 | $('[data-height-all]').css('height',function(index,width){ 60 | let val = set_layout_height_100() - $('.admin-narbar-top').height() - 20; 61 | return `${val}px`; 62 | }); 63 | 64 | $('#admin-only-show-505').on('click',null,null,function(){ 65 | var content =$('#admin-only-show-505-content'); 66 | 67 | if(content.css('display') == "block"){ 68 | content.css("display","none"); 69 | }else{ 70 | content.css("display","block"); 71 | } 72 | }); 73 | 74 | $('#admin-only-show-505-content-cancel').on('click',null,null,function(){ 75 | $('#admin-only-show-505-content').css("display","none"); 76 | }); 77 | 78 | 79 | $('.line-height-all-clenter').css('line-height',function(index,lineheightValue){ 80 | let val_height = $(this).parent('').height() 81 | let val_min_height = Number.parseInt($(this).parent().css('min-height')); 82 | 83 | return Math.max(val_height,val_min_height) + "px"; 84 | }); 85 | 86 | 87 | /* 与加载动画有关的js 脚本 */ 88 | $('.loading-admin').css("top",function(index,value){ 89 | 90 | let this_height = $(this).find('.modal-body').height(); 91 | let page_height = $(window).height(); 92 | 93 | 94 | let val = page_height > this_height ? (page_height/2 - this_height - 100) + "px": "0"; 95 | console.info('tag', this_height); 96 | console.log(val); 97 | return val; 98 | }); 99 | 100 | }); 101 | 102 | /* 与加载动画有关的js 脚本 */ 103 | function StartLoading(target = ".loading-admin"){ 104 | appendLoadDom(); 105 | $(target).modal('show'); 106 | }; 107 | 108 | function EndLoading(target = ".loading-admin"){ 109 | $(target).modal('hide'); 110 | }; 111 | 112 | function appendLoadDom(){ 113 | $('body').append($(` 114 | 126 | `)); 127 | }; -------------------------------------------------------------------------------- /WebContent/auth/myShare.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | <%@ page import="java.util.*"%> 5 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 6 | 7 | 8 | 9 | 10 | 11 | 在线云盘 12 | 13 | 14 | 15 | 16 | 18 | 20 | 23 | 26 | 27 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 66 | 67 |
68 |
69 |
70 |
71 |
72 |

我的分享

73 |
74 |
75 | 79 |
80 |
81 | 82 | 83 | 84 | 85 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 109 | 113 | 118 | 119 | 120 | 121 | 122 | 123 | 124 |
86 |
87 | 88 | 89 |
90 |
文件名下载次数大小分享时间
104 |
105 | 107 |
108 |
logo ${share.fileName}   112 | 114 |
115 | ${share.key} 116 |
117 |
${share.downloads }${share.showSize }${share.shareTime }
125 |
126 |
127 |
128 | 129 | 149 | 150 | -------------------------------------------------------------------------------- /WebContent/js/echars/macarons.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module. 4 | define(['exports', 'echarts'], factory); 5 | } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { 6 | // CommonJS 7 | factory(exports, require('echarts')); 8 | } else { 9 | // Browser globals 10 | factory({}, root.echarts); 11 | } 12 | }(this, function (exports, echarts) { 13 | var log = function (msg) { 14 | if (typeof console !== 'undefined') { 15 | console && console.error && console.error(msg); 16 | } 17 | }; 18 | if (!echarts) { 19 | log('ECharts is not Loaded'); 20 | return; 21 | } 22 | 23 | var colorPalette = [ 24 | '#2ec7c9','#b6a2de','#5ab1ef','#ffb980','#d87a80', 25 | '#8d98b3','#e5cf0d','#97b552','#95706d','#dc69aa', 26 | '#07a2a4','#9a7fd1','#588dd5','#f5994e','#c05050', 27 | '#59678c','#c9ab00','#7eb00a','#6f5553','#c14089' 28 | ]; 29 | 30 | 31 | var theme = { 32 | color: colorPalette, 33 | 34 | title: { 35 | textStyle: { 36 | fontWeight: 'normal', 37 | color: '#008acd' 38 | } 39 | }, 40 | 41 | visualMap: { 42 | itemWidth: 15, 43 | color: ['#5ab1ef','#e0ffff'] 44 | }, 45 | 46 | toolbox: { 47 | iconStyle: { 48 | normal: { 49 | borderColor: colorPalette[0] 50 | } 51 | } 52 | }, 53 | 54 | tooltip: { 55 | backgroundColor: 'rgba(50,50,50,0.5)', 56 | axisPointer : { 57 | type : 'line', 58 | lineStyle : { 59 | color: '#008acd' 60 | }, 61 | crossStyle: { 62 | color: '#008acd' 63 | }, 64 | shadowStyle : { 65 | color: 'rgba(200,200,200,0.2)' 66 | } 67 | } 68 | }, 69 | 70 | dataZoom: { 71 | dataBackgroundColor: '#efefff', 72 | fillerColor: 'rgba(182,162,222,0.2)', 73 | handleColor: '#008acd' 74 | }, 75 | 76 | grid: { 77 | borderColor: '#eee' 78 | }, 79 | 80 | categoryAxis: { 81 | axisLine: { 82 | lineStyle: { 83 | color: '#008acd' 84 | } 85 | }, 86 | splitLine: { 87 | lineStyle: { 88 | color: ['#eee'] 89 | } 90 | } 91 | }, 92 | 93 | valueAxis: { 94 | axisLine: { 95 | lineStyle: { 96 | color: '#008acd' 97 | } 98 | }, 99 | splitArea : { 100 | show : true, 101 | areaStyle : { 102 | color: ['rgba(250,250,250,0.1)','rgba(200,200,200,0.1)'] 103 | } 104 | }, 105 | splitLine: { 106 | lineStyle: { 107 | color: ['#eee'] 108 | } 109 | } 110 | }, 111 | 112 | timeline : { 113 | lineStyle : { 114 | color : '#008acd' 115 | }, 116 | controlStyle : { 117 | normal : { color : '#008acd'}, 118 | emphasis : { color : '#008acd'} 119 | }, 120 | symbol : 'emptyCircle', 121 | symbolSize : 3 122 | }, 123 | 124 | line: { 125 | smooth : true, 126 | symbol: 'emptyCircle', 127 | symbolSize: 3 128 | }, 129 | 130 | candlestick: { 131 | itemStyle: { 132 | normal: { 133 | color: '#d87a80', 134 | color0: '#2ec7c9', 135 | lineStyle: { 136 | color: '#d87a80', 137 | color0: '#2ec7c9' 138 | } 139 | } 140 | } 141 | }, 142 | 143 | scatter: { 144 | symbol: 'circle', 145 | symbolSize: 4 146 | }, 147 | 148 | map: { 149 | label: { 150 | normal: { 151 | textStyle: { 152 | color: '#d87a80' 153 | } 154 | } 155 | }, 156 | itemStyle: { 157 | normal: { 158 | borderColor: '#eee', 159 | areaColor: '#ddd' 160 | }, 161 | emphasis: { 162 | areaColor: '#fe994e' 163 | } 164 | } 165 | }, 166 | 167 | graph: { 168 | color: colorPalette 169 | }, 170 | 171 | gauge : { 172 | axisLine: { 173 | lineStyle: { 174 | color: [[0.2, '#2ec7c9'],[0.8, '#5ab1ef'],[1, '#d87a80']], 175 | width: 10 176 | } 177 | }, 178 | axisTick: { 179 | splitNumber: 10, 180 | length :15, 181 | lineStyle: { 182 | color: 'auto' 183 | } 184 | }, 185 | splitLine: { 186 | length :22, 187 | lineStyle: { 188 | color: 'auto' 189 | } 190 | }, 191 | pointer : { 192 | width : 5 193 | } 194 | } 195 | }; 196 | 197 | echarts.registerTheme('macarons', theme); 198 | })); -------------------------------------------------------------------------------- /src/com/clouddrive/servlet/UpLoadServlet.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.servlet; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.io.PrintWriter; 8 | import java.util.List; 9 | import java.util.UUID; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import javax.servlet.http.HttpSession; 17 | 18 | import org.apache.commons.fileupload.FileItem; 19 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; 20 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 21 | 22 | import com.alibaba.fastjson.JSONObject; 23 | import com.clouddrive.dao.impl.FileDaoImpl; 24 | import com.clouddrive.entity.CurrentTime; 25 | import com.clouddrive.entity.FileMessage; 26 | import com.clouddrive.entity.Type; 27 | 28 | /** 29 | * Servlet implementation class UpLoadServlet 30 | */ 31 | @WebServlet("/UpLoad") 32 | public class UpLoadServlet extends HttpServlet { 33 | private static final long serialVersionUID = 1L; 34 | 35 | /** 36 | * @see HttpServlet#HttpServlet() 37 | */ 38 | public UpLoadServlet() { 39 | super(); 40 | // TODO Auto-generated constructor stub 41 | } 42 | 43 | /** 44 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 45 | * response) 46 | */ 47 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 48 | throws ServletException, IOException { 49 | // TODO Auto-generated method stub 50 | request.setCharacterEncoding("UTF-8"); 51 | response.setCharacterEncoding("UTF-8"); 52 | response.setContentType("application/json"); 53 | HttpSession session = request.getSession(); 54 | String userName = (String) session.getAttribute("name"); 55 | String preName = ""; 56 | 57 | String path = (String) session.getAttribute("path"); 58 | // 用户保存的文件路径 59 | String savePath = ""; 60 | 61 | try { 62 | DiskFileItemFactory factory = new DiskFileItemFactory(); 63 | ServletFileUpload upload = new ServletFileUpload(factory); 64 | // 设置文件名编码格式 65 | upload.setHeaderEncoding("UTF-8"); 66 | // 判断提交的数据是否是表单数据 67 | if (!ServletFileUpload.isMultipartContent(request)) { 68 | // 普通数据 69 | System.out.println("普通数据"); 70 | return; 71 | } 72 | List fileList = upload.parseRequest(request); 73 | FileItem fileItem = null; 74 | boolean isInbox = false; 75 | for (FileItem item : fileList) { 76 | // 普通数据项 77 | if (item.isFormField()) { 78 | String name = item.getFieldName(); 79 | String value = item.getString("UTF-8"); 80 | System.out.println(name + "=" + value); 81 | if (name.equals("path")) { 82 | path = value; 83 | } else if (name.equals("idTF")) { 84 | if (!value.equals("")) { 85 | preName = preName + value + "_"; 86 | } 87 | } else if (name.equals("nameTF")) { 88 | if (!value.equals("")) { 89 | preName = preName + value + "_"; 90 | } 91 | } else if (name.equals("userName")) { 92 | isInbox = true; 93 | userName = value; 94 | } 95 | } else { 96 | fileItem = item; 97 | } 98 | } 99 | // 获取文件名 100 | String fileName = fileItem.getName(); 101 | System.out.println(fileName); 102 | if (fileName == null || fileName.trim().equals("")) { 103 | PrintWriter out = response.getWriter(); 104 | JSONObject json = new JSONObject(); 105 | json.put("error", "文件名为空!"); 106 | out.println(json); 107 | out.close(); 108 | return; 109 | } 110 | // 处理获取到的上传文件的文件名的路径部分,只保留文件名部分 111 | fileName = fileName.substring(fileName.lastIndexOf("/") + 1); 112 | fileName = preName + fileName; 113 | // 添加UUID 114 | String uuidName = makeFileName(fileName); 115 | if (isInbox) { 116 | path = "inbox/" + path; 117 | } 118 | savePath = this.getServletContext().getRealPath("/WEB-INF/Drive/" + userName + "/" + path); 119 | 120 | File folder = new File(savePath); 121 | 122 | if (!folder.exists() || !folder.isDirectory()) { 123 | System.out.println(savePath + "目录不存在,需要创建"); 124 | folder.mkdirs(); 125 | } 126 | InputStream in = fileItem.getInputStream(); 127 | FileOutputStream out = new FileOutputStream(savePath + "/" + uuidName); 128 | byte buffer[] = new byte[1024]; 129 | int len = 0; 130 | while ((len = in.read(buffer)) > 0) { 131 | out.write(buffer, 0, len); 132 | } 133 | in.close(); 134 | out.close(); 135 | long fileSize = fileItem.getSize(); 136 | fileItem.delete(); 137 | System.out.println("文件上传成功!"); 138 | System.out.println("文件大小:" + fileSize); 139 | String type = Type.getType(fileName); 140 | 141 | String updateTime = new CurrentTime().getDateString(); 142 | FileMessage fileMessage = new FileMessage(fileName, uuidName, updateTime, type, path, userName, fileSize); 143 | 144 | FileDaoImpl fileDaoImpl = new FileDaoImpl(); 145 | fileDaoImpl.insert(fileMessage); 146 | System.out.println("数据库操作成功"); 147 | } catch (Exception e) { 148 | PrintWriter out = response.getWriter(); 149 | JSONObject json = new JSONObject(); 150 | json.put("error", "上传失败!"); 151 | out.println(json); 152 | out.close(); 153 | System.out.println("文件上传失败!"); 154 | e.printStackTrace(); 155 | return; 156 | } 157 | System.out.println("yes2"); 158 | 159 | PrintWriter out = response.getWriter(); 160 | JSONObject json = new JSONObject(); 161 | json.put("success", "上传成功!"); 162 | out.println(json); 163 | out.close(); 164 | } 165 | 166 | /** 167 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 168 | * response) 169 | */ 170 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 171 | throws ServletException, IOException { 172 | // TODO Auto-generated method stub 173 | request.setCharacterEncoding("UTF-8"); 174 | response.setCharacterEncoding("UTF-8"); 175 | doGet(request, response); 176 | } 177 | 178 | /** 179 | * 生成唯一的UUID 180 | * 181 | * @param fileName 182 | * @return 183 | */ 184 | public String makeFileName(String fileName) { 185 | return UUID.randomUUID().toString() + "_" + fileName; 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/com/clouddrive/dao/impl/ShareDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.clouddrive.dao.impl; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.util.Vector; 6 | 7 | import com.clouddrive.dao.BaseDao; 8 | import com.clouddrive.dao.RSProcessor; 9 | import com.clouddrive.dao.ShareDao; 10 | import com.clouddrive.entity.Share; 11 | 12 | public class ShareDaoImpl extends BaseDao implements ShareDao { 13 | 14 | @Override 15 | public int countShare() { 16 | String sql = "select count(*) as share_count from share"; 17 | RSProcessor getResultProcessor = new RSProcessor() { 18 | public Object process(ResultSet rs) throws SQLException { 19 | int count = 0; 20 | if (rs != null) { 21 | if (rs.next()) { 22 | count = rs.getInt("share_count"); 23 | } 24 | } 25 | return new Integer(count); 26 | } 27 | }; 28 | return (Integer) this.executeQuery(getResultProcessor, sql); 29 | } 30 | 31 | @Override 32 | public int countShareByKey(String key) { 33 | String sql = "select count(*) as share_count from share where keyword=?"; 34 | Object[] params = { key }; 35 | 36 | RSProcessor getResultProcessor = new RSProcessor() { 37 | 38 | public Object process(ResultSet rs) throws SQLException { 39 | int count = 0; 40 | if (rs != null) { 41 | if (rs.next()) { 42 | count = rs.getInt("share_count"); 43 | } 44 | } 45 | 46 | return new Integer(count); 47 | } 48 | 49 | }; 50 | 51 | return (Integer) this.executeQuery(getResultProcessor, sql, params); 52 | } 53 | 54 | @Override 55 | public Share findShareByKey(String key) { 56 | String sql = "select * from share where keyword = ?"; 57 | Object[] params = { key }; 58 | 59 | RSProcessor getResultProcessor = new RSProcessor() { 60 | 61 | public Object process(ResultSet rs) throws SQLException { 62 | Share share = null; 63 | 64 | if (rs != null) { 65 | if (rs.next()) { 66 | String user = rs.getString("user"); 67 | String uuidName = rs.getString("uuidName"); 68 | String url = rs.getString("url"); 69 | String shareTime = rs.getString("shareTime"); 70 | String key = rs.getString("keyword"); 71 | int downloads = rs.getInt("downloads"); 72 | long size = rs.getLong("size"); 73 | share = new Share(user, uuidName, url, shareTime, key, downloads, size); 74 | } 75 | } 76 | 77 | return share; 78 | 79 | } 80 | }; 81 | 82 | return (Share) this.executeQuery(getResultProcessor, sql, params); 83 | } 84 | 85 | @Override 86 | public int insert(Share share) { 87 | String sql = "insert share (user, uuidName, url, shareTime, keyword, downloads, size) values(?,?,?,?,?,?,?)"; 88 | Object[] params = { share.getUser(), share.getUuidName(), share.getUrl(), share.getShareTime(), share.getKey(), 89 | 0, share.getSize() }; 90 | return this.executeUpdate(sql, params); 91 | } 92 | 93 | @SuppressWarnings("unchecked") 94 | @Override 95 | public Vector findShareByUser(String name) { 96 | String sql = "select * from share where user = ? order by shareTime desc"; 97 | Object[] params = { name }; 98 | 99 | RSProcessor getResultProcessor = new RSProcessor() { 100 | 101 | public Object process(ResultSet rs) throws SQLException { 102 | Vector shares = new Vector(); 103 | 104 | while (rs.next()) { 105 | 106 | String user = rs.getString("user"); 107 | String uuidName = rs.getString("uuidName"); 108 | String url = rs.getString("url"); 109 | String shareTime = rs.getString("shareTime"); 110 | String key = rs.getString("keyword"); 111 | int downloads = rs.getInt("downloads"); 112 | long size = rs.getLong("size"); 113 | Share share = new Share(user, uuidName, url, shareTime, key, downloads, size); 114 | shares.add(share); 115 | } 116 | 117 | return shares; 118 | 119 | } 120 | }; 121 | 122 | return (Vector) this.executeQuery(getResultProcessor, sql, params); 123 | } 124 | 125 | @Override 126 | public int updateDownloadByKey(String key) { 127 | String sql = "update share \r\n" + "set downloads = downloads+1\r\n" + "where keyword = ?"; 128 | Object[] params = { key }; 129 | return this.executeUpdate(sql, params); 130 | } 131 | 132 | @Override 133 | public int delShareByKey(String key) { 134 | String sql = "delete from share\r\n" + "where keyword = ?"; 135 | Object[] params = { key }; 136 | return this.executeUpdate(sql, params); 137 | } 138 | 139 | @Override 140 | public int delShareByUuidName(String uuidName) { 141 | String sql = "delete from share\r\n" + "where uuidName = ?"; 142 | Object[] params = { uuidName }; 143 | return this.executeUpdate(sql, params); 144 | } 145 | 146 | @Override 147 | public int countShareByUuidName(String uuidName) { 148 | String sql = "select count(*) as share_count from share where uuidName=?"; 149 | Object[] params = { uuidName }; 150 | 151 | RSProcessor getResultProcessor = new RSProcessor() { 152 | public Object process(ResultSet rs) throws SQLException { 153 | int count = 0; 154 | if (rs != null) { 155 | if (rs.next()) { 156 | count = rs.getInt("share_count"); 157 | } 158 | } 159 | return new Integer(count); 160 | } 161 | }; 162 | return (Integer) this.executeQuery(getResultProcessor, sql, params); 163 | } 164 | 165 | @Override 166 | public String findKeyByUuidName(String uuidName) { 167 | String sql = "select keyword from share where uuidName = ?"; 168 | Object[] params = { uuidName }; 169 | 170 | RSProcessor getResultProcessor = new RSProcessor() { 171 | 172 | public Object process(ResultSet rs) throws SQLException { 173 | String key = null; 174 | 175 | if (rs != null) { 176 | if (rs.next()) { 177 | key = rs.getString("keyword"); 178 | } 179 | } 180 | return key; 181 | } 182 | }; 183 | 184 | return (String) this.executeQuery(getResultProcessor, sql, params); 185 | } 186 | 187 | @SuppressWarnings("unchecked") 188 | @Override 189 | public Vector getHotShare() { 190 | String sql = "select * from share order by downloads desc limit 12"; 191 | Object[] params = {}; 192 | RSProcessor getResultProcessor = new RSProcessor() { 193 | public Object process(ResultSet rs) throws SQLException { 194 | Vector shares = new Vector(); 195 | while (rs.next()) { 196 | 197 | String user = rs.getString("user"); 198 | String uuidName = rs.getString("uuidName"); 199 | String url = rs.getString("url"); 200 | String shareTime = rs.getString("shareTime"); 201 | String key = rs.getString("keyword"); 202 | int downloads = rs.getInt("downloads"); 203 | long size = rs.getLong("size"); 204 | Share share = new Share(user, uuidName, url, shareTime, key, downloads, size); 205 | shares.add(share); 206 | } 207 | return shares; 208 | } 209 | }; 210 | 211 | return (Vector) this.executeQuery(getResultProcessor, sql, params); 212 | } 213 | 214 | @Override 215 | public int countDownloads() { 216 | String sql = "select sum(downloads) as sumDowmloads from share"; 217 | RSProcessor getResultProcessor = new RSProcessor() { 218 | public Object process(ResultSet rs) throws SQLException { 219 | int count = 0; 220 | if (rs != null) { 221 | if (rs.next()) { 222 | count = rs.getInt("sumDowmloads"); 223 | } 224 | } 225 | return new Integer(count); 226 | } 227 | }; 228 | return (Integer) this.executeQuery(getResultProcessor, sql); 229 | } 230 | 231 | } 232 | -------------------------------------------------------------------------------- /WebContent/js/mustache.min.js: -------------------------------------------------------------------------------- 1 | (function defineMustache(global,factory){if(typeof exports==="object"&&exports&&typeof exports.nodeName!=="string"){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}function primitiveHasOwnProperty(primitive,propName){return primitive!=null&&typeof primitive!=="object"&&primitive.hasOwnProperty&&primitive.hasOwnProperty(propName)}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,intermediateValue,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){intermediateValue=context.view;names=name.split(".");index=0;while(intermediateValue!=null&&index")value=this.renderPartial(token,context,partials,tags);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function t(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function t(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function t(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function t(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function t(){this.removeFake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenClick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})}},{key:"onClick",value:function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultAction",value:function t(e){return l("action",e)}},{key:"defaultTarget",value:function t(e){var n=l("target",e);if(n)return document.querySelector(n)}},{key:"defaultText",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)}); -------------------------------------------------------------------------------- /WebContent/auth/drive.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | <%@ page import="java.util.*"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 6 | 7 | 8 | 9 | 10 | 11 | 在线云盘 12 | 13 | 14 | 15 | 16 | 18 | 20 | 23 | 26 | 27 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 56 | 57 | 58 | 79 | 80 |
81 |
82 | 96 |
97 |
98 | 99 | 100 | <%-- ${path } --%> 101 | 102 | 103 | 104 | 118 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 171 | 172 | 173 | 174 | 175 | 176 | 179 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | ${file.size } 196 | 197 | 200 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 |
149 |
150 | 151 | 152 |
153 |
文件名大小修改日期
166 |
167 | 169 |
170 |
logo ${file.fileName} 180 |
181 | ${file.fileName} ${file.path } 183 |
184 |
-logo ${file.fileName} 201 |
202 | ${file.uuidName} ${file.path } 204 |
205 |
206 | 211 |
212 |
${file.showSize }${file.updateTime }
222 |
223 |
224 |
225 |
226 | 227 | 228 | 251 | 252 | 253 | 277 | 278 | 321 | 322 | 342 | 343 | -------------------------------------------------------------------------------- /WebContent/css/fileinput.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-fileinput v4.4.7 3 | * http://plugins.krajee.com/file-input 4 | * 5 | * Krajee default styling for bootstrap-fileinput. 6 | * 7 | * Author: Kartik Visweswaran 8 | * Copyright: 2014 - 2017, Kartik Visweswaran, Krajee.com 9 | * 10 | * Licensed under the BSD 3-Clause 11 | * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md 12 | */ 13 | .file-loading input[type=file], input[type=file].file-loading { 14 | width: 0; 15 | height: 0; 16 | } 17 | 18 | .kv-hidden, .file-caption-icon, .file-zoom-dialog .modal-header:before, 19 | .file-zoom-dialog .modal-header:after, .file-input-new .file-preview, 20 | .file-input-new .close, .file-input-new .glyphicon-file, 21 | .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, 22 | .file-input-new .no-browse .input-group-btn, .file-input-ajax-new .fileinput-remove-button, 23 | .file-input-ajax-new .fileinput-upload-button, .file-input-ajax-new .no-browse .input-group-btn, 24 | .hide-content .kv-file-content { 25 | display: none; 26 | } 27 | 28 | .btn-file input[type=file], .file-caption-icon, .file-preview .fileinput-remove, 29 | .krajee-default .file-thumb-progress, .file-zoom-dialog .btn-navigate, 30 | .file-zoom-dialog .floating-buttons { 31 | position: absolute; 32 | } 33 | 34 | .file-loading:before, .btn-file, .file-caption, .file-preview, 35 | .krajee-default.file-preview-frame, .krajee-default .file-thumbnail-footer, 36 | .file-zoom-dialog .modal-dialog { 37 | position: relative; 38 | } 39 | 40 | .file-error-message pre, .file-error-message ul, .krajee-default .file-actions, 41 | .krajee-default .file-other-error { 42 | text-align: left; 43 | } 44 | 45 | .file-error-message pre, .file-error-message ul { 46 | margin: 0; 47 | } 48 | 49 | .krajee-default .file-drag-handle, .krajee-default .file-upload-indicator 50 | { 51 | float: left; 52 | margin: 5px 0 -5px; 53 | width: 16px; 54 | height: 16px; 55 | } 56 | 57 | .krajee-default .file-thumb-progress .progress, .krajee-default .file-thumb-progress .progress-bar 58 | { 59 | height: 11px; 60 | font-size: 9px; 61 | line-height: 10px; 62 | } 63 | 64 | .krajee-default .file-caption-info, .krajee-default .file-size-info { 65 | display: block; 66 | white-space: nowrap; 67 | overflow: hidden; 68 | text-overflow: ellipsis; 69 | width: 160px; 70 | height: 15px; 71 | margin: auto; 72 | } 73 | 74 | .file-zoom-content>.file-object.type-video, .file-zoom-content>.file-object.type-flash, 75 | .file-zoom-content>.file-object.type-image { 76 | max-width: 100%; 77 | max-height: 100%; 78 | width: auto; 79 | } 80 | 81 | .file-zoom-content>.file-object.type-video, .file-zoom-content>.file-object.type-flash 82 | { 83 | height: 100%; 84 | } 85 | 86 | .file-zoom-content>.file-object.type-pdf, .file-zoom-content>.file-object.type-html, 87 | .file-zoom-content>.file-object.type-text, .file-zoom-content>.file-object.type-default 88 | { 89 | width: 100%; 90 | } 91 | 92 | .rotate-2 { 93 | transform: rotateY(180deg); 94 | } 95 | 96 | .rotate-3 { 97 | transform: rotate(180deg); 98 | } 99 | 100 | .rotate-4 { 101 | transform: rotate(180deg) rotateY(180deg); 102 | } 103 | 104 | .rotate-5 { 105 | transform: rotate(270deg) rotateY(180deg); 106 | } 107 | 108 | .rotate-6 { 109 | transform: rotate(90deg); 110 | } 111 | 112 | .rotate-7 { 113 | transform: rotate(90deg) rotateY(180deg); 114 | } 115 | 116 | .rotate-8 { 117 | transform: rotate(270deg); 118 | } 119 | 120 | .file-loading:before { 121 | content: " Loading..."; 122 | display: inline-block; 123 | padding-left: 20px; 124 | line-height: 16px; 125 | font-size: 13px; 126 | font-variant: small-caps; 127 | color: #999; 128 | background: transparent url(../img/loading.gif) top left no-repeat; 129 | } 130 | 131 | .file-object { 132 | margin: 0 0 -5px 0; 133 | padding: 0; 134 | } 135 | 136 | .btn-file { 137 | overflow: hidden; 138 | } 139 | 140 | .btn-file input[type=file] { 141 | top: 0; 142 | right: 0; 143 | min-width: 100%; 144 | min-height: 100%; 145 | text-align: right; 146 | opacity: 0; 147 | background: none repeat scroll 0 0 transparent; 148 | cursor: inherit; 149 | display: block; 150 | } 151 | 152 | .btn-file ::-ms-browse { 153 | font-size: 10000px; 154 | width: 100%; 155 | height: 100%; 156 | } 157 | 158 | .file-caption .file-caption-name { 159 | width: 100%; 160 | margin: 0; 161 | padding: 0; 162 | box-shadow: none; 163 | border: none; 164 | background: none; 165 | outline: none; 166 | } 167 | 168 | .file-caption.icon-visible .file-caption-icon { 169 | display: inline-block; 170 | } 171 | 172 | .file-caption.icon-visible .file-caption-name { 173 | padding-left: 15px; 174 | } 175 | 176 | .file-caption-icon { 177 | line-height: 1; 178 | left: 8px; 179 | } 180 | 181 | .file-error-message { 182 | color: #a94442; 183 | background-color: #f2dede; 184 | margin: 5px; 185 | border: 1px solid #ebccd1; 186 | border-radius: 4px; 187 | padding: 15px; 188 | } 189 | 190 | .file-error-message pre { 191 | margin: 5px 0; 192 | } 193 | 194 | .file-caption-disabled { 195 | background-color: #eee; 196 | cursor: not-allowed; 197 | opacity: 1; 198 | } 199 | 200 | .file-preview { 201 | border-radius: 5px; 202 | border: 1px solid #ddd; 203 | padding: 8px; 204 | width: 100%; 205 | margin-bottom: 5px; 206 | } 207 | 208 | .file-preview .btn-xs { 209 | padding: 1px 5px; 210 | font-size: 12px; 211 | line-height: 1.5; 212 | border-radius: 3px; 213 | } 214 | 215 | .file-preview .fileinput-remove { 216 | top: 1px; 217 | right: 1px; 218 | line-height: 10px; 219 | } 220 | 221 | .file-preview .clickable { 222 | cursor: pointer; 223 | } 224 | 225 | .file-preview-image { 226 | font: 40px Impact, Charcoal, sans-serif; 227 | color: #008000; 228 | } 229 | 230 | .krajee-default.file-preview-frame { 231 | margin: 8px; 232 | border: 1px solid #ddd; 233 | box-shadow: 1px 1px 5px 0 #a2958a; 234 | padding: 6px; 235 | float: left; 236 | text-align: center; 237 | } 238 | 239 | .krajee-default.file-preview-frame .kv-file-content { 240 | width: 213px; 241 | height: 160px; 242 | } 243 | 244 | .krajee-default.file-preview-frame .file-thumbnail-footer { 245 | height: 70px; 246 | } 247 | 248 | .krajee-default.file-preview-frame:not (.file-preview-error ):hover { 249 | box-shadow: 3px 3px 5px 0 #333; 250 | } 251 | 252 | .krajee-default .file-preview-text { 253 | display: block; 254 | color: #428bca; 255 | border: 1px solid #ddd; 256 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 257 | outline: none; 258 | padding: 8px; 259 | resize: none; 260 | } 261 | 262 | .krajee-default .file-preview-html { 263 | border: 1px solid #ddd; 264 | padding: 8px; 265 | overflow: auto; 266 | } 267 | 268 | .krajee-default .file-other-icon { 269 | font-size: 6em; 270 | } 271 | 272 | .krajee-default .file-footer-buttons { 273 | float: right; 274 | } 275 | 276 | .krajee-default .file-footer-caption { 277 | display: block; 278 | text-align: center; 279 | padding-top: 4px; 280 | font-size: 11px; 281 | color: #777; 282 | margin-bottom: 15px; 283 | } 284 | 285 | .krajee-default .file-preview-error { 286 | opacity: 0.65; 287 | box-shadow: none; 288 | } 289 | 290 | .krajee-default .file-thumb-progress { 291 | height: 11px; 292 | top: 37px; 293 | left: 0; 294 | right: 0; 295 | } 296 | 297 | .krajee-default.kvsortable-ghost { 298 | background: #e1edf7; 299 | border: 2px solid #a1abff; 300 | } 301 | 302 | .krajee-default .file-preview-other:hover { 303 | opacity: 0.8; 304 | } 305 | 306 | .krajee-default .file-preview-frame:not (.file-preview-error ) 307 | .file-footer-caption:hover { 308 | color: #000; 309 | } 310 | 311 | .kv-upload-progress .progress { 312 | height: 20px; 313 | line-height: 20px; 314 | margin: 10px 0; 315 | overflow: hidden; 316 | } 317 | 318 | .kv-upload-progress .progress-bar { 319 | height: 20px; 320 | line-height: 20px; 321 | } 322 | 323 | /*noinspection CssOverwrittenProperties*/ 324 | .file-zoom-dialog .file-other-icon { 325 | font-size: 22em; 326 | font-size: 50vmin; 327 | } 328 | 329 | .file-zoom-dialog .modal-dialog { 330 | width: auto; 331 | } 332 | 333 | .file-zoom-dialog .modal-header { 334 | display: flex; 335 | align-items: center; 336 | justify-content: space-between; 337 | } 338 | 339 | .file-zoom-dialog .btn-navigate { 340 | padding: 0; 341 | margin: 0; 342 | background: transparent; 343 | text-decoration: none; 344 | outline: none; 345 | opacity: 0.7; 346 | top: 45%; 347 | font-size: 4em; 348 | color: #1c94c4; 349 | } 350 | 351 | .file-zoom-dialog .btn-navigate:not ([disabled] ):hover { 352 | outline: none; 353 | box-shadow: none; 354 | opacity: 0.6; 355 | } 356 | 357 | .file-zoom-dialog .floating-buttons { 358 | top: 5px; 359 | right: 10px; 360 | } 361 | 362 | .file-zoom-dialog .btn-navigate[disabled] { 363 | opacity: 0.3; 364 | } 365 | 366 | .file-zoom-dialog .btn-prev { 367 | left: 1px; 368 | } 369 | 370 | .file-zoom-dialog .btn-next { 371 | right: 1px; 372 | } 373 | 374 | .file-zoom-dialog .kv-zoom-title { 375 | font-weight: 300; 376 | color: #999; 377 | max-width: 50%; 378 | overflow: hidden; 379 | white-space: nowrap; 380 | text-overflow: ellipsis; 381 | } 382 | 383 | .file-input-new .no-browse .form-control { 384 | border-top-right-radius: 4px; 385 | border-bottom-right-radius: 4px; 386 | } 387 | 388 | .file-input-ajax-new .no-browse .form-control { 389 | border-top-right-radius: 4px; 390 | border-bottom-right-radius: 4px; 391 | } 392 | 393 | .file-caption-main { 394 | width: 100%; 395 | } 396 | 397 | .file-thumb-loading { 398 | background: transparent url(../img/loading.gif) no-repeat scroll center 399 | center content-box !important; 400 | } 401 | 402 | .file-drop-zone { 403 | border: 1px dashed #aaa; 404 | border-radius: 4px; 405 | height: 100%; 406 | text-align: center; 407 | vertical-align: middle; 408 | margin: 12px 15px 12px 12px; 409 | padding: 5px; 410 | } 411 | 412 | .file-drop-zone.clickable:hover { 413 | border: 2px dashed #999; 414 | } 415 | 416 | .file-drop-zone.clickable:focus { 417 | border: 2px solid #5acde2; 418 | } 419 | 420 | .file-drop-zone .file-preview-thumbnails { 421 | cursor: default; 422 | } 423 | 424 | .file-drop-zone-title { 425 | color: #aaa; 426 | font-size: 1.6em; 427 | padding: 85px 10px; 428 | cursor: default; 429 | } 430 | 431 | .file-highlighted { 432 | border: 2px dashed #999 !important; 433 | background-color: #eee; 434 | } 435 | 436 | .file-uploading { 437 | background: url(../img/loading-sm.gif) no-repeat center bottom 10px; 438 | opacity: 0.65; 439 | } 440 | 441 | @media ( min-width : 576px) { 442 | .file-zoom-dialog .modal-dialog { 443 | max-width: 500px; 444 | } 445 | } 446 | 447 | @media ( min-width : 992px) { 448 | .file-zoom-dialog .modal-lg { 449 | max-width: 800px; 450 | } 451 | } 452 | 453 | .file-zoom-fullscreen.modal { 454 | position: fixed; 455 | top: 0; 456 | right: 0; 457 | bottom: 0; 458 | left: 0; 459 | } 460 | 461 | .file-zoom-fullscreen .modal-dialog { 462 | position: fixed; 463 | margin: 0; 464 | padding: 0; 465 | width: 100%; 466 | height: 100%; 467 | max-width: 100%; 468 | max-height: 100%; 469 | } 470 | 471 | .file-zoom-fullscreen .modal-content { 472 | border-radius: 0; 473 | box-shadow: none; 474 | } 475 | 476 | .file-zoom-fullscreen .modal-body { 477 | overflow-y: auto; 478 | } 479 | 480 | .btn-kv { 481 | display: inline-block; 482 | text-align: center; 483 | width: 30px; 484 | height: 30px; 485 | line-height: 30px; 486 | padding: 0; 487 | font-size: 90%; 488 | border-radius: 0.2rem; 489 | } 490 | 491 | .floating-buttons { 492 | z-index: 3000; 493 | } 494 | 495 | .floating-buttons .btn-kv { 496 | margin-left: 3px; 497 | z-index: 3000; 498 | } 499 | 500 | .file-zoom-content { 501 | height: 480px; 502 | text-align: center; 503 | } 504 | 505 | .file-zoom-content .file-preview-image { 506 | max-height: 100%; 507 | } 508 | 509 | .file-zoom-content .file-preview-video { 510 | max-height: 100%; 511 | } 512 | 513 | .file-zoom-content .is-portrait-gt4 { 514 | margin-top: 60px; 515 | } 516 | 517 | .file-zoom-content>.file-object.type-image { 518 | height: auto; 519 | min-height: inherit; 520 | } 521 | 522 | .file-zoom-content>.file-object.type-audio { 523 | width: auto; 524 | height: 30px; 525 | } 526 | 527 | @media screen and (max-width: 767px) { 528 | .file-preview-thumbnails { 529 | display: flex; 530 | justify-content: center; 531 | align-items: center; 532 | flex-direction: column; 533 | } 534 | .file-zoom-dialog .modal-header { 535 | flex-direction: column; 536 | } 537 | } 538 | 539 | @media screen and (max-width: 350px) { 540 | .krajee-default.file-preview-frame .kv-file-content { 541 | width: 160px; 542 | } 543 | } 544 | 545 | .file-loading[dir=rtl]:before { 546 | background: transparent url(../img/loading.gif) top right no-repeat; 547 | padding-left: 0; 548 | padding-right: 20px; 549 | } 550 | 551 | .file-sortable .file-drag-handle { 552 | cursor: move; 553 | opacity: 1; 554 | } 555 | 556 | .file-sortable .file-drag-handle:hover { 557 | opacity: 0.7; 558 | } 559 | 560 | .clickable .file-drop-zone-title { 561 | cursor: pointer; 562 | } 563 | 564 | .kv-zoom-actions .btn-kv { 565 | margin-left: 3px; 566 | } 567 | 568 | .file-preview-initial.sortable-chosen { 569 | background-color: #d9edf7; 570 | } --------------------------------------------------------------------------------