java/code/src/com/redhat/rhn/frontend/action/groups/CreateGroupAction.java | 88 ----- java/code/src/com/redhat/rhn/frontend/action/groups/EditGroupAction.java | 170 ++++++++++ java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 3 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_de.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 11 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_es.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_fr.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_it.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ja.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ko.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_pt_BR.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ru.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_CN.xml | 2 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_TW.xml | 2 java/code/webapp/WEB-INF/pages/groups/create.jsp | 67 --- java/code/webapp/WEB-INF/pages/groups/detail.jsp | 2 java/code/webapp/WEB-INF/pages/groups/edit.jsp | 86 +++++ java/code/webapp/WEB-INF/pages/systems/grouplist.jsp | 2 java/code/webapp/WEB-INF/struts-config.xml | 18 - spacewalk/config/etc/httpd/conf.d/zz-spacewalk-www.conf | 6 web/html/network/systems/groups/edit_properties.pxt | 56 --- 21 files changed, 289 insertions(+), 240 deletions(-)
New commits: commit a0c2650fe40f7a9927b125771b175d72dc2916f4 Author: Jan Dobes jdobes@redhat.com Date: Thu Dec 12 11:08:17 2013 +0100
system group edit properties - linking + cleanup
diff --git a/java/code/webapp/WEB-INF/pages/groups/detail.jsp b/java/code/webapp/WEB-INF/pages/groups/detail.jsp index 8816d20..cb60828 100644 --- a/java/code/webapp/WEB-INF/pages/groups/detail.jsp +++ b/java/code/webapp/WEB-INF/pages/groups/detail.jsp @@ -80,7 +80,7 @@ <div class="panel-heading"> <h3><bean:message key="systemgroup.details.properties"/> <rhn:require acl="user_role(org_admin) or user_role(system_group_admin)"> - (<a href="/network/systems/groups/edit_properties.pxt?sgid=${id}"><bean:message key="systemgroup.details.editproperties"/></a>) + (<a href="/rhn/groups/EditGroup.do?sgid=${id}"><bean:message key="systemgroup.details.editproperties"/></a>) </rhn:require></h3> </div>
diff --git a/spacewalk/config/etc/httpd/conf.d/zz-spacewalk-www.conf b/spacewalk/config/etc/httpd/conf.d/zz-spacewalk-www.conf index de4a5f4..cc39758 100644 --- a/spacewalk/config/etc/httpd/conf.d/zz-spacewalk-www.conf +++ b/spacewalk/config/etc/httpd/conf.d/zz-spacewalk-www.conf @@ -139,12 +139,6 @@ PerlConfigRequire PXT/Apache24Config.pm require acl user_role(system_group_admin); user_has_access_to_servergroup() </Files>
- <Files edit_properties.pxt> - AuthType Basic - AuthName "RHN System Group Admin Area" - require acl user_role(system_group_admin); user_has_access_to_servergroup() - </Files> - <Files errata_list.pxt> AuthType Basic AuthName "RHN System Group Admin Area" diff --git a/web/html/network/systems/groups/edit_properties.pxt b/web/html/network/systems/groups/edit_properties.pxt deleted file mode 100644 index a2a8df1..0000000 --- a/web/html/network/systems/groups/edit_properties.pxt +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<pxt-passthrough> - <pxt-use class="Grail::Frame" /> - <pxt-use class="Sniglets::Users" /> - <pxt-use class="Sniglets::ServerGroup" /> - <pxt-use class="Sniglets::Lists" /> - <pxt-use class="Sniglets::Navi" /> - <pxt-use class="Sniglets::HTML" /> - - <grail-canvas-template base="/templates/c.pxt" mode="main_canvas"> - -<pxt-include file="/network/components/system_groups/sgdc_header.pxi" /> - -<rhn-require acl="user_role(system_group_admin)"> - -<pxt-include-late file="/network/components/message_queues/local.pxi" /> - - <pxt-form method="post"> - -<rhn-admin-server-group-edit-form> - - <h2>System Group Details</h2> - <table class="details"> - <tr> - <th>Name:</th> - <td> - <input type="text" name="name" value="{name}" maxlength="64"/> - </td> - </tr> - - <tr> - <th valign="top">Description:</th> - <td> - <textarea wrap="virtual" rows="3" cols="35" name="description">{description}</textarea> - </td> - </tr> - </table> - - <div align="right"> - <hr /> - <input type="submit" value="Modify Details" /> - </div> - - {admin_server_group_formvars} - <pxt-formvar> - <input type="hidden" name="redirect_to" value="/rhn/groups/GroupDetail.do?sgid={formvar:sgid}" /> - </pxt-formvar> -</rhn-admin-server-group-edit-form> - - </pxt-form> - -</rhn-require> - - </grail-canvas-template> -</pxt-passthrough> -
commit e4d32553d6947160cc12550b267f9bb0ef99011b Author: Jan Dobes jdobes@redhat.com Date: Tue Dec 10 11:50:51 2013 +0100
alter system group create page to do editing
diff --git a/java/code/src/com/redhat/rhn/frontend/action/groups/CreateGroupAction.java b/java/code/src/com/redhat/rhn/frontend/action/groups/CreateGroupAction.java deleted file mode 100644 index 384d41b..0000000 --- a/java/code/src/com/redhat/rhn/frontend/action/groups/CreateGroupAction.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2009--2012 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.groups; - -import com.redhat.rhn.domain.server.ManagedServerGroup; -import com.redhat.rhn.domain.server.ServerGroupFactory; -import com.redhat.rhn.domain.user.User; -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.manager.system.ServerGroupManager; - -import org.apache.commons.lang.StringUtils; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.DynaActionForm; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - - -/** - * @author paji - * @version $Rev$ - */ -public class CreateGroupAction extends RhnAction { - - /** {@inheritDoc} */ - public ActionForward execute(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) { - - RequestContext context = new RequestContext(request); - User user = context.getLoggedInUser(); - DynaActionForm daForm = (DynaActionForm)form; - Boolean errors = false; - - if (isSubmitted(daForm)) { - String name = daForm.getString("name"); - String desc = daForm.getString("description"); - - if (StringUtils.isEmpty(name) || StringUtils.isEmpty(desc)) { - request.setAttribute("emptynameordesc", "1"); - errors = true; - } - - ManagedServerGroup newGroup = ServerGroupFactory.lookupByNameAndOrg(name, - user.getOrg()); - - if (newGroup != null) { - request.setAttribute("alreadyexists", "1"); - errors = true; - } - - if (!errors) { - ServerGroupManager manager = ServerGroupManager.getInstance(); - ManagedServerGroup sg = manager.create(user, name, desc); - - createSuccessMessage(request, "systemgroups.create.successmessage", name); - - return mapping.findForward("success"); - } - request.setAttribute("name", daForm.getString("name")); - request.setAttribute("description", - daForm.getString("description")); - - return mapping.findForward("error"); - } - - return mapping.findForward(RhnHelper.DEFAULT_FORWARD); - } - -} diff --git a/java/code/src/com/redhat/rhn/frontend/action/groups/EditGroupAction.java b/java/code/src/com/redhat/rhn/frontend/action/groups/EditGroupAction.java new file mode 100644 index 0000000..89ff426 --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/action/groups/EditGroupAction.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) 2009--2013 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.groups; + +import java.util.Map; + +import com.redhat.rhn.domain.server.ManagedServerGroup; +import com.redhat.rhn.domain.server.ServerGroupFactory; +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.manager.system.ServerGroupManager; + +import org.apache.commons.lang.StringUtils; +import org.apache.struts.action.ActionErrors; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.apache.struts.action.DynaActionForm; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +/** + * @author paji + * @version $Rev$ + */ +public class EditGroupAction extends RhnAction { + + /** {@inheritDoc} */ + public ActionForward execute(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) { + + DynaActionForm daForm = (DynaActionForm)form; + ActionErrors errors = new ActionErrors(); + Map params = makeParamMap(request); + RequestContext ctx = new RequestContext(request); + + if (ctx.hasParam("sgid")) { + params.put("sgid", ctx.getParam("sgid", true)); + } + + if (!isSubmitted(daForm)) { + setupForm(request, daForm); + return getStrutsDelegate().forwardParams( + mapping.findForward(RhnHelper.DEFAULT_FORWARD), + params); + } + + // process values - create or update + if (ctx.hasParam("create_button")) { + Long sgid = create(daForm, errors, ctx); + params.put("sgid", sgid); + } + else if (ctx.hasParam("edit_button")) { + edit(daForm, errors, ctx); + } + + if (!errors.isEmpty()) { + addErrors(request, errors); + request.setAttribute("name", daForm.get("name")); + request.setAttribute("description", daForm.get("description")); + return getStrutsDelegate().forwardParams( + mapping.findForward(RhnHelper.DEFAULT_FORWARD), + params); + } + + if (ctx.hasParam("create_button")) { + createSuccessMessage(request, + "systemgroups.create.successmessage", daForm.getString("name")); + } + else if (ctx.hasParam("edit_button")) { + createSuccessMessage(request, + "systemgroups.edit.successmessage", daForm.getString("name")); + } + + + return getStrutsDelegate().forwardParams( + mapping.findForward("success"), params); + } + + private void setupForm(HttpServletRequest request, DynaActionForm form) { + + RequestContext ctx = new RequestContext(request); + Long sgid = ctx.getParamAsLong("sgid"); + + // editing form - prefill values + if (sgid != null) { + ManagedServerGroup sg = ctx.lookupAndBindServerGroup(); + form.set("name", sg.getName()); + form.set("description", sg.getDescription()); + } + } + + private Long create(DynaActionForm form, ActionErrors errors, + RequestContext ctx) { + + validate(form, errors, ctx); + + if (errors.isEmpty()) { + ServerGroupManager manager = ServerGroupManager.getInstance(); + ManagedServerGroup sg = manager.create(ctx.getLoggedInUser(), + form.getString("name"), form.getString("description")); + + return sg.getId(); + } + + return null; + } + + private void edit(DynaActionForm form, ActionErrors errors, + RequestContext ctx) { + + validate(form, errors, ctx); + + if (errors.isEmpty()) { + ManagedServerGroup sg = ctx.lookupAndBindServerGroup(); + sg.setName(form.getString("name")); + sg.setDescription(form.getString("description")); + ServerGroupFactory.save(sg); + } + } + + private void validate(DynaActionForm form, ActionErrors errors, + RequestContext ctx) { + + String name = form.getString("name"); + String desc = form.getString("description"); + Long sgid = ctx.getParamAsLong("sgid"); + + // Check if both values are entered + if (StringUtils.isEmpty(name) || StringUtils.isEmpty(desc)) { + errors.add(ActionMessages.GLOBAL_MESSAGE, + new ActionMessage("systemgroup.create.requirements")); + } + + // Check if sg already exists + ManagedServerGroup newGroup = ServerGroupFactory.lookupByNameAndOrg(name, + ctx.getLoggedInUser().getOrg()); + + // Ugly condition for two error cases: + // creating page + group name exists + // editing page + group name exists except our group + if (((sgid == null) && (newGroup != null)) || + (sgid != null) && (newGroup != null) && (!sgid.equals(newGroup.getId()))) { + errors.add(ActionMessages.GLOBAL_MESSAGE, + new ActionMessage("systemgroup.create.alreadyexists")); + } + + } + +} diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml index 88f9c93..83109a3 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml @@ -2925,6 +2925,9 @@ user before attempting to deactivate their account.</source> <trans-unit id="systemgroups.create.successmessage"> <source>System group {0} created.</source> </trans-unit> + <trans-unit id="systemgroups.edit.successmessage"> + <source>System group {0} updated.</source> + </trans-unit> <trans-unit id="probe.empty.status"> <source>No status for probe</source> <context-group name="ctx"> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_de.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_de.xml index 81b5b6b..dd00b6d 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_de.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_de.xml @@ -6060,7 +6060,7 @@ für diese Berechtigung, mit Ausnahme des Verbrauchs der Standardorganisation.</ </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> 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 c83168e..6be4b99 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 @@ -5315,14 +5315,20 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> </trans-unit> + <trans-unit id="systemgroup.edit.header"> + <source>Edit System Group</source> + </trans-unit> <trans-unit id="systemgroup.create.summary"> <source>Create a system group using the form provided. Note that the group will be empty until systems are joined to it. Entries marked with an asterisk (<span class="required-form-field">*</span>) are <strong>required</strong>.</source> </trans-unit> + <trans-unit id="systemgroup.edit.summary"> + <source>Update group properties using the form provided. Entries marked with an asterisk (<span class="required-form-field">*</span>) are <strong>required</strong>.</source> + </trans-unit> <trans-unit id="systemgroup.create.requiredfield"> <source>Required Field</source> </trans-unit> @@ -5341,6 +5347,9 @@ value for this entitlement, excluding the default organization's consumption.</s <trans-unit id="systemgroup.create.creategroup"> <source>Create Group</source> </trans-unit> + <trans-unit id="systemgroup.edit.editgroup"> + <source>Update Group</source> + </trans-unit> </group> <!--System Entitlements Page - entitlements.jsp --> <trans-unit id="systementitlements.jsp.header"> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_es.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_es.xml index 3ba20ee..bc9f1f9 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_es.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_es.xml @@ -6059,7 +6059,7 @@ para este derecho, excluyendo el consumo de la organización predeterminada.</ta </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_fr.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_fr.xml index a7b32bd..e82ea7e 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_fr.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_fr.xml @@ -6060,7 +6060,7 @@ pour ce droit d'accès, moins la consommation par défaut de l'organisation.</ta </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_it.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_it.xml index 9354a5f..15351de 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_it.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_it.xml @@ -6059,7 +6059,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ja.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ja.xml index f67349a..9cfa328 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ja.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ja.xml @@ -6061,7 +6061,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ko.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ko.xml index a909ae3..18be1d7 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ko.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ko.xml @@ -6058,7 +6058,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_pt_BR.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_pt_BR.xml index af9fadb..f3986b2 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_pt_BR.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_pt_BR.xml @@ -6057,7 +6057,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ru.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ru.xml index 946aa1f..9687212 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ru.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_ru.xml @@ -6056,7 +6056,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_CN.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_CN.xml index a6220cb..1111727 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_CN.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_CN.xml @@ -6059,7 +6059,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_TW.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_TW.xml index 4102afc..f8e4367 100644 --- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_TW.xml +++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_zh_TW.xml @@ -6056,7 +6056,7 @@ value for this entitlement, excluding the default organization's consumption.</s </group> <group> <context-group name="ctx"> - <context context-type="sourcefile">/rhn/groups/CreateGroup.do</context> + <context context-type="sourcefile">/rhn/groups/EditGroup.do</context> </context-group> <trans-unit id="systemgroup.create.header"> <source>Create System Group</source> diff --git a/java/code/webapp/WEB-INF/pages/groups/create.jsp b/java/code/webapp/WEB-INF/pages/groups/create.jsp deleted file mode 100644 index 6535da1..0000000 --- a/java/code/webapp/WEB-INF/pages/groups/create.jsp +++ /dev/null @@ -1,67 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> -<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> -<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %> - -<html> - <body> - <h1> - <i class="fa spacewalk-icon-system-groups" title="system group"></i> - <bean:message key="systemgroup.create.header"/> - <a href="/rhn/help/reference/en-US/s1-sm-systems.jsp#s3-sm-system-group-creation" target="_blank" class="help-title"> - <i class="fa fa-question-circle" title="Help Icon"></i> - </a> - </h1> - <p><bean:message key="systemgroup.create.summary"/></p> - <c:if test="${not empty emptynameordesc}"> - <div class="local-alert"><bean:message key="systemgroup.create.requirements"/><br /></div> - </c:if> - <c:if test="${not empty alreadyexists}"> - <div class="local-alert"><bean:message key="systemgroup.create.alreadyexists"/><br /></div> - </c:if> - <html:form method="post" - action="/groups/CreateGroup.do" - styleClass="form-horizontal"> - <rhn:csrf /> - <html:hidden property="submitted" value="true"/> - - <div class="form-group"> - <label class="col-lg-3 control-label" for="name"> - <bean:message key="systemgroup.create.name"/> - <span class="required-form-field">*</span>: - </label> - <div class="col-lg-6"> - <html:text property="name" size="30" styleId="name" - maxlength="64" styleClass="form-control" /> - </div> - </div> - <div class="form-group"> - <label class="col-lg-3 control-label" for="description"> - <bean:message key="systemgroup.create.description" /> - <span class="required-form-field">*</span>: - </label> - <div class="col-lg-6"> - <html:textarea property="description" cols="40" - styleClass="form-control" - rows="4" styleId="description"/> - </div> - </div> - - <%-- - <div class="text-right"> - <hr /> - <input type="hidden" name="pxt:trap" value="rhn:server_group_create_cb" /> - <input type="hidden" name="redirect_to" value="/rhn/systems/SystemGroupList.do" /> - <input type="submit" name="make_group" value="<bean:message key='systemgroup.create.creategroup'/>" /> - --%> - - <div class="form-group"> - <div class="col-lg-offset-3 col-lg-6"> - <html:submit styleClass="btn btn-success"> - <bean:message key="systemgroup.create.creategroup"/> - </html:submit> - </div> - </div> - </html:form> - </body> -</html> \ No newline at end of file diff --git a/java/code/webapp/WEB-INF/pages/groups/edit.jsp b/java/code/webapp/WEB-INF/pages/groups/edit.jsp new file mode 100644 index 0000000..20589fa --- /dev/null +++ b/java/code/webapp/WEB-INF/pages/groups/edit.jsp @@ -0,0 +1,86 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> +<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> +<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %> + +<html> + <body> + <h1> + <i class="fa spacewalk-icon-system-groups" title="system group"></i> + <c:choose> + <c:when test='${empty param.sgid}'> + <bean:message key="systemgroup.create.header"/> + </c:when> + <c:otherwise> + <bean:message key="systemgroup.edit.header"/> + </c:otherwise> + </c:choose> + </h1> + <p> + <c:choose> + <c:when test='${empty param.sgid}'> + <bean:message key="systemgroup.create.summary"/> + </c:when> + <c:otherwise> + <bean:message key="systemgroup.edit.summary"/> + </c:otherwise> + </c:choose> + </p> + <html:form method="post" + action="/groups/EditGroup.do" + styleClass="form-horizontal"> + <rhn:csrf /> + + <div class="form-group"> + <label class="col-lg-3 control-label" for="name"> + <bean:message key="systemgroup.create.name"/> + <span class="required-form-field">*</span>: + </label> + <div class="col-lg-6"> + <html:text property="name" size="30" styleId="name" + maxlength="64" styleClass="form-control" /> + </div> + </div> + <div class="form-group"> + <label class="col-lg-3 control-label" for="description"> + <bean:message key="systemgroup.create.description" /> + <span class="required-form-field">*</span>: + </label> + <div class="col-lg-6"> + <html:textarea property="description" cols="40" + styleClass="form-control" + rows="4" styleId="description"/> + </div> + </div> + + <%-- + <div class="text-right"> + <hr /> + <input type="hidden" name="pxt:trap" value="rhn:server_group_create_cb" /> + <input type="hidden" name="redirect_to" value="/rhn/systems/SystemGroupList.do" /> + <input type="submit" name="make_group" value="<bean:message key='systemgroup.create.creategroup'/>" /> + --%> + + <div class="form-group"> + <div class="col-lg-offset-3 col-lg-6"> + <c:choose> + <c:when test='${empty param.sgid}'> + <html:submit property="create_button" styleClass="btn btn-success"> + <bean:message key="systemgroup.create.creategroup"/> + </html:submit> + </c:when> + <c:otherwise> + <html:submit property="edit_button" styleClass="btn btn-success"> + <bean:message key="systemgroup.edit.editgroup"/> + </html:submit> + </c:otherwise> + </c:choose> + </div> + </div> + <html:hidden property="submitted" value="true" /> + <c:if test='${not empty param.sgid}'> + <html:hidden property="sgid" value="${param.sgid}" /> + </c:if> + </html:form> + </body> +</html> diff --git a/java/code/webapp/WEB-INF/pages/systems/grouplist.jsp b/java/code/webapp/WEB-INF/pages/systems/grouplist.jsp index 4062520..1b96095 100644 --- a/java/code/webapp/WEB-INF/pages/systems/grouplist.jsp +++ b/java/code/webapp/WEB-INF/pages/systems/grouplist.jsp @@ -12,7 +12,7 @@ <body> <rhn:toolbar base="h1" icon="header-system-groups" imgAlt="system.common.groupAlt" helpUrl="/rhn/help/reference/en-US/s1-sm-systems.jsp#s2-sm-system-group-list" - creationUrl="/rhn/groups/CreateGroup.do" + creationUrl="/rhn/groups/EditGroup.do" creationType="group" creationAcl="user_role(system_group_admin)"> <bean:message key="grouplist.jsp.header"/> diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml index 6ce376e..47e5539 100644 --- a/java/code/webapp/WEB-INF/struts-config.xml +++ b/java/code/webapp/WEB-INF/struts-config.xml @@ -1165,7 +1165,7 @@ <form-property name="submitted" type="java.lang.Boolean" /> </form-bean>
- <form-bean name="createSystemGroupForm" + <form-bean name="editSystemGroupForm" type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm" > <form-property name="name" type="java.lang.String" /> <form-property name="description" type="java.lang.String" /> @@ -3917,20 +3917,18 @@ redirect="true" /> </action>
- <action path="/groups/CreateGroup" + <action path="/groups/EditGroup" scope="request" - type="com.redhat.rhn.frontend.action.groups.CreateGroupAction" - input="/WEB-INF/pages/groups/create.jsp" - parameter="dispatch" - name="createSystemGroupForm" + type="com.redhat.rhn.frontend.action.groups.EditGroupAction" + name="editSystemGroupForm" className="com.redhat.rhn.frontend.struts.RhnActionMapping"> + <set-property property="acls" + value="user_role(system_group_admin)"/> <set-property property="postRequiredIfSubmitted" value="true" /> <forward name="default" - path="/WEB-INF/pages/groups/create.jsp" /> - <forward name="error" - path="/WEB-INF/pages/groups/create.jsp" /> + path="/WEB-INF/pages/groups/edit.jsp" /> <forward name="success" - path="/systems/SystemGroupList.do" + path="/groups/GroupDetail.do" redirect="true" /> </action>
spacewalk-commits@lists.fedorahosted.org