Skip to content

Commit

Permalink
修改各种定死部署会在HTTP ROOT可能造成的问题
Browse files Browse the repository at this point in the history
如果将项目带contextpath来发布就会出现各种路径问题
  • Loading branch information
ufologist committed Apr 18, 2014
1 parent 6f38d0b commit 5335f86
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 35 deletions.
1 change: 1 addition & 0 deletions WebContent/mock/createPluginScript.vm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#parse('/tcom/const.inc.vm')
#include('/stat/js/util/structureValidator.js')
#include('/stat/js/util/mock-min.js')
#parse('/stat/js/util/mock.plugin.js')
2 changes: 1 addition & 1 deletion WebContent/org/group/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
position: relative;
cursor: pointer;
opacity: 0.7;
background: url('/stat/img/plus.png') no-repeat center center;
background: url('../../stat/img/plus.png') no-repeat center center;
background-color: #FFF;
-webkit-transition: .3s;
-moz-transition: .3s;
Expand Down
2 changes: 1 addition & 1 deletion WebContent/org/group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ $(function() {
var id = $(this).data('id');
var url = '';
$.message({
content: '<input type="text" id="rap-plugin-inputer" class="form-control" value="<script src=\'http://rap.alibaba-inc.com/rap.plugin.js?projectId=' + id + '\'></script>" />',
content: '<input type="text" id="rap-plugin-inputer" class="form-control" value="<script src=\'' + RAP_ROOT_URL + '/rap.plugin.js?projectId=' + id + '\'></script>" />',
title: '复制RAP插件地址',
showCallback: function() {
$('#rap-plugin-inputer').focus();
Expand Down
2 changes: 1 addition & 1 deletion WebContent/org/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ $(function() {
var id = $(this).data('id');
var url = '';
$.message({
content: '<input type="text" id="rap-plugin-inputer" class="form-control" value="<script src=\'http://rap.alibaba-inc.com/rap.plugin.js?projectId=' + id + '\'></script>" />',
content: '<input type="text" id="rap-plugin-inputer" class="form-control" value="<script src=\'' + RAP_ROOT_URL + '/rap.plugin.js?projectId=' + id + '\'></script>" />',
title: '复制RAP插件地址',
showCallback: function() {
$('#rap-plugin-inputer').focus();
Expand Down
2 changes: 1 addition & 1 deletion WebContent/stat/js/core/rap.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ if (!window.console) {
* @return {Boolean} 是/否验证通过
*/
Validate.validForm = function (form) {
var list = form.elements;
var list = form;
var r = true;
for (var i = 0, o; o = list[i]; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion WebContent/stat/js/core/rap.min.js

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions WebContent/stat/js/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
var URLS = {
org : {
home: {
'projects': '/org/projects.action',
'productlines': '/org/home/productlines.action',
'groups': '/org/home/groups.action'
'projects': RAP_ROOT_URL + '/org/projects.action',
'productlines': RAP_ROOT_URL + '/org/home/productlines.action',
'groups': RAP_ROOT_URL + '/org/home/groups.action'
},
group: {
'all': '/org/group/all.action',
'update': '/org/group/update.action',
'delete': '/org/group/delete.action',
'create': '/org/group/create.action'
'all': RAP_ROOT_URL + '/org/group/all.action',
'update': RAP_ROOT_URL + '/org/group/update.action',
'delete': RAP_ROOT_URL + '/org/group/delete.action',
'create': RAP_ROOT_URL + '/org/group/create.action'
},
productline: {
'all': '/org/productline/all.action',
'update': '/org/productline/update.action',
'delete': '/org/productline/delete.action',
'create': '/org/productline/create.action'
'all': RAP_ROOT_URL + '/org/productline/all.action',
'update': RAP_ROOT_URL + '/org/productline/update.action',
'delete': RAP_ROOT_URL + '/org/productline/delete.action',
'create': RAP_ROOT_URL + '/org/productline/create.action'
},
project: {
'create': '/project/create.action',
'delete': '/project/delete.action',
'update': '/project/update.action',
'search': '/project/search.action'
'create': RAP_ROOT_URL + '/project/create.action',
'delete': RAP_ROOT_URL + '/project/delete.action',
'update': RAP_ROOT_URL + '/project/update.action',
'search': RAP_ROOT_URL + '/project/search.action'
},
account: {
'all': '/account/all.action'
'all': RAP_ROOT_URL + '/account/all.action'
}
},
workspace: {
'mine': '/workspace/myWorkspace.action'
'mine': RAP_ROOT_URL + '/workspace/myWorkspace.action'
}
};

Expand Down
6 changes: 3 additions & 3 deletions WebContent/stat/js/util/mock-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion WebContent/stat/js/util/mock.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var node = null;
var blackList = [];
var whiteList = [#foreach($url in $urlList)#if($velocityCount>1),#end"$url"#end];
var ROOT = 'rap.alibaba-inc.com';
var ROOT = '${urlRoot}';
var LOST = "LOST";
var PREFIX = "/mockjs/";
var EMPTY_ARRAY = "EMPTY_ARRAY";
Expand Down
6 changes: 5 additions & 1 deletion WebContent/tcom/const.inc.vm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@

##----------------------页面请求action地址-------------------------------
## 配置工程的上下文路径
#set($projectContext = "$!link.getContextPath()")
##set($projectContext = "$!link.getContextPath()")
##set($projectContext = "$!link.getContextPath()/rap")
## 这样配置才对吧?
#set($projectContext = "$!request.getContextPath()")
## 获得RAP web应用路URL的根地址, 例如 localhost:8080/RAP
#set($urlRoot = "$!request.getServerName():" + "$!request.getServerPort()" + "$!projectContext")

## 配置静态资源请求的路径
#set($staticRoot = "$!projectContext/stat")
Expand Down
4 changes: 1 addition & 3 deletions WebContent/tcom/template.rap.vm
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@
#macro (bodyEnd)
<hr>
<footer>
<p>&copy;&nbsp;如需帮助请联系<a href="mailto:[email protected]">霍雍</a>&nbsp;或&nbsp;<a href="[email protected]">思竹</a>&nbsp;&nbsp;在线用户:$!countOfOnlineUserList&nbsp;&nbsp;旺旺群支持:582755829
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_5879641'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "v1.cnzz.com/stat.php%3Fid%3D5879641%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>
</p>
<p>&copy;&nbsp;如需帮助请联系<a href="mailto:[email protected]">霍雍</a>&nbsp;或&nbsp;<a href="[email protected]">思竹</a>&nbsp;&nbsp;在线用户:$!countOfOnlineUserList&nbsp;&nbsp;旺旺群支持:582755829</p>
</footer>
</div>
#end
3 changes: 3 additions & 0 deletions WebContent/tcom/utils.macro.vm
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ baidu.dom.ready(function (){
<link rel="stylesheet" href="${staticRoot}/css/rap.template.css?_r=$!timeStamp" type="text/css" media="screen">
<link rel="stylesheet" href="${staticRoot}/js/ui/floater/css/floater.css?_r=$!timeStamp" type="text/css">

<script>
var RAP_ROOT_URL = location.protocol + '//' + '${urlRoot}';
</script>
<script type="text/javascript" src="${staticRoot}/js/core/jquery-2.1.0.min.js?_r=$!timeStamp"></script>
<script type="text/javascript" src="${staticRoot}/js/core/tangram-1.2.1.js?_r=$!timeStamp"></script>
<script type="text/javascript" src="${staticRoot}/js/core/tangram-fix.js?_r=$!timeStamp"></script>
Expand Down
6 changes: 2 additions & 4 deletions WebContent/tester/pageTester.vm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RAP - $!utils.escapeInH($page.name)控制台</title>
<link rel="stylesheet" href="${staticRoot}/bootstrap/css/bootstrap.css?_r=$!timeStamp" type="text/css" media="screen">
<link rel="stylesheet" href="${staticRoot}/bootstrap/css/bootstrap-responsive.css?_r=$!timeStamp" type="text/css" media="screen">
<link rel="stylesheet" href="${staticRoot}/css/rap.template.css?_r=$!timeStamp" type="text/css" media="screen">
#includeNewRapStatic
<link type="text/css" rel="stylesheet" href="${staticRoot}/css/pageTester.css?_r=$!timeStamp" />
<script src="http://a.tbcdn.cn/??s/yui/3.6.0/build/yui/yui-min.js"></script>
<script src="${staticRoot}/js/util/jsformat.js"></script>
Expand Down Expand Up @@ -84,7 +82,7 @@
};
}

var RAP_ROOT = 'rap.alibaba-inc.com$!projectContext/mockjs/$!projectId';
var RAP_ROOT = RAP_ROOT_URL + '/mockjs/$!projectId';
document.getElementById("txtRootPath").value = RAP_ROOT;

YUI().use('handlebars', 'node', 'event', 'jsonp', 'jsonp-url', 'json-stringify', function (Y) {
Expand Down
2 changes: 1 addition & 1 deletion WebContent/workspace/myWorkspace.vm
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
<form name="formPluginCodeFloater">
<div class="myfloater">
<div>
<input id="pluginCodeInput" style="width:550px;margin:8px 0;" type="text" value="&lt;script src=&quot;http://rap.alibaba-inc.com/rap.plugin.js?projectId=$!projectId&quot;&gt;&lt;/script&gt;">
<input id="pluginCodeInput" style="width:550px;margin:8px 0;" type="text" value="&lt;script src=&quot;http://${urlRoot}/rap.plugin.js?projectId=$!projectId&quot;&gt;&lt;/script&gt;">
</div>
<div class="div-floater-control">
<input type="button" class="btn" onclick="ws.closePluginCodeFloater();" value="关闭" />
Expand Down

0 comments on commit 5335f86

Please sign in to comment.