mirror of https://github.com/Rekoe/rk_svnadmin
添加 目录管理功能
parent
caac23c80a
commit
56273f45c5
|
@ -32,6 +32,7 @@ import com.rekoe.service.ProjectService;
|
|||
import com.rekoe.service.RepositoryService;
|
||||
import com.rekoe.service.UsrService;
|
||||
import com.rekoe.utils.CommonUtils;
|
||||
import com.rekoe.utils.DoCommit;
|
||||
|
||||
@IocBean
|
||||
@At("/admin/project")
|
||||
|
@ -247,4 +248,24 @@ public class AdminProjectAct extends BaseAction {
|
|||
projectAuthService.save(pj, res, rw, grs, usrs);
|
||||
return pjauth(pj, res, entity, Mvcs.getReq());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("fm:template.admin.project.add_dir")
|
||||
@RequiresPermissions("svn.project:update")
|
||||
@PermissionTag(name = "SVN编辑项目", tag = "SVN项目管理", enable = false)
|
||||
public String file_add(@Param("pj") String pj) {
|
||||
return pj;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private DoCommit doCommit;
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@RequiresPermissions("svn.project:update")
|
||||
@PermissionTag(name = "SVN编辑项目", tag = "SVN项目管理", enable = false)
|
||||
public Message file_save(@Param("pj") String pj,@Param("file") String file, HttpServletRequest req) {
|
||||
doCommit.mkdirs(pj, new String[]{file});
|
||||
return Message.success("ok", req);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
|
@ -41,7 +42,13 @@ public class DoCommit {
|
|||
private ProjectConfigService projectConfigService;
|
||||
|
||||
public boolean mkdirs(String pj) {
|
||||
Pj project =projectService.get(pj);
|
||||
ProjectConfig conf = projectConfigService.get();
|
||||
List<String> dirs = conf.getDirs();
|
||||
return mkdirs(pj, Lang.collection2array(dirs));
|
||||
}
|
||||
|
||||
public boolean mkdirs(String pj, String[] dirs) {
|
||||
Pj project = projectService.get(pj);
|
||||
Usr usr = UsrProvider.getCurrentUsr();
|
||||
String svnUrl = repositoryService.getProjectSVNUrl(project);
|
||||
if (StringUtils.isBlank(svnUrl)) {
|
||||
|
@ -57,9 +64,7 @@ public class DoCommit {
|
|||
}
|
||||
}
|
||||
svnPassword = EncryptUtil.decrypt(svnPassword);// 解密
|
||||
ProjectConfig conf = projectConfigService.get();
|
||||
List<String> dirs = conf.getDirs();
|
||||
SVNURL[] urlAr = new SVNURL[dirs.size()];
|
||||
SVNURL[] urlAr = new SVNURL[dirs.length];
|
||||
int i = 0;
|
||||
for (String url : dirs) {
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title></title>
|
||||
<#include "/template/admin/head.ftl"/>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#jvForm").validate();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box-positon">
|
||||
<div class="rpos"><@s.m "global.position"/>: 目录管理 - <@s.m "global.add"/></div>
|
||||
<form class="ropt">
|
||||
<input type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='list.rk';" class="return-button"/>
|
||||
</form>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="body-box">
|
||||
<@p.form id="jvForm" action="file_save" labelWidth="12" onsubmit="return false;">
|
||||
<@p.hidden name="pj" id="pj" value='${obj}' />
|
||||
<@p.text width="30" label="目录" id="file" name="file" value="" maxlength="100" class="required" required="true" help="说明: 若trunk下如果要增加目录请使用 trunk/filename"/><@p.tr/>
|
||||
<@p.td>
|
||||
<@p.submit code="global.submit" onclick="Cms.add('file_save','file_add.rk');"/>
|
||||
</@p.td><@p.tr/>
|
||||
</@p.form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -76,6 +76,7 @@ function all_email(pj){
|
|||
<@p.column title="设置用户组" align="center"><a href="${base}/admin/project/group/list?pj=${project.pj}">设置用户组</a></@p.column><#t/>
|
||||
</@shiro.hasPermission>
|
||||
<@p.column title="设置权限" align="center"><a href="rep?pj=${project.pj}">设置权限</a></@p.column><#t/>
|
||||
<@p.column title="添加目录" align="center"><a href="file_add?pj=${project.pj}">添加目录</a></@p.column><#t/>
|
||||
<@p.column title="初始化" align="center"><a href="onclick="javascript:void(0);" init('${project.pj}')">初始化</a></@p.column><#t/>
|
||||
<@shiro.hasPermission name="svn.project:auth.manager">
|
||||
<@p.column title="编辑" align="center">
|
||||
|
|
|
@ -90,6 +90,31 @@ Cms.addBack = function(url){
|
|||
});
|
||||
return false;
|
||||
}
|
||||
Cms.add = function(act,back){
|
||||
$.dialog({
|
||||
type: "warn",
|
||||
content: '确定要添加此记录?',
|
||||
ok: 'Ok',
|
||||
cancel: 'Cancel',
|
||||
onOk: function() {
|
||||
$.ajax({
|
||||
url: act,
|
||||
type: "POST",
|
||||
data: $('#jvForm').serialize(),
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
success: function(message) {
|
||||
$.message(message);
|
||||
if (message.type == "success")
|
||||
{
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
Cms.updateBack = function(url){
|
||||
$.dialog({
|
||||
type: "warn",
|
||||
|
|
Loading…
Reference in New Issue