mirror of https://github.com/Rekoe/rk_svnadmin
合并属性
parent
478961ef65
commit
ddb5c66ca6
|
@ -11,7 +11,7 @@ import org.nutz.dao.entity.annotation.Table;
|
|||
* 项目
|
||||
*/
|
||||
@Table("pj")
|
||||
public class Pj implements Serializable{
|
||||
public class Pj implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -21,11 +21,6 @@ public class Pj implements Serializable{
|
|||
*/
|
||||
@Name
|
||||
private String pj;
|
||||
/**
|
||||
* 访问项目的svn地址
|
||||
*/
|
||||
@Comment
|
||||
private String url;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
|
@ -88,21 +83,6 @@ public class Pj implements Serializable{
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 访问项目的svn地址
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* 访问项目的svn地址
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 用户是否是这个项目的管理员
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,7 @@ public class AdminProjectAct extends BaseAction {
|
|||
public String rep(@Param("pj") String pj, HttpServletRequest req) {
|
||||
Pj project = projectService.fetch(Cnd.where("pj", "=", pj));
|
||||
String root = repositoryService.getRepositoryRoot(project);
|
||||
String svnUrl = RepositoryService.parseURL(project.getUrl());
|
||||
String svnUrl = RepositoryService.parseURL(projectConfigService.getProjectUrl(pj));
|
||||
String path = "/";
|
||||
if (root != null) {
|
||||
try {
|
||||
|
|
|
@ -49,4 +49,17 @@ public class ProjectConfigService extends BaseService<ProjectConfig> {
|
|||
public String getRepoPath(Pj pj) {
|
||||
return getRepoPath(pj.getPj());
|
||||
}
|
||||
|
||||
public String getProjectUrl(String pj) {
|
||||
ProjectConfig conf = get();
|
||||
String path = conf.getDomainPath();
|
||||
if (!StringUtils.endsWith(path, "/") || !StringUtils.endsWith(path, "\\")) {
|
||||
path += "/";
|
||||
}
|
||||
return path + pj;
|
||||
}
|
||||
|
||||
public String getProjectUrl(Pj pj) {
|
||||
return getProjectUrl(pj.getPj());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,9 +71,6 @@ public class ProjectService extends BaseService<Pj> {
|
|||
* 项目
|
||||
*/
|
||||
public void save(Pj pj) {
|
||||
if (StringUtils.isNotBlank(pj.getUrl())) {
|
||||
pj.setUrl(StringUtils.replace(pj.getUrl(), "\\", "/"));
|
||||
}
|
||||
// 是否可以增加项目
|
||||
boolean insert = nameOk(pj.getPj());
|
||||
String path = projectConfigService.getRepoPath(pj);
|
||||
|
|
|
@ -113,7 +113,7 @@ public class RepositoryService {
|
|||
@SuppressWarnings("deprecation")
|
||||
public SVNRepository getRepository(Pj pj) throws SVNException {
|
||||
Usr usr = UsrProvider.getCurrentUsr();
|
||||
String svnUrl = parseURL(pj.getUrl());
|
||||
String svnUrl = parseURL(projectConfigService.getProjectUrl(pj));
|
||||
if (StringUtils.isBlank(svnUrl)) {
|
||||
throw new RuntimeException("URL不可以为空");
|
||||
}
|
||||
|
|
|
@ -453,12 +453,11 @@ public class SvnService {
|
|||
contents.append("#Include ").append(path).append("/conf/httpd.conf").append(SEP);
|
||||
String location = pj.getPj();
|
||||
// 例如 http://192.168.1.100/svn/projar/trunk
|
||||
if (StringUtils.isNotBlank(pj.getUrl()) && pj.getUrl().indexOf("//") != -1) {
|
||||
String svnUrl = RepositoryService.parseURL(pj.getUrl());
|
||||
location = StringUtils.substringAfter(svnUrl, "//");// 192.168.1.100/svn/projar/trunk
|
||||
location = StringUtils.substringAfter(location, "/");// svn/projar/trunk
|
||||
location = StringUtils.substringBeforeLast(location, "/trunk");// svn/projar
|
||||
}
|
||||
|
||||
String svnUrl = RepositoryService.parseURL(projectConfigService.getProjectUrl(pj));
|
||||
location = StringUtils.substringAfter(svnUrl, "//");// 192.168.1.100/svn/projar/trunk
|
||||
location = StringUtils.substringAfter(location, "/");// svn/projar/trunk
|
||||
location = StringUtils.substringBeforeLast(location, "/trunk");// svn/projar
|
||||
contents.append("<Location /").append(location).append(">").append(SEP);
|
||||
contents.append("DAV svn").append(SEP);
|
||||
contents.append("SVNPath ").append(path).append(SEP);
|
||||
|
|
|
@ -24,7 +24,6 @@ function getTableForm() {
|
|||
<@p.table value=obj;project,i,has_next><#rt/>
|
||||
<@p.column title="ID" align="center">${i+1}</@p.column><#t/>
|
||||
<@p.column title="姓名" align="center">${project.pj}</@p.column><#t/>
|
||||
<@p.column title="URL" align="center"><a href="rep?pj=${project.pj}">${project.url}</a></@p.column><#t/>
|
||||
<@p.column title="类型" align="center">${project.type}</@p.column><#t/>
|
||||
<@p.column title="描述" align="center">${project.des}</@p.column><#t/>
|
||||
<@shiro.hasPermission name="project.group">
|
||||
|
|
Loading…
Reference in New Issue