diff options
Diffstat (limited to 'warehouse/src/main/webapp/WEB-INF')
22 files changed, 3265 insertions, 0 deletions
diff --git a/warehouse/src/main/webapp/WEB-INF/pages/account/detail.jsp b/warehouse/src/main/webapp/WEB-INF/pages/account/detail.jsp new file mode 100644 index 0000000..096c6a5 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/account/detail.jsp @@ -0,0 +1,80 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + label{ + margin-top:15px; + } + /* .col-sm-4 { + margin-top:-16px; + } */ + #e_au { + height:auto; + } + .div-label{ + margin-top:-10px; + } +</style> +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" id="defaultForm"> + <div class="card-body card-change-password pt0"> + <!-- <div class="card-header"></div> --> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <div class="card-body" style="min-height:530px;"> + <form id="registerForm" class="was-validated" action = "accountList"> + <input type="hidden" id="e_userId" value="${appInfo.userId}"> + <input type="hidden" id="e_userId" value="${appInfo.userPw}"> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_userName" class="notNull">User name </label></div> + <div class="col-md-9"> + <input class="form-control" title="This field is required" placeholder="This field is required" id="e_userName" name="e_userName" type="text" value="${appInfo.userName}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_mailAddress" class="notNull">Mail address</label></div> + <div class="col-md-9"> + <input class="form-control" title="This field is required" id="e_mailAddress" placeholder="This field is required" name="e_mailAddress" type="email" value="${appInfo.mailAddress}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_au" class="notNull">Authority</label></div> + <div class="col-md-9"> + <input class="form-control" id="e_au" name="e_au" type="text" value="${appInfo.auName}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_au" class="notNull">Create date</label></div> + <div class="col-md-9"> + <input class="form-control" id="e_createDate" name="e_au" type="text" value="${createDate}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_au" class="notNull">Update date</label></div> + <div class="col-md-9"> + <input class="form-control" id="e_updateDate" name="e_au" type="text" value="${updateDate}" required disabled> + </div> + </div> + </form> + </div> + </div> + </div> + </c:otherwise> +</c:choose>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/account/list.jsp b/warehouse/src/main/webapp/WEB-INF/pages/account/list.jsp new file mode 100644 index 0000000..d6da7aa --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/account/list.jsp @@ -0,0 +1,225 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + div.dataTables_wrapper div.dataTables_info { + padding-top: 0.3em; + white-space: nowrap; + margin-left:120px; +} + a.page-link{ + height:calc(1.8125rem + 4px); + } + .styleTable{ + text-align:center; + } +</style> +<div class="alert alert-secondary" role="alert"> + <div style="display:inline-block">User</div> +</div> +<div id="mouse" style="width:200px;border:1px solid #D0D0D0;position:absolute;z-index:999;background:#F0F0F0;margin-left:180px;margin-top:-110px;display:none"> + <c:forEach var="list" items="${authorityList}"> + <option value="${list.value}" >${list.label}</option> + </c:forEach> +</div> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <div class="card mb-3"> + <div class="card-header"> + <div class=""> + <div class="row"> + <div style="display:none"> + <div class="form-group" > + <label class="control-label" for="s_createDate">CreateDate</label> + <div class="input-group date date_yyyymmdd" data-date="" data-date-format="yyyy/mm/dd" data-link-field="s_begin_06020101" data-link-format="yyyy/mm/dd"> + <input class="form-control" size="10" type="text" placeholder="please choose" readonly id="s_createDate" style="width:150px;height:38px"> + <span class="input-group-addon"><span class="glyphicon glyphicon-remove fa fa-window-close"></span></span> + <span class="input-group-addon"><span class="glyphicon glyphicon-calendar fa fa-calendar"></span></span> + </div> + <input type="hidden" id="s_begin_06020101"/> + </div> + </div> + <div class="col"> + <div class="form-group" > + <label class="control-label" for="s_authority">Authority</label> + <select id="s_authority" class="form-control"> + <c:forEach var="list" items="${authorityList}"> + <option value="${list.value}" >${list.label}</option> + </c:forEach> + </select> + </div> + </div> + <div class="col"> + <div style="position:absolute;right:20px;top:40px;cursor:pointer;display:none;" class="input_clear"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <label class="control-label" for="t_userName">KeyWord</label> + <input type="text" class="form-control style-height" id="t_keyWord" name="t_userName" placeholder="please enter"> + </div> + <div class="col" style="visibility:hidden"> + <div style="position:absolute;right:20px;top:40px;cursor:pointer;display:none;" class="input_clear"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <label class="control-label" for="t_mailAddress">MailAddress</label> + <input type="email" class="form-control style-height" id="t_mailAddress" name="s_mailAddress" placeholder="please enter"> + </div> + <div class="col" style="visibility:hidden"> + <div class="form-group"> + <label class="control-label" for="t_mailAddress">*******</label> + <input type="email" class="form-control style-height" id="t_mailAddress" name="s_mailAddress" placeholder="please enter"> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col" style="text-align:right"> + <button type="button" class="btn btn-primary pl20 pr20" id="btn-save-edit" onclick="Commons.showContent('<%=basePath%>/account/modify')">Create</button> + <button type="button" title="step2 development" class="btn btn-success pl20 pr20 ml10" id="btn-save-edit" onclick="$table.DataTable().ajax.reload();">Search</button> + </div> + </div> + </div> + <div class="card-body"> + <div class="table-responsive" id="div-table-container"> + <table id="example" class="table table-bordered hover table-striped" cellspacing="0" width="100%"> + <thead> + <tr> + <th style="text-align:left;">No.</th> + <th>UserName</th> + <th>MailAddress</th> + <th>CreateDate</th> + <th>Authority</th> + <th>Operation</th> + </tr> + </thead> + </table> + <div style="height:20px;"></div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script> +$(function() { + $("input").focus(function(){ + $(this).parent().children(".input_clear").show(); + }); + $("input").blur(function(){ + if($(this).val()==''){ + $(this).parent().children(".input_clear").hide(); + } + }); + $(".input_clear").click(function(){ + $(this).parent().find('input').val(''); + $(this).hide(); + }); + $(".card-body").css({ + minHeight:($(window).height()-500) + }) + Commons.bindDateControl(); + Commons.appendRedAsterisk(); + initTable(); + bingDateControl(); +}); + +var $table = $('#example'); +var $errorArea = $('#modalErrorArea'); + +var queryParam = function(param) { + param.orderColumn = param.order[0].column; + param.orderDir = param.order[0].dir; + param.keyWord = $('#t_keyWord').val(); + param.mailAddress = $('#t_mailAddress').val(); + param.auId = $('#s_authority').val(); + param.createDate = $('#s_createDate').val(); + return param; +}; + +function initTable() { + $table.DataTable({ + order: [[ 1, 'asc' ]], + ajax: { + url: '<%=basePath%>/account/search', + data: queryParam, + type: 'GET', + dataFilter: function(data){ + $errorArea.empty(); + $errorArea.css("display", "none"); + var json = $.parseJSON(data); + for(var i= 0;i<json.data.length;i++){ + json.data[i].createDate = Commons.format(json.data[i].createDate); + } + + if (json.statusCode && json.statusCode != null) { + $errorArea.empty().append('<div>' + json.statusText + '</div>'); + $errorArea.css("display", "block"); + } + var data = JSON.stringify(json) + return data; // return JSON string + } + }, + columns: [ + { + orderable : false, + /* style : "text-align:center", */ + class : 'styleTable', + width : '30px', + render : function(data, type, row, meta) { + return meta.row+1; + } + }, + { + data : 'userName', + width : '150px' + }, + { + data : 'mailAddress', + width : '150px' + }, + { + data : 'createDate', + width : '120px' + }, + { + data : 'auName', + orderable : false, + width : '120px' + }, + { + className : 'td-operation', + data: null, + defaultContent:'', + orderable : false, + width : '80px', + render: function(data, type, row, meta) { + var context = '<a href="javascript:void(0)" style="color:rgba(134, 142, 150, 1);" title="REVISE" onclick="Commons.showContent(\'<%=basePath%>/account/modify?isDetail=false&userId='+data.userId+'\')"><i class="fa fa-pencil" aria-hidden="true"></i></a> '; + if (data.isDel == 0){ + context += '<a href="javascript:void(0)" style="color:rgba(134, 142, 150, 1);padding:15px;" title="DELETE" class="data-delete" data-data-id="'+data.userId+'" style="margin-left:0.5em"><i class="fa fa-trash" aria-hidden="true"></i></a>'; + context += '<a href="javascript:void(0)" style="color:rgba(134, 142, 150, 1);" title="DETAIL" onclick="Commons.showContent(\'<%=basePath%>/account/modify?isDetail=true&userId='+data.userId+'\')"><i class="fa fa-search-plus" aria-hidden="true"></i></a> '; + + } + return context; + } + } + ], + drawCallback: function(settings) { + TableListDeletePlugin.init('example', '<%=basePath%>/account/search', '<%=basePath%>/account/delete'); + } + }); +} +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/account/modify.jsp b/warehouse/src/main/webapp/WEB-INF/pages/account/modify.jsp new file mode 100644 index 0000000..79937cf --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/account/modify.jsp @@ -0,0 +1,178 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + label{ + margin-top:15px; + } + /* .col-sm-4 { + margin-top:-16px; + } */ + #e_au { + height:auto; + } + .div-label{ + margin-top:-10px; + } +</style> +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" id="defaultForm"> + <div class="card-body card-change-password pt0"> + <!-- <div class="card-header"></div> --> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <div class="card-body" style="min-height:530px;"> + <div class="alert alert-danger" style="display:none" id="modalErrorArea" role="alert"></div> + <form id="registerForm" class="was-validated" action = "accountList"> + <input type="hidden" id="e_userId" value="${appInfo.userId}"> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_userName" class="notNull">User Name </label></div> + <div class="col-md-9"> + <input class="form-control style-height" maxlength="32" placeholder="Maximum length is 32 characters" id="e_userName" name="e_userName" type="text" value="${appInfo.userName}" required> + </div> + </div> + <c:if test="${empty appInfo.userId}"> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_userPw" class="notNull">Password</label></div> + <div class="col-md-9"> + <input class="form-control input-color style-height" id="e_userPw" name="e_userPw" type="password" maxlength="32" placeholder="Between 6 and 32 characters" value="${appInfo.userPw}" required> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_reuserPw" class="notNull">Password Confirmation</label></div> + <div class="col-md-9"> + <input class="form-control input-color style-height" id="e_reuserPw" name="e_reuserPw" type="password" maxlength="32" placeholder="The same as the password above" value="${appInfo.reuserPw}" required> + </div> + </div> + </c:if> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_mailAddress" class="notNull">Mail Address</label></div> + <div class="col-md-9"> + <input class="form-control input-color style-height" id="e_mailAddress" maxlength="32" placeholder="Only letters, numbers, and underlines can be used" name="e_mailAddress" value="${appInfo.mailAddress}" required> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3 div-label"><label for="e_au" class="notNull">Authority</label></div> + <div class="col-md-9"> + <select id="e_au" class="form-control" required> + <c:forEach var="list" items="${authorityList}"> + <option value="${list.value}" <c:if test="${list.value eq appInfo.auId}">selected="selected"</c:if>>${list.label}</option> + </c:forEach> + </select> + </div> + </div> + </form> + <div style="float:right" class="col-md-0"> + <button type="button" class="btn btn-primary form-btn-w-70" id="btn-save-edit" onclick="saveaccountForm()">save</button> + <%-- <button type="button" class="btn btn-cancel form-btn-w-70" Style="background-Color:gray" onclick="Commons.showContent('<%=basePath%>/account/')">back</button> --%> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> + +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function(){ + Commons.appendRedAsterisk(); + var e_userId = $('#e_userId').val(); + if(e_userId !== ""){ + $('#e_mailAddress')[0].style.border = "1px solid #28a745"; + } + $('#e_userPw').bind('input propertychange', function() { + if($('#e_userPw').val().length > 5 ){ + $('#e_userPw')[0].style.border = "1px solid #28a745"; + }else{ + $('#e_userPw')[0].style.border = "1px solid red"; + } + }); + $('#e_reuserPw').bind('input propertychange', function() { + if($('#e_reuserPw').val().length > 5 ){ + $('#e_reuserPw')[0].style.border = "1px solid #28a745"; + }else{ + $('#e_reuserPw')[0].style.border = "1px solid red"; + } + }); + $('#e_mailAddress').bind('input propertychange', function() { + var szReg=/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; + + if(!szReg.test($('#e_mailAddress').val())){ + $('#e_mailAddress')[0].style.border = "1px solid red"; + }else{ + $('#e_mailAddress')[0].style.border = "1px solid #28a745"; + } + }); +}); +var accountForm = function() { + this.userId = ''; + this.userPw = ''; + this.userName = ''; + this.auId = ''; + this.mailAddress = ''; + this.userPw = ''; + this.reuserPw = ''; +}; + +var $errorArea = $('#modalErrorArea'); +var saveaccountForm = function() { + $("#btn-save-edit").attr('disabled',true); + $errorArea.empty(); + $errorArea.css("display", "none"); + var tf = new accountForm(); + tf.userId = $('#e_userId').val(); + tf.reuserPw = $('#e_reuserPw').val(); + tf.userPw = $('#e_userPw').val(); + tf.userName = $('#e_userName').val(); + tf.auId = $('#e_au').val(); + tf.mailAddress = $('#e_mailAddress').val(); + + $.ajax({ + url: '<%=basePath%>/account/update', + cache: false, + type: 'POST', + data: {form: JSON.stringify(tf)}, + success: function (data) { + var json = JSON.parse(data); + if(200 == json.result) { + Commons.showContent('<%=basePath%>' + json.forward); + } else if(401 == json.result) { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + $("#btn-save-edit").attr('disabled',false); + } else if(500 == json.result) { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + $("#btn-save-edit").attr('disabled',false); + } + } + }); + /* } + } */ +}; +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/checkAppInfo.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/checkAppInfo.jsp new file mode 100644 index 0000000..3e9e015 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/checkAppInfo.jsp @@ -0,0 +1,115 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> +<style type="text/css"> + .triangle{width:0;height:0;border-right:25px solid transparent;border-left:25px solid #0080FF;border-bottom:25px solid transparent;border-top:25px solid transparent;} + .rectangle{height:50px;font-size:20px;background:#0080FF;color:white} + .box{height:50px;border-style:solid; border-width:1px; border-color:#F0F0F0;text-align:center;line-height:50px;color:white;} + .center_div{border-style:solid; border-width:1px; border-color:white;border-top:none;border-bottom:none;} + .space{background:#FFFFFF;width:5px;position:relative;margin-left:-5px;} + .create-schedule{border:2px solid #E0E0E0;} + .create-scheduling{border:2px solid #29e62d;} +</style> +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div id="page-content" style="height:auto;"> + <div class="col-md-12 box"> + <div class="form-group row"> + <img src="image/insertAppSubmit.PNG" style="height:100%;width:100%"/> + </div> + <div class="form-group row" style="margin-top:-15px"> + <div class="col-md-4 create-schedule"></div> + <div class="col-md-4 create-schedule"></div> + <div class="col-md-4 create-scheduling"></div> + </div> + </div> + <div class="row"> + <div class="col-md-12 col-md-offset-12"> + <div id="main-content" style="min-height:520px;height:100%;width:100%;"> + <article> + <div class="art-content" style="min-height:480px;height:100%;width:auto;margin-left:45px;margin-right:45px;word-break: break-all; word-wrap:break-word;"> + <input id="t_typeId" type="hidden" value="${appInfo.typeId}"> + <input id="t_appId" type="hidden" value="${appInfo.appId}"> + <input id="t_filePath" type="hidden" value="${appInfo.verFilePath}"> + <input id="t_developer" type="hidden" value="${appInfo.developer}"> + <input id="iconPath" type="hidden" value="${appInfo.imagePath}"> + <br> + <p style="font-size:25px;margin-left:-20px;margin-top:10px;">Submission of audit</p> + <h4>${appInfo.appName}</h4> + <table> + <tr> + <td rowspan="3" valign="top" style="width:130px"><img id="imagePath" src="${appInfo.imagePath}" style="width:120px;height:120px"/></td> + <td>By <a style="color:#00D096" href="#">${appInfo.developerName}</a> ${date}<br>${appInfo.versionName}<br>${appInfo.typeName}<br>${appInfo.appDeviceTypeName}<br>${appInfo.appIdCustom}</td> + </tr> + <tr><td></td></tr> + <tr><td></td></tr> + </table> + <div id="appAbstract" class="col-md-12" style="margin-left:-15px">${appInfo.appAbstract}</div> + <div style="float:right;margin-top:30px;" class="col-md-0"> + <button type="button" class="btn btn-primary" id="btn-save-edit" onclick="saveAppForm()">SUBMIT</button> + </div> + </div> + </article> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function() { + <%-- if($('#iconPath').val() == ''){ + $('#imagePath').attr("src",'<%=basePath%>/image/defaultAppIcon.png'); + } --%> + // TODO DJ 暂时放置,等上传功能好用之后再对应,猜想textarea上传后,数据库会把回车空格之类的给替换掉。 + var abstractSubStr = document.getElementById("appAbstract").innerHTML; + var reg=new RegExp("\r\n","g"); + var reg1=new RegExp("\n","g"); + var abstractSubStr= abstractSubStr.replace(reg,"<br>"); + abstractSubStr= abstractSubStr.replace(reg1,"<br>"); + document.getElementById("appAbstract").innerHTML = abstractSubStr; +}); +var saveAppForm = function(){ + var appId = $('#t_appId').val(); + $.ajax({ + url: '<%=basePath%>/app/check?appId='+appId, + cache: false, + type: 'GET', + async:true, + processData:false, + contentType:false, + data: '', + success: function (data) { + var json = JSON.parse(data); + if(200 == json.result) { + Commons.showContent('<%=basePath%>/' + json.forward); + } else if(401 == json.result) { + $errorArea.empty().append('<div>' + json.message[i] + '</div>'); + $errorArea.css("display", "block"); + } else { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + /*错误信息处理*/ + } + }); +}; +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/createApp.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/createApp.jsp new file mode 100644 index 0000000..d323d2e --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/createApp.jsp @@ -0,0 +1,112 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + #e_appTypeId {height:auto;} + .box{height:50px;border-style:solid; border-width:1px; border-color:#F0F0F0;text-align:center;line-height:50px;color:white;} + .device_type{position: relative;left:7%;width:950px;} + .style_button{width:300px;height:100px;margin-top:10px;margin-left:10px;white-space: normal;font-size:20px;} + .file-btn{z-index:0;filter:alpha(opacity=1);opacity:0.8;} + #e_position{z-index:100;} + .create-schedule{border:2px solid #E0E0E0;} + .create-scheduling{border:2px solid #29e62d;} +</style> +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" style="height:auto;"> + <div class="col-md-12 box"> + <div class="form-group row" > + <img src="image/insertAppCreate.PNG" style="height:100%;width:100%"/> + </div> + <div class="form-group row" style="margin-top:-15px"> + <div class="col-md-4 create-scheduling"></div> + <div class="col-md-4 create-schedule"></div> + <div class="col-md-4 create-schedule"></div> + </div> + </div> + <div class="card-body card-change-password pt0"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <p style="font-size:25px;margin-top:10px;">Choose device type</p> + <div class="form-group row device_type"> + <c:forEach var="list" items="${appDeviceTypeList}"> + <div id="e_deviceTypeId" class="btn btn-info style_button" style="line-height:80px;" onclick="saveAppForm(${list.value})">${list.label}</div> + </c:forEach> + </div> + </div> + </div> + </c:otherwise> +</c:choose> + +<script src="<%=basePath%>/js/constant.js"></script> +<script> +var $errorArea = $('#modalErrorArea'); +var appForm = function() { + this.appDeviceTypeId = ''; +}; + +var saveAppForm = function(value) { + $("#e_deviceTypeId").attr('disabled',true); + var tf = new appForm(); + tf.appDeviceTypeId = value; + var formData = new FormData(); + formData.append("form", JSON.stringify(tf)); + + try { + $.ajax({ + url: '<%=basePath%>/app/createApp', + cache: false, + type: 'POST', + async:true, + processData:false, + contentType:false, + data: formData, + success: function (data) { + var json = JSON.parse(data); + if(200 == json.result) { + Commons.showContent('<%=basePath%>' + json.forward+'?appId='+json.message.appId+'&modifyFlag='+0); + } else if(401 == json.result) { + $("#btn-save-edit").attr('disabled',false); + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + } else{ + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + $("#btn-save-edit").attr('disabled',false); + } + + }, + error: function (jqXHR, textStatus, errorThrown) { + /*错误信息处理*/ + } + }); + } catch(e) { + console.log(e); + } +}; + +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/list.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/list.jsp new file mode 100644 index 0000000..c4064e9 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/list.jsp @@ -0,0 +1,393 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% + +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> +<style type="text/css"> + div.dataTables_wrapper div.dataTables_info { + padding-top: 0.3em; + white-space: nowrap; + margin-left:120px; +} + a.page-link{ + height:calc(1.8125rem + 4px); + margin-left:-5px; + } + +</style> +<div class="alert alert-secondary container" role="alert"> + <div style="display:inline-block">App</div> +</div> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3"> + <div class="card-header"> + <div class=""> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <input type="text" class="form-control" id="t_filePath" size="16" name="t_filePath" style="display:none;"> + <div class="row" > + <div class="col"> + <div class="form-group"> + <label class="control-label" for="t_appTypeId">AppType</label> + <select id="t_appTypeId" class="form-control"> + <c:forEach var="list" items="${appTypeList}"> + <option value="${list.value}">${list.label}</option> + </c:forEach> + </select> + </div> + </div> + <div class="col" > + <div class="form-group"> + <label class="control-label" for="t_appDeveloper">DeviceType</label> + <select id="e_deviceTypeId" class="form-control"> + <c:forEach var="list" items="${appDeviceTypeList}"> + <option value="${list.value}">${list.label}</option> + </c:forEach> + </select> + </div> + </div> + <div class="col"> + <div style="position:absolute;right:20px;top:40px;cursor:pointer;display:none;" class="input_clear"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <label class="control-label" for="t_keyWord">KeyWord</label> + <input type="text" class="form-control style-height" id="t_keyWord" size="16" name="t_keyWord" placeholder="please enter"> + </div> + <div class="col" style="visibility:hidden"> + <div style="position:absolute;right:20px;top:40px;cursor:pointer;display:none;" class="input_clear"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + </div> + <label class="control-label" for="t_appName">Developer</label> + <input type="text" class="form-control style-height" id="t_appDeveloper" name="t_appDeveloper" size="16" placeholder="please enter"> + </div> + </div> + </div> + <div class="row"> + <div class="col" style="text-align:right;"> + <c:if test="${fn:contains(menuPathString, 'app/insert')}"> + <button type="button" class="btn btn-primary pl20 pr20" id="btn-save-edit" onclick="Commons.showContent('<%=basePath%>/app/initCreate')">Create</button> + </c:if> + <button type="button" class="btn btn-success pl20 pr20 ml10" id="listSearch" onclick="search()">Search</button> + <button id="gridView" type="button" class="btn btn-info pl20 pr20 ml10" onclick="chageView(1)" style="float:right">gridView</button> + <button id="listView" type="button" class="btn btn-info pl20 pr20 ml10" onclick="chageView(0)" style="float:right">listView</button> + </div> + </div> + </div> + <div class="card-body" style="margin-left:12px;margin-right:12px;"> + <div class="table-responsive" id="div-table-container"> + <table id="example" cellspacing="0" style="width:100%;"> + <thead> + </thead> + </table> + <div style="height:20px;"></div> + </div> + <div id="grid"> + <div id="chunk" class="row"></div> + </div> + <div style="display: none;" id="page"> + <div class="row"> + <div class="col-md-6" style="text-align:right"> + <button id="last" type="button" class="btn btn-primary" + onclick="chunk(0)"><h4 style="color:white"><</h4></button> + </div> + <div class="col-md-6"> + <button id="next" type="button" class="btn btn-primary" + onclick="chunk(1)"><h4 style="color:white">></h4></button> + </div> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script src="<%=basePath%>/js/main.js"></script> +<script src="<%=basePath%>/js/jquery.cookie.js"></script> +<script> + +$(function() { + $("#listView").css('display','none'); + $("input").focus(function(){ + $(this).parent().children(".input_clear").show(); + }); + $("input").blur(function(){ + if($(this).val()==''){ + $(this).parent().children(".input_clear").hide(); + } + }); + $(".input_clear").click(function(){ + $(this).parent().find('input').val(''); + $(this).hide(); + }); + + $(".card-body").css({ + minHeight:($(window).height()-500) + }) + Commons.bindDateControl(); + Commons.appendRedAsterisk(); + init(); +}); + +var $table = $('#example'); +var $errorArea = $('#modalErrorArea'); +var queryParam = function(param) { + param.orderColumn = param.order[0].column; + param.orderDir = param.order[0].dir; + param.keyWord = $('#t_keyWord').val(); + param.typeId = $('#t_appTypeId').val(); + param.deviceTypeId = $('#e_deviceTypeId').val(); + param.filepath = $('#t_filePath').val(); + return param; +}; + + var strSub = function(str, subLen){ + if(str == null){ + return ""; + } + var subStr = str; + var len = 0; + for (var i=0; i<str.length; i++) { + if (str.charCodeAt(i)>127 || str.charCodeAt(i)==94) { + len += 2; + } else { + len ++; + } + if(len >= subLen){ + subStr = str.substring(0, i); + break; + } + } + return subStr; +}; + +var strName = function(str, subLen){ + if (str == null){ + return ""; + } + if (str.length > subLen) { + str=str.substring(0,subLen-3); + var appName = str+"..."; + }else{ + var appName = str; + } + return appName; +}; +function init(){ + var flag = $.cookie('flag'); + if(flag == 1){ + chunk(); + }else{ + initTable(); + } +} + +function search(){ + var flag = getCookie("flag"); + if(flag == 1){ + chunk(); + }else{ + $table.DataTable().ajax.reload(); + } +} + +function setCookie(key,value){ + $.cookie(key, value, { expires: 7 ,path:'/'}); +} + +function getCookie(key){ + return $.cookie(key); +} + +function lastPageButton(start){ + if(start == 0){ + $("#last").attr('disabled',true); + }else{ + $("#last").attr('disabled',false); + } +} + +function nextPageButton(i,length){ + if(i < length){ + $("#next").attr('disabled',true); + }else{ + $("#next").attr('disabled',false); + } +} +var check = 0; +function chageView(value){ + if(value == 0){ + if(check == 1){ + $table.DataTable().ajax.reload(); + }else{ + initTable(); + } + }else{ + chunk(); + } +} + +//chunkList +var nowStart = 0; +function chunk(page){ + var start = 0; + var length = 48; + // last page + if(page == 0){ + start = nowStart - length; + } + // next page + if(page == 1){ + start = nowStart + length; + } + nowStart = start; + + $("#div-table-container").css('display','none'); + $("#gridView").css('display','none'); + $("#grid").css('display','block'); + $("#page").css('display','block'); + $("#listView").css('display','block'); + setCookie("flag",1); + var keyWord = $('#t_keyWord').val(); + var appTypeId = $('#t_appTypeId').val(); + var deviceTypeId = $('#e_deviceTypeId').val(); + + $.ajax({ + url: '<%=basePath%>/app/search', + data: { "draw":"1","length":length,"start":nowStart,"orderColumn":"1","orderDir":"asc","typeId":appTypeId,"deviceTypeId":deviceTypeId,"keyWord":keyWord}, + type: 'GET', + dataFilter: function(data){ + $errorArea.empty(); + $errorArea.css("display", "none"); + $("#chunk").empty(); + var json = $.parseJSON(data); + debugger; + if (json.statusCode && json.statusCode != null) { + $errorArea.empty().append('<div>' + json.statusText + '</div>'); + $errorArea.css("display", "block"); + } + var i = 0; + $.each(json.data, function(index, item){ + i++; + var imagePath = '<%=ippath%>'+item.imagePath; + if(item.imagePath == ''){ + imagePath = '<%=basePath%>/image/defaultAppIcon.png'; + } + var appName = strName(item.appName, 16); + var a = '<div class="col-md-3" style="height:340px;padding: 12px;">' + +'<div onclick="Commons.showContent(\'<%=basePath%>/app/more?appId='+ item.appId+ '\')" style="border-radius:3px;padding:18px; border:1px solid #BEBEBE;background:#F0F0F0; cursor:pointer;box-shadow: darkgrey 1px 1px 30px 0px">' + + '<div style="height:190px;width:100%;border:1px solid #BEBEBE">' + + '<img style="height:100%; width:100%;border-radius:3px;box-shadow:0px 0px 10px 0px darkgrey inset" src='+imagePath+'>' + +'</div>' + + '<h6 style="margin-bottom:5px; margin-top:10px">'+ appName + '</h5>' + + '<p style="margin-bottom:2px; color:#111">'+ item.appDeviceTypeName + '</p>' + + '<p style="margin-bottom:0px; color:#111">'+ item.typeName+ '</p>' + +'</div>' + +'</div>'; + $("#chunk").append(a); + }); + lastPageButton(start); + nextPageButton(i, length) + } + }) +} +function initTable() { + check = 1; + $table.DataTable({ + order: [[ 1 , 'asc' ]], + displayLength:50, + ajax: { + url: '<%=basePath%>/app/search', + data: queryParam, + type: 'GET', + dataFilter: function(data){ + $("#div-table-container").css('display','block'); + $("#gridView").css('display','block'); + $("#grid").css('display','none'); + $("#page").css('display','none'); + $("#listView").css('display','none'); + setCookie("flag",0); + + $errorArea.empty(); + $errorArea.css("display", "none"); + var json = $.parseJSON(data); + debugger; + if (json.statusCode && json.statusCode != null) { + $errorArea.empty().append('<div>' + json.statusText + '</div>'); + $errorArea.css("display", "block"); + } + return data; // return JSON string + } + }, + columns: [ + { + className : 'td-operation', + data: null, + defaultContent:'', + orderable : false, + width : '100%', + render: function(data, type, row, meta) + { + var deleteBtn = ''; + var modifyBtn = ''; + var imagePath = '<%=ippath%>' + data.imagePath; + if($('#auId').val() == 1 || ($('#auId').val() == 2 && data.developer == $('#userId').val())){ + deleteBtn = '<a href="javascript:void(0)" style="margin-left:0.5em" class="data-delete" data-data-id="'+data.appId+'">' + +'<button type="button" style="margin-right:auto;" class="btn btn-skin">    Delete    </button></a>'; + modifyBtn = '<a style="margin-left:0.5em" onclick="Commons.showContent(\'<%=basePath%>/app/initInfo?appId='+data.appId+'&modifyFlag='+1+'\')" >' + +'<button type="button" class="btn btn-skin"> Modify </button></a>'; + } + //default image + if(data.imagePath == ''){ + imagePath = '<%=basePath%>/image/defaultAppIcon.png'; + } + + var downloadBtn = '<a href="<%=basePath%>/app/download?appId=' + data.appId + '&typeId=' + data.typeId + '&filePath='+ data.verFilePath + '&token=' + $("#tokenAuthorization").val() + + '"onclick="">'+'<button type="button" style="margin-right:auto;" class="btn btn-skin">DownLoad</button></a>'; + var abstractSubStr = strSub(data.appAbstract, 300); + var date = new Date(data.createDate).format("yyyy-MM-dd"); + + var context = '<article><div style="width:100%; height:100%;border-bottom:1px solid black; word-break: break-all; word-wrap:break-word; padding:20px">' + +'<div class="art-header"><h2 style="margin-top:10px;">'+data.appName+'</h2></div>' + +'<div class="info" >By <a>'+data.developerName+'</a> '+ date +'</div>' + +'<div class="art-content">' + +'<img style="height:120px;width:120px" src=' + imagePath + '>' + +'<div class="ellipsis4" style="color:#272727">'+data.appAbstract+'</div>' + +'<a href="javascript:void(0)" style="color:#1ECD97; padding:8px" onclick="Commons.showContent(\'<%=basePath%>/app/more?appId='+data.appId+'\')">MORE</a>'+'</div>' + +'<div class="art-header" style="color:#ADADAD;"> MD5:<a>'+data.hashcode+'</a></div>' + +'<div class="art-footer">' + downloadBtn + deleteBtn + modifyBtn + ' </div>' + +'</div></article>'; + return context; + } + }, + { + data: null, + defaultContent:'', + orderable : false, + width : '1px', + render: function(data, type, row, meta) { + return null; + } + } + ], + drawCallback: function(settings) { + TableListDeletePlugin.init('example', '<%=basePath%>/app/search', '<%=basePath%>/app/delete'); + $(window).scrollTop(0); + } + }); +} +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/modify.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/modify.jsp new file mode 100644 index 0000000..57c8d20 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/modify.jsp @@ -0,0 +1,85 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> +<style type="text/css"> +.btn-float{ + float:left; + margin-left:5px; +} +</style> + +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div id="page-content" class="index-page container" style="background:#F0F0F0;"> + <div class="row"> + <div class="col-md-12 col-md-offset-12"> + <div id="main-content" style="min-height:520px;height:100%;width:100%;"> + <article> + <div class="art-content" style="min-height:480px;height:100%;width:auto;margin-left:45px;margin-right:45px;word-break: break-all; word-wrap:break-word;"> + <input id="t_typeId" type="hidden" value="${appInfo.typeId}"> + <input id="t_appId" type="hidden" value="${appInfo.appId}"> + <input id="t_filePath" type="hidden" value="${appInfo.verFilePath}"> + <input id="iconPath" type="hidden" value="${appInfo.imagePath}"> + <div style="display:none"> + <input id="t_developer" type="text" value="${appInfo.developer}"> + </div> + + <h2>${appInfo.appName}</h2> + <table> + <tr> + <td rowspan="3" valign="top" style="width:130px"><img id="imagePath" src="${appInfo.imagePath}" style="width:120px;height:120px"/></td> + <td>By ${appInfo.developerName} ${date}<br>${appInfo.versionName}<br>${appInfo.typeName}<br>${appInfo.appDeviceTypeName}<br></td> + </tr> + <tr><td></td></tr> + <tr><td></td></tr> + </table><input id="iconPath" type="hidden" value="${appInfo.imagePath}"> + <div id="appAbstract" class="col-md-12" style="margin-left:-15px">${appInfo.appAbstract}</div><br> + <div style="color:#ADADAD; margin: 0px 0px 10px 0px;">MD5:<a>${appInfo.hashcode}</a></div> + <div class="btn-float"> + <a href="<%=basePath%>/app/download?appId=${appInfo.appId}&typeId=${appInfo.typeId}&filePath=${appInfo.verFilePath}&token=${token}"> + <button type="button" class="btn btn-skin"> DownLoad</button></a> + </div> + <div id="modifyBtn" style="display:none;" class="btn-float"> + <a onclick="Commons.showContent('<%=basePath%>/app/initInfo?appId=${appInfo.appId}&modifyFlag=2')" > + <button type="button" id="modify" class="btn btn-skin"> Modify </button></a> + </div> + </div> + </div> + </article> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function() { + var developer = $('#t_developer').val(); + if($('#auId').val() == 1 || developer == $('#userId').val()){ + $("#modifyBtn")[0].style.display='block'; + } + if($('#iconPath').val() == ''){ + $('#imagePath').attr("src",'<%=basePath%>/image/defaultAppIcon.png'); + } + // TODO DJ 暂时放置,等上传功能好用之后再对应,猜想textarea上传后,数据库会把回车空格之类的给替换掉。 + var abstractSubStr = document.getElementById("appAbstract").innerHTML; + var reg=new RegExp("\r\n","g"); + var reg1=new RegExp("\n","g"); + var abstractSubStr= abstractSubStr.replace(reg,"<br>"); + abstractSubStr= abstractSubStr.replace(reg1,"<br>"); + document.getElementById("appAbstract").innerHTML = abstractSubStr; +}); + +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/saveAppInfo.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/saveAppInfo.jsp new file mode 100644 index 0000000..51ca352 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/saveAppInfo.jsp @@ -0,0 +1,348 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> +<style type="text/css"> + #e_appTypeId {height:auto;} + .box{height:50px;border-style:solid; border-width:1px; border-color:#F0F0F0;text-align:center;line-height:50px;color:white;} + .file-btn{z-index:0;filter:alpha(opacity=1);opacity:0.8;} + #e_position{z-index:100;} + .create-schedule{border:2px solid #E0E0E0;} + .create-scheduling{border:2px solid #29e62d;} +</style> +<!-- navigationDialog dialog --> +<jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" style="height:auto;"> + <!-- <div style="margin-left:10px;width:98%"> --> + <div class="col-md-12 box"> + <div class="form-group row"> + <img src="image/insertAppDetails.PNG" style="height:100%;width:100%"/> + </div> + <div class="form-group row" style="margin-top:-15px;"> + <div class="col-md-4 create-scheduling" ></div> + <div class="col-md-4 create-schedule" ></div> + <div class="col-md-4 create-schedule" ></div> + </div> + </div> + <div class="card-body card-change-password pt0"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <p style="font-size:25px;margin-top:10px;">Fill in information</p> + <div class="card-body"> + <div class="alert alert-danger;"style="display:none" id="modalErrorArea" role="alert"></div> + <form id="registerForm" class="was-validated"> + <input type="hidden" id="e_deviceTypeId" value="${appInfo.appDeviceTypeId}"> + <input type="hidden" id="e_hashcode" value="${appInfo.hashcode}"> + <input type="hidden" id="e_verFilePath" value="${appInfo.verFilePath}"> + <input type="hidden" id="e_appSize" value="${appInfo.appSize}"> + <input type="hidden" id="e_appVersionId" value="${appInfo.appVersionId}"> + <input type="hidden" id="e_imagePath" value="${appInfo.imagePath}"> + <div class="form-group row"> + <div class="col-md-3"><label for="e_uuId" class="notNull">UUID</label></div> + <div class="col-md-9"> + <input class="form-control style-height" id="e_uuId" name="e_uuId" title="This field is required" maxlength="32" type="text" placeholder="" value="${appInfo.appId}" required disabled> + </div> + </div> + <c:if test="${empty appInfo.appIdCustom}"> + <div class="form-group row"> + <div class="col-md-3 "><label for="e_position" class="notNull">App File</label></div> + <div class="col-md-2 file-box" id="upload" style="display:block"> + <input type="button" class="btn btn-success" value="UPLOAD" style="height:50px;width:150px;padding:0px;position:absolute;top:-10px;"> + <input title="This field is required" id="path" name="position" type="file" style="height:50px;width:150px;padding:0px;position:absolute;top:-10px;opacity:0;" class="form-control file-btn" value="${appInfo.verFilePath}" accept=".wgt" onchange="change(event)" required> + </div> + + <div class="col-md-2 file-box" id="uploading" style="display:none"> + <input type="button" class="btn btn-success" value="UPLOADING......" style="height:50px;width:150px;padding:0px;position:absolute;top:-10px;background:#ADADAD"> + <input title="This field is required" id="path" name="position" type="file" style="height:50px;width:150px;padding:0px;position:absolute;top:-10px;opacity:0;" class="form-control file-btn" value="${appInfo.verFilePath}" accept=".wgt" onchange="change(event)" required> + </div> + </div> + </c:if> + <div class="form-group row"> + <div class="col-md-3"><label for="e_appId" class="notNull">App Id</label></div> + <div class="col-md-9"> + <input class="form-control style-height" id="e_appId" name="e_appId" title="This field is required" type="text" value="${appInfo.appIdCustom}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3"><label for="e_versionName" class="notNull">Version</label></div> + <div class="col-md-9"> + <input class="form-control style-height" id="e_versionName" title="This field is required" name="e_versionName" type="text" value="${appInfo.versionName}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3"><label for="e_appName" class="notNull">App Name</label></div> + <div class="col-md-9"> + <input class="form-control style-height" id="e_appName" name="e_appName" title="This field is required" type="text" placeholder="" value="${appInfo.appName}" required disabled> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3"><label for="e_isPublicName" class="notNull">App Is Public</label></div> + <div class="col-md-9"> + <select id="e_isPublicName" class="form-control" required> + <c:forEach var="list" items="${appIsPublicList}"> + <option value="${list.value}" <c:if test="${list.value eq appInfo.appIsPublic}">selected="selected"</c:if>>${list.label}</option> + </c:forEach> + </select> + </div> + </div> + <div class="form-group row" > + <div class="col-md-3 "><label for="e_appTypeId" class="notNull">App Type</label></div> + <div class="col-md-9"> + <select id="e_appTypeId" class="form-control" required> + <c:forEach var="list" items="${appTypeList}"> + <option value="${list.value}" <c:if test="${list.value eq appInfo.typeId}">selected="selected"</c:if>>${list.label}</option> + </c:forEach> + </select> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3" style="margin-top:65px;"><label for="e_appAbstract" class="notNull">App Description</label></div> + <div class="col-md-9"> + <textarea class="form-control" title="This field is required" maxlength="800" placeholder="Maximum length is 800 characters." id="e_appAbstract" name="e_appAbstract" style="height:150px;" rows="8" cols="40" required>${appInfo.appAbstract}</textarea> + </div> + </div> + <div class="form-group row"> + <div class="col-md-3"><label style="margin-top:35px;" for="e_thumbnail" class="notNull">App Icon</label></div> + <div class="col-md-9"> + <img id="e_iconPath" src="${appInfo.imagePath}" style="width: 150px; height:150px;border:#ADADAD 1px solid"/><br> + <input onchange="changeImg(event,'e_iconPath')" type="file" style="width:150px;height:150px;margin-top:-150px;position: absolute; opacity:0;"> + </div> + </div> + </form> + <div style="float:right;" class="col-md-0"> + <button type="button" class="btn btn-primary form-btn-w-70" id="btn-save-edit" onclick="saveAppForm()">Save</button> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> + +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function(){ + Commons.bindDateControl(); + Commons.appendRedAsterisk(); + blobData=null; + filename=null; + if($('#e_imagePath').val() == ''){ + $('#e_iconPath').attr("src",'<%=basePath%>/image/addPic.png'); + } +}); +var load = function(event){ + var load = document.getElementById("path"); + var index=load.value.lastIndexOf("\_"); + load.value=load.value.substring(index+1,load.value.length); + return load.value; +} + +var blobData, filename; +var change = function (event) { + file = event.target.files[0]; + var fileReader = new FileReader(); + fileReader.readAsArrayBuffer(file); + var toBlob = function(a){ + return new Blob([a],{type:file.type}) + } + + fileReader.onload = function(){ + var result = this.result; + var blob = new Blob([result],{type:file.type}); + blobData = blob; + filename = file.name; + saveUpload(); + } +} + +var $errorArea = $('#modalErrorArea'); +var appForm = function() { + this.developer = ''; + this.typeId = ''; + this.appName = ''; + this.verFilePath = ''; + this.versionName = ''; + this.appAbstract = ''; + this.appId = ''; + this.appVersionId = ''; + this.appIsPublic = ''; +}; +var saveUpload = function() { + $("#btn-save-edit").attr('disabled',true); + $("#upload")[0].style.display = "none"; + $("#uploading")[0].style.display = "block"; + var tf = new appForm(); + tf.appId = $('#e_uuId').val(); + tf.appDeviceTypeId = $('#e_deviceTypeId').val(); + if( filename == null){ + tf.verFilePath = load(); + }else{ + tf.verFilePath = filename; + } + var formData = new FormData(); + formData.append("file", blobData); + formData.append("form", JSON.stringify(tf)); + + try { + $.ajax({ + url: '<%=basePath%>/app/uploadFile', + cache: false, + type: 'POST', + async:true, + processData:false, + contentType:false, + data: formData, + success: function (data) { + $("#btn-save-edit").attr('disabled',false); + var json = JSON.parse(data); + if(200 == json.result) { + Commons.showContent('<%=basePath%>' + json.forward); + $('#e_hashcode').attr("value",json.message.fileHashCode); + $('#e_appId').attr("value",json.message.configAppId); + $('#e_versionName').attr("value",json.message.configVersionName); + $('#e_verFilePath').attr("value",json.message.filePath); + $('#e_appName').attr("value",json.message.configAppName); + $('#e_iconPath').attr("src",'<%=ippath%>'+json.message.iconPath); + $('#e_imagePath').attr("value",json.message.iconPath); + $('#e_appSize').attr("value",json.message.fileSize); + if($('#e_imagePath').val() == ''){ + $('#e_iconPath').attr("src",'<%=basePath%>/image/addPic.png'); + } + blobData=""; + filename=""; + $errorArea.css("display", "none"); + } else if(401 == json.result) { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + $("#btn-save-edit").attr('disabled',true); + } else if(500 == json.result) { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + $("#btn-save-edit").attr('disabled',true); + } + $("#upload")[0].style.display = "block"; + $("#uploading")[0].style.display = "none"; + }, + error: function (jqXHR, textStatus, errorThrown) { + /*错误信息处理*/ + } + }); + } catch(e) { + console.log(e); + } +}; +//image +function changeImg(e,name) { + $errorArea.empty(); + $errorArea.css("display", "none"); + for (var i = 0; i < e.target.files.length; i++) { + var file = e.target.files.item(i); + if (!(/^image\/.*$/i.test(file.type))) { + //isImage + $errorArea.empty().append('<div>' + 'You can upload pictures only.' + '</div>'); + $errorArea.css("display", "block"); + } else if(file.size > (500*1024)){ + //image size + $errorArea.empty().append('<div>' + 'The picture sizes should not exceed 500KB.' + '</div>'); + $errorArea.css("display", "block"); + } else{ + //FileReader API + var freader = new FileReader(); + blobData = file; + freader.readAsDataURL(file); + freader.onload = function (e) { + var result = this.result; + var blob = new Blob([result],{type:file.type}); + $("#e_iconPath").attr("src",e.target.result); + } + } + } +} +var saveAppForm = function() { + $("#btn-save-edit").attr('disabled',true); + var tf = new appForm(); + tf.appId = $('#e_uuId').val(); + tf.appDeviceTypeId = $('#e_deviceTypeId').val(); + tf.versionName = $('#e_versionName').val(); + tf.typeId = $('#e_appTypeId').val(); + tf.appName = $('#e_appName').val(); + tf.appAbstract = $('#e_appAbstract').val(); + tf.appIsPublic = $('#e_isPublicName').val(); + tf.hashcode = $('#e_hashcode').val(); + tf.verFilePath = $('#e_verFilePath').val(); + tf.imagePath = $('#e_imagePath').val(); + tf.appIdCustom = $('#e_appId').val(); + tf.appSize = $('#e_appSize').val(); + tf.appVersionId = $('#e_appVersionId').val(); + var formData = new FormData(); + formData.append("file", blobData); + formData.append("form", JSON.stringify(tf)); + + try { + $.ajax({ + url: '<%=basePath%>/app/saveInfo', + cache: false, + type: 'POST', + async:true, + processData:false, + contentType:false, + data: formData, + success: function (data) { + var json = JSON.parse(data); + if(200 == json.result) { + Commons.showContent('<%=basePath%>/' + json.forward+'?appId='+json.message.appId); + blobData=null; + } else if(401 == json.result) { + $("#btn-save-edit").attr('disabled',false); + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + } else { + $("#btn-save-edit").attr('disabled',false); + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + $errorArea.css("display", "block"); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + /*错误信息处理*/ + } + }); + } catch(e) { + console.log(e); + } +}; +var upload = function() { + $('#path').click(); +}; +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/app/type.jsp b/warehouse/src/main/webapp/WEB-INF/pages/app/type.jsp new file mode 100644 index 0000000..b06ea2e --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/app/type.jsp @@ -0,0 +1,288 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<% + String path = request.getContextPath(); + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + + path; + String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> +<style type="text/css"> +.vBtn { + font-size: 30px; + margin-top: -40px; + float: right; + text-align: center; + background: none; + border: none; + color: gray; +} + +.div3D { + box-shadow: 0px 0px 4px #000; + background: #FFFFFF; + border-radius: 5px; +} + +.hr { + height: 1px; + border: none; + border-top: 1px solid #E0E0E0; +} + +.cr-link-row { + cr-link-row-icon-width: 40px; + border-top: var(- -settings-separator-line); +} +</style> + +<div class="alert alert-secondary container" role="alert"> + <div style="display: inline-block">Setting</div> +</div> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert">${modelErrors}</div> + </c:when> + <c:otherwise> + <input type="hidden" id="appTypeList" value="${appTypeList}"> + <div id="page-content" class="index-page container"> + <div style="margin-left: 100px;"> + <div class="col-md-4" style="margin-left: -50px; font-size: 25px;"> + <p>Application Type</p> + <button id="downShwoBtn" class="vBtn fa fa-chevron-circle-up" type="button" onclick="typeBtn()"></button> + <button id="downCloseBtn" style="display: none" class="vBtn fa fa-chevron-circle-down" type="button" onclick="typeBtn()"></button> + </div> + <br> + <ul> + <div id="type" class="col-md-9 div3D"> + <hr style="height: 1px; border: none; border-top: 1px solid #FFFFFF;" /> + <c:forEach var="list" items="${appTypeList}"> + <option value="${list.value}">${list.label}</option> + <div style="float: right; margin-top: -27px;"> + <button type="button" style="color: #1a73e8; background: #FFFFFF; border: solid 1px #D0D0D0; border-radius: 5px;" + data-toggle="modal" data-target="#popTypeModal" onclick="setValues('0100', '${list.value}', '${list.label}')">Modify</button> + </div> + <hr class="hr" /> + </c:forEach> + <button type="button" class="btn btn-info" data-toggle="modal" + data-target="#popTypeModal" onclick="setValues('0100', '', '')">Add Type</button> + <br> + <br> + </div> + </ul> + </div> + <br> + <br> + <div style="margin-left: 100px;"> + <div class="col-md-5" style="margin-left: -50px; font-size: 25px;"> + <p>Application Device Type</p> + <button id="downDeviceCloseBtn" style="display: none" class="vBtn fa fa-chevron-circle-down" type="button" onclick="deviceTypeBtn()"></button> + <button id="downDeviceShwoBtn" class="vBtn fa fa-chevron-circle-up" type="button" onclick="deviceTypeBtn()"></button> + </div> + <br> + <ul> + <div id="deviceType" class="col-md-9 div3D"> + <hr style="height: 1px; border: none; border-top: 1px solid #FFFFFF;" /> + <c:forEach var="list" items="${appDeviceTypeList}"> + <option value="${list.value}">${list.label}</option> + <div style="float: right; margin-top: -27px;"> + <button type="button" + style="color: #1a73e8; background: #FFFFFF; border: solid 1px #D0D0D0; border-radius: 5px;" + data-toggle="modal" data-target="#popTypeModal" + onclick="setValues('0101', '${list.value}', '${list.label}')">Modify</button> + </div> + <hr class="hr"> + </c:forEach> + <button type="button" class="btn btn-info" data-toggle="modal" data-target="#popTypeModal" onclick="setValues('0101', '', '')"> + Add Device Type</button> + <br> + <br> + </div> + </ul> + </div> + <%-- <br><a href="" onclick="Commons.showContent('<%=basePath%>/app/')" style="margin-left: 780px;"> + <button type="button" class="btn btn-primary">Back</button> + </a><br> --%> + <br> + </div> + <!-- show window --> + <!-- modal --> + <div class="modal fade" id="popTypeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title" id="typeModalTitle">AddType</h4> + </div> + <div class="modal-body"> + <div class="alert alert-danger" style="display:none" id="typeModalErrorArea" role="alert"></div> + <label id="typeModalDescribe">Please input the type name you want to add.</label> + <input type="hidden" id="m_type" name="m_type" value=""></input> + <input type="hidden" id="m_value" name="m_value" value=""></input> + <input type="hidden" id="m_label" name="m_label" value=""></input> + <div class="form-group fond-size"> + <!-- <label id="typeLabel">Type</label> --> + <input class="form-control login-input style-input" id="typeName" name="s_typeLabel" type="text"> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" style="width: 100px;" data-dismiss="modal">Close</button> + <button type="button" id="submitBtn" class="btn btn-primary" style="width: 100px;" onclick="submitType()">Submit</button> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> + +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function() { + $("#submitBtn").attr('disabled',true); + $("#popTypeModal").on("hide.bs.modal", function() { + $(this).removeData("bs.modal"); + var div = document.getElementById("typeModalErrorArea"); + div.innerHTML = ""; + div.style.display="none"; + }); + /* $("#type").parent().parent().find("ul").toggle(); + $("#deviceType").parent().parent().find("ul").toggle(); */ + + $('#typeName').bind('input propertychange', function() { + $("#submitBtn").attr('disabled',false); + }); + $('#typeName').bind('input propertychange', function() { + $("#submitBtn").attr('disabled',false); + }); +}); + +/* A function to show a modal window and set the detail style of this modal window. + type:0100(type),0101(deviceType) + typeValue: label name, null(add), value exists(modify) + typeLabel: label name */ +function setValues(type, typeValue, typeLabel){ + document.getElementById("m_type").value = type; + document.getElementById("m_value").value = typeValue; + document.getElementById("m_label").value = typeLabel; + + var m_type = document.getElementById("m_type").value; + var m_typeValue = document.getElementById("m_value").value; + var m_typeLabel = document.getElementById("m_label").value; + + var typeModalTitle = document.getElementById("typeModalTitle"); + var typeModalDescribe = document.getElementById("typeModalDescribe"); + var typeLabel = document.getElementById("typeLabel"); + var typeName = document.getElementById("typeName"); + + //type + if('0100' == m_type){ + //type-modify + //typeLabel.innerHTML = "Type"; + if("" != m_typeValue){ + typeModalTitle.innerHTML = "Modify Type"; + typeModalDescribe.innerHTML = "Please input the type you want to modify."; + typeName.value = m_typeLabel; + } + //type-add + else if("" == m_typeValue) { + typeModalTitle.innerHTML = "Add Type"; + typeModalDescribe.innerHTML = "Please input the type you want to add."; + typeName.value = ""; + } + } + //device type + else if('0101' == m_type){ + //device type-modify + //typeLabel.innerHTML = "DeviceType"; + if("" != m_typeValue){ + typeModalTitle.innerHTML = "Modify Device Type"; + typeModalDescribe.innerHTML = "Please input the device type you want to modify."; + typeName.value = m_typeLabel; + } + //device type-add + else if("" == m_typeValue) { + typeModalTitle.innerHTML = "Add Device Type"; + typeModalDescribe.innerHTML = "Please input the device type you want to add."; + typeName.value = ""; + } + } +} + +function submitType(){ + var type = document.getElementById("m_type").value; + var typeValue = document.getElementById("m_value").value; + var typeLabel = document.getElementById("typeName").value; + var div = document.getElementById("typeModalErrorArea"); + + if("" == typeLabel || null == typeLabel) + { + var errorContent = ''; + errorContent = "Type name is required."; + div.innerHTML = errorContent; + div.style.display="block"; + return; + } + try { + $.ajax({ + url: '<%=basePath%>/app/saveType', + type: 'POST', + data: { "type":type, "typeValue":typeValue, "typeLabel":typeLabel}, + success: function (data) { + var json = JSON.parse(data); + if(200 == json.result) { + $('#popTypeModal').modal('hide'); + $('.modal-backdrop').remove(); + $('body').removeClass('modal-open'); + Commons.showContent('<%=basePath%>/app/type'); + } else if(401 == json.result) { + $("#submitBtn").attr('disabled',true); + var errorContent = ''; + for (var i in json.message) { + errorContent += json.message[i]; + } + div.innerHTML = errorContent; + div.style.display="block"; + } else { + $("#submitBtn").attr('disabled',true); + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + div.innerHTML = errorContent; + div.style.display="block"; + } + }, + error: function (jqXHR, textStatus, errorThrown) { + /*错误信息处理*/ + } + }); + } catch(e) { + console.log(e); + } +} + +var typeNum = 0; +function typeBtn(){ + $("#type").parent().parent().find("ul").slideToggle(); + typeNum++; + if(typeNum%2 == 1){ + $("#downShwoBtn").css("display","none"); + $("#downCloseBtn").css("display","block"); + }else{ + $("#downShwoBtn").css("display","block"); + $("#downCloseBtn").css("display","none"); + } +} + +var deviceTypeNum = 0; +function deviceTypeBtn(){ + $("#deviceType").parent().parent().find("ul").slideToggle(); + deviceTypeNum++; + if(deviceTypeNum%2 == 1){ + $("#downDeviceShwoBtn").css("display","none"); + $("#downDeviceCloseBtn").css("display","block"); + }else{ + $("#downDeviceShwoBtn").css("display","block"); + $("#downDeviceCloseBtn").css("display","none"); + } +} +</script> diff --git a/warehouse/src/main/webapp/WEB-INF/pages/appDev/detailDev.jsp b/warehouse/src/main/webapp/WEB-INF/pages/appDev/detailDev.jsp new file mode 100644 index 0000000..3f7928d --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/appDev/detailDev.jsp @@ -0,0 +1,87 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<!-- navigationDialog dialog --> +<%-- <jsp:include page="../navigationDialog.jsp" flush="true"></jsp:include> --%> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div id="page-content" class="index-page container" style="BACKGROUND-COLOR: transparent;color:white"> + <div class="row" id="appHeight"> + <div class="col-md-12 col-md-offset-12"> + <div id="main-content"> + <article> + <div class="art-content" style="min-height:480px;height:100%;width:auto;margin-left:45px;margin-right:45px;word-break: break-all; word-wrap:break-word;"> + <input id="t_typeId" type="hidden" value="${appInfo.typeId}"> + <input id="t_appId" type="hidden" value="${appInfo.appId}"> + <input id="t_filePath" type="hidden" value="${appInfo.verFilePath}"> + <input id="iconPath" type="hidden" value="${appInfo.imagePath}"> + <div style="display:none"> + <input id="t_developer" type="text" value="${appInfo.developer}"> + </div> + + <h2 style="color:white;">${appInfo.appName}</h2> + <table> + <tr> + <td rowspan="3" valign="top" style="width:130px"><img id="imagePath" src="${appInfo.imagePath}" style="width:120px;height:120px"/></td> + <td>By ${appInfo.developerName} ${date}<br>${appInfo.versionName}<br>${appInfo.typeName}<br>${appInfo.appDeviceTypeName}<br></td> + </tr> + <tr><td></td></tr> + <tr><td></td></tr> + </table> + <div id="appAbstract" class="col-md-12" style="margin-left:-15px">${appInfo.appAbstract}</div><br> + <div style="color:#ADADAD; margin: 0px 0px 10px 0px;">MD5:<a>${appInfo.hashcode}</a></div> + <c:choose> + <c:when test="${appStatus == 0}"> + <button class="btn btn-skin size" type="button" style="width:190px;padding-left:0px;padding-right:0px;" onclick="doDownload(this, '${appInfo.appId}','${appInfo.typeId}','${appInfo.verFilePath}')">install</button> + </c:when> + <c:when test="${appStatus == 1}"> + <button class="btn btn-skin size" type="button" style="width:190px;padding-left:0px;padding-right:0px;" onclick="launchApp('${localApp.id}')">launch</button> + </c:when> + <c:when test="${appStatus == 2}"> + <button class="btn btn-skin size" type="button" style="width:190px;padding-left:0px;padding-right:0px;" onclick="onclick=updateApp(this,'${appInfo.appId}','${appInfo.typeId}','${appInfo.verFilePath}','${localApp.id}')">update</button> + </c:when> + </c:choose> + <a href="javascript:void(0);" onclick="backToPrePage('${isListDev}')"><button type="button" class="btn btn-skin size" style="width:190px;">Back</button></a> + </div> + + </div> + </article> + </div> + </div> + <div style="height:28px"></div> + </div> + </c:otherwise> +</c:choose> +<script src="<%=basePath%>/js/constant.js"></script> +<script> +$(function() { + $("#appHeight").height($(document).height()-250); + $("#page-content").css("background-image","url(<%=basePath%>/image/AGL_HMI_Blue_Background_Car-01.png)"); + if($('#iconPath').val() == ''){ + $('#imagePath').attr("src",'<%=basePath%>/image/defaultAppIcon.png'); + } + // TODO DJ 暂时放置,等上传功能好用之后再对应,猜想textarea上传后,数据库会把回车空格之类的给替换掉。 + var abstractSubStr = document.getElementById("appAbstract").innerHTML; + var reg=new RegExp("\r\n","g"); + var reg1=new RegExp("\n","g"); + var abstractSubStr= abstractSubStr.replace(reg,"<br>"); + abstractSubStr= abstractSubStr.replace(reg1,"<br>"); + document.getElementById("appAbstract").innerHTML = abstractSubStr; +}); + +function backToPrePage(isListDev){ + if("true" == isListDev){ + Commons.showContent('<%=basePath%>/appDev'); + }else if("false" == isListDev){ + Commons.showContent('<%=basePath%>/appDev/SearchDev'); + } +} +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/appDev/listDev.jsp b/warehouse/src/main/webapp/WEB-INF/pages/appDev/listDev.jsp new file mode 100644 index 0000000..b815dbf --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/appDev/listDev.jsp @@ -0,0 +1,85 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> +div.dataTables_wrapper div.dataTables_info { + padding-top: 0.3em; + white-space: nowrap; + margin-left: 120px; +} + +a.page-link { + height: calc(1.8125rem + 4px); + margin-left: -5px; +} + +</style> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" style="BACKGROUND-COLOR: transparent;color:white"> + <div class="container" role="alert" style="display:none"> + <div class="row" > + <div class="input-group"> + <input type="text" class="form-control size" id="t_keyWord" name="t_keyWord" value="" placeholder="please input keywords" style="height:50px;BACKGROUND-COLOR: transparent;color:white"> + <button class="input-group-addon fa fa-search" id="btn-save-edit" style="font-size:30px;color:green;height:50px;BACKGROUND-COLOR: transparent;" onclick="$table.DataTable().ajax.reload();"></button> + </div> + </div> + </div> + <div class="card-header" style="display:none"> + <input type="text" class="form-control" id="t_filePath" size="16" name="t_filePath" style="display:none;"> + <div style="overflow-x:scroll;white-space:nowrap;height:70px;"> + <c:forEach var="list" items="${appDeviceTypeList}"> + <label class="btn btn-skin col-md-4 button-size" style="overflow:hidden;color:white" onclick="deviceTypeButton(${list.value})"><input style="display:none;" type="radio" name="deviceType" >${list.label}</label> + </c:forEach> + </div><br> + <div id="appType" style="color:gray;overflow-x:scroll;white-space:nowrap;height:70px;display:none;"> + <c:forEach var="list" items="${appTypeList}"> + <label class="btn btn-skin col-md-4 button-size" style="overflow:hidden;color:white" onclick="TypeButton(${list.value})"><input style="display:none;" type="radio" name="appType" >${list.label}</label> + </c:forEach> + </div> + </div> + <div class="card-body"> + <div id="appHeight" style="overflow-x:hidden;" class="test1"> + <table id="example" cellspacing="0" style="width:100%;"> + <thead style="display:none"> + <tr><hr> + <th>No.</th> + <th>App Name</th> + <th>Developer</th> + <th>TypeId</th> + <th id="textarea">App Abstract</th> + <th>Manipulation</th> + </tr> + </thead> + </table> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script src="<%=basePath%>/js/common.js"></script> +<script> +$(function() { + $("#appHeight").height($(document).height()-250); + $("#page-content").css("background-image","url(<%=basePath%>/image/AGL_HMI_Blue_Background_Car-01.png)"); + Commons.bindDateControl(); + Commons.appendRedAsterisk(); + + initData(true); +}); + +var deviceTypeId = ""; +var TypeId = ""; +var $table = $('#example'); +var $errorArea = $('#modalErrorArea'); + +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/appDev/localListDev.jsp b/warehouse/src/main/webapp/WEB-INF/pages/appDev/localListDev.jsp new file mode 100644 index 0000000..bafa8f8 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/appDev/localListDev.jsp @@ -0,0 +1,175 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + a.page-link{height:calc(1.8125rem + 4px);margin-left:-5px;} + .div{font-size:18px; color:#000;line-height:24px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all;overflow:hidden;} + .item,.carousel-caption{ + width: 100%; + height: 300px; + } + .carousel-caption{ + left: 0; + top: 0; + padding: 0; + } +</style> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors}</div> + </c:when> + <c:otherwise> + <div class="card mb-3" + style="BACKGROUND-COLOR: transparent; color: white"> + <div class="card-body"> + <div id="appHeight" style="overflow-x: hidden;" class="test1"> + <div> + <hr> + <div id="localList" style="padding-left: 15px; padding-right: 15px;"></div> + </div> + </div> + </div> + </div> + </c:otherwise> +</c:choose> +<script> +$(function() { + $("#appHeight").height($(document).height()-250); + $("#page-content").css("background-image","url(<%=basePath%>/image/AGL_HMI_Blue_Background_Car-01.png)"); + Commons.bindDateControl(); + Commons.appendRedAsterisk(); + + initLocalData(); +}); + +var $errorArea = $('#modalErrorArea'); + +function initLocalData(){ + debugger; + console.log("localapp" + "initLocalData"); + this.listReplyok = this.listReplyok.bind(this); + aglSocket.listInstalledApps(initLocalDataReplyok, initLocalDatareplyerr); +}; + +function initLocalDataReplyok(obj){ + debugger; + console.log("localapp" + "listReplyok\n"); + var appListStr = obj["response"]; + checkLocalUpdate(appListStr); + console.log(appListStr); +}; + +function initLocalDatareplyerr(obj){ + debugger; + alert("get local app failed"); +}; + +function checkLocalUpdate(appListStr){ + debugger; + $.ajax({ + url:"<%=basePath%>/appDev/CheckUpdateInfoDev", + type: "POST", + dataType: "json", + contentType:"application/json;charset=utf-8", + data: JSON.stringify(appListStr), + success:function(data){ + debugger; + initTable(data,appListStr); + } + }) +}; + +/* +author:"↵ Loïc Collignon <loic.collignon@iot.bzh>↵ Matt Porter <mporter@konsulko.com>↵ " +author-email:"info@automotivelinux.org" +description:"AGL Default Mixer" +height:"" +http-port:1024 +icon:"/var/local/lib/afm/applications/mixer/6.90/icon.svg" +id:"mixer@6.90" +name:"mixer" +shortname:"" +version:"6.90.0-04990a8" +width:"" +*/ +/*** + * applist: local list + * appListStr:local app package(afm-util list) + */ +function initTable(applist,appListStr){ + console.log(TAG_LOG + "applist.length" + applist.length); + for (var i = 0; i < applist.length; i++) { + var data = applist[i]; + var localdata = appListStr[i]; + var appStatusButton = ""; + +/* if(data.updateFlag){ + var appStatusButton = '<button class="btn btn-skin button-size" type="button" style="margin-right:auto;padding-left:0px;padding-right:0px;width:150px;color:white"' + +'onclick=updateApp(this,"'+data.appId+'","'+data.typeId+'","'+data.verFilePath+'","'+localdata.id+'")>update</button>' + } + else */{ + var appStatusButton = '<a href="javascript:void(0);" onclick=launchApp("'+localdata.id+'")><button class="btn btn-skin button-size" type="button" style="margin-right:auto;width:150px;color:white" >launch</button></a>'; + } + + if(data.systemApp){ + var uninstall = '<a href="javascript:void(0);"><button class="btn btn-skin button-size" type="button" style="display:none;" >uninstall</button></a>'; + } + else{ + var uninstall = '<a href="javascript:void(0);" onclick=uninstallApp("'+localdata.id+'")><button class="btn btn-skin button-size" type="button" style="margin-right:auto;width:150px;color:white" >uninstall</button></a>'; + } + + var date = null; + if(data.createDate == null){ + date = "----/--/--"; + } + else{ + date = new Date(data.createDate).format("yyyy-MM-dd"); + } + + if(data.imagePath == null){ + data.imagePath = '<%=basePath%>/image/defaultAppIcon.png'; + } + + if(data.typeName == null){ + data.typeName = "--"; + } + + var context = + '<div class="row">' + +'<div class="col-md-2" style="text-align:center;">' + +'<img style="height:auto;width:100%;" src = "'+data.imagePath+'">' + +'</div>' + + +'<div class="col-md-7">' + +'<h4 style="color:#00AEAE;">' + localdata.name + '</h3>' + +'<div class="font-size"> <strong>Version</strong>: '+ localdata.version + '</div>' + +'<p class="font-size ellipsis" style="color:white;"> <strong>Description</strong>: ' + data.appAbstract + '</p>' + +'</div>' + + +'<div class="col-md-3">' + +'<div style="float:right">'+ appStatusButton + '</div>' + +'<div style="float:right;margin-top:10px;">' + uninstall + '</div>' + +'</div>' + +'</div>' + + '<hr>'; +/* var context = '<div style="height:120px width:100%; margin-right:210px;""><div><img style="height:120px;width:120px" src = "'+data.imagePath+'"></div>' + +'<div class="margin-left"style="margin-top:-120px;"><div style="color:#00AEAE;font-size:30px;">'+localdata.name+'</div></div><div style="height:20px;"></div>' + +'<div class="font-size margin-left">'+ 'Version: ' + localdata.version +'</div>' + +'<div class="font-size margin-left" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis; max-width:400px; height:50px;">'+ 'Description: ' + data.appAbstract+'</div></div>' + +'<div style="float:right; width:200px;"><div style="margin-top:-105px;">'+appStatusButton+'</div>' + +'<div style="padding-top:10px;">'+uninstall+'</div></div><hr>'; */ + $("#localList").append(context); + } +} + +function uninstallApp(appId) { + debugger; + aglSocket.uninstallApp(appId); + Commons.showContent('<%=basePath%>/appDev/localApp'); +} +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/appDev/searchDev.jsp b/warehouse/src/main/webapp/WEB-INF/pages/appDev/searchDev.jsp new file mode 100644 index 0000000..33ac523 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/appDev/searchDev.jsp @@ -0,0 +1,155 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<style type="text/css"> + div.dataTables_wrapper div.dataTables_info {padding-top: 0.3em;white-space: nowrap;margin-left:120px;} + a.page-link{height:calc(1.8125rem + 4px);margin-left:-5px;} + .div{font-size:18px; color:#000;line-height:24px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all;overflow:hidden;} + .item,.carousel-caption{ + width: 100%; + height: 300px; + } + .carousel-caption{ + left: 0; + top: 0; + padding: 0; + } + .mask { + position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; + z-index: 1002; left: 0px; + opacity:0.5; -moz-opacity:0.5; + } + + </style> +<c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <div class="card mb-3" style="BACKGROUND-COLOR: transparent;color:white"> + <div class="alert alert-danger" id="modalErrorArea" role="alert" + <c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + ${modelErrors} + </c:if> + </div> + <div class="card-header" style="height:250px;"> + <div style="color:#00CACA;font-size:30px;">KeyWord</div><br> + <div class="row" > + <div class="input-group col-md-10"> + <input type="text" class="form-control size" id="t_keyWord" name="t_keyWord" value="" placeholder="please input keywords" style="height:50px;BACKGROUND-COLOR: transparent;color:white"> + <button id="btn-save-edit" style="color:white;height:50px;width:50px;font-size:30px;border-color:white;background:none;" onclick="clean()">X</button> + </div> + <div class="col-md-2"> + <button class="btn btn-skin button-size" id="btn-search" style="color:white;height:50px;float:right" onclick="searchApp(this);">search</button> + </div> + </div><br> + <div style="color:#00CACA;font-size:30px;">AppType</div> + <input type="text" class="form-control" id="t_filePath" size="16" name="t_filePath" style="display:none;"> + <div style="overflow-x:scroll;white-space:nowrap;height:70px;display:none"> + <c:forEach var="list" items="${appDeviceTypeList}"> + <label class="btn btn-skin col-md-4 button-size" style="overflow:hidden;color:white" onclick="deviceTypeButton(${list.value})"><input style="display:none;" type="radio" name="deviceType" >${list.label}</label> + </c:forEach> + </div><br> + <div id="appType" style="color:gray;overflow-x:scroll;white-space:nowrap;height:70px;" class="test1"> + <button id="type-btn-all" class="btn btn-skin col-md-4 button-size" style="overflow:hidden;color:white"" onclick="TypeButton(this,'');">Show All Types</button> + <c:forEach var="list" items="${appTypeList}"> + <button id="type-btn-signal" class="btn btn-skin col-md-4 button-size" style="overflow:hidden;color:white" onclick="TypeButton(this,${list.value});">${list.label}</button> + </c:forEach> + </div> + </div> + <div class="card-body"> + <div id="appHeight" style="overflow-x:hidden;" class="test1"> + <table id="example" cellspacing="0" style="width:100%;"> + <thead style="display:none"> + <tr><hr> + <th>No.</th> + <th>App Name</th> + <th>Developer</th> + <th>TypeId</th> + <th id="textarea">App Abstract</th> + <th>Manipulation</th> + </tr> + </thead> + </table> + </div> + <div style="height:20px"></div> + </div> + </div> + </c:otherwise> +</c:choose> + +<script> +$(function() { + $("#appHeight").height($(document).height()-520); + $("#page-content").css("background-image","url(<%=basePath%>/image/AGL_HMI_Blue_Background_Car-01.png)"); + Commons.bindDateControl(); + Commons.appendRedAsterisk(); +}); + +var appTypeFlag = false; +function searchApp(obj){ + debugger; + if(appTypeFlag == false){ + $("#type-btn-all").css("background-color", "#00D096"); + } + if(isInitTable == false){ + initData(false); + isInitTable = true; + }else if(isInitTable == true){ + $table.DataTable().ajax.reload(); + } +} + +//appDeviceType +var deviceTypeButton = function(deviceTypeValue){ + $("input[name='deviceType']").parent().css('background-color',''); + $('#appType')[0].style.display="block"; + $table.DataTable().ajax.reload(); + $('input:radio[name="deviceType"]:checked').parent().css('background-color','#00D096'); + deviceTypeId = deviceTypeValue; +}; + +//appType +var TypeButton = function(obj, typeValue){ + TypeId = typeValue; + debugger; + $('button[id^="type-btn-"]').css("background-color", ""); + $(obj).css("background-color", "#00D096"); + appTypeFlag = true; + searchApp(obj); +}; + +//Judge whether is the first time searched +var isInitTable = false; +var deviceTypeId = ""; +var TypeId = ""; +var $table = $('#example'); +var $errorArea = $('#modalErrorArea'); + + var strSub = function(str, subLen){ + if(str == null){ + return ""; + } + if(str.length > subLen){ + str = str.substring(0, subLen); + appAbstract = str + "..."; + return appAbstract; + } + return str; +}; + +function clean(){ + $("#t_keyWord").val(""); +} + +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/deleteDialog.jsp b/warehouse/src/main/webapp/WEB-INF/pages/deleteDialog.jsp new file mode 100644 index 0000000..b42e350 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/deleteDialog.jsp @@ -0,0 +1,19 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<input type="hidden" id="deleteId" value="0"/> +<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + </button> + <h4 class="modal-title" id="myModalLabel">Delete</h4> + </div> + <div class="modal-body">Are you sure you want to delete the selected?</div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" Style="background-Color:gray" data-dismiss="modal">NO </button> + <button type="button" id="dialog-delete-confirm" class="btn btn-primary">Yes</button> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/index.jsp b/warehouse/src/main/webapp/WEB-INF/pages/index.jsp new file mode 100644 index 0000000..e23319e --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/index.jsp @@ -0,0 +1,145 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>Agl app warehouse</title> + <link href="<%=basePath%>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/font-awesome.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/style.css" rel="stylesheet"> +</head> +<body class="bg-dark"> + <input type="hidden" id="basePath" value="<%=basePath%>"/> + <div class="container"> + <div class="alert alert-danger" id="loginModalErrorArea" role="alert"<c:choose> + <c:when test="${not empty modelErrors}">style="display: block"</c:when> + <c:otherwise>style="display: none"</c:otherwise> + </c:choose>> + <c:if test="${not empty modelErrors}"> + <span class="glyphicon glyphicon-exclamation-sign" style="top:2px !important" aria-hidden="true"></span> ${modelErrors} + </c:if> + </div> + <div id="loginContainer" class="card card-login mx-auto mt-5 col-5 px-0"> + <label class="card-header style-login" >Agl app warehouse<a href="javascript:history.back(-1)" style="float:right;color:#C0C0C0"><i class="fa fa-close"></i></a></label> + <div style="border:solid 20px #FFF"> + <div class="alert alert-danger" style="display:none" id="loginErrorArea" role="alert"></div> + <form id="loginForm"> + <div class="form-group fond-size"> + <label for="exampleInputEmail1">Username</label> + <input class="form-control login-input style-input" id="s_loginId" name="s_username" type="text" placeholder="Username"> + </div> + <div class="form-group fond-size"> + <label for="exampleInputPassword1">Password</label> + <input class="form-control login-input style-input" id="s_userPw" name="s_userPw" type="password" placeholder="Password"> + </div> + <div><input id="remember" type="checkbox" style="zoom:200%"></div> <div class="style-login1"><label>Remember me</label></div> + <a class="btn btn-primary btn-block fond-size" href="javascript:void(0)" id="login">LOGIN</a> + </form> + </div> + </div> + </div> +</body> +<script src="<%=basePath%>/js/jquery/jquery.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-4.0.0-beta/popper/popper.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-4.0.0-beta/bootstrap.min.js"></script> +<script src="<%=basePath%>/js/jquery/jqLoading.min.js"></script> +<script src="<%=basePath%>/js/common.js"></script> +<script type="text/javascript"> +var oUser = document.getElementById('s_loginId'); +var oPswd = document.getElementById('s_userPw'); +var oRemember = document.getElementById('remember'); +$(function(){ + Commons.appendRedAsterisk(); + $('#login').click(function(){ + if($("input[type='checkbox']").is(':checked')){ + //Account cipher is valid for 7 days. + setCookie('s_username',oUser.value,7); + setCookie('s_userPw',oPswd.value,7); + } + loginAsync(); + }); + + $('.login-input').keypress(function(e) { + var e = event ? event : window.event; + if (e.keyCode === 13) { + loginAsync(); + } + }); +}); + +var loginAsync = function() { + var formData = new FormData(); + formData.append("loginId", $('#s_loginId').val()); + formData.append("userPw",$('#s_userPw').val()); + $.ajax({ + url: '<%=basePath%>/login/signin', + cache: false, + type: 'POST', + async:true, + processData:false, + contentType:false, + data: formData, + success: function (data, status, xhr) { + $errorArea = $('#loginErrorArea'); + var json = JSON.parse(data); + if (json.result == 200) { + Commons.redirect2($("#basePath").val() + json.forward); + }else { + var errorContent = ''; + for (var i in json.message) { + errorContent += '<div>' + json.message[i] + '</div>'; + } + $errorArea.empty().append(errorContent); + var div = document.getElementById("loginErrorArea"); + div.style.display="block"; + + } + } + }); +} + + window.onload = function(){ + //If the account password cookie exists, the fill is filled. + if(getCookie('s_username') && getCookie('s_userPw')){ + oUser.value = getCookie('s_username'); + oPswd.value = getCookie('s_userPw'); + oRemember.checked = true; + } + //Remove cookie if unchecked. + oRemember.onchange = function(){ + if(!this.checked){ + delCookie('s_username'); + delCookie('s_userPw'); + } + }; + }; + + //Set cookie. + function setCookie(name,value,day){ + var date = new Date(); + date.setDate(date.getDate() + day); + document.cookie = name + '=' + value + ';expires='+ date; + }; + //Get cookie. + function getCookie(name){ + var reg = RegExp(name+'=([^;]+)'); + var arr = document.cookie.match(reg); + if(arr){ + return arr[1]; + }else{ + return ''; + } + }; + //delete cookie + function delCookie(name){ + setCookie(name,null,-1); + }; +</script> +</html>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/main.jsp b/warehouse/src/main/webapp/WEB-INF/pages/main.jsp new file mode 100644 index 0000000..dddbe55 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/main.jsp @@ -0,0 +1,226 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +%> + +<!DOCTYPE html> +<html lang="en"> +<script> +var width = window.screen.width; +</script> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>AGL App Warehouse</title> + <link href="<%=basePath%>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/font-awesome.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/dataTables-1.10.16/dataTables.bootstrap4.css" rel="stylesheet"> + <link href="<%=basePath%>/css/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/style.css" rel="stylesheet"> +</head> +<style type="text/css"> + #mainNav{ + z-index:0; + } + body { + background: url('image/transp_bg.png'); + } + .style { + min-height:500px; + } + .user-name-label{ + margin-top:auto; + } +</style> +<div style="border-radius:3px;box-shadow: darkgrey 1px 1px 30px 10px"> +<body class="" id="page-top"> + <input type="hidden" id="basePath" value="<%=basePath%>"/> + <input type="hidden" id="ippath" value="<%=ippath%>"/> + <input type="hidden" id="userId" value="${userid}"/> + <input type="hidden" id="auId" value="${auid}"/> + <input type="hidden" id="tokenAuthorization" value="${authorization_token}"/> + <input type="hidden" id="refreshtokenAuthorization" value="${authorization_refreshtoken}"/> + +<header> + <!-- ########################### --> + <div class="top container"> + <div class="row"> + <div class="col-md-12"> + <img class="toplogo" src="image/logo.png"/> + </div> + </div> + </div> + <!-- delete dialog --> + <jsp:include page="deleteDialog.jsp" flush="true"></jsp:include> + <!-- ############################## --> + <div id="nav-wrapper"> + <nav class="navbar navbar-expand-lg navbar-dark container bg-gradient" id="mainNav"> + <c:if test="${fn:contains(menuPathString, 'account/list')}"> + <ul class="main-manager"> + <li class="main-manager-nav"><a id="AppManager" class="navbar-choosen" href="javascript:void(0)" onclick="Commons.showContent('<%=basePath%>/app/')">App</a><div class="main-manager-nav-line"></div></li> + <li class="main-manager-nav"><a id="UserManager" class="navbar-default" href="javascript:void(0)" onclick="Commons.showContent('<%=basePath%>/account/')">User</a><div class="main-manager-nav-line"></div></li> + <li class="main-manager-nav"><a id="TypeManager" class="navbar-default" href="javascript:void(0)" onclick="Commons.showContent('<%=basePath%>/app/type')">Setting</a></li> + </ul> + </c:if> + <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarResponsive"> + <c:choose> + <c:when test="${not empty username}"> + <ul class="navbar-nav ml-auto"> + <li class="nav-item"> + <!-- <div class="dropdown show"> --> + <div class="nav-link" style="color:rgba(255, 255, 255, 0.5);fond-size:20px;" id="dropdownMenuLink"> + <i class="fa fa-user-circle" aria-hidden="true"></i> <label class="user-name-label">${username}</label> + <%-- ${menuPathString} contains--%> + </div> + <!-- </div> --> + </li> + <li class="nav-item"> + <a class="nav-link" data-toggle="modal" id="logout" href="javascript:void(0)"><i class="fa fa-fw fa-sign-out"></i>Logout</a> + </li> + </ul> + </c:when> + <c:otherwise> + <ul class="navbar-nav ml-auto"> + <li class="nav-item"> + <a class="nav-link" data-toggle="modal" id="loginbut" href="javascript:void(0)"><i class="fa fa-fw fa-sign-in"></i>Login</a> + </li> + </ul> + </c:otherwise> + </c:choose> + </div> + </nav> + </div> +</header> +<script src="<%=basePath%>/js/jquery/jquery.min.js"></script> +<script src="<%=basePath%>/js/jquery/easing/jquery.easing.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-4.0.0-beta/popper/popper.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-4.0.0-beta/bootstrap.min.js"></script> +<script src="<%=basePath%>/js/dataTables-1.10.16/jquery.dataTables.min.js"></script> +<script src="<%=basePath%>/js/dataTables-1.10.16/dataTables.bootstrap4.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script> +<script src="<%=basePath%>/js/bootstrap-datetimepicker/bootstrap-datetimepicker.ja.js"></script> +<script src="<%=basePath%>/js/chart/Chart.bundle.js"></script> +<script src="<%=basePath%>/js/chart/utils.js"></script> +<script src="<%=basePath%>/js/jquery/jqLoading.min.js"></script> +<script src="<%=basePath%>/js/main.js"></script> +<script src="<%=basePath%>/js/common.js"></script> +<div id="page-content" class="index-page container"> + <div class="row"> + <div class="col-md-12 col-md-offset-1"> + <div id="htmlContent" class="style"> + <c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <jsp:include page="app/list.jsp" flush="true"></jsp:include> + </c:otherwise> + </c:choose> + </div><!-- htmlContent --> + </div><!-- class="col-md-6 col-md-offset-1 --> + </div><!-- row --> + <!-- Scroll to Top Button--> + <a class="scroll-to-top rounded" href="#page-top"> + <i class="fa fa-angle-up"></i> + </a> + <!-- Logout Modal--> + <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + </button> + <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5> + </div> + <div class="modal-body">Please make sure。</div> + <div class="modal-footer"> + <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button> + <a class="btn btn-primary" href="javascript:void(0)" id="logout"> Ok </a> + </div> + </div> + </div> + </div> +</div> + +<!-- /.content-wrapper--> +<footer class="container "> + <div class="row"> + <div class="col-md-8" style="margin:auto;"> + <p>Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION -V03.00.00</p> + </div> + </div> +</footer> +</body> +</div> +<script> +$(function(){ + $(".style").css({ + minHeight:($(window).height()- 300) + }) + + $('#AppManager').click(function(){ + var $AppManager = $("#AppManager"); + var $UserManager = $("#UserManager"); + var $TypeManager = $("#TypeManager"); + $AppManager.removeClass(); + $UserManager.removeClass(); + $TypeManager.removeClass(); + $AppManager.addClass("navbar-choosen"); + $UserManager.addClass("navbar-default"); + $TypeManager.addClass("navbar-default"); + }); +}); +(function($) { + $('#logout').click(function(){ + debugger; + $.ajax({ + url: $('#basePath').val()+'/login/logout', + cache: false, + type: 'GET', + success: function (data) { + window.location.href="<%=basePath%>"; + } + }); + }); + + $('#UserManager').click(function(){ + var $AppManager = $("#AppManager"); + var $UserManager = $("#UserManager"); + var $TypeManager = $("#TypeManager"); + $AppManager.removeClass(); + $UserManager.removeClass(); + $TypeManager.removeClass(); + $AppManager.addClass("navbar-default"); + $UserManager.addClass("navbar-choosen"); + $TypeManager.addClass("navbar-default"); + }); + + $('#TypeManager').click(function(){ + var $AppManager = $("#AppManager"); + var $UserManager = $("#UserManager"); + var $TypeManager = $("#TypeManager"); + $AppManager.removeClass(); + $UserManager.removeClass(); + $TypeManager.removeClass(); + $AppManager.addClass("navbar-default"); + $UserManager.addClass("navbar-default"); + $TypeManager.addClass("navbar-choosen"); + }); +})(jQuery); + +$('#loginbut').click(function(){ + Commons.login(); +}); +</script> +</html>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/mainDev.jsp b/warehouse/src/main/webapp/WEB-INF/pages/mainDev.jsp new file mode 100644 index 0000000..0d9bd07 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/mainDev.jsp @@ -0,0 +1,261 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String ippath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort(); +String remoteIp = request.getRemoteAddr(); +String params = request.getQueryString(); +%> + +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>AGL App Warehouse</title> + <link href="<%=basePath%>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/font-awesome.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/dataTables-1.10.16/dataTables.bootstrap4.css" rel="stylesheet"> + <link href="<%=basePath%>/css/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/style.css" rel="stylesheet"> +</head> +<style type="text/css"> + #mainNav{ + z-index:0; + } + body { + background: url('image/transp_bg.png'); + } + .style { + min-height:500px; + } + .size { + font-size:20px; + } +</style> +<body class="test1" id="page-top" style="width:100%;"> + <input type="hidden" id="remoteIp" value="<%=remoteIp%>"/> + <input type="hidden" id="params" value="<%=params%>"/> + <input type="hidden" id="basePath" value="<%=basePath%>"/> + <input type="hidden" id="ippath" value="<%=ippath%>"/> + <input type="hidden" id="userId" value="${userid}"/> + <input type="hidden" id="auId" value="${auid}"/> + <input type="hidden" id="tokenAuthorization" value="${authorization_token}"/> +<header> + <!-- delete dialog --> + <jsp:include page="deleteDialog.jsp" flush="true"></jsp:include> + <!-- ############################## --> + + <div id="nav-wrapper"> + <nav class="navbar navbar-expand-lg navbar-dark container bg-gradient" style="background-color: #29282E;;" id="mainNav"> + <div style="font-size:30px;color:#EAC100">Warehouse For AGL</div> + <div id="backButton"></div> + <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarResponsive"> + <c:choose> + <c:when test="${not empty username}"> + <ul class="navbar-nav ml-auto"> + <li class="nav-item"> + <div class="dropdown show"> + <div class="nav-link button-size" style="color:rgba(255, 255, 255, 0.5);color:#EAC100" id="dropdownMenuLink"> + <i class="fa fa-user-circle" aria-hidden="true"></i> <label>${username}</label> + <%-- ${menuPathString} contains--%> + </div> + </div> + </li> + <li class="nav-item button-size"> + <a class="nav-link" data-toggle="modal" id="logout" href="javascript:void(0)" style="color:#EAC100"><i class="fa fa-fw fa-sign-out"></i>Logout</a> + </li> + </ul> + </c:when> + <c:otherwise> + <ul class="navbar-nav ml-auto button-size"> + <li class="nav-item"> + <a class="nav-link" data-toggle="modal" id="login" href="javascript:void(0)" style="color:#EAC100"><i class="fa fa-fw fa-sign-in"></i>Login</a> + </li> + </ul> + </c:otherwise> + </c:choose> + </div> + </nav> + </div> +</header> + <script src="<%=basePath%>/js/jquery/jquery.min.js"></script> + <script src="<%=basePath%>/js/jquery/easing/jquery.easing.min.js"></script> + <script src="<%=basePath%>/js/bootstrap-4.0.0-beta/popper/popper.min.js"></script> + <script src="<%=basePath%>/js/bootstrap-4.0.0-beta/bootstrap.min.js"></script> + <script src="<%=basePath%>/js/dataTables-1.10.16/jquery.dataTables.min.js"></script> + <script src="<%=basePath%>/js/dataTables-1.10.16/dataTables.bootstrap4.min.js"></script> + <script src="<%=basePath%>/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script> + <script src="<%=basePath%>/js/bootstrap-datetimepicker/bootstrap-datetimepicker.ja.js"></script> + <script src="<%=basePath%>/js/chart/Chart.bundle.js"></script> + <script src="<%=basePath%>/js/chart/utils.js"></script> + <script src="<%=basePath%>/js/jquery/jqLoading.min.js"></script> + <script src="<%=basePath%>/js/main.js"></script> + <script src="<%=basePath%>/js/common.js"></script> + <script src="<%=basePath%>/js/AFB-websock.js"></script> + <script src="<%=basePath%>/js/AglSocket.js"></script> + <script src="<%=basePath%>/js/download.js"></script> + <script src="<%=basePath%>/js/deviceList.js"></script> +<div id="page-content" class="index-page container test1" style="width:100%;height:100%;background-size:cover;"> + <div class="row"> + <div class="col-md-12 col-md-offset-1" style="overflow-x:hidden;"> + <div id="htmlContent" class="style"> + <c:choose> + <c:when test="${not empty modelErrors}"> + <div class="alert alert-danger" id="modalErrorArea" role="alert"> + ${modelErrors} + </div> + </c:when> + <c:otherwise> + <jsp:include page="appDev/listDev.jsp" flush="true"></jsp:include> + </c:otherwise> + </c:choose> + </div><!-- htmlContent --> + </div><!-- class="col-md-6 col-md-offset-1 --> + </div><!-- row --> + <!-- Scroll to Top Button--> + <!-- <a class="scroll-to-top" href="#page-top"> + <i class="fa fa-angle-up"></i> + </a> --> + <!-- Logout Modal--> + <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span aria-hidden="true">×</span> + </button> + <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5> + </div> + <div class="modal-body">Please make sure。</div> + <div class="modal-footer"> + <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button> + <a class="btn btn-primary" href="javascript:void(0)" id="logout"> Ok </a> + </div> + </div> + </div> + </div> + <div class="row" style="text-align:center;line-height:50px;"> + <div id="listBtn" class="size col-md-4" style="border-right:solid 1px white;" onclick="list()">List</div> + <div id="searchBtn" class="size col-md-4" style="border-right:solid 1px white;" onclick="search()">Search</div> + <div id="localBtn" class="size col-md-4" onclick="localList()">Local List</div> + </div> +</div> + +<!-- /.content-wrapper--> +<footer class="container" style="background:#272727"> + + <div class="row"> + <div class="col-md-12" style="text-align:center"> + <p>Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION -V03.00.00</p> + </div> + </div> +</footer> +</body> +<script> +$(function(){ + $('#AppManager').click(function(){ + var $AppManager = $("#AppManager"); + var $UserManager = $("#UserManager"); + $AppManager.removeAttr("style"); + $UserManager.removeAttr("style"); + var data={ + 'padding-left':'10px', + 'font-size':'22px', + 'color':'#cee3f6', + }; + var userdata={ + 'padding-left':'30px', + 'font-size':'22px', + 'color':'rgba(255, 255, 255, 1)', + } + $AppManager.css(data); + $UserManager.css(userdata); + }); + initAglSocket(); + list(); +}); +function list(){ + debugger; + Commons.showContent('<%=basePath%>/appDev'); + $("#localBtn").css({"background": "#3C3C3C"}); + $("#localBtn").css({"color": "white"}); + $("#listBtn").css({"background": "white"}); + $("#listBtn").css({"color": "black"}); + $("#searchBtn").css({"background": "#3C3C3C"}); + $("#searchBtn").css({"color": "white"}); + +}; +function search(){ + debugger; + Commons.showContent('<%=basePath%>/appDev/SearchDev'); + $("#localBtn").css({"background": "#3C3C3C"}); + $("#localBtn").css({"color": "white"}); + $("#listBtn").css({"background": "#3C3C3C"}); + $("#listBtn").css({"color": "white"}); + $("#searchBtn").css({"background": "white"}); + $("#searchBtn").css({"color": "black"}); + +}; +function localList(){ + debugger; + $("#localBtn").css({"background": "white"}); + $("#localBtn").css({"color": "black"}); + $("#listBtn").css({"background": "#3C3C3C"}); + $("#listBtn").css({"color": "white"}); + $("#searchBtn").css({"background": "#3C3C3C"}); + $("#searchBtn").css({"color": "white"}); + Commons.showContent('<%=basePath%>/appDev/localApp'); +}; +var aglSocket; +function initAglSocket() { + aglSocket = new AglSocket(); +} + +(function($) { + var param = $('#params').val(); + $('#logout').click(function(){ + debugger; + $.ajax({ + url: $('#basePath').val()+'/login/logout', + cache: false, + type: 'GET', + success: function (data) { + window.location.href="<%=basePath%>/mainDev?" + param; + } + }); + }); + + $('#UserManager').click(function(){ + var $AppManager = $("#AppManager"); + var $UserManager = $("#UserManager"); + $AppManager.removeAttr("style"); + $UserManager.removeAttr("style"); + var data={ + 'padding-left':'10px', + 'font-size':'22px', + 'color':'rgba(255, 255, 255, 1)', + }; + var userdata={ + 'padding-left':'30px', + 'font-size':'22px', + 'color':'#cee3f6', + } + $AppManager.css(data); + $UserManager.css(userdata); + }); +})(jQuery); + +$('#login').click(function(){ + debugger; + Commons.login(); +}); +</script> +</html>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/navigationDialog.jsp b/warehouse/src/main/webapp/WEB-INF/pages/navigationDialog.jsp new file mode 100644 index 0000000..afa95c1 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/navigationDialog.jsp @@ -0,0 +1,22 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +%> +<script src="<%=basePath%>/js/constant.js"></script> +<div>${breadcrumb.name}</div> +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <c:forEach var="breadcrumb" items="${appInfo.breadcrumb}"> + <c:choose> + <c:when test="${not breadcrumb.current}"> + <li class="breadcrumb-item"><a href="javascript:void(0);"onclick="Commons.showContent('<%=basePath%>/${breadcrumb.url}/')">${breadcrumb.name}</a></li> + </c:when> + <c:otherwise> + <li class="breadcrumb-item active" aria-current="page">${breadcrumb.name}</li> + </c:otherwise> + </c:choose> + </c:forEach> + </ol> +</nav> diff --git a/warehouse/src/main/webapp/WEB-INF/pages/other/404.jsp b/warehouse/src/main/webapp/WEB-INF/pages/other/404.jsp new file mode 100644 index 0000000..f64f50a --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/other/404.jsp @@ -0,0 +1,73 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String header = request.getHeader("referer"); +%> +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>AGL</title> + <link href="<%=basePath%>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/styles.css" rel="stylesheet"> + <link rel="shortcut icon" href="<%=basePath%>/img/favicon.ico" type="images/x-icon" /> + <link rel="icon" href="<%=basePath%>/img/favicon.ico" type="images/x-icon" /> + + <style> + body { + width: 100%; + background: #363D4D none repeat scroll 0% 0% !important; + font-size: 16px; + font-family: miranafont,"Hiragino Sans GB",STXihei,"Microsoft YaHei",SimSun,sans-serif; + line-height: 1.82; + } + + #error404 { + color: #505C73; + text-align: center; + font-size: 22px; + } + + p.errorfour { + margin: 100px auto 40px; + width: 504px; + height: 215px; + background: transparent url("<%=basePath%>/img/page404.png") no-repeat scroll 0% 0%; + } + + p { + margin: 20px 0px; + } + + #error404 a { + display: inline-block; + margin-top: 80px; + width: 200px; + height: 50px; + border: 1px solid #475266; + border-radius: 5px; + color: #505C73; + text-align: center; + font-size: 20px; + line-height: 50px; + transition: all 0.3s linear 0s; + } + + #error404 a:hover { + border: 1px solid #737F99; + color: #737F99; + } + </style> +</head> + <div id="error404"> + <p class="errorfour"></p> + <p> Page not found 。</p> + <a href="<%=basePath%>">Jump to the login</a> + </div> +<body> + +</body> +<script src="<%=header%>/js/jquery-1.11.1.min.js"></script> +</html>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/other/500.jsp b/warehouse/src/main/webapp/WEB-INF/pages/other/500.jsp new file mode 100644 index 0000000..f2c325e --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/other/500.jsp @@ -0,0 +1,73 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String header = request.getHeader("referer"); +%> +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>AGL</title> + <link href="<%=basePath%>/css/bootstrap.min.css" rel="stylesheet"> + <link href="<%=basePath%>/css/styles.css" rel="stylesheet"> + <link rel="shortcut icon" href="<%=basePath%>/img/favicon.ico" type="images/x-icon" /> + <link rel="icon" href="<%=basePath%>/img/favicon.ico" type="images/x-icon" /> + + <style> + body { + width: 100%; + background: #363D4D none repeat scroll 0% 0% !important; + font-size: 16px; + font-family: miranafont,"Hiragino Sans GB",STXihei,"Microsoft YaHei",SimSun,sans-serif; + line-height: 1.82; + } + + #error404 { + color: #505C73; + text-align: center; + font-size: 22px; + } + + p.errorfour { + margin: 100px auto 50px; + width: 504px; + height: 215px; + font-size: 200px; + } + + p { + margin: 20px 0px; + } + + #error404 a { + display: inline-block; + margin-top: 80px; + width: 200px; + height: 50px; + border: 1px solid #475266; + border-radius: 5px; + color: #505C73; + text-align: center; + font-size: 20px; + line-height: 50px; + transition: all 0.3s linear 0s; + } + + #error404 a:hover { + border: 1px solid #737F99; + color: #737F99; + } + </style> +</head> + <div id="error404"> + <p class="errorfour">500</p> + <p>${message}</p> + <a href="<%=header%>">Jump to the home page</a> + </div> +<body> + +</body> +<script src="<%=basePath%>/js/jquery-1.11.1.min.js"></script> +</html>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/pages/skip.jsp b/warehouse/src/main/webapp/WEB-INF/pages/skip.jsp new file mode 100644 index 0000000..fd2c713 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/pages/skip.jsp @@ -0,0 +1,31 @@ +<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<% +String path = request.getContextPath(); +String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path; +String params = request.getQueryString(); +%> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<input type="hidden" id="params" value="<%=params%>"/> +<script src="<%=basePath%>/js/jquery/jquery.min.js"></script> +<script src="<%=basePath%>/js/jquery/easing/jquery.easing.min.js"></script> +</body> +</html> +<script> +$(function(){ + debugger; + var param = $('#params').val(); + + if(param == "null"){ + window.location.href="<%=basePath%>/main"; + }else{ + window.location.href="<%=basePath%>/mainDev?" + param; + } +}); +</script>
\ No newline at end of file diff --git a/warehouse/src/main/webapp/WEB-INF/web.xml b/warehouse/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..2f99608 --- /dev/null +++ b/warehouse/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="WebApp_ID" version="3.0"> + + <display-name>springmvcRestful</display-name> + + <filter> + <filter-name>encodingFilter</filter-name> + <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> + <init-param> + <param-name>encoding</param-name> + <param-value>UTF-8</param-value> + </init-param> + <init-param> + <param-name>forceEncoding</param-name> + <param-value>true</param-value> + </init-param> + </filter> + + <filter-mapping> + <filter-name>encodingFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter> + <filter-name>filter</filter-name> + <filter-class>app.market.filter.Filter</filter-class> + </filter> + <filter-mapping> + <filter-name>filter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <servlet> + <servlet-name>appMarket</servlet-name> + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> + <init-param> + <param-name>contextConfigLocation</param-name> + <param-value>classpath:config/spring-servlet.xml</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>appMarket</servlet-name> + <url-pattern>/</url-pattern> + </servlet-mapping> + + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>classpath:config/spring-application.xml</param-value> + </context-param> + + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + + <listener> + <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> + </listener> + + <listener> + <listener-class>app.market.filter.Log4jlistener</listener-class> + </listener> + <context-param> + <param-name>log4jConfigLocation</param-name> + <param-value>classpath:config/log4j.xml</param-value> + </context-param> + + <listener> + <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> + </listener> + + <welcome-file-list> + <welcome-file>/WEB-INF/pages/skip.jsp</welcome-file> + </welcome-file-list> + + <session-config> + <session-timeout>0</session-timeout> + </session-config> + + <error-page> + <error-code>404</error-code> + <location>/WEB-INF/pages/other/404.jsp</location> + </error-page> + +</web-app>
\ No newline at end of file |