bug fix
This commit is contained in:
parent
5ba5f09f77
commit
a20c9da0bb
|
|
@ -168,7 +168,7 @@ public class Func {
|
|||
return true;
|
||||
}
|
||||
if (o instanceof String) {
|
||||
if (o.toString().trim().equals("")) {
|
||||
if (o.toString().equals("")) {
|
||||
return true;
|
||||
}
|
||||
} else if (o instanceof List) {
|
||||
|
|
|
|||
|
|
@ -74,15 +74,15 @@ public class BladeFile {
|
|||
this.file = file;
|
||||
this.fileName = file.getName();
|
||||
this.originalFileName = file.getOriginalFilename();
|
||||
this.uploadPath = UploadFileUtils.formatUrl(File.separator + Cst.me().getUploadRealPath() + File.separator + dir + File.separator + DateKit.getDays() + File.separator + this.originalFileName);
|
||||
this.uploadVirtualPath = UploadFileUtils.formatUrl(Cst.me().getUploadCtxPath().replace(Cst.me().getContextPath(), "") + File.separator + dir + File.separator + DateKit.getDays() + File.separator + this.originalFileName);
|
||||
this.uploadPath = BladeFileKit.formatUrl(File.separator + Cst.me().getUploadRealPath() + File.separator + dir + File.separator + DateKit.getDays() + File.separator + this.originalFileName);
|
||||
this.uploadVirtualPath = BladeFileKit.formatUrl(Cst.me().getUploadCtxPath().replace(Cst.me().getContextPath(), "") + File.separator + dir + File.separator + DateKit.getDays() + File.separator + this.originalFileName);
|
||||
}
|
||||
|
||||
private BladeFile(MultipartFile file, String dir, String uploadPath, String uploadVirtualPath) {
|
||||
this(file, dir);
|
||||
if (null != uploadPath){
|
||||
this.uploadPath = UploadFileUtils.formatUrl(uploadPath);
|
||||
this.uploadVirtualPath = UploadFileUtils.formatUrl(uploadVirtualPath);
|
||||
this.uploadPath = BladeFileKit.formatUrl(uploadPath);
|
||||
this.uploadVirtualPath = BladeFileKit.formatUrl(uploadVirtualPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.smallchill.core.toolbox.kit.DateKit;
|
|||
import com.smallchill.core.toolbox.kit.PathKit;
|
||||
import com.smallchill.core.toolbox.kit.StrKit;
|
||||
|
||||
public class UploadFileUtils {
|
||||
public class BladeFileKit {
|
||||
|
||||
// 定义允许上传的文件扩展名
|
||||
private static HashMap<String, String> extMap = new HashMap<String, String>();
|
||||
|
|
@ -49,7 +49,7 @@ public class UploadFileUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试文件后缀 只让指定后缀的文件上次,像jsp,war,sh等危险的后缀禁止
|
||||
* 测试文件后缀 只让指定后缀的文件上传,像jsp,war,sh等危险的后缀禁止
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -20,6 +20,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.util.Date;
|
||||
|
||||
import com.smallchill.common.vo.ShiroUser;
|
||||
import com.smallchill.core.constant.Cst;
|
||||
import com.smallchill.core.plugins.dao.Blade;
|
||||
import com.smallchill.core.shiro.ShiroKit;
|
||||
|
|
@ -52,13 +53,15 @@ public class DefaultFileProxyFactory implements IFileProxy {
|
|||
.append(time)
|
||||
.append(getFileExt(f.getName()));
|
||||
|
||||
return new String [] {UploadFileUtils.formatUrl(uploadPath.toString()), UploadFileUtils.formatUrl(virtualPath.toString())};
|
||||
return new String [] {BladeFileKit.formatUrl(uploadPath.toString()), BladeFileKit.formatUrl(virtualPath.toString())};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFileId(BladeFile bf) {
|
||||
Attach attach = new Attach();
|
||||
attach.setCreater(Func.toInt(ShiroKit.getUser().getId(), 0));
|
||||
ShiroUser user = ShiroKit.getUser();
|
||||
Object creater = (null == user) ? 0 : user.getId();
|
||||
attach.setCreater(Func.toInt(creater));
|
||||
attach.setCreatetime(new Date());
|
||||
attach.setName(bf.getOriginalFileName());
|
||||
attach.setStatus(1);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class BeanInjector {
|
|||
if (value.length > 1) {
|
||||
o = CollectionKit.join(value, ",");
|
||||
} else {
|
||||
o = value[0];
|
||||
o = Func.equals(value[0], "") ? " " : value[0];
|
||||
}
|
||||
}
|
||||
map.put(StrKit.removePrefixIgnoreCase(param.getKey(), start).toLowerCase(), o);
|
||||
|
|
@ -85,7 +85,7 @@ public class BeanInjector {
|
|||
if (value.length > 1) {
|
||||
o = CollectionKit.join(value, ",");
|
||||
} else {
|
||||
o = value[0];
|
||||
o = Func.equals(value[0], "") ? " " : value[0];
|
||||
}
|
||||
}
|
||||
map.put(param.getKey(), o);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.smallchill.core.toolbox.Paras;
|
|||
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
||||
import com.smallchill.core.toolbox.file.BladeFile;
|
||||
import com.smallchill.core.toolbox.file.FileRender;
|
||||
import com.smallchill.core.toolbox.file.UploadFileUtils;
|
||||
import com.smallchill.core.toolbox.file.BladeFileKit;
|
||||
import com.smallchill.core.toolbox.kit.PathKit;
|
||||
|
||||
@Controller
|
||||
|
|
@ -56,7 +56,7 @@ public class KindEditorController extends BladeController {
|
|||
String originalFileName = file.getOriginalFilename();
|
||||
String dir = getParameter("dir", "image");
|
||||
// 测试后缀
|
||||
boolean ok = UploadFileUtils.testExt(dir, originalFileName);
|
||||
boolean ok = BladeFileKit.testExt(dir, originalFileName);
|
||||
if (!ok) {
|
||||
ps.set("error", 1);
|
||||
ps.set("message", "上传文件的类型不允许");
|
||||
|
|
@ -89,7 +89,7 @@ public class KindEditorController extends BladeController {
|
|||
}
|
||||
String order = getParameter("order", "name");
|
||||
|
||||
Map<String, Object> result = UploadFileUtils.listFiles(dir, path, order);
|
||||
Map<String, Object> result = BladeFileKit.listFiles(dir, path, order);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import com.smallchill.core.plugins.dao.Db;
|
|||
import com.smallchill.core.toolbox.Paras;
|
||||
import com.smallchill.core.toolbox.file.BladeFile;
|
||||
import com.smallchill.core.toolbox.file.FileRender;
|
||||
import com.smallchill.core.toolbox.file.UploadFileUtils;
|
||||
import com.smallchill.core.toolbox.file.BladeFileKit;
|
||||
import com.smallchill.core.toolbox.kit.PathKit;
|
||||
|
||||
@Controller
|
||||
|
|
@ -38,7 +38,7 @@ public class UploadifyController extends BladeController {
|
|||
String originalFileName = file.getOriginalFilename();
|
||||
String dir = getParameter("dir", "image");
|
||||
// 测试后缀
|
||||
boolean ok = UploadFileUtils.testExt(dir, originalFileName);
|
||||
boolean ok = BladeFileKit.testExt(dir, originalFileName);
|
||||
if (!ok) {
|
||||
rd.set("error", 1);
|
||||
rd.set("message", "上传文件的类型不允许");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@
|
|||
<!-- blade通用工具类 -->
|
||||
<script src="${ctxPath}/static/blade/js/blade-toolbox.js" type="text/javascript" ></script>
|
||||
<script src="${ctxPath}/static/blade/js/blade-ajax.js" type="text/javascript" ></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
BladeApp.addCtx("${ctxPath}");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="no-skin">
|
||||
<div class="main-container" id="main-container">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
${"@"}layout("/common/_container.html"){
|
||||
|
||||
<script type="text/javascript">
|
||||
var ctx = "${"$"}{ctxPath}";
|
||||
var grid_selector = "#grid-table";
|
||||
var pager_selector = "#grid-pager";
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ ${"@"}layout("/common/_container.html"){
|
|||
});
|
||||
|
||||
function initGrid(){
|
||||
var grid_url = ctx + "/${"$"}{code}/list";
|
||||
var grid_url = "${"$"}{ctxPath}/${"$"}{code}/list";
|
||||
var _colnames = [@trim(){
|
||||
@ for (attr in attrs) {
|
||||
@if (isEmpty(attr.comment)) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Blade企业级开发平台-登录页</title>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@ layout("/common/_container.html"){
|
||||
<script type="text/javascript">
|
||||
var ctx="${ctxPath}";
|
||||
var ctx = "${ctxPath}";
|
||||
var grid_selector = "#grid-table";
|
||||
var pager_selector = "#grid-pager";
|
||||
var _filter = "";//如果点了搜索按钮想让过滤条件失效,则将定义放入initGrid()中
|
||||
|
|
@ -11,14 +11,15 @@
|
|||
});
|
||||
|
||||
function initGrid(){
|
||||
var grid_url = ctx+"/${code}/list";//查询列表接口
|
||||
var _colnames=[ "序列","通知标题", "公告类型","创建人", "创建时间", "发布时间"];
|
||||
var _colmodel=[ {name:"F_IT_XL",index:"F_IT_XL", width:80,hidden:true},
|
||||
{name:"F_VC_BT",index:"F_VC_BT", width:100},
|
||||
{name:"DIC_F_IT_LX",index:"F_IT_LX", width:80},
|
||||
{name:"DIC_F_IT_CJR",index:"F_IT_CJR", width:80},
|
||||
{name:"F_DT_CJSJ",index:"F_DT_CJSJ", width:80},
|
||||
{name:"F_DT_FBSJ",index:"F_DT_FBSJ", width:80}
|
||||
var grid_url = ctx + "/${code}/list";//查询列表接口
|
||||
var _colnames=[ "序列","通知标题", "公告类型", "公告类型", "创建人", "创建时间", "发布时间"];
|
||||
var _colmodel=[ {name:"F_IT_XL", index:"F_IT_XL", width:80, hidden:true},
|
||||
{name:"F_VC_BT", index:"F_VC_BT", width:250},
|
||||
{name:"F_IT_LX", index:"F_IT_LX", width:80, hidden:true},
|
||||
{name:"DIC_F_IT_LX", index:"F_IT_LX", width:80, formatter:rowShow},
|
||||
{name:"DIC_F_IT_CJR", index:"F_IT_CJR", width:80},
|
||||
{name:"F_DT_CJSJ", index:"F_DT_CJSJ", width:135, align:"center"},
|
||||
{name:"F_DT_FBSJ", index:"F_DT_FBSJ", width:135, align:"center"}
|
||||
];
|
||||
|
||||
@ if (shiro.lacksRole('administrator')) {
|
||||
|
|
@ -28,16 +29,50 @@
|
|||
|
||||
jQuery(grid_selector).jqGrid({
|
||||
url:grid_url,
|
||||
shrinkToFit:true,//适用于较少字段,响应式
|
||||
shrinkToFit:false,//适用于较少字段,响应式
|
||||
colNames:_colnames,
|
||||
colModel:_colmodel,
|
||||
jsonReader:{id:"F_IT_XL"},
|
||||
jsonReader:{id : "F_IT_XL"},
|
||||
pager : pager_selector,
|
||||
postData: {where: _filter, sort: "F_IT_XL", order: "desc"}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function rowShow(cellvalue, options, rowObject) {
|
||||
var lx = rowObject.F_IT_LX;
|
||||
var sclass = "";
|
||||
switch (lx) {
|
||||
case 1:
|
||||
sclass = "label label-info arrowed-right arrowed-in";
|
||||
break;
|
||||
case 2:
|
||||
sclass = "label label-success arrowed arrowed-right";
|
||||
break;
|
||||
case 3:
|
||||
sclass = "label label-info arrowed arrowed-in-right";
|
||||
break;
|
||||
case 4:
|
||||
sclass = "label label-warning arrowed arrowed-right";
|
||||
break;
|
||||
case 5:
|
||||
sclass = "label label-danger arrowed arrowed-right";
|
||||
break;
|
||||
case 6:
|
||||
sclass = "label label-danger arrowed arrowed-in-right";
|
||||
break;
|
||||
case 7:
|
||||
sclass = "label arrowed arrowed-right";
|
||||
break;
|
||||
default:
|
||||
sclass = "label label-info arrowed-right arrowed-in";
|
||||
break;
|
||||
}
|
||||
|
||||
var html = "<span class='" + sclass + "'>" + rowObject.DIC_F_IT_LX + "</span>";
|
||||
return html;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ var exwhere;
|
|||
this.name = btnjson.NAME;
|
||||
this.pname = btnjson.PNAME;
|
||||
this.alias = btnjson.ALIAS;
|
||||
this.url = this.isEmpty(ctx) + btnjson.URL;
|
||||
this.url = this.isEmpty(BladeApp.ctxPath) + btnjson.URL;
|
||||
this.div = this.isEmpty(btnjson.ICON.split('|')[0]);
|
||||
this.li = this.isEmpty(btnjson.ICON.split('|')[1]);
|
||||
this.area=this.isEmpty(btnjson.TIPS);
|
||||
|
|
@ -144,7 +144,7 @@ var exwhere;
|
|||
return;
|
||||
}
|
||||
var _this = this;
|
||||
$.post(ctx + "/role/getPowerById", { id: ids }, function (data) {
|
||||
$.post(BladeApp.ctxPath + "/role/getPowerById", { id: ids }, function (data) {
|
||||
if (data.code === 0) {
|
||||
var roleName=rowData.NAME;
|
||||
_this.open(_this.url + "?roleId=" + ids + "&roleName=" + roleName);
|
||||
|
|
@ -251,7 +251,7 @@ var exwhere;
|
|||
if (this.alias == "audit" || this.alias == "recycle") {
|
||||
var code = this.id;
|
||||
if (stage.all[code] == undefined) {
|
||||
$.post(ctx + "/cache/getChildBtn", { code: code }, function (data) {
|
||||
$.post(BladeApp.ctxPath + "/cache/getChildBtn", { code: code }, function (data) {
|
||||
if (data.code === 0) {
|
||||
btnjsons = data.data;
|
||||
var _btn_child_stage = new btn_child_stage();
|
||||
|
|
@ -268,7 +268,7 @@ var exwhere;
|
|||
else {
|
||||
stage.all[code].btn.bind(toolbar);
|
||||
}
|
||||
exwhere = this.url.replace(ctx, "");//修复未发布在tomcat根目录下带有项目路径导致不能搜索的问题
|
||||
exwhere = this.url.replace(BladeApp.ctxPath, "");//修复未发布在tomcat根目录下带有项目路径导致不能搜索的问题
|
||||
isAutoPage = false;//自动跳转到第一页
|
||||
searchGrid();
|
||||
return;
|
||||
|
|
@ -482,7 +482,7 @@ var exwhere;
|
|||
|
||||
// 根据模块code生成每个工具条上面的 btn
|
||||
function initMenuBtn(obj, code) {
|
||||
$.post(ctx + "/cache/getBtn", { code: code }, function (data) {
|
||||
$.post(BladeApp.ctxPath + "/cache/getBtn", { code: code }, function (data) {
|
||||
if (data.code === 0) {
|
||||
toolbar = obj;
|
||||
btnjsons = data.data;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
|
||||
/********************** 公共工具类 ***************/
|
||||
/****************** 基本信息 ***************/
|
||||
var BladeApp = {
|
||||
ctxPath : "",
|
||||
addCtx: function (ctx) {
|
||||
if (this.ctxPath == "") {
|
||||
this.ctxPath = ctx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/****************** 公共工具类 ***************/
|
||||
var BladeTool = {
|
||||
isNotEmpty: function(val) {
|
||||
return ! this.isEmpty(val);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user