java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDeleteAction.java |
66 ++++++++++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml |
18 ++
java/code/webapp/WEB-INF/pages/channel/manage/repo/deleteconfirm.jsp |
53 ++++++++
java/code/webapp/WEB-INF/struts-config.xml |
10 +
4 files changed, 147 insertions(+)
New commits:
commit 893fd9503d953b008099cde8025e97facbb3db59
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Thu May 27 14:19:20 2010 -0400
initial files to support Repo delete
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDeleteAction.java
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDeleteAction.java
new file mode 100644
index 0000000..b58b838
--- /dev/null
+++
b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/repo/RepoDeleteAction.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2009--2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.channel.manage.repo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import com.redhat.rhn.common.validator.ValidatorException;
+import com.redhat.rhn.domain.channel.ContentSource;
+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.EditRepoCommand;
+
+/**
+ * RepoDeleteAction
+ * @version $Rev: 1 $
+ */
+public class RepoDeleteAction extends RhnAction {
+ /** {@inheritDoc} */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+ RequestContext context = new RequestContext(request);
+ EditRepoCommand cmd = new EditRepoCommand(context.getLoggedInUser(),
+ context.getParamAsLong("id"));
+ ContentSource src = cmd.getNewRepo();
+
+ request.setAttribute(RepoDetailsAction.LABEL, src.getLabel() );
+ request.setAttribute(RepoDetailsAction.URL, src.getSourceUrl() );
+ request.setAttribute("id", src.getId());
+
+ if (context.isSubmitted()) {
+ try {
+ //delete here
+ createSuccessMessage(request,
+ "repos.delete.success", cmd.getLabel());
+ return mapping.findForward("success");
+ }
+ catch (ValidatorException ve) {
+ getStrutsDelegate().saveMessages(request, ve.getResult());
+ RhnValidationHelper.setFailedValidation(request);
+ }
+ }
+
+ return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
+ }
+}
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 e4d3056..5150b80 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
@@ -9268,15 +9268,33 @@ Please note that some manual configuration of these scripts may
still be require
<trans-unit id="repos.jsp.update.submit">
<source>Update Repository</source>
</trans-unit>
+ <trans-unit id="repos.jsp.delete.submit">
+ <source>Delete Repository</source>
+ </trans-unit>
<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.delete.success">
+ <source>Repository deleted successfully</source>
+ </trans-unit>
<trans-unit id="repos.jsp.details.header2">
<source>Repository Details</source>
</trans-unit>
+ <trans-unit id="repos.jsp.delete.header2">
+ <source>Confirm Repository Delete</source>
+ </trans-unit>
+ <trans-unit id="repos.jsp.delete.summary">
+ <source>Are you sure you want to delete this repository
permanently?</source>
+ </trans-unit>
+ <trans-unit id="repos.jsp.delete.warning">
+ <source>Warning: Deleting this repository will remove any channel
mappings this repository is associated with</source>
+ </trans-unit>
+ <trans-unit id="repos.jsp.delete.info.header">
+ <source>Repository Information</source>
+ </trans-unit>
<!-- TNC -->
<trans-unit id="tnc.jsp.tnc">
diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/repo/deleteconfirm.jsp
b/java/code/webapp/WEB-INF/pages/channel/manage/repo/deleteconfirm.jsp
new file mode 100644
index 0000000..4e9c3d5
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/channel/manage/repo/deleteconfirm.jsp
@@ -0,0 +1,53 @@
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib
uri="http://jakarta.apache.org/struts/tags-bean"
prefix="bean" %>
+<%@ taglib
uri="http://jakarta.apache.org/struts/tags-html"
prefix="html" %>
+
+<html:xhtml/>
+<html>
+<body>
+<rhn:toolbar base="h1" img="/img/rhn-icon-info.gif"
imgAlt="info.alt.img">
+ <c:out value="${requestScope.label}"/>
+</rhn:toolbar>
+
+<h2><bean:message key="repos.jsp.delete.header2"/></h2>
+<p><bean:message key="repos.jsp.delete.summary"/></p>
+<p><rhn:warning key= "repos.jsp.delete.warning"/></p>
+<div>
+ <form method="post"
action="/rhn/channels/cobbler/manage/repos/RepoDelete.do">
+<h2><bean:message key="repos.jsp.delete.info.header"/></h2>
+ <table class="details">
+ <tr>
+ <th>
+ <bean:message key="repos.jsp.create.label"/>
+ </th>
+ <td>
+ <c:out value="${label}"/></pre>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <bean:message key="repos.jsp.create.url"/>
+ </th>
+ <td>
+ <c:out value="${url}"/></pre>
+ </td>
+ </tr>
+
+ </table>
+ <hr />
+ <table align="right">
+ <tr>
+ <td></td>
+ <rhn:submitted/>
+ <input type="hidden" name="id"
value="${requestScope.id}"/>
+ <td align="right"><input type=submit name="dispatch"
+
value="${rhn:localize('repos.jsp.delete.submit')}"/></td>
+ </tr>
+ </table>
+ </form>
+</div>
+
+</body>
+</html>
+
diff --git a/java/code/webapp/WEB-INF/struts-config.xml
b/java/code/webapp/WEB-INF/struts-config.xml
index b2b0f01..a2cf993 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -6638,6 +6638,16 @@
path="/channels/manage/repos/RepoEdit.do" redirect =
"true"/>
</action>
+ <action path="/channels/manage/repos/RepoDelete"
+ scope="request"
+
type="com.redhat.rhn.frontend.action.channel.manage.repo.RepoDeleteAction"
+ className="com.redhat.rhn.frontend.struts.RhnActionMapping">
+ <forward name="default"
+
path="/WEB-INF/pages/channel/manage/repo/deleteconfirm.jsp"/>
+ <forward name="success"
+ path="/channels/manage/repos/RepoList.do" redirect =
"true"/>
+ </action>
+
<!-- end repo -->
<action path="/common/DownloadFile"