java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDetailsAction.java |
31 +++++-----
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml |
3
java/code/webapp/WEB-INF/pages/channel/manage/repo/repodetails.jsp |
2
java/code/webapp/WEB-INF/struts-config.xml |
4 -
4 files changed, 23 insertions(+), 17 deletions(-)
New commits:
commit 1159006a7460640cca48e3ba4c84722097f7f94a
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Wed May 26 16:38:59 2010 -0400
bug fixes for EditRepo, strut path fixes
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDetailsAction.java
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDetailsAction.java
index 1c10245..5a580a2 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDetailsAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDetailsAction.java
@@ -33,6 +33,7 @@ import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
import com.redhat.rhn.frontend.struts.RhnHelper;
import com.redhat.rhn.frontend.struts.RhnValidationHelper;
+import com.redhat.rhn.manager.channel.repo.BaseRepoCommand;
import com.redhat.rhn.manager.channel.repo.CreateRepoCommand;
import com.redhat.rhn.manager.channel.repo.EditRepoCommand;
@@ -47,7 +48,7 @@ public class RepoDetailsAction extends RhnAction {
public static final String REPO = "repo";
public static final String URL = "url";
public static final String LABEL = "label";
- public static final String OLD_LABEL = "oldLabel";
+ public static final String SOURCEID = "sourceid";
private static final String VALIDATION_XSD =
"/com/redhat/rhn/frontend/action/channel/" +
@@ -87,7 +88,7 @@ public class RepoDetailsAction extends RhnAction {
request.removeAttribute(CREATE_MODE);
setupRepo(request, form, repo);
return
getStrutsDelegate().forwardParam(mapping.findForward("success"),
- LABEL, repo.getLabel());
+ "id", repo.getId().toString());
}
catch (ValidatorException ve) {
getStrutsDelegate().saveMessages(request, ve.getResult());
@@ -97,9 +98,7 @@ public class RepoDetailsAction extends RhnAction {
}
else if(!isCreateMode(request)) {
setup(request, form);
- }
-
- // setup(request, form);
+ }
return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
}
@@ -118,16 +117,16 @@ public class RepoDetailsAction extends RhnAction {
private void setup(HttpServletRequest request, DynaActionForm form) {
RequestContext context = new RequestContext(request);
EditRepoCommand cmd = new EditRepoCommand(context.getLoggedInUser(),
- context.getParamAsLong("id"));
+ context.getParamAsLong("id"));
setupRepo(request, form, cmd.getNewRepo());
}
private void setupRepo(HttpServletRequest request, DynaActionForm form,
ContentSource repo) {
- form.set(LABEL, repo.getLabel());
- form.set(OLD_LABEL, repo.getLabel());
+ form.set(LABEL, repo.getLabel());
form.set(URL, repo.getSourceUrl());
+ form.set(SOURCEID, repo.getId());
bindRepo(request, repo);
}
@@ -140,15 +139,19 @@ public class RepoDetailsAction extends RhnAction {
request.setAttribute(REPO, repo);
}
- private ContentSource submit(HttpServletRequest request, DynaActionForm form) {
- RequestContext context = new RequestContext(request);
-
- String label = isCreateMode(request) ?
- form.getString(LABEL) : form.getString(OLD_LABEL);
+ private ContentSource submit(HttpServletRequest request, DynaActionForm form) {
+ RequestContext context = new RequestContext(request);
String url = form.getString(URL);
+ String label = form.getString(LABEL);
Org org = context.getLoggedInUser().getOrg();
+ BaseRepoCommand repoCmd = null;
+ if(isCreateMode(request)) {
+ repoCmd = new CreateRepoCommand(org);
+ }
+ else {
+ repoCmd = new EditRepoCommand(context.getLoggedInUser(),
context.getParamAsLong(SOURCEID));
+ }
- CreateRepoCommand repoCmd = new CreateRepoCommand(org);
repoCmd.setLabel(label);
repoCmd.setUrl(url);
repoCmd.store();
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index ef9e26f..e4d3056 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -9271,6 +9271,9 @@ Please note that some manual configuration of these scripts may
still be require
<trans-unit id="repos.jsp.create.success">
<source>Repository created successfully</source>
</trans-unit>
+ <trans-unit id="repos.jsp.update.success">
+ <source>Repository updated successfully</source>
+ </trans-unit>
<trans-unit id="repos.jsp.details.header2">
<source>Repository Details</source>
</trans-unit>
diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/repo/repodetails.jsp
b/java/code/webapp/WEB-INF/pages/channel/manage/repo/repodetails.jsp
index 2ea3d21..fa74ff9 100644
--- a/java/code/webapp/WEB-INF/pages/channel/manage/repo/repodetails.jsp
+++ b/java/code/webapp/WEB-INF/pages/channel/manage/repo/repodetails.jsp
@@ -43,7 +43,7 @@
<html:text property="label"/>
<c:if test = "${empty requestScope.create_mode}">
- <html:hidden property="oldLabel"/>
+ <html:hidden property="sourceid"/>
</c:if>
</td>
</tr>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml
b/java/code/webapp/WEB-INF/struts-config.xml
index 2d7bb87..b2b0f01 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -821,7 +821,7 @@
<form-bean name="contentSourceForm"
type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm">
<form-property name="url"
type="java.lang.String"/>
- <form-property name="oldLabel" type="java.lang.String"
/>
+ <form-property name="sourceid" type="java.lang.Long"
/>
<form-property name="label"
type="java.lang.String"/>
</form-bean>
@@ -6635,7 +6635,7 @@
<forward name="default"
path="/WEB-INF/pages/channel/manage/repo/repodetails.jsp"/>
<forward name="success"
- path="/channels/manage/repo/RepoEdit.do" redirect =
"true"/>
+ path="/channels/manage/repos/RepoEdit.do" redirect =
"true"/>
</action>
<!-- end repo -->