Update of 
/var/cvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets
In directory 
james.mmbase.org:/tmp/cvs-serv27648/src/java/com/finalist/cmsc/portlets

Modified Files:
      Tag: b1_6
        UnregisterPortlet.java 
Log Message:
CMSC-1359 Newsletter: create a Community un-register portlet


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets
See also: http://www.mmbase.org/jira/browse/CMSC-1359


Index: UnregisterPortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Portlets/portlets-login/src/java/com/finalist/cmsc/portlets/UnregisterPortlet.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- UnregisterPortlet.java      6 Apr 2009 10:00:08 -0000       1.1.2.2
+++ UnregisterPortlet.java      7 Apr 2009 05:09:28 -0000       1.1.2.3
@@ -14,22 +14,41 @@
 
 import org.apache.commons.lang.StringUtils;
 
+import com.finalist.cmsc.portalImpl.PortalConstants;
 import com.finalist.cmsc.services.community.ApplicationContextFactory;
 import com.finalist.cmsc.services.community.person.PersonService;
 import com.finalist.cmsc.services.community.security.AuthenticationService;
 //import com.finalist.newsletter.services.NewsletterSubscriptionServices;
 
 public class UnregisterPortlet extends AbstractLoginPortlet {
+   private static final String CONFIRMATION_TEXT = "confirmationText";
    private static final String USER_ACCOUNT_NOTEXIST = "view.account.notexist";
    private static final String REGISTER_EMAIL_MATCH = "register.email.match";
    private static final String REGISTER_EMAIL_EMPTY = "register.email.empty";
    private static final String REMOVE_SUCCESS = "removeSuccess";
    protected static final String EMAIL_REGISTER = "registerEmail";
    protected static final String ERRORMESSAGES = "errormessages";
+   protected void doEditDefaults(RenderRequest req, RenderResponse res) throws 
IOException,
+   PortletException {
+      PortletPreferences preferences = req.getPreferences();
+      setAttribute(req, CONFIRMATION_TEXT, 
preferences.getValue(CONFIRMATION_TEXT,""));
+      super.doEditDefaults(req, res);
+   }
+   @Override
+   public void processEditDefaults(ActionRequest request,
+         ActionResponse response) throws PortletException, IOException {
+      PortletPreferences preferences = request.getPreferences();
+      String portletId = 
preferences.getValue(PortalConstants.CMSC_OM_PORTLET_ID, null);
+      if (portletId != null) {
+         setPortletParameter(portletId, CONFIRMATION_TEXT, 
request.getParameter(CONFIRMATION_TEXT));
+      }
+      super.processEditDefaults(request, response);
+      }
    @Override
    public void processView(ActionRequest request, ActionResponse response) 
throws PortletException, IOException {
       PortletPreferences preferences = request.getPreferences();
       String register_email = request.getParameter(EMAIL_REGISTER);
+      
       Map<String, String> errorMessages = new HashMap<String, String>();
       if (StringUtils.isBlank(register_email)) {
          errorMessages.put(EMAIL_REGISTER, REGISTER_EMAIL_EMPTY);
@@ -56,13 +75,13 @@
          request.getPortletSession().setAttribute(EMAIL_REGISTER, 
register_email);
       }
       request.getPortletSession().setAttribute(REMOVE_SUCCESS, 
"unregister.success");
+      request.getPortletSession().setAttribute(CONFIRMATION_TEXT, 
preferences.getValue(CONFIRMATION_TEXT, null));
    }
    @Override
    protected void doView(RenderRequest request, RenderResponse response) 
throws PortletException, IOException {
       String template = "login/unregister.jsp";
       PortletSession portletSession = request.getPortletSession();
       Map<String, String> errorMessages = (HashMap<String, String>) 
portletSession.getAttribute(ERRORMESSAGES);
-     
       if (errorMessages != null && errorMessages.size() > 0) {
          String registerEmail = (String) 
portletSession.getAttribute(EMAIL_REGISTER);
          portletSession.removeAttribute(ERRORMESSAGES);
@@ -75,6 +94,11 @@
          portletSession.removeAttribute(REMOVE_SUCCESS);
          request.setAttribute(REMOVE_SUCCESS, remove_success);
       }
+      if(portletSession.getAttribute(CONFIRMATION_TEXT) != null) {
+         String confirmation_text = (String) 
portletSession.getAttribute(CONFIRMATION_TEXT);
+         portletSession.removeAttribute(CONFIRMATION_TEXT);
+         request.setAttribute("confirmText", confirmation_text);
+      }
       doInclude("view", template, request, response);
    }
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to