head	1.18;
access;
symbols
	TIGRIS_1_1_0RC2:1.12
	TIGRIS_1_1_0RC1:1.12
	TIGRIS_1_1:1.12.0.4
	TIGRIS_1_0_8:1.12
	TIGRIS_1_0_8RC3:1.12
	TIGRIS_1_0_8RC2:1.12
	TIGRIS_1_0_8RC1:1.12
	TIGRIS_1_0_7:1.12
	TIGRIS_1_0_7RC3:1.12
	TIGRIS_1_0_7RC2:1.12
	TIGRIS_1_0_7RC1:1.12
	TIGRIS_1_0_6:1.12
	TIGRIS_1_0_6RC5:1.12
	TIGRIS_1_0_6RC4:1.12
	TIGRIS_1_0_6RC3:1.12
	TIGRIS_1_0_6RC2:1.12
	TIGRIS_1_0_6RC1:1.12
	TIGRIS_1_0_5:1.12
	TIGRIS_1_0_5RC6:1.12
	TIGRIS_1_0_5RC5:1.12
	TIGRIS_1_0_5RC4:1.12
	TIGRIS_1_0_5RC3:1.12
	TIGRIS_1_0_5RC2:1.12
	TIGRIS_1_0_5RC1:1.12
	TIGRIS_1_0_4:1.12
	TIGRIS_1_0_3:1.12
	TIGRIS_1_0_2:1.12
	TIGRIS_1_0_1:1.12
	TIGRIS_1_0:1.12.0.6
	TIGRIS_1_0_0:1.12
	TIGRIS_1_0_0_RC1:1.12.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.9
	TIGRIS_0_9_2_1:1.9
	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.18
date	2001.08.28.17.45.19;	author leonardr;	state Exp;
branches;
next	1.17;

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

1.16
date	2001.07.31.22.03.30;	author edk;	state Exp;
branches;
next	1.15;

1.15
date	2001.07.18.23.32.49;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2001.07.18.10.05.16;	author dlr;	state Exp;
branches;
next	1.13;

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

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

1.11
date	2001.03.07.01.53.28;	author lucas;	state Exp;
branches;
next	1.10;

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

1.9
date	2001.01.26.18.29.11;	author edk;	state Exp;
branches
	1.9.2.1;
next	1.8;

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

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

1.6
date	2001.01.25.02.20.45;	author lucas;	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.21.10.26;	author edk;	state Exp;
branches;
next	1.3;

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

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

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

1.9.2.1
date	2001.01.28.01.02.20;	author dlr;	state dead;
branches;
next	1.9.2.2;

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


desc
@@


1.18
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.util.ArrayList;
import java.util.Iterator;
import javax.servlet.ServletException;
import javax.servlet.http.*;

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

import org.apache.velocity.context.Context;

import gnu.regexp.RE;

import org.tigris.helm.security.RedirectException;
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.User;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.tool.ContextAPI;
import org.tigris.helm.tool.ListElement;
import org.tigris.helm.tool.mail.Util;

/**
 * Present a form for the editing of a mailing list
 *
 * @@author <a href="mailto:edk@@collab.net">Ed Korthof</a>
 * @@version $Id: MailingListEdit.java,v 1.17 2001/08/11 09:08:09 dlr Exp $
 */
public class MailingListEdit 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

        // TODO : use the ACL to determine permissions.  but for now:
        context.put("allowEdits", new Boolean(true));

        ArrayList missingFields = new ArrayList();
        ArrayList validationErrors = new ArrayList();

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

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

        MailingList mList = null;
        try {
            mList = MailingListPeer.getInstanceByName(project, list);
        } catch (Exception e) {
            throw new NestableException("Invalid mailing list", e);
        }
        if (mList == null || !mList.exists())
            redirectToError(context, "list " + list + " does not exist");

        // Determine which button was pushed
        String action = (String) context.get("action");
        String listType = mList.getType();

        if (action.equals("Make List Changes") && validationErrors.isEmpty()) {
            try
            {
                if (DEBUG)
                    Log.debug("Button=Make List Changes");

                String type = ContextAPI.getParameter(context, "type");
                if (type == null || type.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else {
                    mList.setType(type);
                }
                String trailerFlag = ContextAPI.getParameter
                    (context, "trailer");
                if (trailerFlag == null || trailerFlag.equals("")) {
                    mList.setBooleanOption("trailer", new Boolean(false));
                } else {
                    mList.setBooleanOption("trailer", new Boolean(true));
                }
                String privateFlag = ContextAPI.getParameter
                    (context, "private");
                if (privateFlag == null || privateFlag.equals("")) {
                    mList.setPrivate(false);
                } else {
                    mList.setPrivate(true);
                }
                String owner = ContextAPI.getParameter(context, "owner");
                if (owner == null || owner.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else if (!Util.emailRE.isMatch(owner)) {
                    validationErrors.add("Owner Email Address");
                } else {
                    mList.setStringOption("owner", owner);
                }
                String prefix = ContextAPI.getParameter(context, "prefix");
                if (prefix != null) {
                    mList.setStringOption("prefix", prefix);
                }
                String description = ContextAPI.getParameter
                    (context, "description");
                if (description != null && !description.equals("")) {
                    mList.setDescription(description);
                }
                AccessControlList acl = null;
                User loginUser = getLoginUser(context);
                if (DEBUG)
                    Log.debug("saving mList");
                mList.save(loginUser.getACL());
            }
            catch (Exception e)
            {
                Log.error(e);
                redirectToError(context, e.getMessage());
            }
        }

        try
        {
            Boolean trailerFlag = mList.getBooleanOption("trailer");
            if (trailerFlag.booleanValue()) {
                context.put("trailerChecked", " checked");
            } else {
                context.put("trailerChecked", "");
            }
            boolean privateFlag = mList.isPrivate();
            if (privateFlag) {
                context.put("privateChecked", "checked");
            } else {
                context.put("privateChecked", "");
            }
            String prefix = mList.getStringOption("prefix");
            if (prefix == null) prefix = "";
            context.put("prefix", prefix);

            String owner = mList.getStringOption("owner");
            if (owner == null) owner = "";
            context.put("owner", owner);
        }
        catch (Exception e)
        {
            Log.error(e);
            redirectToError(context, e.getMessage());
        }

        String type = null;
        try {
            String description = mList.getDescription();
            context.put("description", description);

            type = mList.getType();
            Iterator i = mList.getListTypes().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);
        } catch (NullPointerException e) {
            Log.error(e);
            if (DEBUG) Log.debug("unable to contact anzu? "+e.getMessage());
            redirectToError(context, "unable to contact anzu server");
        } catch (Exception e) {
            Log.error(e);
            if (DEBUG) Log.debug("Exception: "+e.getMessage());
            redirectToError(context, "internal error: "+e.getMessage());
        }

        if (DEBUG)
            Log.debug("step 3");
    
// FIXME : do this w/ anzu
//        if (Boolean.TRUE.equals(mList.privValue("digest"))) {
//            context.put ("digest_enabled", Boolean.TRUE);
//        }
//        if (Boolean.TRUE.equals(mList.privValue("message_moderation")) ||
//                Boolean.TRUE.equals(mList.privValue("sub_moderation"))) {
//            context.put("moderation_enabled", Boolean.TRUE);
//        }
    
        context.put("missingFields", missingFields);
        context.put("validationErrors", validationErrors);
    
        return templateName;
    }
}
@


1.17
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d69 1
d77 1
a77 1
 * @@version $Id: MailingListEdit.java,v 1.16 2001/07/31 22:03:30 edk Exp $
d102 1
a102 1
        String list = getParameter(context, "list");
d126 1
a126 1
                String type = getParameter(context, "type");
d132 2
a133 1
                String trailerFlag = getParameter(context, "trailer");
d139 2
a140 1
                String privateFlag = getParameter(context, "private");
d146 1
a146 1
                String owner = getParameter(context, "owner");
d154 1
a154 1
                String prefix = getParameter(context, "prefix");
d158 2
a159 1
                String description = getParameter(context, "description");
@


1.16
log
@remove dead comments
@
text
@d56 1
a56 1
import org.apache.turbine.util.TurbineException;
d76 1
a76 1
 * @@version $Id: MailingListEdit.java,v 1.15 2001/07/18 23:32:49 dlr Exp $
d86 1
a86 1
        throws TurbineException, RedirectException
d110 1
a110 1
            throw new TurbineException("Invalid mailing list", e);
@


1.15
log
@Removed Joist dependancies.
@
text
@d76 1
a76 1
 * @@version $Id: MailingListEdit.java,v 1.14 2001/07/18 10:05:16 dlr Exp $
a233 4
//        owner = mList.getOwner();
//        context.put("owner", owner != null ? owner : "");

// FIXME : do this w/ anzu
a241 17
        String level = getParameter(context, "level");
        // For now, we always specify the default options - getting
        // the currently-specified ones is a pain
        if ("Advanced".equals(level)) {
// FIXME : need to do this w/ anzu
//            context.put("options", mList.getPrivArray(
//                        MailingListSpec.DISPLAY_ADVANCED));
            context.put("alternate_level", "Simple");
        } else {
//            context.put("options", mList.getPrivArray(
//                        MailingListSpec.DISPLAY_BEGINER));
            context.put("alternate_level", "Advanced");
        }

//        if (DEBUG)
//            Log.debug("step 4 Options="+ mList.getPrivArray());

@


1.14
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a48 1
import org.tigris.helm.tool.mail.Util;
d52 1
a52 2

import javax.servlet.*;
a61 2
import org.joist.util.ListElement;
import org.joist.database.DataManager;
a62 1

d64 2
a65 1
import org.tigris.helm.om.MailingListPeer;import org.tigris.helm.om.Project;
d69 2
d76 1
a76 1
 * @@version $Id: MailingListEdit.java,v 1.13 2001/05/23 01:50:22 dlr Exp $
@


1.13
log
@Ported Helm from WebMacro to Velocity.
@
text
@d66 1
a66 1
import org.joist.security.RedirectException;
d78 1
a78 1
 * @@version $Id: MailingListEdit.java,v 1.12 2001/03/07 17:33:44 edk Exp $
@


1.12
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
@a50 7
import com.workingdogs.village.*;

import org.webmacro.util.*;
import org.webmacro.servlet.*;
import org.webmacro.engine.*;
import org.webmacro.broker.*;

d57 5
a61 1
import java.sql.*;
d78 1
a78 1
 * @@version $Id: MailingListEdit.java,v 1.11 2001/03/07 01:53:28 lucas Exp $
d81 1
a81 2
    static private Log log = new Log("pmlEdt", "MailingListEdit");
    static private boolean debug = true;
d87 2
a88 2
    protected String processRequest(Connection connection, WebContext context)
        throws HandlerException, RedirectException
d90 1
a90 1
        String templateName = super.processRequest(connection, context);
d103 1
a103 1
        String list = context.getForm("list");
d112 1
a112 3
            log.exception(e);
            if (debug) log.debug("unable to get MailingList" + e.getMessage());
            redirectToError(context, "invalid mailing list");
d124 2
a125 2
                if (debug)
                    log.debug("Button=Make List Changes");
d127 1
a127 1
                String type = context.getForm("type");
d133 1
a133 1
                String trailerFlag = context.getForm("trailer");
d139 1
a139 1
                String privateFlag = context.getForm("private");
d145 1
a145 1
                String owner = context.getForm("owner");
d153 1
a153 1
                String prefix = context.getForm("prefix");
d157 1
a157 1
                String description = context.getForm("description");
d163 2
a164 2
                if (debug)
                    log.debug("saving mList");
d169 1
a169 1
                log.exception(e);
d198 1
a198 1
            log.exception(e);
d219 1
a219 1
                log.debug("list type: "+lType);
d223 2
a224 2
            log.exception(e);
            if (debug) log.debug("unable to contact anzu? "+e.getMessage());
d227 2
a228 2
            log.exception(e);
            if (debug) log.debug("Exception: "+e.getMessage());
d232 2
a233 2
        if (debug)
            log.debug("step 3");
d248 1
a248 1
        String level = (String) context.getForm("level");
d262 2
a263 2
//        if (debug)
//            log.debug("step 4 Options="+ mList.getPrivArray());
d270 1
a270 2

} /* end class MailingListEdit */
@


1.11
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d81 1
a81 1
 * @@version $Id: MailingListEdit.java,v 1.10 2001/02/21 01:08:26 dlr Exp $
d98 1
a98 1
        context.put("allow_edits", new Boolean(true));
d139 2
a140 2
                String trailer = context.getForm("trailer");
                if (trailer == null || trailer.equals("")) {
d145 6
d169 2
d182 9
a190 3
            Boolean trailer = mList.getBooleanOption("trailer");
            if (trailer.booleanValue()) {
                context.put("trailer_checked", " checked");
d192 1
a192 1
                context.put("trailer_checked", "");
@


1.10
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d72 1
a72 2
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
d81 1
a81 1
 * @@version $Id: MailingListEdit.java,v 1.9.2.2 2001/02/20 09:49:21 edk Exp $
@


1.9
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d71 4
a75 2
import org.tigris.helm.database.MailingListManager;
import org.tigris.helm.project.Project;
d82 1
a82 1
 * @@version $Id: MailingListEdit.java,v 1.4 2000/11/29 21:10:26 edk Exp $
d115 1
a115 1
            mList = new MailingList(connection, dMgr, project.getID(), list);
d126 1
a126 8
        String listType;
        try {
            listType = mList.getType();
        } catch (DataSetException e) {
            log.exception(e);
            if (debug) log.debug("MailingListEdit unable to getType");
            throw new HandlerException(e.getMessage());
        }
d129 9
a137 8
            if (debug)
                log.debug("Button=Make List Changes");

            String type = context.getForm("type");
            if (type == null || type.equals("")) {
                // this is broken -- but we can ignore it for now
            } else {
                try {
a138 4
                } catch (DataSetException e) {
                    log.exception(e);
                    if (debug) log.debug("MailingListEdit setType failed");
                    throw new HandlerException(e.getMessage());
d140 20
a159 22
            }
            String trailer = context.getForm("trailer");
            if (trailer == null || trailer.equals("")) {
                mList.setBooleanOption("trailer", new Boolean(false));
            } else {
                mList.setBooleanOption("trailer", new Boolean(true));
            }
            String owner = context.getForm("owner");
            if (owner == null || owner.equals("")) {
                // this is broken -- but we can ignore it for now
            } else if (!Util.emailRE.isMatch(owner)) {
                validationErrors.add("Owner Email Address");
            } else {
                mList.setStringOption("owner", owner);
            }
            String prefix = context.getForm("prefix");
            if (prefix != null) {
                mList.setStringOption("prefix", prefix);
            }
            String description = context.getForm("description");
            if (description != null && !description.equals("")) {
                try {
a160 4
                } catch (DataSetException e) {
                    log.exception(e);
                    if (debug) log.debug("DataSetException : "+e);
                    throw new HandlerException("unable to setDescription");
d162 3
d166 2
a167 4
            AccessControlList acl = null;
            try {
                acl = getACL(context, connection);
            } catch (Exception e) {
d169 1
a169 1
                throw new HandlerException(e.getMessage());
a170 1
            mList.update(acl);
d173 20
a192 5
        Boolean trailer = mList.getBooleanOption("trailer");
        if (trailer.booleanValue()) {
            context.put("trailer_checked", " checked");
        } else {
            context.put("trailer_checked", "");
a193 8
        String prefix = mList.getStringOption("prefix");
        if (prefix == null) prefix = "";
        context.put("prefix", prefix);

        String owner = mList.getStringOption("owner");
        if (owner == null) owner = "";
        context.put("owner", owner);

a214 4
        } catch (DataSetException e) {
            log.exception(e);
            if (debug) log.debug("DataSetException: "+e.getMessage());
            redirectToError(context, "internal error: "+e.getMessage());
d219 4
@


1.9.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d80 1
a80 1
 * @@version $Id: MailingListEdit.java,v 1.9 2001/01/26 18:29:11 edk Exp $
@


1.9.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
@a70 4
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.User;
d72 2
d113 1
a113 1
            mList = MailingListPeer.getInstanceByName(project, list);
d124 8
a131 1
        String listType = mList.getType();
d134 8
a141 9
            try
            {
                if (debug)
                    log.debug("Button=Make List Changes");

                String type = context.getForm("type");
                if (type == null || type.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else {
d143 4
d148 22
a169 20
                String trailer = context.getForm("trailer");
                if (trailer == null || trailer.equals("")) {
                    mList.setBooleanOption("trailer", new Boolean(false));
                } else {
                    mList.setBooleanOption("trailer", new Boolean(true));
                }
                String owner = context.getForm("owner");
                if (owner == null || owner.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else if (!Util.emailRE.isMatch(owner)) {
                    validationErrors.add("Owner Email Address");
                } else {
                    mList.setStringOption("owner", owner);
                }
                String prefix = context.getForm("prefix");
                if (prefix != null) {
                    mList.setStringOption("prefix", prefix);
                }
                String description = context.getForm("description");
                if (description != null && !description.equals("")) {
d171 4
a175 3
                AccessControlList acl = null;
                User loginUser = getLoginUser(context);
                mList.save(loginUser.getACL());
d177 4
a180 2
            catch (Exception e)
            {
d182 1
a182 1
                redirectToError(context, e.getMessage());
d184 1
d187 5
a191 20
        try
        {
            Boolean trailer = mList.getBooleanOption("trailer");
            if (trailer.booleanValue()) {
                context.put("trailer_checked", " checked");
            } else {
                context.put("trailer_checked", "");
            }
            String prefix = mList.getStringOption("prefix");
            if (prefix == null) prefix = "";
            context.put("prefix", prefix);

            String owner = mList.getStringOption("owner");
            if (owner == null) owner = "";
            context.put("owner", owner);
        }
        catch (Exception e)
        {
            log.exception(e);
            redirectToError(context, e.getMessage());
d193 8
d222 4
a229 4
        } catch (Exception e) {
            log.exception(e);
            if (debug) log.debug("Exception: "+e.getMessage());
            redirectToError(context, "internal error: "+e.getMessage());
@


1.8
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;
d80 1
a80 1
 * @@version $Id: MailingListEdit.java,v 1.7 2001/01/25 02:42:47 edk Exp $
d113 1
a113 1
            mList = new MailingList(dMgr, project.getID(), list);
d127 1
a127 1
        } catch (DBException e) {
d143 1
a143 1
                } catch (DBException e) {
d171 1
a171 1
                } catch (DBException e) {
d173 1
a173 1
                    if (debug) log.debug("DBException : "+e);
d222 1
a222 1
        } catch (DBException e) {
d224 1
a224 1
            if (debug) log.debug("DBException: "+e.getMessage());
@


1.7
log
@more changes to match the new pattern
@
text
@d80 1
a80 1
 * @@version $Id: MailingListEdit.java,v 1.6 2001/01/25 02:20:45 lucas Exp $
@


1.6
log
@now using the DBException
@
text
@a71 1
import org.tigris.helm.database.MailingListManager;
d80 1
a80 1
 * @@version $Id: MailingListEdit.java,v 1.5 2001/01/25 00:26:08 edk Exp $
d173 1
a173 1
                    if (debug) log.debug("DataSetException : "+e);
d224 1
a224 1
            if (debug) log.debug("DataSetException: "+e.getMessage());
@


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
@d73 1
d81 1
a81 1
 * @@version $Id: MailingListEdit.java,v 1.4 2000/11/29 21:10:26 edk Exp $
d128 1
a128 1
        } catch (DataSetException e) {
d144 1
a144 1
                } catch (DataSetException e) {
d172 1
a172 1
                } catch (DataSetException e) {
d223 1
a223 1
        } catch (DataSetException e) {
@


1.4
log
@handle setting the type correctly when creating mailing lists.  this
involves changing the throws slightly ... hence the changes in
project/*Profile and project/Project  ... try to avoid unnecessary
additional exceptions when possible.
@
text
@d80 1
a80 1
 * @@version $Id: MailingListEdit.java,v 1.3 2000/11/17 06:15:47 edk Exp $
d113 1
a113 1
            mList = new MailingList(connection, dMgr, project.getID(), list);
@


1.3
log
@use the name of the submit button as seen in the template ...
@
text
@d68 2
a70 1
import org.joist.security.RedirectException;
a71 1

a73 1
import org.joist.database.DataManager;
d80 1
a80 1
 * @@version $Id: MailingListEdit.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
@d81 1
a81 1
 * @@version $Id: MailingListEdit.java,v 1.5 2000/11/11 11:57:00 edk Exp $
d134 1
a134 1
        if (action.equals("Make Changes") && validationErrors.isEmpty()) {
d136 1
a136 1
                log.debug("Button=Make Changes");
@


1.1
log
@Initial revision
@
text
@@


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
@d68 1
a68 1
import org.joist.database.DataManager;
d70 1
d72 3
a74 5
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.User;
import org.tigris.helm.security.HelmServlet;
d81 1
a81 1
 * @@version $Id: MailingListEdit.java,v 1.9.2.2 2001/02/20 09:49:21 edk Exp $
d114 1
a114 1
            mList = MailingListPeer.getInstanceByName(project, list);
d125 8
a132 1
        String listType = mList.getType();
d134 9
a142 10
        if (action.equals("Make List Changes") && validationErrors.isEmpty()) {
            try
            {
                if (debug)
                    log.debug("Button=Make List Changes");

                String type = context.getForm("type");
                if (type == null || type.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else {
d144 4
d149 22
a170 20
                String trailer = context.getForm("trailer");
                if (trailer == null || trailer.equals("")) {
                    mList.setBooleanOption("trailer", new Boolean(false));
                } else {
                    mList.setBooleanOption("trailer", new Boolean(true));
                }
                String owner = context.getForm("owner");
                if (owner == null || owner.equals("")) {
                    // this is broken -- but we can ignore it for now
                } else if (!Util.emailRE.isMatch(owner)) {
                    validationErrors.add("Owner Email Address");
                } else {
                    mList.setStringOption("owner", owner);
                }
                String prefix = context.getForm("prefix");
                if (prefix != null) {
                    mList.setStringOption("prefix", prefix);
                }
                String description = context.getForm("description");
                if (description != null && !description.equals("")) {
d172 4
a176 3
                AccessControlList acl = null;
                User loginUser = getLoginUser(context);
                mList.save(loginUser.getACL());
d178 4
a181 2
            catch (Exception e)
            {
d183 1
a183 1
                redirectToError(context, e.getMessage());
d185 1
d188 5
a192 20
        try
        {
            Boolean trailer = mList.getBooleanOption("trailer");
            if (trailer.booleanValue()) {
                context.put("trailer_checked", " checked");
            } else {
                context.put("trailer_checked", "");
            }
            String prefix = mList.getStringOption("prefix");
            if (prefix == null) prefix = "";
            context.put("prefix", prefix);

            String owner = mList.getStringOption("owner");
            if (owner == null) owner = "";
            context.put("owner", owner);
        }
        catch (Exception e)
        {
            log.exception(e);
            redirectToError(context, e.getMessage());
d194 8
d223 4
a230 4
        } catch (Exception e) {
            log.exception(e);
            if (debug) log.debug("Exception: "+e.getMessage());
            redirectToError(context, "internal error: "+e.getMessage());
@

