forked from p81075629/datagear
解决jetty嵌入程序运行时部分功能URL链接错误的BUG;
This commit is contained in:
parent
e63db286b7
commit
70c28f7465
|
@ -931,40 +931,6 @@
|
|||
return $.meta.escapeHtml(text);
|
||||
},
|
||||
|
||||
/**
|
||||
* 将传入参数转义为路径。
|
||||
*
|
||||
* @param args 路径元素,元素为true或false,可控制下一个元素是否转义
|
||||
*/
|
||||
toPath : function(args)
|
||||
{
|
||||
var re="";
|
||||
|
||||
var encode = true;
|
||||
for(var i=0; i< arguments.length; i++)
|
||||
{
|
||||
var element = arguments[i];
|
||||
|
||||
//设置下一个元素是否转义
|
||||
if(element === true || element === false)
|
||||
{
|
||||
encode = element;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(encode)
|
||||
element = encodeURIComponent(element);
|
||||
|
||||
if(re && re.charAt(re.length - 1) != "/")
|
||||
re += "/";
|
||||
|
||||
re += element;
|
||||
encode=true;
|
||||
}
|
||||
|
||||
return re;
|
||||
},
|
||||
|
||||
/**
|
||||
* 为DataTables转义列名。
|
||||
* 参考jquery.dataTables.js的_fnSplitObjNotation函数。
|
||||
|
|
|
@ -225,7 +225,7 @@ readonly 是否只读操作,允许为null
|
|||
if(chartPluginVO.iconUrl)
|
||||
{
|
||||
$wapper.removeClass("no-icon");
|
||||
$("<div class='plugin-icon'></div>").css("background-image", "url(${contextPath}/"+chartPluginVO.iconUrl+")").appendTo($wapper);
|
||||
$("<div class='plugin-icon'></div>").css("background-image", "url(${contextPath}"+chartPluginVO.iconUrl+")").appendTo($wapper);
|
||||
}
|
||||
else
|
||||
$wapper.addClass("no-icon");
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
.attr("chart-plugin-id", chartPlugin.id).attr("title", chartPlugin.nameLabel.value).appendTo($liulli);
|
||||
|
||||
if(chartPlugin.iconUrl)
|
||||
$("<div class='plugin-icon'> </div>").css("background-image", "url(${contextPath}/"+chartPlugin.iconUrl+")").appendTo($item);
|
||||
$("<div class='plugin-icon'> </div>").css("background-image", "url(${contextPath}"+chartPlugin.iconUrl+")").appendTo($item);
|
||||
|
||||
$("<div class='plugin-name'></div>").text(chartPlugin.nameLabel.value).appendTo($item);
|
||||
}
|
||||
|
|
|
@ -130,7 +130,9 @@ boolean readonly 是否只读操作,默认为false
|
|||
</#if>
|
||||
};
|
||||
|
||||
po.open(po.url("", "add", "batchSet=true"), options);
|
||||
var url = po.url("add");
|
||||
url = $.addParam(url, "batchSet", "true");
|
||||
po.open(url, options);
|
||||
});
|
||||
|
||||
po.element("input[name=editButton]").click(function()
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
*
|
||||
* @param tableName 可选,操作对应的表名,默认是当前表名
|
||||
* @param action 操作名称
|
||||
* @param param URL后面加的参数,不需要以'?'开头
|
||||
*/
|
||||
url : function(tableName, action, param)
|
||||
url : function(tableName, action)
|
||||
{
|
||||
if(action == undefined)
|
||||
{
|
||||
|
@ -28,7 +27,7 @@
|
|||
if(!tableName)
|
||||
tableName = this.tableName;
|
||||
|
||||
return $.toPath(false, contextPath, "data", this.schemaId, tableName, action) + (param ? "?" + param : "");
|
||||
return po.concatContextPath("data", this.schemaId, tableName, action);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -202,6 +202,25 @@ var ${pageId} =
|
|||
this.close();
|
||||
|
||||
return close;
|
||||
},
|
||||
|
||||
/**
|
||||
* 连接contextPath路径。
|
||||
* @param pathNode 可变路径节点,不需要加“/”
|
||||
*/
|
||||
concatContextPath : function(pathNode)
|
||||
{
|
||||
var path = "${contextPath}";
|
||||
|
||||
for(var i=0; i< arguments.length; i++)
|
||||
{
|
||||
if(path == "" || path.charAt(path.length - 1) != "/")
|
||||
path += "/";
|
||||
|
||||
path += encodeURIComponent(arguments[i]);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -220,7 +220,7 @@ ${detectNewVersionScript}
|
|||
if(table.comment)
|
||||
atitle += "<@spring.message code='bracketLeft' />" + table.comment + "<@spring.message code='bracketRight' />";
|
||||
|
||||
table.a_attr = { "href": $.toPath(false, contextPath, "data", schema.id, table.name, "query"), "title" : atitle};
|
||||
table.a_attr = { "href": po.concatContextPath("data", schema.id, table.name, "query"), "title" : atitle};
|
||||
|
||||
return table;
|
||||
};
|
||||
|
@ -389,7 +389,7 @@ ${detectNewVersionScript}
|
|||
}
|
||||
else if(po.isSchemaNode(node))
|
||||
{
|
||||
$.ajaxJson($.toPath(false, contextPath, "schema", node.id, "pagingQueryTable"),
|
||||
$.ajaxJson(po.concatContextPath("schema", node.id, "pagingQueryTable"),
|
||||
{
|
||||
data: po.getSearchSchemaFormDataForTable(),
|
||||
success: function(pagingData)
|
||||
|
@ -422,7 +422,7 @@ ${detectNewVersionScript}
|
|||
tabTitle += "<@spring.message code='bracketLeft' />" + tableInfo.comment + "<@spring.message code='bracketRight' />";
|
||||
tabTitle += "<@spring.message code='bracketLeft' />" + schema.title + "<@spring.message code='bracketRight' />";
|
||||
|
||||
var tabUrl = $.toPath(false, contextPath, "data", schema.id, tableInfo.name, "query");
|
||||
var tabUrl = po.concatContextPath("data", schema.id, tableInfo.name, "query");
|
||||
|
||||
po.activeWorkTab(po.toMainTabIdForSchemaName(schema.id, tableInfo.name), data.node.text, tabTitle, tabUrl, schema);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ ${detectNewVersionScript}
|
|||
var param = po.getSearchSchemaFormDataForTable();
|
||||
param = $.extend({}, data.node.original.nextPageInfo, param);
|
||||
|
||||
$.ajaxJson($.toPath(false, contextPath, "schema", schemaId, "pagingQueryTable"),
|
||||
$.ajaxJson(po.concatContextPath("schema", schemaId, "pagingQueryTable"),
|
||||
{
|
||||
data : param,
|
||||
success : function(pagingData)
|
||||
|
@ -867,7 +867,9 @@ ${detectNewVersionScript}
|
|||
|
||||
var schemaId = selNode.original.id;
|
||||
|
||||
po.open($.toPath(false, contextPath, "schema", ($item.hasClass("schema-operation-edit") ? "edit" : "view"))+"?id="+encodeURIComponent(schemaId),
|
||||
var url = po.concatContextPath("schema", ($item.hasClass("schema-operation-edit") ? "edit" : "view"));
|
||||
url = $.addParam(url, "id", schemaId);
|
||||
po.open(url,
|
||||
{
|
||||
"pageParam" :
|
||||
{
|
||||
|
@ -938,7 +940,7 @@ ${detectNewVersionScript}
|
|||
var prelia = $("> li > a[href='#"+tabId+"']", uiTabsNav);
|
||||
if(prelia.length > 0)
|
||||
{
|
||||
$.get($.toPath(false, contextPath, "data", schemaId, tableName, "query"), function(data)
|
||||
$.get(po.concatContextPath("data", schemaId, tableName, "query"), function(data)
|
||||
{
|
||||
uiTabsNav.show();
|
||||
|
||||
|
|
Loading…
Reference in New Issue