head	1.30;
access;
symbols
	TIGRIS_1_1_0RC2:1.23
	TIGRIS_1_1_0RC1:1.23
	TIGRIS_1_1:1.23.0.4
	TIGRIS_1_0_8:1.23
	TIGRIS_1_0_8RC3:1.23
	TIGRIS_1_0_8RC2:1.23
	TIGRIS_1_0_8RC1:1.23
	TIGRIS_1_0_7:1.23
	TIGRIS_1_0_7RC3:1.23
	TIGRIS_1_0_7RC2:1.23
	TIGRIS_1_0_7RC1:1.23
	TIGRIS_1_0_6:1.23
	TIGRIS_1_0_6RC5:1.23
	TIGRIS_1_0_6RC4:1.23
	TIGRIS_1_0_6RC3:1.23
	TIGRIS_1_0_6RC2:1.23
	TIGRIS_1_0_6RC1:1.23
	TIGRIS_1_0_5:1.23
	TIGRIS_1_0_5RC6:1.23
	TIGRIS_1_0_5RC5:1.23
	TIGRIS_1_0_5RC4:1.23
	TIGRIS_1_0_5RC3:1.23
	TIGRIS_1_0_5RC2:1.23
	TIGRIS_1_0_5RC1:1.23
	TIGRIS_1_0_4:1.23
	TIGRIS_1_0_3:1.23
	TIGRIS_1_0_2:1.23
	TIGRIS_1_0_1:1.23
	TIGRIS_1_0:1.23.0.6
	TIGRIS_1_0_0:1.23
	TIGRIS_1_0_0_RC1:1.23.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.16
	TIGRIS_0_9_2_3:1.16
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.20
	TIGRIS_0_9_2_1:1.20
	TIGRIS_0_9_2:1.16.0.2
	TIGRIS_0_9_0:1.15.0.4
	TIGRIS_0_8_4:1.15.0.2;
locks; strict;
comment	@# @;


1.30
date	2001.07.23.23.58.55;	author leonardr;	state dead;
branches;
next	1.29;

1.29
date	2001.07.19.00.50.54;	author dlr;	state Exp;
branches;
next	1.28;

1.28
date	2001.07.18.10.05.12;	author dlr;	state Exp;
branches;
next	1.27;

1.27
date	2001.07.17.17.55.45;	author leonardr;	state Exp;
branches;
next	1.26;

1.26
date	2001.05.23.01.50.09;	author dlr;	state Exp;
branches;
next	1.25;

1.25
date	2001.05.01.23.24.39;	author dlr;	state Exp;
branches;
next	1.24;

1.24
date	2001.04.12.20.39.22;	author elicia;	state Exp;
branches;
next	1.23;

1.23
date	2001.03.07.01.53.20;	author lucas;	state Exp;
branches;
next	1.22;

1.22
date	2001.03.02.23.26.19;	author ms;	state Exp;
branches;
next	1.21;

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

1.20
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.20.2.1;
next	1.19;

1.19
date	2001.01.26.05.24.05;	author edk;	state dead;
branches;
next	1.18;

1.18
date	2001.01.25.02.52.28;	author ms;	state Exp;
branches;
next	1.17;

1.17
date	2001.01.24.21.41.49;	author leonardr;	state Exp;
branches;
next	1.16;

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

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

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

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

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

1.11
date	2000.11.27.22.59.41;	author dlr;	state Exp;
branches;
next	1.10;

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

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

1.8
date	2000.11.27.20.04.12;	author dlr;	state Exp;
branches;
next	1.7;

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

1.6
date	2000.11.23.09.49.49;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2000.11.23.09.24.52;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.23.09.24.16;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.15.18.49.19;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.14.22.49.28;	author elicia;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.13.21.27.44;	author edk;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2001.02.21.00.32.11;	author dlr;	state Exp;
branches;
next	;

1.20.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	1.20.2.2;

1.20.2.2
date	2001.02.08.01.57.58;	author dlr;	state Exp;
branches;
next	1.20.2.3;

1.20.2.3
date	2001.02.15.20.50.35;	author leonardr;	state Exp;
branches;
next	1.20.2.4;

1.20.2.4
date	2001.02.16.03.01.26;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.30
log
@Got rid of ugly multi-page project add in favor of lovely single-page project add. Those adjectives are not subjective in any way.
@
text
@/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  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 COLLABNET 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 CollabNet.
 */


package org.tigris.helm.domain;

import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

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

import org.apache.velocity.context.Context;

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.security.*;
import org.tigris.helm.tool.*;

/**
 * People to invite to join a new project.
 *
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: ProjectAddStep3.java,v 1.29 2001/07/19 00:50:54 dlr Exp $
 */
public class ProjectAddStep3 extends ProjectAdd
{
    /**
     * Collection project invitation information for the new project.
     */
    protected String processRequest(Context context)
        throws TurbineException, RedirectException
    {
        String templateName = super.processRequest(context);
    
        try
        {
            User loginUser = getLoginUser(context);
            String action = getAction(context);

            Log.debug("userID=" + loginUser.getID());
            Log.debug("action=" + action);

            HttpSession session = getSessionManager(context).getSession();
            List missingFields = new ArrayList();
            ContextAPI.processField(context, PROJECT_NAME, session);
            String inviteEmailAddrs = ContextAPI.processField
                (context, INVITE_EMAIL_ADDRS, session);
            String inviteMessage = ContextAPI.processField
                (context, INVITATION, session);
            boolean isInviting = 
                (haveValue(inviteEmailAddrs) || haveValue(inviteMessage));
            session.putValue(IS_INVITING,
                             isInviting ? Boolean.TRUE : Boolean.FALSE);
            Log.debug("isInviting=" + isInviting);

            // If values are filled in for either field, require the other.
            if (isInviting)
            {
                ContextAPI.requireValue(context, inviteEmailAddrs,
                                        "List of email addresses");
                ContextAPI.requireValue(context, inviteMessage, 
                                        "Invitation message");
         
                if (TagValidator.containsHTML(inviteMessage))
                {
                    context.put(INVITATION, 
                            TagValidator.escapeHTML(inviteMessage));
                    ContextAPI.addValidationError
                        (context, "No HTML or JavaScript allowed in invitation");
                }
  
                // Check for invalid email addresses
                StringTokenizer tok = new StringTokenizer
                   (inviteEmailAddrs, myProperties.
                   getProperty("recipientSeparators"));
                while (tok.hasMoreTokens())
                {
                    String email = tok.nextToken();
                    if (!DataValidator.isValidEmail(email))
                        ContextAPI.addValidationError
                            (context, "Email is not valid: " + email);
                }
            }

            if (action != null && action.equals(FINISH))
            {
                if (isInviting)
                {
                    if (ContextAPI.isValidUserInput(context))
                    {
                        // Store the information for sending the invitation.
                        session.putValue(INVITE_EMAIL_ADDRS, inviteEmailAddrs);
                        session.putValue(INVITATION, inviteMessage);
                        redirectToNextStep(context);
                    }
                }
                else
                {
                    redirectToNextStep(context);
                }
            }
            else if (action != null && action.equals(PREV_STEP))
            {
                redirectToPreviousStep(context);
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            Log.error(e);
            appendToError(context, e.getMessage());
        }
    
        return templateName;
    }
}
@


1.29
log
@Removed Joist dependancies.
@
text
@d70 1
a70 1
 * @@version $Id: ProjectAddStep3.java,v 1.28 2001/07/18 10:05:12 dlr Exp $
@


1.28
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a59 4
import org.joist.util.TagValidator;
import org.tigris.helm.security.RedirectException;


d70 1
a70 1
 * @@version $Id: ProjectAddStep3.java,v 1.27 2001/07/17 17:55:45 leonardr Exp $
@


1.27
log
@Porting of domain package to new error handling API.
@
text
@d61 1
a61 1
import org.joist.security.RedirectException;
d74 1
a74 1
 * @@version $Id: ProjectAddStep3.java,v 1.26 2001/05/23 01:50:09 dlr Exp $
@


1.26
log
@Ported Helm from WebMacro to Velocity.
@
text
@a56 1
import org.apache.turbine.util.TurbineException;
d74 1
a74 1
 * @@version $Id: ProjectAddStep3.java,v 1.25 2001/05/01 23:24:39 dlr Exp $
d81 1
a81 1
    protected String processRequest(Context ctx)
d84 1
a84 1
        String templateName = super.processRequest(ctx);
d88 2
a89 2
            User loginUser = getLoginUser(ctx);
            String action = getAction(ctx);
d94 1
a94 1
            HttpSession session = getSessionManager(ctx).getSession();
d96 5
a100 4
            processField(ctx, PROJECT_NAME, session);
            String inviteEmailAddrs = processField(ctx, INVITE_EMAIL_ADDRS,
                                                   session);
            String inviteMessage = processField(ctx, INVITATION, session);
a106 1
            List validationErrors = new ArrayList();
d110 4
a113 4
                requireValue(inviteEmailAddrs, "List of email addresses", 
                             missingFields);
                requireValue(inviteMessage, "Invitation message", 
                             missingFields);
d117 1
a117 1
                    ctx.put(INVITATION, 
d119 2
a120 2
                    validationErrors.add
                        ("No HTML or JavaScript allowed in invitation");
d131 2
a132 1
                        validationErrors.add("Email is not valid: " + email);
a135 1

d140 1
a140 1
                    if (isValidUserInput(missingFields, validationErrors))
d145 1
a145 6
                        redirectToNextStep(ctx);
                    }
                    else
                    {
                        reportInvalidUserInput(ctx, missingFields,
                                               validationErrors);
d150 1
a150 1
                    redirectToNextStep(ctx);
d155 1
a155 1
                redirectToPreviousStep(ctx);
d165 1
a165 1
            appendToError(ctx, e.getMessage());
@


1.25
log
@Validation errors should say why an error occurred, rather than what
happened.
@
text
@d56 2
d59 1
a59 1
import org.webmacro.servlet.*;
d75 1
a75 1
 * @@version $Id: ProjectAddStep3.java,v 1.24 2001/04/12 20:39:22 elicia Exp $
d82 2
a83 2
    protected String processRequest (Connection conn, WebContext ctx)
        throws HandlerException, RedirectException
d85 1
a85 1
        String templateName = super.processRequest(conn, ctx);
@


1.24
log
@added check for invalid email addresses when inviting people to a project
@
text
@d73 1
a73 1
 * @@version $Id: ProjectAddStep3.java,v 1.23 2001/03/07 01:53:20 lucas Exp $
d118 2
a119 1
                    validationErrors.add("HTML or Javascript in Invitation");
@


1.23
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d66 1
a66 1
//import org.tigris.helm.tool.Invitation;
d73 1
a73 1
 * @@version $Id: ProjectAddStep3.java,v 1.22 2001/03/02 23:26:19 ms Exp $
d120 11
a131 1

@


1.22
log
@check invite message for html or javascript
@
text
@a64 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d73 1
a73 1
 * @@version $Id: ProjectAddStep3.java,v 1.21 2001/02/21 01:08:21 dlr Exp $
@


1.21
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d59 1
d75 1
a75 1
 * @@version $Id: ProjectAddStep3.java,v 1.20.2.4 2001/02/16 03:01:26 dlr Exp $
d107 1
d115 7
d124 2
d130 1
a130 1
                    if (isValidUserInput(missingFields, null))
d139 2
a140 1
                        reportInvalidUserInput(ctx, missingFields, null);
@


1.20
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d17 1
a17 1
 * software developed by Collab.Net (http://www.Collab.Net/)."
d32 1
a32 1
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d55 2
a56 1
import org.webmacro.util.Log;
d59 1
a59 2
import org.joist.*;
import org.joist.util.*;
a60 5
import com.workingdogs.village.*;

import org.joist.security.RedirectException;
import org.joist.database.DataManager;
import org.joist.database.UserManager;
d62 6
a67 5
import org.tigris.helm.security.AccessControlList;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.database.ProjectManager;
import org.tigris.helm.tool.Invitation;
import org.tigris.helm.project.Project;
d70 1
a70 1
 * Invite people to join a new project.
d74 1
a74 1
 * @@version $Id: ProjectAddStep3.java,v 1.16 2001/01/08 23:25:02 dlr Exp $
a77 12
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.16 2001/01/08 23:25:02 dlr Exp $";

    /**
     * Open the log file.
     */
    private static Log log = new Log("projAdd3", "ProjectAddStep3");

    /**
     * Whether to log debugging information.
     */
    private static boolean debug = true;

a83 1
        if (debug) log.info("started");
a87 1
            if (debug) log.debug("Checking inputs and adding to context");
d91 2
a92 5
            if (debug)
            {
                log.info("userID=" + loginUser.getID());
                log.info("action=" + action);
            }
d104 1
a104 1
            if (debug) log.info("isInviting=" + isInviting);
d147 2
a148 4
            log.exception(e);
            String msg = e.getMessage();
            appendToMessage(ctx, msg);
            throw new HandlerException(msg);
@


1.20.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.20 2001/01/26 18:29:02 edk Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.20 2001/01/26 18:29:02 edk Exp $";
@


1.20.2.2
log
@People to invite to join a new project.
@
text
@d17 1
a17 1
 * software developed by Collab.Net (http://www.collab.net/)."
d32 1
a32 1
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d55 5
a59 1
import org.apache.turbine.util.Log;
d61 1
a61 1
import org.webmacro.servlet.*;
d64 2
d67 5
a71 6

import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.security.*;
//import org.tigris.helm.tool.Invitation;
d74 1
a74 1
 * People to invite to join a new project.
d82 12
d100 1
d105 1
d109 5
a113 2
            Log.debug("userID=" + loginUser.getID());
            Log.debug("action=" + action);
d125 1
a125 1
            Log.debug("isInviting=" + isInviting);
d168 4
a171 2
            Log.error(e);
            appendToError(ctx, e.getMessage());
@


1.20.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d73 1
a73 1
 * @@version $Id: ProjectAddStep3.java,v 1.20.2.2 2001/02/08 01:57:58 dlr Exp $
@


1.20.2.4
log
@Added new imports necessitated by Torque.
@
text
@a64 1
import org.tigris.helm.om.base.*;
d73 1
a73 1
 * @@version $Id: ProjectAddStep3.java,v 1.20.2.3 2001/02/15 20:50:35 leonardr Exp $
@


1.19
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
@d65 1
a65 1
import org.tigris.helm.database.UserManager;
d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.18 2001/01/25 02:52:28 ms Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.18 2001/01/25 02:52:28 ms Exp $";
a116 1
	    List validationErrors = new ArrayList();
d122 1
a122 6
                (haveValue(inviteEmailAddrs) && !haveValue(inviteMessage) ||
		 haveValue(inviteEmailAddrs) &&  haveValue(inviteMessage));
	    if (!haveValue(inviteEmailAddrs) && haveValue(inviteMessage))
	    {
		isInviting = true;
	    }
d134 1
d136 1
a136 8
		if (TagValidator.containsHTML(inviteMessage))
		{
		    ctx.put(INVITATION, TagValidator.escapeHTML(inviteMessage));
		    validationErrors.add("HTML or Javascript in Invitation");
		}
	    }
	    log.info("# of errors = " + validationErrors.size());	    
	    if (action != null && action.equals(FINISH))
d140 1
a140 1
                    if (isValidUserInput(missingFields, validationErrors))
d149 1
a149 1
                        reportInvalidUserInput(ctx, missingFields, validationErrors);
@


1.18
log
@Integrated TagValidator with the form-input in the servlets so that when a
form says "no html here" it actually checks the input for html, and if it allows HTML then checks it for some releative sanity.
These changes require you to update joist also for changes in TagValidator.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.17 2001/01/24 21:41:49 leonardr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.17 2001/01/24 21:41:49 leonardr Exp $";
@


1.17
log
@Ported UserManager and RoleManager to Helm. Started moving other TableManagers toward a grab-connection-on-demand model. Massive breakage ensues. dlr and I are working on it.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.16 2001/01/08 23:25:02 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.16 2001/01/08 23:25:02 dlr Exp $";
d117 1
d123 6
a128 1
                (haveValue(inviteEmailAddrs) || haveValue(inviteMessage));
a139 1
            }
d141 8
a148 1
            if (action != null && action.equals(FINISH))
d152 1
a152 1
                    if (isValidUserInput(missingFields, null))
d161 1
a161 1
                        reportInvalidUserInput(ctx, missingFields, null);
@


1.16
log
@Corrected a bunch of regressions to previous User instantion method.  Deprecated User's getUserID() method in favor of getID() for better conformance with BusinessObject interface and orthoginality with other business objects.  Added a guest user and interface.  Added some JavaDoc to User.
@
text
@d65 1
a65 1
import org.joist.database.UserManager;
d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.15 2000/11/29 07:56:30 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.15 2000/11/29 07:56:30 dlr Exp $";
@


1.15
log
@Actually, no need to create new objects here.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.14 2000/11/29 07:54:59 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.14 2000/11/29 07:54:59 dlr Exp $";
d111 1
a111 1
                log.info("userID=" + loginUser.getUserID());
@


1.14
log
@Add IS_INVITING to the session, not the context.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.13 2000/11/28 23:12:06 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.13 2000/11/28 23:12:06 dlr Exp $";
d123 2
a124 1
            session.putValue(IS_INVITING, new Boolean(isInviting));
@


1.13
log
@Changed next step action as per IZ #1340.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.12 2000/11/28 22:47:38 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.12 2000/11/28 22:47:38 dlr Exp $";
d123 1
a123 1
            addBooleanToContext(ctx, IS_INVITING, isInviting);
@


1.12
log
@Addition of actions to context now handled by super-class.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.11 2000/11/27 22:59:41 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.11 2000/11/27 22:59:41 dlr Exp $";
d135 1
a135 1
            if (action != null && action.equals(NEXT_STEP))
@


1.11
log
@Fixes and default settings for steps 2 and 3.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.10 2000/11/27 21:15:35 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.10 2000/11/27 21:15:35 dlr Exp $";
a159 3

            // Displaying the page.
            ctx.put("nextStep", NEXT_STEP);
@


1.10
log
@Back button support for steps 2 and 3.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.9 2000/11/27 20:46:07 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.9 2000/11/27 20:46:07 dlr Exp $";
d95 1
a95 1
     * Display and process the project addition request, step 2.
d117 1
@


1.9
log
@Corrected build errors.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.8 2000/11/27 20:04:12 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.8 2000/11/27 20:04:12 dlr Exp $";
a135 1
                String nextStepURL = myProperties.getProperty("nextStep");
d154 4
@


1.8
log
@Modifications to make project addition more wizard-like...small breakage on this commit, will fix immediatly.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.7 2000/11/23 09:55:51 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.7 2000/11/23 09:55:51 dlr Exp $";
d115 1
a115 1
            HttpSession session = ctx.getRequest().getSession();
d117 2
a118 2
            String inviteEmails = processField(ctx, INVITE_EMAIL_ADDRS,
                                               session);
d121 2
a122 1
                (haveValue(inviteEmails) || haveValue(inviteMessage));
d128 1
a128 1
                requireValue(inviteEmails, "List of email addresses", 
d160 1
a160 1
        catch (RedirectURLException e)
@


1.7
log
@Make use of a local var when processing the invitation action.
@
text
@d55 1
a55 1
import org.webmacro.util.*;
a59 1
import org.joist.session.*;
d78 1
a78 1
 * @@version $Id: ProjectAddStep3.java,v 1.6 2000/11/23 09:49:49 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.6 2000/11/23 09:49:49 dlr Exp $";
d115 1
d117 3
a119 2
            String inviteEmails = processField(ctx, "inviteEmails");
            String inviteMessage = processField(ctx, "inviteMessage");
a132 3
            Project project = getCurrentProject(ctx);
            ctx.put("project", project);

d140 4
a143 12
                        // Send the invitation.
                        Domain domain = getCurrentDomain(ctx);
                        DataManager dMgr = getDataManager(ctx);
                        Invitation.sendInvitations(conn,
                                                   dMgr,
                                                   domain,
                                                   getRecipients(inviteEmails),
                                                   loginUser,
                                                   project,
                                                   inviteMessage);

                        redirectTo(nextStepURL);
d152 1
a152 1
                    redirectTo(nextStepURL);
d159 1
a159 1
        catch (RedirectException e)
d166 1
a166 1
            String msg = "Could not send invitation: " + e.getMessage();
a170 1
        if (debug) log.debug("done");
a171 18
    }

    /**
     * Parse the recipients from the provided address list text.
     *
     * @@param addresses The data to parse.
     * @@return          The recipients.
     */
    private ArrayList getRecipients (String addresses)
    {
        ArrayList recipients = new ArrayList(); 
        StringTokenizer tok = new StringTokenizer
            (addresses, myProperties.getProperty("recipientSeparators"));
        while (tok.hasMoreTokens())
        {
            recipients.add(tok.nextToken());
        }
        return recipients;
@


1.6
log
@- ACTION --> NEXT_STEP
- Different context key for NEXT_STEP action.
- context --> ctx
@
text
@d75 1
a75 1
 * The second step in adding a new project.  Invite people to join.
d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.5 2000/11/23 09:24:52 dlr Exp $
d83 1
a83 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.5 2000/11/23 09:24:52 dlr Exp $";
d137 1
d153 1
a153 1
                        redirectTo(myProperties.getProperty("nextStep"));
d162 1
a162 1
                    redirectTo(myProperties.getProperty("nextStep"));
@


1.5
log
@Use newish getAction() method.
@
text
@d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.4 2000/11/23 09:24:16 dlr Exp $
d83 1
a83 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.4 2000/11/23 09:24:16 dlr Exp $";
d98 1
a98 1
    protected String processRequest (Connection conn, WebContext context)
d102 1
a102 1
        String templateName = super.processRequest(conn, context);
d107 1
a107 1
            User loginUser = getLoginUser(context);
d117 2
a118 2
            String inviteEmails = processField(context, "inviteEmails");
            String inviteMessage = processField(context, "inviteMessage");
d132 2
a133 2
            Project project = getCurrentProject(context);
            context.put("project", project);
d135 1
a135 1
            if (action != null && action.equals(ACTION))
d142 2
a143 2
                        Domain domain = getCurrentDomain(context);
                        DataManager dMgr = getDataManager(context);
d156 1
a156 1
                        reportInvalidUserInput(context, missingFields, null);
d166 1
a166 1
            context.put("action", ACTION);
d176 1
a176 1
            appendToMessage(context, msg);
@


1.4
log
@Made use of super class.
@
text
@d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.3 2000/11/15 18:49:19 dlr Exp $
d83 1
a83 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.3 2000/11/15 18:49:19 dlr Exp $";
d108 1
a108 1
            String action = (String)context.get("action");
@


1.3
log
@indented as w/ the rest of the file
@
text
@d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.2 2000/11/14 22:49:28 elicia Exp $
d81 1
a81 1
public class ProjectAddStep3 extends HelmServlet
d83 1
a83 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.2 2000/11/14 22:49:28 elicia Exp $";
d88 1
a88 1
    private static Log log = new Log("sspa3", "ProjectAddStep3");
a95 5
     * The value for the action CGI query parameter.
     */
    private static final String ACTION = "Next Step";

    /**
d101 1
a101 1
        if (debug) log.debug("started");
@


1.2
log
@broke up ProjectAdd into ProjectAdd and ProjectAddStep2.  Renamed later steps. Removed Member Policy field.
@
text
@d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.1 2000/11/13 21:27:44 edk Exp $
d83 1
a83 1
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.1 2000/11/13 21:27:44 edk Exp $";
d150 6
a155 6
                                dMgr,
                                domain,
                                getRecipients(inviteEmails),
                                loginUser,
                                project,
                                inviteMessage);
@


1.1
log
@SelfServeProjectAddStep([23]) => ProjectAddStep$1
@
text
@d47 1
d50 1
d53 1
d58 6
a63 1
import org.tigris.helm.security.HelmServlet;
d66 7
d75 1
a75 2
 * The third step in adding a new project.  Mostly just a confirmation for the 
 * user.
d77 1
d79 1
a79 1
 * @@version $Id: ProjectAddStep3.java,v 1.1.1.1 2000/11/12 21:15:35 dlr Exp $
d83 2
a84 2
    public static final  String versionID = "$Id: ProjectAddStep3.java,v 1.1.1.1 2000/11/12 21:15:35 dlr Exp $";
        
d93 6
a98 1
    private static final boolean debug = true;
d101 1
a101 1
     * Show the project approval message.
d106 1
d108 78
a185 1
        context.put("approvalTime", getApprovalTime());
d190 1
a190 2
     * Returns a description of the amount of time which approval usually 
     * takes.
d192 2
a193 1
     * @@return The amount of time which approval usually takes.
d195 1
a195 1
    private final String getApprovalTime ()
d197 8
a204 1
        return myProperties.getProperty("approvalTime");
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d17 1
a17 1
 * software developed by Collab.Net (http://www.collab.net/)."
d32 1
a32 1
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
a46 1

a48 1
import java.util.*;
a50 3
import javax.servlet.http.*;

import org.apache.turbine.util.Log;
d52 1
d55 1
d57 1
a57 8


import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
import org.tigris.helm.security.*;
//import org.tigris.helm.tool.Invitation;
d60 2
a61 1
 * People to invite to join a new project.
a62 1
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
d64 1
a64 1
 * @@version $Id: ProjectAddStep3.java,v 1.20.2.4 2001/02/16 03:01:26 dlr Exp $
d66 1
a66 1
public class ProjectAddStep3 extends ProjectAdd
d68 7
d76 1
a76 1
     * Collection project invitation information for the new project.
d78 6
a83 1
    protected String processRequest (Connection conn, WebContext ctx)
d86 2
a87 67
        String templateName = super.processRequest(conn, ctx);
    
        try
        {
            User loginUser = getLoginUser(ctx);
            String action = getAction(ctx);

            Log.debug("userID=" + loginUser.getID());
            Log.debug("action=" + action);

            HttpSession session = getSessionManager(ctx).getSession();
            List missingFields = new ArrayList();
            processField(ctx, PROJECT_NAME, session);
            String inviteEmailAddrs = processField(ctx, INVITE_EMAIL_ADDRS,
                                                   session);
            String inviteMessage = processField(ctx, INVITATION, session);
            boolean isInviting = 
                (haveValue(inviteEmailAddrs) || haveValue(inviteMessage));
            session.putValue(IS_INVITING,
                             isInviting ? Boolean.TRUE : Boolean.FALSE);
            Log.debug("isInviting=" + isInviting);

            // If values are filled in for either field, require the other.
            if (isInviting)
            {
                requireValue(inviteEmailAddrs, "List of email addresses", 
                             missingFields);
                requireValue(inviteMessage, "Invitation message", 
                             missingFields);
            }

            if (action != null && action.equals(FINISH))
            {
                if (isInviting)
                {
                    if (isValidUserInput(missingFields, null))
                    {
                        // Store the information for sending the invitation.
                        session.putValue(INVITE_EMAIL_ADDRS, inviteEmailAddrs);
                        session.putValue(INVITATION, inviteMessage);
                        redirectToNextStep(ctx);
                    }
                    else
                    {
                        reportInvalidUserInput(ctx, missingFields, null);
                    }
                }
                else
                {
                    redirectToNextStep(ctx);
                }
            }
            else if (action != null && action.equals(PREV_STEP))
            {
                redirectToPreviousStep(ctx);
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            Log.error(e);
            appendToError(ctx, e.getMessage());
        }
    
d89 11
@


