开源error页面,include页面,layouts页面

This commit is contained in:
thinkgem
2018-02-27 22:10:41 +08:00
parent 88800fa1f1
commit 64233ef9f0
9 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<%
@servlet.getResponse().setStatus(400);
var message = @ObjectUtils.toString(@request.getAttribute("message"));
if (isBlank(message)){
var ex = @ExceptionUtils.getThrowable(request);
if (ex != null){
if(@StringUtils.startsWith(@ex.getMessage(), "msg:")){
message = @StringUtils.replace(@ex.getMessage(), "msg:", "");
}
}
}
if (isBlank(message)){
message = "您的操作权限不足!";
}
// 如果是异步请求或是手机端,则直接返回信息
if (@ServletUtils.isAjaxRequest(request)) {
print(message);
}
// 输出异常信息页面
else {
%>
<% layout('/layouts/default.html', {title: '403 - 操作权限不足'}){ %>
<link rel="stylesheet" href="${ctxStatic}/common/error.css?${_version}">
<div class="error-page">
<div class="headline text-yellow">403</div>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> ${message}</h3>
<p>很抱歉,您没有权限访问此页面,若有疑问请联系管理员。</p>
<button type="button" class="btn btn-warning btn-sm" onclick="history.go(-1);"><i
class="fa fa-reply-all"></i> 返回上一页</button>
</div>
<div class="copyright">
<% var productName = @Global.getConfig('productName'), productVersion = @Global.getConfig('productVersion'); %>
版权所有 &copy; ${@DateUtils.getYear()} ${productName} - Powered By <a href="http://jeesite.com">JeeSite</a>.
</div>
</div>
<% } %>
<% } %>

View File

@@ -0,0 +1,50 @@
<%
@servlet.getResponse().setStatus(404);
var message = @ObjectUtils.toString(@request.getAttribute("message"));
if (isBlank(message)){
message = "您访问的页面不存在!";
}
// 下载文件不存在的异常,状态码设为正常
if (message == '文件已丢失或不存在!'){
@servlet.getResponse().setStatus(200);
}
// 如果是异步请求或是手机端,则直接返回信息
if (@ServletUtils.isAjaxRequest(request)) {
print(message);
}
// 输出异常信息页面
else {
%>
<% layout('/layouts/default.html', {title: '404 - 页面不存在'}){ %>
<link rel="stylesheet" href="${ctxStatic}/common/error.css?${_version}">
<div class="error-page">
<div class="headline text-aqua mt20">404</div>
<div class="error-content">
<h3><i class="fa fa-warning text-aqua"></i> ${message}</h3>
<p>可能是如下原因引起的这个错误:</p>
<ul>
<li>地址输入错误,链接已经失效过期.</li>
<li style="word-break:break-all;word-wrap:break-word;">
您访问的地址为:${
@EncodeUtils.escapeHtml(
@request.getAttribute('javax.servlet.forward.request_uri')
)
}</li>
<li>若有疑问请联系管理员.</li>
<li>......</li>
</ul>
<button type="button" class="btn btn-info btn-sm" onclick="history.go(-1);"><i
class="fa fa-reply-all"></i> 返回上一页</button>
</div>
<div class="copyright">
<% var productName = @Global.getConfig('productName'), productVersion = @Global.getConfig('productVersion'); %>
版权所有 &copy; ${@DateUtils.getYear()} ${productName} - Powered By <a href="http://jeesite.com">JeeSite</a>.
</div>
</div>
<% } %>
<% } %>

View File

@@ -0,0 +1,53 @@
<%
@servlet.getResponse().setStatus(500);
var message = @ObjectUtils.toString(@request.getAttribute("message"));
var ex;
if (isBlank(message)){
ex = @ExceptionUtils.getThrowable(request);
if (ex != null){
if (@StringUtils.startsWith(@ex.getMessage(), "msg:")){
message = @StringUtils.replace(@ex.getMessage(), "msg:", "");
}else if (ex.class.name == 'com.jeesite.common.service.ServiceException'){
message = @ex.getMessage();
}
@org.slf4j.LoggerFactory.getLogger("error/500").error(ex.message, ex);
}
}
if (isBlank(message)){
message = "您访问的页面出错啦!";
}
// 如果是异步请求或是手机端,则直接返回信息
if (@ServletUtils.isAjaxRequest(request)) {
print(message);
}
// 输出异常信息页面
else {
%>
<% layout('/layouts/default.html', {title: '500 - 系统内部错误'}){ %>
<link rel="stylesheet" href="${ctxStatic}/common/error.css?${_version}">
<div class="error-page">
<div class="headline text-red">500</div>
<div class="error-content">
<h3><i class="fa fa-warning text-red"></i> ${message}</h3>
<p>对不起,你访问的页面出现了一点问题,请及时联系管理员解决!</p>
<button type="button" class="btn btn-danger btn-sm" onclick="history.go(-1);"><i
class="fa fa-reply-all"></i> 返回上一页</button>
</div>
<div class="copyright">
<% var productName = @Global.getConfig('productName'), productVersion = @Global.getConfig('productVersion'); %>
版权所有 &copy; ${@DateUtils.getYear()} ${productName} - Powered By <a href="http://jeesite.com">JeeSite</a>.
</div>
</div>
<% if (@ObjectUtils.toBoolean(@Global.getConfig('error.page.printErrorInfo', 'true'))){ %>
<div class="box mt20">
${@StringUtils.toHtml(@ExceptionUtils.getStackTraceAsString(ex))}<br/>
此异常信息若不想输出可打开jeesite.properties文件设置error.page.printErrorInfo=false即可
</div>
<% } %>
<% } %>
<% } %>

View File

@@ -0,0 +1,22 @@
<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. */ %>
<link rel="stylesheet" href="${ctxStatic}/fonts/font-icons.min.css">
<link rel="stylesheet" href="${ctxStatic}/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="${ctxStatic}/select2/4.0/select2.css?${_version}">
<link rel="stylesheet" href="${ctxStatic}/icheck/1.0/minimal/grey.css?${_version}">
<% if (@ListUtils.inString('zTree', libs!)){ %>
<link rel="stylesheet" href="${ctxStatic}/jquery-ztree/3.5/css/metro/zTreeStyle.css?${_version}">
<% } %>
<% if (@ListUtils.inString('tabPage', libs!)){ %>
<link rel="stylesheet" href="${ctxStatic}/wdScrollTab/css/TabPanel.css?${_version}">
<% } %>
<% if (@ListUtils.inString('dataGrid', libs!)){ %>
<link rel="stylesheet" href="${ctxStatic}/jqGrid/4.7/css/ui.jqgrid.css?${_version}">
<% } %>
<% if (@ListUtils.inString('layout', libs!)){ %>
<link rel="stylesheet" href="${ctxStatic}/jquery-plugins/jquery.layout-latest.css?${_version}">
<% } %>
<% if (@ListUtils.inString('fileupload', libs!)){ %>
<link rel="stylesheet" href="${ctxStatic}/webuploader/0.1/webuploader.extend.css?${_version}">
<% } %>
<link rel="stylesheet" href="${ctxStatic}/adminlte/css/AdminLTE.min.css?${_version}">
<link rel="stylesheet" href="${ctxStatic}/common/jeesite.css?${_version}">

View File

@@ -0,0 +1,18 @@
<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. */
var productName = @Global.getConfig('productName') + ' ' + @Global.getConfig('productVersion');
var pageTitle = (isNotBlank(title!) ? title! + ' - ' : '') + productName;
var globalFields = @Global.getConst('Global.Fields');
%>
<meta charset="utf-8">
<meta content="webkit" name="renderer"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/><meta http-equiv="Expires" content="0"/>
<meta content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
<meta content="${productName} - Powered By JeeSite" name="description"/>
<meta content="ThinkGem, http://jeesite.com" name="author"/>
<title>${pageTitle}</title>
<script src="${ctxPath}/global.min.js?ctx=${ctx}"></script>
<script src="${ctxStatic}/jquery/jquery-1.12.4.min.js"></script>
<script src="${ctxStatic}/jquery/jquery-migrate-1.4.1.min.js"></script>
<!--[if lt IE 9]><script src="${ctxStatic}/common/h5fix.min.js"></script><![endif]-->

View File

@@ -0,0 +1,41 @@
<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. */ %>
<script src="${ctxStatic}/bootstrap/js/bootstrap.min.js"></script>
<script src="${ctxStatic}/select2/4.0/select2.js?${_version}"></script>
<script src="${ctxStatic}/select2/4.0/i18n/${lang()}.js?${_version}"></script>
<script src="${ctxStatic}/layer/3.1/layer.js?${_version}"></script>
<script src="${ctxStatic}/my97/WdatePicker.js?${_version}"></script>
<% if (@ListUtils.inString('zTree', libs!)){ %>
<script src="${ctxStatic}/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('tabPage', libs!)){ %>
<script src="${ctxStatic}/wdScrollTab/js/TabPanel.js?${_version}"></script>
<script src="${ctxStatic}/wdScrollTab/js/TabPanel.extend.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('dataGrid', libs!)){ %>
<script src="${ctxStatic}/jqGrid/4.7/js/jquery.jqGrid.js?${_version}"></script>
<script src="${ctxStatic}/jqGrid/4.7/js/jquery.jqGrid.extend.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('validate', libs!)){ %>
<script src="${ctxStatic}/jquery-validation/1.16/jquery.validate.js?${_version}"></script>
<script src="${ctxStatic}/jquery-validation/1.16/jquery.validate.extend.js?${_version}"></script>
<script src="${ctxStatic}/jquery-validation/1.16/localization/messages_${lang()}.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('layout', libs!)){ %>
<script src="${ctxStatic}/jquery/jquery-ui-draggable-1.12.1.min.js?${_version}"></script>
<script src="${ctxStatic}/jquery/jquery-ui-effect-1.12.1.min.js?${_version}"></script>
<script src="${ctxStatic}/jquery-plugins/jquery.layout-latest.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('inputmask', libs!)){ %>
<script src="${ctxStatic}/jquery-plugins/jquery.inputmask.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('fileupload', libs!)){ %>
<script src="${ctxStatic}/webuploader/0.1/webuploader.js?${_version}"></script>
<script src="${ctxStatic}/webuploader/0.1/webuploader.extend.js?${_version}"></script>
<% } %>
<% if (@ListUtils.inString('ueditor', libs!)){ %>
<script src="${ctxStatic}/ueditor/1.4/ueditor.config.js?${_version}"></script>
<script src="${ctxStatic}/ueditor/1.4/ueditor.all.js?${_version}"></script>
<script src="${ctxStatic}/ueditor/1.4/lang/${lang()}/${lang()}.js?${_version}"></script>
<% } %>
<script src="${ctxStatic}/common/jeesite.js?${_version}"></script>
<script src="${ctxStatic}/common/i18n/${lang()}.js?${_version}"></script>

View File

@@ -0,0 +1,19 @@
<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. */
/*
* 默认布局文件
* @param title 页面标题
* @param bodyClass body标签的class内容
* @param libs 要引用的js或css类库
*/
var themeName = @Global.getConfig('web.view.themeName', 'default');
%>
<% print('<'+'!DOC'+'TYPE html'+'>'); %>
<% print('<'+'html'+'><'+'head'+'>'); %>
<% include('/include/head.html', {title: title!}){} %>
<% include('/themes/'+themeName+'/include/header.html', {libs: libs!}){} %>
</head><body class="hold-transition ${bodyClass!}">
<% if (!@ListUtils.inString('layout', libs!)){ %>
<div class="wrapper">${layoutContent}</div>
<% }else{ %>${layoutContent}<% } %>
<a id="scroll-up" href="#" class="btn btn-sm"><i class="fa fa-angle-double-up"></i></a>
<% include('/themes/'+themeName+'/include/footer.html', {libs: libs!}){} %>

View File

@@ -0,0 +1,2 @@
<% include('/include/jslibs.html', {libs: libs!}){} %>
<script src="${ctxStatic}/common/common.js?${_version}"></script>

View File

@@ -0,0 +1,2 @@
<% include('/include/csslibs.html', {libs: libs!}){} %>
<link rel="stylesheet" href="${ctxStatic}/common/common.css?${_version}">