Update of
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms
In directory
james.mmbase.org:/tmp/cvs-serv20339/java/com/finalist/cmsc/community/forms
Modified Files:
DeleteUserAction.java UserAddAction.java
UserAddInitAction.java
Log Message:
CMSC-996,User and Group lists in Editors,add edit user's forward
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms
See also: http://www.mmbase.org/jira/browse/CMSC-996
Index: DeleteUserAction.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/DeleteUserAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- DeleteUserAction.java 5 Aug 2008 05:44:37 -0000 1.6
+++ DeleteUserAction.java 5 Aug 2008 07:56:06 -0000 1.7
@@ -21,22 +21,26 @@
@Override
public ActionForward execute(ActionMapping mapping, ActionForm
actionForm, HttpServletRequest request,
HttpServletResponse httpServletResponse) throws
Exception {
- String path=request.getParameter(FORWARD_GROUP);
+ String groupFoeward=request.getParameter(FORWARD_GROUP);
deleteUser(request);
- if (null==path||",".equals(path)) {
+ if (null==groupFoeward||",".equals(groupFoeward)) {
return mapping.findForward(SUCCESS);
}else {
//deleteUser(request);
- String[] temp=path.split(",");
+ setGroupParamater(request, groupFoeward);
+ return mapping.findForward(FORWARD_GROUP);
+ }
+ //return mapping.findForward(SUCCESS);
+ }
+
+ private void setGroupParamater(HttpServletRequest request, String
groupFoeward) {
+ String[] temp=groupFoeward.split(",");
String groupNmae=temp[0];
if (temp.length==2) {
String option = temp[1];
request.setAttribute("option",option);
}
request.setAttribute("groupName",groupNmae);
- return mapping.findForward(FORWARD_GROUP);
- }
- //return mapping.findForward(SUCCESS);
}
private void deleteUser(HttpServletRequest request) {
Index: UserAddAction.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserAddAction.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- UserAddAction.java 4 Aug 2008 10:35:15 -0000 1.9
+++ UserAddAction.java 5 Aug 2008 07:56:06 -0000 1.10
@@ -35,6 +35,7 @@
public class UserAddAction extends AbstractCommunityAction {
private static Log log = LogFactory.getLog(UserAddInitAction.class);
+ protected static final String FORWARD_GROUP = "group";
@Override
public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest httpServletRequest,
@@ -42,16 +43,110 @@
ActionMessages errors = new ActionMessages();
Long authId = null;
String tmpForward = (String)
httpServletRequest.getSession().getAttribute("forward");
+ String
groupFoeward=httpServletRequest.getParameter(FORWARD_GROUP);
if (!isCancelled(httpServletRequest)) {
+ if (null==groupFoeward||",".equals(groupFoeward)) {
UserForm userForm = (UserForm) actionForm;
-
// String accountName = userForm.getEmail();
String accountName = userForm.getAccount();
-
// AuthorityService aus = getAuthorityService();
//Never used (yet).
AuthenticationService as = getAuthenticationService();
PersonService ps = getPersonService();
+ authId = updatePersonRecord(errors, authId,
userForm,
+ accountName, as, ps);
+ }else{
+ setGroupParamater(httpServletRequest,
groupFoeward);
+ return actionMapping.findForward(FORWARD_GROUP);
+ }
+ } else {
+ if (null==groupFoeward||",".equals(groupFoeward)) {
+ return setActionForward(actionMapping,
httpServletRequest,
+ tmpForward);
+ }else{
+ setGroupParamater(httpServletRequest,
groupFoeward);
+ return actionMapping.findForward(FORWARD_GROUP);
+ }
+ }
+ if (errors.size() > 0) {
+ ActionForward ret = new
ActionForward("/editors/community/user.jsp");
+ saveErrors(httpServletRequest, errors);
+ return ret;
+ } else {
+ if ("newslettersubscribers".equals(tmpForward)) {
+ ActionForward ret = new
ActionForward(actionMapping
+
.findForward("newslettersubscribers").getPath()
+ + "?newsletterId="
+ +
httpServletRequest.getSession().getAttribute(
+
"newsletterId"));
+ clearSession(httpServletRequest.getSession());
+ ret.setRedirect(true);
+ return ret;
+ } else if ("newslettersubscription".equals(tmpForward))
{
+ ActionForward ret;
+ if (((UserForm)
actionForm).getAction().equalsIgnoreCase(
+ UserForm.ACTION_ADD)) {
+ ret = new
ActionForward(actionMapping.findForward(
+
"newslettersubscription").getPath()
+ + "?newsletterId="
+ +
httpServletRequest.getSession().getAttribute(
+
"newsletterId") + "&authid=" + authId);
+ ret.setRedirect(true);
+ } else {
+ ret = new
ActionForward(actionMapping.findForward(
+
"newslettersubscribers").getPath()
+ + "?newsletterId="
+ +
httpServletRequest.getSession().getAttribute(
+
"newsletterId"));
+ }
+
+ clearSession(httpServletRequest.getSession());
+ ret.setRedirect(true);
+ return ret;
+ } else if ("communitypreference".equals(tmpForward)) {
+ String path = (String)
httpServletRequest.getSession()
+ .getAttribute("path");
+ path = path.substring(0, path.indexOf("page") -
1) + "&"
+ +
path.substring(path.indexOf("page"));
+ ActionForward ret = new ActionForward(path);
+ clearSession(httpServletRequest.getSession());
+ ret.setRedirect(true);
+ return ret;
+ }
+ }
+ removeFromSession(httpServletRequest, actionForm);
+ return actionMapping.findForward(SUCCESS);
+ }
+ private void setGroupParamater(HttpServletRequest request, String
groupFoeward) {
+ String[] temp=groupFoeward.split(",");
+ String groupNmae=temp[0];
+ if (temp.length==2) {
+ String option = temp[1];
+ request.setAttribute("option",option);
+ }
+ request.setAttribute("groupName",groupNmae);
+ }
+ private ActionForward setActionForward(ActionMapping actionMapping,
HttpServletRequest httpServletRequest, String tmpForward) {
+ log.info("cancelled");
+ ActionForward ret;
+ String newsletterId = (String)
httpServletRequest.getSession().getAttribute("newsletterId");
+ if (StringUtils.isNotBlank(tmpForward)) {
+ if(tmpForward.equals("communitypreference")) {
+ String path = (String)
httpServletRequest.getSession().getAttribute("path");
+ path =
path.substring(0,path.indexOf("page")-1)+"&"+path.substring(path.indexOf("page"));
+ ret = new ActionForward(path);
+ }
+ else {
+ ret = new
ActionForward("/editors/newsletter/NewsletterPublicationSubscriberSearch.do?newsletterId="
+ +
httpServletRequest.getSession().getAttribute("newsletterId"));
+ }
+ ret.setRedirect(true);
+ } else {
+ ret = actionMapping.findForward(SUCCESS);
+ }
+ return ret;
+ }
+ private Long updatePersonRecord(ActionMessages errors, Long authId,
UserForm userForm, String accountName, AuthenticationService as, PersonService
ps) {
if
(userForm.getAction().equalsIgnoreCase(UserForm.ACTION_ADD)) {
Long authenticationId =
as.getAuthenticationIdForUserId(userForm.getEmail());
@@ -110,64 +205,7 @@
} else {
log.info("action failed");
}
- } else {
- log.info("cancelled");
- ActionForward ret;
- String newsletterId = (String)
httpServletRequest.getSession().getAttribute("newsletterId");
- if (StringUtils.isNotBlank(tmpForward)) {
- if(tmpForward.equals("communitypreference")) {
- String path = (String)
httpServletRequest.getSession().getAttribute("path");
- path =
path.substring(0,path.indexOf("page")-1)+"&"+path.substring(path.indexOf("page"));
- ret = new ActionForward(path);
- }
- else {
- ret = new
ActionForward("/editors/newsletter/NewsletterPublicationSubscriberSearch.do?newsletterId="
- +
httpServletRequest.getSession().getAttribute("newsletterId"));
- }
- ret.setRedirect(true);
- } else {
- ret = actionMapping.findForward(SUCCESS);
- }
- return ret;
- }
- if (errors.size() > 0) {
- ActionForward ret = new
ActionForward("/editors/community/user.jsp");
- saveErrors(httpServletRequest, errors);
- return ret;
- } else {
- if ("newslettersubscribers".equals(tmpForward)) {
- ActionForward ret = new
ActionForward(actionMapping.findForward("newslettersubscribers").getPath() +
"?newsletterId="
- +
httpServletRequest.getSession().getAttribute("newsletterId"));
- clearSession(httpServletRequest.getSession());
- ret.setRedirect(true);
- return ret;
- }
- else if ("newslettersubscription".equals(tmpForward)) {
- ActionForward ret;
- if (((UserForm)
actionForm).getAction().equalsIgnoreCase(UserForm.ACTION_ADD)) {
- ret = new
ActionForward(actionMapping.findForward("newslettersubscription").getPath() +
"?newsletterId="
- +
httpServletRequest.getSession().getAttribute("newsletterId") + "&authid=" +
authId);
- ret.setRedirect(true);
- } else {
- ret = new
ActionForward(actionMapping.findForward("newslettersubscribers").getPath() +
"?newsletterId="
- +
httpServletRequest.getSession().getAttribute("newsletterId"));
- }
-
- clearSession(httpServletRequest.getSession());
- ret.setRedirect(true);
- return ret;
- }
- else if("communitypreference".equals(tmpForward)) {
- String path = (String)
httpServletRequest.getSession().getAttribute("path");
- path =
path.substring(0,path.indexOf("page")-1)+"&"+path.substring(path.indexOf("page"));
- ActionForward ret = new ActionForward(path);
- clearSession(httpServletRequest.getSession());
- ret.setRedirect(true);
- return ret;
- }
- }
- removeFromSession(httpServletRequest, actionForm);
- return actionMapping.findForward(SUCCESS);
+ return authId;
}
private void clearSession(HttpSession session){
Index: UserAddInitAction.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/UserAddInitAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- UserAddInitAction.java 4 Aug 2008 07:34:54 -0000 1.8
+++ UserAddInitAction.java 5 Aug 2008 07:56:06 -0000 1.9
@@ -32,11 +32,43 @@
private static Log log = LogFactory.getLog(UserAddInitAction.class);
protected static final String AUTHENTICATION_ID = "authid";
-
+ protected static final String FORWARD_GROUP = "group";
public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request,
HttpServletResponse httpServletResponse) throws
Exception {
String authId = request.getParameter(AUTHENTICATION_ID);
+ String groupFoeward=request.getParameter(FORWARD_GROUP);
+ setUserFormParamater(actionForm, authId);
+ if (null==groupFoeward||",".equals(groupFoeward)) {
+ setNewsletterForward(request);
+ }else{
+ setGroupForward(request, groupFoeward);
+ }
+ return actionMapping.findForward(SUCCESS);
+ }
+
+ private void setGroupForward(HttpServletRequest request, String
groupFoeward) {
+ String[] temp=groupFoeward.split(",");
+ String groupNmae=temp[0];
+ if (temp.length==2) {
+ String option = temp[1];
+ request.setAttribute("option",option);
+ }
+ request.setAttribute("groupName",groupNmae);
+ }
+
+ private void setNewsletterForward(HttpServletRequest request) {
+ if (StringUtils.isNotBlank(request.getParameter("forward"))) {
+ request.getSession().setAttribute("newsletterId",
request.getParameter("newsletterId"));
+ request.getSession().setAttribute("forward",
request.getParameter("forward"));
+ //community preference return back
+ if(request.getParameter("path") != null) {
+ request.getSession().setAttribute("path",
request.getParameter("path"));
+ }
+ }
+ }
+
+ private void setUserFormParamater(ActionForm actionForm, String authId)
{
UserForm userForm = (UserForm) actionForm;
userForm.clear();
@@ -67,14 +99,5 @@
// new
userForm.setAction(UserForm.ACTION_ADD);
}
- if (StringUtils.isNotBlank(request.getParameter("forward"))) {
- request.getSession().setAttribute("newsletterId",
request.getParameter("newsletterId"));
- request.getSession().setAttribute("forward",
request.getParameter("forward"));
- //community preference return back
- if(request.getParameter("path") != null) {
- request.getSession().setAttribute("path",
request.getParameter("path"));
- }
- }
- return actionMapping.findForward(SUCCESS);
}
}
\ No newline at end of file
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs