This is an automated email from the ASF dual-hosted git repository.

snoopdave pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/roller.git


The following commit(s) were added to refs/heads/master by this push:
     new 619a3d2  Fixes to User Admin pages: disable edit button if nothing 
selected and send user back to user admin page after save.
619a3d2 is described below

commit 619a3d275933e6543bb6ad6c993a9cf8872f1ab3
Author: David M. Johnson <snoopd...@apache.org>
AuthorDate: Sun Sep 1 09:56:11 2019 -0400

    Fixes to User Admin pages: disable edit button if nothing selected and send 
user back to user admin page after save.
---
 .../roller/weblogger/ui/struts2/admin/UserEdit.java      | 16 ++++++----------
 app/src/main/resources/struts.xml                        |  6 ++----
 app/src/main/webapp/WEB-INF/jsps/admin/UserAdmin.jsp     | 12 +++++++++++-
 app/src/main/webapp/roller-ui/scripts/ajax-user.js       |  3 ++-
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git 
a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java 
b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
index 73d5b01..2cb4399 100644
--- 
a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
+++ 
b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/admin/UserEdit.java
@@ -203,16 +203,12 @@ public class UserEdit extends UIAction {
                     mgr.grantRole("admin", user);
                 }
                 WebloggerFactory.getWeblogger().flush();
-                if (isAdd()) {
-                    // now that user is saved we have an id value
-                    // store it back in bean for use in next action
-                    bean.setId(user.getId());
-                    // route to edit mode, saveFirst() provides the success 
message.
-                    return SUCCESS;
-                } else {
-                    addMessage("userAdmin.userSaved");
-                    return INPUT;
-                }
+
+                // successful add or edit: send user back to user admin page
+                bean = new CreateUserBean();
+                addMessage("userAdmin.userSaved");
+                return SUCCESS;
+
             } catch (WebloggerException ex) {
                 log.error("ERROR in action", ex);
                 addError("generic.error.check.logs");
diff --git a/app/src/main/resources/struts.xml 
b/app/src/main/resources/struts.xml
index f03c745..63d5bb3 100644
--- a/app/src/main/resources/struts.xml
+++ b/app/src/main/resources/struts.xml
@@ -220,10 +220,7 @@
             <param name="actionName">createUser</param>
             <param name="pageTitle">userAdmin.title.createNewUser</param>
             <result name="input" type="tiles">.UserEdit</result>
-            <result name="success" type="redirectAction">
-                <param name="actionName">modifyUser!firstSave</param>
-                <param name="bean.id">${bean.id}</param>
-            </result>
+            <result name="success" type="tiles">.UserAdmin</result>
             <allowed-methods>execute,firstSave,save</allowed-methods>
         </action>
 
@@ -236,6 +233,7 @@
             <result name="cancel" type="redirectAction">
                 <param name="actionName">userAdmin</param>
             </result>
+            <result name="success" type="tiles">.UserAdmin</result>
             <allowed-methods>execute,firstSave,save</allowed-methods>
         </action>
         
diff --git a/app/src/main/webapp/WEB-INF/jsps/admin/UserAdmin.jsp 
b/app/src/main/webapp/WEB-INF/jsps/admin/UserAdmin.jsp
index 6310997..59fd609 100644
--- a/app/src/main/webapp/WEB-INF/jsps/admin/UserAdmin.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/admin/UserAdmin.jsp
@@ -55,4 +55,14 @@
 
 </s:if>
 
-<script> document.getElementById('userName').focus(); </script>
+<script>
+
+
+$(document).ready(function () {
+
+    document.getElementById('userName').focus();
+    onUserNameFocus(false);
+
+});
+
+</script>
diff --git a/app/src/main/webapp/roller-ui/scripts/ajax-user.js 
b/app/src/main/webapp/roller-ui/scripts/ajax-user.js
index 1cb578c..f3bbfb2 100644
--- a/app/src/main/webapp/roller-ui/scripts/ajax-user.js
+++ b/app/src/main/webapp/roller-ui/scripts/ajax-user.js
@@ -16,7 +16,7 @@
 * directory of this distribution.
 */
 
-// Used in: InviteMember.jsp, UserAdmin.jsp
+// Used in: MemberInvite.jsp, UserAdmin.jsp
 
 function createRequestObject() {
     var ro;
@@ -41,6 +41,7 @@ function onUserNameFocus(enabled) {
         if (enabled != null) u = u + "&enabled=" + enabled;
         sendUserRequest(u);
     } else {
+        userSubmitButton = document.getElementById("user-submit");
         userSubmitButton.disabled = true;
     }
 }

Reply via email to