head	1.21;
access;
symbols
	TIGRIS_1_1_0RC2:1.15
	TIGRIS_1_1_0RC1:1.15
	TIGRIS_1_1:1.15.0.4
	TIGRIS_1_0_8:1.15
	TIGRIS_1_0_8RC3:1.15
	TIGRIS_1_0_8RC2:1.15
	TIGRIS_1_0_8RC1:1.15
	TIGRIS_1_0_7:1.15
	TIGRIS_1_0_7RC3:1.15
	TIGRIS_1_0_7RC2:1.15
	TIGRIS_1_0_7RC1:1.15
	TIGRIS_1_0_6:1.15
	TIGRIS_1_0_6RC5:1.15
	TIGRIS_1_0_6RC4:1.15
	TIGRIS_1_0_6RC3:1.15
	TIGRIS_1_0_6RC2:1.15
	TIGRIS_1_0_6RC1:1.15
	TIGRIS_1_0_5:1.15
	TIGRIS_1_0_5RC6:1.15
	TIGRIS_1_0_5RC5:1.15
	TIGRIS_1_0_5RC4:1.15
	TIGRIS_1_0_5RC3:1.15
	TIGRIS_1_0_5RC2:1.15
	TIGRIS_1_0_5RC1:1.15
	TIGRIS_1_0_4:1.15
	TIGRIS_1_0_3:1.15
	TIGRIS_1_0_2:1.15
	TIGRIS_1_0_1:1.15
	TIGRIS_1_0:1.15.0.6
	TIGRIS_1_0_0:1.15
	TIGRIS_1_0_0_RC1:1.15.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.4
	TIGRIS_0_9_2_3:1.4
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.8
	TIGRIS_0_9_2_1:1.8
	TIGRIS_0_9_2:1.4.0.6
	TIGRIS_0_9_0:1.4.0.4
	TIGRIS_0_8_4:1.4.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.21
date	2001.08.11.09.08.09;	author dlr;	state Exp;
branches;
next	1.20;

1.20
date	2001.07.24.00.02.28;	author leonardr;	state Exp;
branches;
next	1.19;

1.19
date	2001.07.19.18.42.23;	author dlr;	state Exp;
branches;
next	1.18;

1.18
date	2001.07.18.22.12.36;	author dlr;	state Exp;
branches;
next	1.17;

1.17
date	2001.07.18.10.05.16;	author dlr;	state Exp;
branches;
next	1.16;

1.16
date	2001.05.23.01.50.22;	author dlr;	state Exp;
branches;
next	1.15;

1.15
date	2001.03.09.05.22.44;	author elicia;	state Exp;
branches;
next	1.14;

1.14
date	2001.03.07.17.33.44;	author edk;	state Exp;
branches;
next	1.13;

1.13
date	2001.03.06.02.59.01;	author ms;	state Exp;
branches;
next	1.12;

1.12
date	2001.03.02.08.33.11;	author dlr;	state Exp;
branches;
next	1.11;

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

1.10
date	2001.02.22.22.48.36;	author edk;	state Exp;
branches;
next	1.9;

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

1.8
date	2001.01.26.18.29.11;	author edk;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2001.01.26.05.24.08;	author edk;	state dead;
branches;
next	1.6;

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

1.5
date	2001.01.25.00.26.08;	author edk;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.29.01.44.22;	author edk;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.22.00.36.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.16.56;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

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

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

1.8.2.1
date	2001.01.28.01.02.20;	author dlr;	state dead;
branches;
next	1.8.2.2;

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


desc
@@


1.21
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
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.util.List;
import java.util.Iterator;
import java.util.ArrayList;
import java.sql.*;

import org.tigris.anzu.client.MailingListManagerSpec;

import javax.servlet.ServletException;

import org.apache.velocity.context.Context;

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

import gnu.regexp.RE;

import org.tigris.helm.security.RedirectException;

import org.tigris.helm.om.User;
import org.tigris.helm.om.Domain;
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
import org.tigris.helm.tool.ListElement;
import org.tigris.helm.tool.mail.Util;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.DoesNotExist;
import org.tigris.helm.AlreadyExists;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.tool.ContextAPI;

/**
 * Present a form for the adding a new mailing list.
 *
 * @@author <a href="mailto:edk@@collab.net">Ed Korthof</a>
 * @@version $Id: MailingListAdd.java,v 1.20 2001/07/24 00:02:28 leonardr Exp $
 */
public class MailingListAdd extends HelmServlet {
    private static final boolean DEBUG = true;

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

    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;

        Domain domain = getCurrentDomain(context);
        // put the domain in the context for use by anzu
        context.put("domain", domain.getName());

        Project project = getCurrentProject(context);
        if (project == null)
            redirectToError(context, "MailingListAdd: No project specified");

        context.put("listname", "");
        context.put("owner", "");
        context.put("description", "");
        context.put("prefix", "");
        context.put("privateChecked", "");

        // Determine which button was pushed
        String action = (String) context.get("action");
        String type = null;
        MailingList mList = null;
        String prefix = null;
        String subscribersRaw = "";
        String moderatorsRaw = "";
        String owner = "";
        User loginUser = getLoginUser(context);
        boolean trailerChecked =
            !(Util.readFormInput(context, "trailer", null, false,
                        missingFields, validationErrors).equals(""));

        boolean privateChecked =
            !(Util.readFormInput(context, "private", null, false,
                        missingFields, validationErrors).equals(""));

        if (action.equals("Create Mailing List")) {
            String list = Util.readFormInput(context, "listname",
                    Util.listnameRE, true, missingFields,
                    validationErrors);
            
            String description = Util.readFormInput(context, "description",
                    null, true, missingFields, validationErrors);

            owner = Util.readFormInput(context, "owner", 
                    Util.emailRE, true, missingFields, validationErrors);

            subscribersRaw = Util.readFormInput(context, "subscribers",
                    null, false, missingFields, validationErrors);

            moderatorsRaw = Util.readFormInput(context, "moderators",
                    null, false, missingFields, validationErrors);

            prefix = Util.readFormInput(context, "prefix",
                    Util.prefixRE, false, missingFields,
                    validationErrors);

            type = Util.readFormInput(context, "type", Util.listnameRE,
                    true, missingFields, validationErrors);

            ArrayList subscribers = Util.parseEmailList(subscribersRaw,
                    validationErrors);
            ArrayList moderators = Util.parseEmailList(moderatorsRaw,
                    validationErrors);

            if (missingFields.isEmpty() && validationErrors.isEmpty()) {
                try {
                    mList = MailingList.add(loginUser.getACL(), project,
                            list, description, type);
                    mList.setType(type);
                    mList.setPrivate(privateChecked);
                    mList.setStringOption("owner", owner);
                    mList.setStringOption("description", description);
                    if ( ! prefix.equals(""))
                        mList.setStringOption("prefix", prefix);

                    mList.setBooleanOption("trailer", trailerChecked ? 
                            Boolean.TRUE : Boolean.FALSE);

                    mList.save(loginUser.getACL());
                    if (subscribers.size() > 0)
                        mList.subscribe(subscribers, "");

                    if (moderators.size() > 0)
                        mList.subscribe(moderators, "Moderators");

                    redirectToURL(context, "ProjectMailingListList");
                } 
                catch (AlreadyExists e) 
                {
                    ContextAPI.addError(context, e.getMessage());
                } 
                catch (RedirectException e) 
                {
                    throw e;
                }
                catch (Exception e) 
                {
                    Log.error(e);
                    throw new NestableException(e);
                }
            }
        }

        List listTypesRaw = null;
        try
        {
            if (mList != null)
            {
                listTypesRaw = mList.getListTypes();
            }
            else
            {
                try {
                    MailingListManagerSpec mlmSpec
                        = new MailingListManagerSpec(project.getDomain().
                                                     getName());
                    listTypesRaw = mlmSpec.getListTypes();
                } catch (Exception e) {
                    Log.debug("MailingListManagerSpec.getListTypes failed");
                    Log.error(e);
                    throw new NestableException(e);
                }
            }
        }
        catch (Exception e)
        {
            Log.error(e);
            String msg = e.getMessage();
            if (DEBUG) Log.warn(msg);
            redirectToError(context, msg);
        }

        if (listTypesRaw == null)
            throw new NestableException("Unable to get list types from Anzu");
        Iterator i = listTypesRaw.iterator();
        ArrayList listTypes = new ArrayList();
        while (i.hasNext()) {
            String lType = (String)i.next();
            ListElement e;
            if (lType.equals(type)) {
                e = new ListElement(lType, lType, true);
            } else {
                e = new ListElement(lType, lType, false);
            }
            listTypes.add(e);
            Log.debug("list type: "+lType);
        }
        context.put("listTypes", listTypes);
        context.put("trailerChecked", trailerChecked ? "checked" : "");
        context.put("privateChecked", privateChecked ? "checked" : "");

        if (owner.equals("")) {
            owner = loginUser.getEmail();
        }
        context.put("owner", owner);
        context.put("moderators", moderatorsRaw);
        context.put("subscribers", subscribersRaw);
        context.put("missingFields", missingFields);
        context.put("validationErrors", validationErrors);
        context.put("listExists", new Boolean(listExists));
        context.put("warnChanged", new Boolean(listExists
                    || !missingFields.isEmpty()));

        return templateName;
    }
}
@


1.20
log
@The final pieces of the error handling revolution.
@
text
@d62 1
a62 1
import org.apache.turbine.util.TurbineException;
d84 1
a84 1
 * @@version $Id: MailingListAdd.java,v 1.19 2001/07/19 18:42:23 dlr Exp $
d94 1
a94 1
            throws TurbineException, RedirectException {
d196 1
a196 1
                    throw new TurbineException(e);
d218 1
a218 1
                    throw new TurbineException(e);
d231 1
a231 1
            throw new TurbineException("Unable to get list types from Anzu");
@


1.19
log
@Updated in light of the port of Joist JoistProperties class to Helm (as class HelmProperties).
@
text
@d78 1
d84 1
a84 1
 * @@version $Id: MailingListAdd.java,v 1.18 2001/07/18 22:12:36 dlr Exp $
d184 7
a190 3
                } catch (AlreadyExists e) {
                    appendToMessage(context, e.getMessage());
                } catch (RedirectException e) {
d192 3
a194 1
                } catch (Exception e) {
d196 1
a196 3
                    String msg = e.getMessage();
                    if (DEBUG) Log.warn(msg);
                    redirectToError(context, msg);
@


1.18
log
@Ported ListElement from Joist to Helm on path to remove Joist dependancy.
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.17 2001/07/18 10:05:16 dlr Exp $
d86 1
a86 1
    static private boolean DEBUG = true;
@


1.17
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a66 2
import org.joist.util.ListElement;
import org.joist.database.DataManager;
d72 1
d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.16 2001/05/23 01:50:22 dlr Exp $
@


1.16
log
@Ported Helm from WebMacro to Velocity.
@
text
@d66 1
a66 1
import org.joist.security.RedirectException;
d84 1
a84 1
 * @@version $Id: MailingListAdd.java,v 1.15 2001/03/09 05:22:44 elicia Exp $
@


1.15
log
@redirecting to mailing list page after add, instead of to ProjectEdit
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d59 1
a59 1
import org.webmacro.servlet.*;
d62 1
d84 1
a84 1
 * @@version $Id: MailingListAdd.java,v 1.14 2001/03/07 17:33:44 edk Exp $
d93 3
a95 3
    protected String processRequest(Connection connection, WebContext context)
            throws HandlerException, RedirectException {
        String templateName = super.processRequest(connection, context);
d214 1
a214 1
                    throw new HandlerException("unable to get list types");
d227 1
a227 1
            throw new HandlerException("unable to get ListTypes from anzu");
d259 1
a259 1
} /* end class MailingListAdd */
@


1.14
log
@* changes to use the private toggle, which will replace -private list types
* fix a bug in MailingList : update wasn't implemented (d'oh)
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.13 2001/03/06 02:59:01 ms Exp $
d182 1
a182 1
                    redirectTo("ProjectEdit");
@


1.13
log
@pass input description to anzu
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.12 2001/03/02 08:33:11 dlr Exp $
d113 1
a122 1
        Boolean trailerChecked = Boolean.FALSE;
d124 7
a130 5

        trailerChecked = new Boolean( !
                Util.readFormInput(context, "trailer", null, false,
                    missingFields, validationErrors)
                .equals(""));
d166 1
d172 2
a173 1
                    mList.setBooleanOption("trailer", trailerChecked);
d241 2
a242 1
        context.put("trailerChecked", trailerChecked);
@


1.12
log
@Use an existing object instead of creating a new one.
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.11 2001/03/02 07:24:59 edk Exp $
d165 1
@


1.11
log
@provide a decent default owner (which also explains the format of the
field, though it could still use some more explanation in the ui)
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.10 2001/02/22 22:48:36 edk Exp $
d122 1
a122 1
        Boolean trailerChecked = new Boolean(false);
@


1.10
log
@switch to using MailingListManagerSpec directly; now mailing list creation
works by getting the mailing list types from it.
@
text
@d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.9 2001/02/21 01:08:26 dlr Exp $
d121 1
d123 1
a134 3
            String owner = Util.readFormInput(context, "owner", 
                    Util.emailRE, true, missingFields, validationErrors);

d138 3
a160 1
                    User loginUser = getLoginUser(context);
d238 4
a241 2
        // FIXME : find a good default owner, stick it in if owner is not set

@


1.9
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d55 2
a58 1
import org.webmacro.util.Log;
d61 2
d83 1
a83 1
 * @@version $Id: MailingListAdd.java,v 1.8.2.2 2001/02/20 09:49:21 edk Exp $
d86 1
a86 2
    static private Log log = new Log("mlAdd", "MailingListAdd");
    static private boolean debug = true;
d182 1
a182 1
                    log.exception(e);
d184 1
a184 1
                    if (debug) log.warning(msg);
d199 10
a208 10
//                TODO: use MailingListConf as below
//                try {
//                    MailingListConf mlc
//                        = new MailingListConf(project);
//                    listTypesRaw = mlc.getListTypes();
//                } catch (Exception e) {
//                    log.debug("unable to get a dummy mailing list");
//                    log.exception(e);
//                    throw new HandlerException("unable to get list types");
//                }
d213 1
a213 1
            log.exception(e);
d215 1
a215 1
            if (debug) log.warning(msg);
d232 1
a232 1
            log.debug("list type: "+lType);
@


1.8
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@a61 2
import com.workingdogs.village.DataSetException;

d66 4
a71 3
import org.tigris.helm.project.Project;
import org.tigris.helm.domain.Domain;
import org.tigris.helm.database.MailingListManager;
d80 1
a80 1
 * @@version $Id: MailingListAdd.java,v 1.4 2000/11/29 01:44:22 edk Exp $
a98 3
        MailingListManager mlMgr = (MailingListManager)
            dMgr.getManager ("org.tigris.helm.database.MailingListManager");

d157 3
a159 3
                    mList = new MailingList(connection, dMgr, list, 
                                            description, project.getID(),
                                            type);
d167 1
a167 2
                    AccessControlList acl = getACL(context, connection);
                    mList.create(acl);
d188 6
a193 9
        if (mList == null) {
            try {
                mList = new MailingList(connection, dMgr, "dummy",
                        "dummy mailing list", project.getID(), "custom");
            } catch (Exception e) {
                log.debug("unable to get a dummy mailing list");
                log.exception(e);
                throw new HandlerException("unable to get dummy list for " +
                        "list types");
d195 20
a216 1
        List listTypesRaw = mList.getListTypes();
@


1.8.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.8 2001/01/26 18:29:11 edk Exp $
@


1.8.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
@d62 2
a67 4
import org.tigris.helm.om.User;
import org.tigris.helm.om.Domain;
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
d70 3
d100 3
d161 3
a163 3
                    User loginUser = getLoginUser(context);
                    mList = MailingList.add(loginUser.getACL(), project,
                            list, description, type);
d171 2
a172 1
                    mList.save(loginUser.getACL());
d193 9
a201 6
        List listTypesRaw = null;
        try
        {
            if (mList != null)
            {
                listTypesRaw = mList.getListTypes();
a202 20
            else
            {
//                TODO: use MailingListConf as below
//                try {
//                    MailingListConf mlc
//                        = new MailingListConf(project);
//                    listTypesRaw = mlc.getListTypes();
//                } catch (Exception e) {
//                    log.debug("unable to get a dummy mailing list");
//                    log.exception(e);
//                    throw new HandlerException("unable to get list types");
//                }
            }
        }
        catch (Exception e)
        {
            log.exception(e);
            String msg = e.getMessage();
            if (debug) log.warning(msg);
            redirectToError(context, msg);
d205 1
@


1.7
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
@d72 1
a72 1
import org.tigris.helm.database.DBException;
d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.6 2001/01/25 02:42:47 edk Exp $
d100 3
d105 1
a105 7
        try {
            context.put("domain", domain.getName());
        } catch (DBException e) {
            log.exception(e);
            if (debug) log.info("unable to get domain name: " + e.getMessage());
            context.put("domain", "");
        }
d161 1
a161 1
                    mList = new MailingList(dMgr, list, 
d195 1
a195 1
                mList = new MailingList(dMgr, "dummy",
@


1.6
log
@more changes to match the new pattern
@
text
@d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.5 2001/01/25 00:26:08 edk Exp $
@


1.5
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
@d72 1
a72 1
import org.tigris.helm.database.MailingListManager;
d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.4 2000/11/29 01:44:22 edk Exp $
a99 3
        MailingListManager mlMgr = (MailingListManager)
            dMgr.getManager ("org.tigris.helm.database.MailingListManager");

d102 7
a108 1
        context.put("domain", domain.getName());
@


1.4
log
@clean error messages if the mailing list already exists
@
text
@d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.3 2000/11/22 00:36:08 edk Exp $
d161 1
a161 1
                    mList = new MailingList(connection, dMgr, list, 
d195 1
a195 1
                mList = new MailingList(connection, dMgr, "dummy",
@


1.3
log
@handle trailer checkbox
@
text
@d74 1
d81 1
a81 1
 * @@version $Id: MailingListAdd.java,v 1.2 2000/11/13 19:45:21 edk Exp $
d180 2
@


1.2
log
@updates from last night: use ArrayList instead of String[]'s; and correct
Util's prefix pattern
@
text
@d80 1
a80 1
 * @@version $Id: MailingListAdd.java,v 1.7 2000/11/13 16:47:36 edk Exp $
d122 6
d165 1
a165 1
                    if (prefix != null)
d167 3
d219 1
@


1.1
log
@Initial revision
@
text
@d80 1
a80 1
 * @@version $Id: MailingListAdd.java,v 1.6 2000/11/11 11:57:00 edk Exp $
d147 1
a147 1
            String subscribers[] = Util.parseEmailList(subscribersRaw,
d149 1
a149 1
            String moderators[] = Util.parseEmailList(moderatorsRaw,
d163 1
a163 1
                    if (subscribers.length > 0)
d166 1
a166 1
                    if (moderators.length > 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
@d62 2
a67 4
import org.tigris.helm.om.User;
import org.tigris.helm.om.Domain;
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.Project;
d70 3
a73 1
import org.tigris.helm.AlreadyExists;
d80 1
a80 1
 * @@version $Id: MailingListAdd.java,v 1.8.2.2 2001/02/20 09:49:21 edk Exp $
d99 3
a121 6
        Boolean trailerChecked = new Boolean(false);

        trailerChecked = new Boolean( !
                Util.readFormInput(context, "trailer", null, false,
                    missingFields, validationErrors)
                .equals(""));
d147 1
a147 1
            ArrayList subscribers = Util.parseEmailList(subscribersRaw,
d149 1
a149 1
            ArrayList moderators = Util.parseEmailList(moderatorsRaw,
d154 3
a156 3
                    User loginUser = getLoginUser(context);
                    mList = MailingList.add(loginUser.getACL(), project,
                            list, description, type);
d159 1
a159 1
                    if ( ! prefix.equals(""))
d161 3
a163 5

                    mList.setBooleanOption("trailer", trailerChecked);

                    mList.save(loginUser.getACL());
                    if (subscribers.size() > 0)
d166 1
a166 1
                    if (moderators.size() > 0)
a169 2
                } catch (AlreadyExists e) {
                    appendToMessage(context, e.getMessage());
d181 9
a189 19
        List listTypesRaw = null;
        try
        {
            if (mList != null)
            {
                listTypesRaw = mList.getListTypes();
            }
            else
            {
//                TODO: use MailingListConf as below
//                try {
//                    MailingListConf mlc
//                        = new MailingListConf(project);
//                    listTypesRaw = mlc.getListTypes();
//                } catch (Exception e) {
//                    log.debug("unable to get a dummy mailing list");
//                    log.exception(e);
//                    throw new HandlerException("unable to get list types");
//                }
a191 7
        catch (Exception e)
        {
            log.exception(e);
            String msg = e.getMessage();
            if (debug) log.warning(msg);
            redirectToError(context, msg);
        }
d193 1
a209 1
        context.put("trailerChecked", trailerChecked);
@

