head	1.14;
access;
symbols
	TIGRIS_1_1_0RC2:1.8
	TIGRIS_1_1_0RC1:1.8
	TIGRIS_1_1:1.8.0.4
	TIGRIS_1_0_8:1.8
	TIGRIS_1_0_8RC3:1.8
	TIGRIS_1_0_8RC2:1.8
	TIGRIS_1_0_8RC1:1.8
	TIGRIS_1_0_7:1.8
	TIGRIS_1_0_7RC3:1.8
	TIGRIS_1_0_7RC2:1.8
	TIGRIS_1_0_7RC1:1.8
	TIGRIS_1_0_6:1.8
	TIGRIS_1_0_6RC5:1.8
	TIGRIS_1_0_6RC4:1.8
	TIGRIS_1_0_6RC3:1.8
	TIGRIS_1_0_6RC2:1.8
	TIGRIS_1_0_6RC1:1.8
	TIGRIS_1_0_5:1.8
	TIGRIS_1_0_5RC6:1.8
	TIGRIS_1_0_5RC5:1.8
	TIGRIS_1_0_5RC4:1.8
	TIGRIS_1_0_5RC3:1.8
	TIGRIS_1_0_5RC2:1.8
	TIGRIS_1_0_5RC1:1.8
	TIGRIS_1_0_4:1.8
	TIGRIS_1_0_3:1.8
	TIGRIS_1_0_2:1.8
	TIGRIS_1_0_1:1.8
	TIGRIS_1_0:1.8.0.6
	TIGRIS_1_0_0:1.8
	TIGRIS_1_0_0_RC1:1.8.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.2
	TIGRIS_0_9_2_3:1.2
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.5
	TIGRIS_0_9_2_1:1.5
	TIGRIS_0_9_2:1.2.0.6
	TIGRIS_0_9_0:1.2.0.4
	TIGRIS_0_8_4:1.2.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.14
date	2001.08.28.17.45.19;	author leonardr;	state Exp;
branches;
next	1.13;

1.13
date	2001.08.11.09.08.09;	author dlr;	state Exp;
branches;
next	1.12;

1.12
date	2001.07.31.22.04.29;	author edk;	state Exp;
branches;
next	1.11;

1.11
date	2001.07.31.22.03.08;	author edk;	state Exp;
branches;
next	1.10;

1.10
date	2001.07.18.10.05.16;	author dlr;	state Exp;
branches;
next	1.9;

1.9
date	2001.05.23.01.50.22;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2001.03.07.01.53.28;	author lucas;	state Exp;
branches;
next	1.7;

1.7
date	2001.02.21.01.08.26;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2001.02.13.00.20.09;	author edk;	state Exp;
branches;
next	1.5;

1.5
date	2001.01.26.18.29.11;	author edk;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2001.01.26.05.24.08;	author edk;	state dead;
branches;
next	1.3;

1.3
date	2001.01.25.00.26.08;	author edk;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.13.19.45.21;	author edk;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.12.21.17.00;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.17.00;	author dlr;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.02.21.00.35.35;	author dlr;	state Exp;
branches;
next	;

1.5.2.1
date	2001.01.28.01.02.20;	author dlr;	state dead;
branches;
next	1.5.2.2;

1.5.2.2
date	2001.02.20.09.49.21;	author edk;	state Exp;
branches;
next	;


desc
@@


1.14
log
@More methods migrated to ContextAPI.
@
text
@/* ================================================================
 * Copyright (c) 2000 Collab.Net.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of Collab.Net.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Collab.Net.
 */


package org.tigris.helm.tool.mail;

import java.sql.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;

import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.velocity.context.Context;

import gnu.regexp.RE;

import org.apache.commons.util.exception.NestableException;

import org.tigris.helm.security.RedirectException;
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.MailingListPeer;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.AccessControlList;

import org.apache.turbine.util.Log;
import org.tigris.helm.tool.ContextAPI;
import org.tigris.helm.security.AccessControlList;

/**
 * Present a form for editing one of the ezmlm "files"  -- this includes
 * the subscribers, the moderators, the digest list, and so on.
 * This should not be used by ordinary subscribers -- only project
 * admins/owners.
 * Parts taken from ProjMailEdit.java (orig. in helm), parts taken from
 * sourcexchange.
 *
 * @@author <a href="mailto:edk@@collab.net">Ed Korthof</a>
 * @@version $Id: MailingListMembers.java,v 1.13 2001/08/11 09:08:09 dlr Exp $
 */
public class MailingListMembers extends HelmServlet {
    static private boolean debug = true;

    public void start() throws ServletException
    {
        super.start();
    }

    protected boolean subscribe(String group, MailingList ml, 
            Context context, ArrayList validationErrors)
        throws NestableException, Exception
    {
        String membersRaw = ContextAPI.getParameter(context, "subscribeList");

        if (membersRaw == null || membersRaw.equals("")) {
            context.put("info", "no new subscriptions: no addresses provided");
            return true;
        }
        ArrayList members = Util.parseEmailList(membersRaw, validationErrors);
        if (!validationErrors.isEmpty()) {
            if (membersRaw != null)
                context.put("subscribe", membersRaw);
            Log.debug("no email addresses passed validation");
            return false;
        }

        context.put("info", "new subscribers: "+members);
        ml.subscribe(members, group);
        return true;
    }

    protected boolean unsubscribe(String group, MailingList ml,
            Context context, ArrayList validationErrors)
        throws NestableException, Exception
    {
        String[] membersRaw = ContextAPI.getParameterValues
            (context, "unsubscribeList");
        if (membersRaw == null || membersRaw[0] == null ||
                membersRaw[0].equals(""))  {
            context.put("info","no unsubscriptions: no addresses selected");
            return true;
        }
        ArrayList members = new ArrayList();
        for (int i = 0; i < membersRaw.length; ++i ) {
            members.add(membersRaw[i]);
        }
        context.put("info", "unsubscribed: "+members);
        ml.unsubscribe(members, group);
        return true;
    }

    protected List getMembers(String group, MailingList ml,
            Context context) throws NestableException, Exception
    {
        List subscribers = ml.listMembers(group);
        String filter = ContextAPI.getParameter(context, "filterString");
        context.put("filterString", filter != null ? filter : "");
        if ("".equals(filter))
            filter = null;

        if (filter != null) {
            context.put("filter_info", "entries containing: " + filter);
        } else {
            return subscribers;
        }

        int count = 0;
        Iterator i = subscribers.iterator();
        ArrayList membersShown = new ArrayList();
        while (i.hasNext()) {
            String member = (String)i.next();
            if (filter == null || member.indexOf(filter) >= 0) {
                membersShown.add(member);
            }
        }
        return membersShown;
    }

    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        String templateName = super.processRequest(context);
        // super sets $UserName, Cancel

        ArrayList missingFields = new ArrayList();
        ArrayList validationErrors = new ArrayList();
        boolean listExists = false;
        context.put("subscribe","");

        Project project = getCurrentProject(context);
        if (project == null)
            redirectToError(context, "MailingListMembers: No project given");

        // TODO: use acl appropriately.  but for now, always give permission:
        context.put("allow_edits", new Boolean(true));

        String list = ContextAPI.getParameter(context, "list");
        if (list == null)
            redirectToError(context, "MailingListMembers: No list specified");
        context.put("listname", list);

        String group = ContextAPI.getParameter(context, "group");
        context.put("group", group != null ? group : "");

        MailingList mList = null;
        try {
            mList = MailingListPeer.getInstanceByName(project, list);
        } catch (Exception e) {
            Log.error(e);
            if (debug) Log.debug("unable to get MailingList" + e.getMessage());
            redirectToError(context, "invalid mailing list");
        }
        if (mList == null || !mList.exists())
            redirectToError(context, "list "+ list + " does not exist");

        String action = (String) context.get("action");

        if ("".equals(action)) action = null;

        try
        {
            if (validationErrors.isEmpty() && action != null) {
                if ("Subscribe".equals(action)) {
                    if (debug) Log.debug("button = Subscribe");
                    subscribe(group, mList, context, validationErrors);
                } else if ("Unsubscribe".equals(action)) {
                    if (debug) Log.debug("button = Unsubscribe");
                    unsubscribe(group, mList, context, validationErrors);
                }
            }

            List members = getMembers(group, mList, context);

            if (members == null) members = new ArrayList();
            context.put("members", members);
        }
        catch (Exception e)
        {
            Log.error(e);
            redirectToError(context, e.getMessage());
        }

        context.put("missingFields", missingFields);
        context.put("validationErrors", validationErrors);
    
        return templateName;
    }
} /* end class MailingListMembers */
@


1.13
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d77 1
d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.12 2001/07/31 22:04:29 edk Exp $
d103 1
a103 1
        String membersRaw = getParameter(context, "subscribeList");
d126 2
a127 1
        String[] membersRaw = getParameterValues(context, "unsubscribeList");
d146 1
a146 1
        String filter = getParameter(context, "filterString");
d187 1
a187 1
        String list = getParameter(context, "list");
d192 1
a192 1
        String group = getParameter(context, "group");
@


1.12
log
@avoid references to webmacro, which is not longer used
@
text
@d50 7
d58 1
a58 2

import org.apache.velocity.context.Context;
d63 2
a64 1
import java.sql.*;
d67 2
d76 1
a76 10
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Iterator;

import java.net.URL;
import java.net.URLEncoder;

import java.io.BufferedReader;
import java.io.InputStreamReader;

a78 5
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.TurbineException;


d88 1
a88 1
 * @@version $Id: MailingListMembers.java,v 1.11 2001/07/31 22:03:08 edk Exp $
d100 1
a100 1
        throws TurbineException, Exception
d123 1
a123 1
        throws TurbineException, Exception
d141 1
a141 1
            Context context) throws TurbineException, Exception
d168 1
a168 1
        throws TurbineException, RedirectException
@


1.11
log
@use variables which avoid confusion/name space conflicts
@
text
@a51 1
//import org.webmacro.util.*;
a52 2
import org.webmacro.engine.*;
import org.webmacro.broker.*;
d93 1
a93 1
 * @@version $Id: MailingListMembers.java,v 1.10 2001/07/18 10:05:16 dlr Exp $
@


1.10
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d96 1
a96 1
 * @@version $Id: MailingListMembers.java,v 1.9 2001/05/23 01:50:22 dlr Exp $
d110 1
a110 1
        String membersRaw = getParameter(context, "subscribe");
d120 1
d133 1
a133 1
        String[] membersRaw = getParameterValues(context, "unsubscribe");
a139 1
        StringBuffer listBuff = new StringBuffer();
a141 3
            if (membersRaw[i] != null) {
                listBuff.append(" ").append(membersRaw[i]);
            }
d143 1
a143 2
        String list = listBuff.toString();
        context.put("info", "unsubscribed: "+list);
d152 2
a153 2
        String filter = getParameter(context, "filter");
        context.put("filter", filter != null ? filter : "");
@


1.9
log
@Ported Helm from WebMacro to Velocity.
@
text
@d63 1
a63 1
import org.joist.security.RedirectException;
d96 1
a96 1
 * @@version $Id: MailingListMembers.java,v 1.8 2001/03/07 01:53:28 lucas Exp $
@


1.8
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d53 1
a53 1
import org.webmacro.servlet.*;
d84 1
d96 1
a96 1
 * @@version $Id: MailingListMembers.java,v 1.7 2001/02/21 01:08:26 dlr Exp $
d107 1
a107 1
            WebContext context, ArrayList validationErrors)
d110 1
a110 1
        String membersRaw = context.getForm("subscribe");
d129 1
a129 1
            WebContext context, ArrayList validationErrors)
d132 1
a132 1
        String membersRaw[] = context.getFormList("unsubscribe");
d153 1
a153 1
            WebContext context) throws TurbineException, Exception
d156 1
a156 1
        String filter = context.getForm("filter");
d179 2
a180 2
    protected String processRequest(Connection connection, WebContext context)
        throws HandlerException, RedirectException
d182 1
a182 1
        String templateName = super.processRequest(connection, context);
d197 1
a197 1
        String list = context.getForm("list");
d202 1
a202 1
        String group = context.getForm("group");
@


1.7
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d66 1
a66 1
import org.tigris.helm.om.peer.MailingListPeer;
d95 1
a95 1
 * @@version $Id: MailingListMembers.java,v 1.5.2.2 2001/02/20 09:49:21 edk Exp $
@


1.6
log
@switch from ArrayList to List where appropriate
@
text
@d50 3
a52 1
import org.webmacro.util.*;
d64 3
a68 3
import org.tigris.helm.project.Project;

import com.workingdogs.village.DataSetException;
a71 1
import java.util.List;
d82 4
d95 1
a95 1
 * @@version $Id: MailingListMembers.java,v 1.5 2001/01/26 18:29:11 edk Exp $
a97 1
    static private Log log = new Log("mlMembers", "MailingListMembers");
d107 1
a107 1
        throws HandlerException
d129 1
a129 1
        throws HandlerException
d152 1
a152 1
            WebContext context) throws HandlerException
d154 19
a172 11
        try {
            List subscribers = ml.listMembers(group);
            String filter = context.getForm("filter");
            context.put("filter", filter != null ? filter : "");
            if ("".equals(filter))
                filter = null;

            if (filter != null) {
                context.put("filter_info", "entries containing: " + filter);
            } else {
                return subscribers;
a173 15

            int count = 0;
            Iterator i = subscribers.iterator();
            ArrayList membersShown = new ArrayList();
            while (i.hasNext()) {
                String member = (String)i.next();
                if (filter == null || member.indexOf(filter) >= 0) {
                    membersShown.add(member);
                }
            }
            return membersShown;
        }
        catch (HandlerException e) {
            throw new HandlerException("Unable to list members for " + group +
                    ": " + e.getMessage() + "/" + e);
d175 1
d206 1
a206 1
            mList = new MailingList(connection, dMgr, project.getID(), list);
d208 2
a209 2
            log.exception(e);
            if (debug) log.debug("unable to get MailingList" + e.getMessage());
d219 10
a228 7
        if (validationErrors.isEmpty() && action != null) {
            if ("Subscribe".equals(action)) {
                if (debug) log.debug("button = Subscribe");
                subscribe(group, mList, context, validationErrors);
            } else if ("Unsubscribe".equals(action)) {
                if (debug) log.debug("button = Unsubscribe");
                unsubscribe(group, mList, context, validationErrors);
a229 1
        }
d231 1
a231 1
        List members = getMembers(group, mList, context);
d233 8
a240 2
        if (members == null) members = new ArrayList();
        context.put("members", members);
@


1.5
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d70 1
d90 1
a90 1
 * @@version $Id: MailingListMembers.java,v 1.2 2000/11/13 19:45:21 edk Exp $
d147 1
a147 1
    protected ArrayList getMembers(String group, MailingList ml,
d151 1
a151 1
            ArrayList subscribers = ml.listMembers(group);
d231 1
a231 1
        ArrayList members = getMembers(group, mList, context);
@


1.5.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.5 2001/01/26 18:29:11 edk Exp $
@


1.5.2.2
log
@* port MailingList* to the peer system
* add some necessary methods to MailingList, update AnzuTask to use those
* this compiles, but some methods still need to be implemented, so it
  doesn't all work
@
text
@d50 1
a50 3
import java.util.List;

//import org.webmacro.util.*;
a61 3
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.peer.MailingListPeer;
d64 3
a79 4
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.Log;


d92 1
d102 1
a102 1
        throws TurbineException, Exception
d124 1
a124 1
        throws TurbineException, Exception
d146 2
a147 2
    protected List getMembers(String group, MailingList ml,
            WebContext context) throws TurbineException, Exception
d149 11
a159 19
        List subscribers = ml.listMembers(group);
        String filter = context.getForm("filter");
        context.put("filter", filter != null ? filter : "");
        if ("".equals(filter))
            filter = null;

        if (filter != null) {
            context.put("filter_info", "entries containing: " + filter);
        } else {
            return subscribers;
        }

        int count = 0;
        Iterator i = subscribers.iterator();
        ArrayList membersShown = new ArrayList();
        while (i.hasNext()) {
            String member = (String)i.next();
            if (filter == null || member.indexOf(filter) >= 0) {
                membersShown.add(member);
d161 15
a176 1
        return membersShown;
d207 1
a207 1
            mList = MailingListPeer.getInstanceByName(project, list);
d209 2
a210 2
            Log.error(e);
            if (debug) Log.debug("unable to get MailingList" + e.getMessage());
d220 7
a226 10
        try
        {
            if (validationErrors.isEmpty() && action != null) {
                if ("Subscribe".equals(action)) {
                    if (debug) Log.debug("button = Subscribe");
                    subscribe(group, mList, context, validationErrors);
                } else if ("Unsubscribe".equals(action)) {
                    if (debug) Log.debug("button = Unsubscribe");
                    unsubscribe(group, mList, context, validationErrors);
                }
d228 1
d230 1
a230 1
            List members = getMembers(group, mList, context);
d232 2
a233 8
            if (members == null) members = new ArrayList();
            context.put("members", members);
        }
        catch (Exception e)
        {
            Log.error(e);
            redirectToError(context, e.getMessage());
        }
@


1.4
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.3 2001/01/25 00:26:08 edk Exp $
d207 1
a207 1
            mList = new MailingList(dMgr, project.getID(), list);
@


1.3
log
@MailingList changes to more closely resemble other business objects (I
don't like certain parts of the pattern, but consistency is more important)
including changes to avoid keeping reference to Connections.
@
text
@d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.2 2000/11/13 19:45:21 edk Exp $
@


1.2
log
@updates from last night: use ArrayList instead of String[]'s; and correct
Util's prefix pattern
@
text
@d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.6 2000/11/13 16:47:36 edk Exp $
d207 1
a207 1
            mList = new MailingList(connection, dMgr, project.getID(), list);
@


1.1
log
@Initial revision
@
text
@d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.5 2000/11/11 12:13:26 edk Exp $
d110 1
a110 1
        String members[] = Util.parseEmailList(membersRaw, validationErrors);
d126 3
a128 2
        String members[] = context.getFormList("unsubscribe");
        if (members == null || members[0] == null || members[0].equals(""))  {
d132 1
d134 4
a137 3
        for (int i = 0; i < members.length ; ++i) {
            if (members[i] != null) {
                listBuff.append(" ").append(members[i]);
d146 1
a146 1
    protected String[] getMembers(String group, MailingList ml,
d150 1
a150 1
            String subscribers[] = ml.listMembers(group);
d163 4
a166 2
            for (int i = 0; i < subscribers.length ; ++i ) {
                String member = subscribers[i];
d168 1
a168 10
                    ++count;
                }
            }

            String membersShown [] = new String[count];
            int idx = 0;
            for (int i = 0; i < subscribers.length; ++i) {
                String member = subscribers[i];
                if (filter == null || member.indexOf(filter) >= 0) {
                    membersShown[idx++] = member;
d230 1
a230 1
        String members[] = getMembers(group, mList, context);
d232 1
a232 1
        if (members == null) members = new String[0];
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@


1.1.1.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d50 1
a50 3
import java.util.List;

//import org.webmacro.util.*;
a61 3
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.peer.MailingListPeer;
d64 3
a79 4
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.Log;


d89 1
a89 1
 * @@version $Id: MailingListMembers.java,v 1.5.2.2 2001/02/20 09:49:21 edk Exp $
d92 1
d102 1
a102 1
        throws TurbineException, Exception
d110 1
a110 1
        ArrayList members = Util.parseEmailList(membersRaw, validationErrors);
d124 1
a124 1
        throws TurbineException, Exception
d126 2
a127 3
        String membersRaw[] = context.getFormList("unsubscribe");
        if (membersRaw == null || membersRaw[0] == null ||
                membersRaw[0].equals(""))  {
a130 1
        ArrayList members = new ArrayList();
d132 3
a134 4
        for (int i = 0; i < membersRaw.length; ++i ) {
            members.add(membersRaw[i]);
            if (membersRaw[i] != null) {
                listBuff.append(" ").append(membersRaw[i]);
d143 2
a144 2
    protected List getMembers(String group, MailingList ml,
            WebContext context) throws TurbineException, Exception
d146 19
a164 19
        List subscribers = ml.listMembers(group);
        String filter = context.getForm("filter");
        context.put("filter", filter != null ? filter : "");
        if ("".equals(filter))
            filter = null;

        if (filter != null) {
            context.put("filter_info", "entries containing: " + filter);
        } else {
            return subscribers;
        }

        int count = 0;
        Iterator i = subscribers.iterator();
        ArrayList membersShown = new ArrayList();
        while (i.hasNext()) {
            String member = (String)i.next();
            if (filter == null || member.indexOf(filter) >= 0) {
                membersShown.add(member);
d166 14
a180 1
        return membersShown;
d211 1
a211 1
            mList = MailingListPeer.getInstanceByName(project, list);
d213 2
a214 2
            Log.error(e);
            if (debug) Log.debug("unable to get MailingList" + e.getMessage());
d224 7
a230 10
        try
        {
            if (validationErrors.isEmpty() && action != null) {
                if ("Subscribe".equals(action)) {
                    if (debug) Log.debug("button = Subscribe");
                    subscribe(group, mList, context, validationErrors);
                } else if ("Unsubscribe".equals(action)) {
                    if (debug) Log.debug("button = Unsubscribe");
                    unsubscribe(group, mList, context, validationErrors);
                }
d232 1
d234 1
a234 1
            List members = getMembers(group, mList, context);
d236 2
a237 8
            if (members == null) members = new ArrayList();
            context.put("members", members);
        }
        catch (Exception e)
        {
            Log.error(e);
            redirectToError(context, e.getMessage());
        }
@

