head	1.34;
access;
symbols
	TIGRIS_1_1_0RC2:1.27
	TIGRIS_1_1_0RC1:1.27
	TIGRIS_1_1:1.27.0.4
	TIGRIS_1_0_8:1.27
	TIGRIS_1_0_8RC3:1.27
	TIGRIS_1_0_8RC2:1.27
	TIGRIS_1_0_8RC1:1.27
	TIGRIS_1_0_7:1.27
	TIGRIS_1_0_7RC3:1.27
	TIGRIS_1_0_7RC2:1.27
	TIGRIS_1_0_7RC1:1.27
	TIGRIS_1_0_6:1.27
	TIGRIS_1_0_6RC5:1.27
	TIGRIS_1_0_6RC4:1.27
	TIGRIS_1_0_6RC3:1.27
	TIGRIS_1_0_6RC2:1.27
	TIGRIS_1_0_6RC1:1.27
	TIGRIS_1_0_5:1.27
	TIGRIS_1_0_5RC6:1.27
	TIGRIS_1_0_5RC5:1.27
	TIGRIS_1_0_5RC4:1.27
	TIGRIS_1_0_5RC3:1.27
	TIGRIS_1_0_5RC2:1.27
	TIGRIS_1_0_5RC1:1.27
	TIGRIS_1_0_4:1.27
	TIGRIS_1_0_3:1.27
	TIGRIS_1_0_2:1.27
	TIGRIS_1_0_1:1.27
	TIGRIS_1_0:1.27.0.6
	TIGRIS_1_0_0:1.27
	TIGRIS_1_0_0_RC1:1.27.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.19
	TIGRIS_0_9_2_3:1.19
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.21
	TIGRIS_0_9_2_1:1.21
	TIGRIS_0_9_2:1.19.0.2
	TIGRIS_0_9_0:1.17.0.4
	TIGRIS_0_8_4:1.17.0.2;
locks; strict;
comment	@# @;


1.34
date	2001.07.23.23.58.55;	author leonardr;	state dead;
branches;
next	1.33;

1.33
date	2001.07.18.10.05.12;	author dlr;	state Exp;
branches;
next	1.32;

1.32
date	2001.07.17.17.55.45;	author leonardr;	state Exp;
branches;
next	1.31;

1.31
date	2001.07.05.22.21.38;	author leonardr;	state Exp;
branches;
next	1.30;

1.30
date	2001.06.21.00.22.14;	author leonardr;	state Exp;
branches;
next	1.29;

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

1.28
date	2001.04.26.16.16.43;	author leonardr;	state Exp;
branches;
next	1.27;

1.27
date	2001.03.09.22.31.15;	author dlr;	state Exp;
branches;
next	1.26;

1.26
date	2001.03.07.01.53.20;	author lucas;	state Exp;
branches;
next	1.25;

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

1.24
date	2001.02.26.22.51.43;	author leonardr;	state Exp;
branches;
next	1.23;

1.23
date	2001.02.21.06.55.40;	author edk;	state Exp;
branches;
next	1.22;

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

1.21
date	2001.01.26.18.29.02;	author edk;	state Exp;
branches
	1.21.2.1;
next	1.20;

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

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

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

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

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

1.15
date	2000.11.27.22.43.20;	author leonardr;	state Exp;
branches;
next	1.14;

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

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

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

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

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

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

1.8
date	2000.11.23.04.43.43;	author elicia;	state Exp;
branches;
next	1.7;

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

1.6
date	2000.11.17.19.49.13;	author leonardr;	state Exp;
branches;
next	1.5;

1.5
date	2000.11.17.18.44.32;	author leonardr;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.17.02.49.37;	author elicia;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.15.18.47.22;	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.21.2.1
date	2001.01.28.01.02.17;	author dlr;	state dead;
branches;
next	1.21.2.2;

1.21.2.2
date	2001.02.08.01.52.20;	author dlr;	state Exp;
branches;
next	1.21.2.3;

1.21.2.3
date	2001.02.09.02.40.17;	author dlr;	state Exp;
branches;
next	1.21.2.4;

1.21.2.4
date	2001.02.15.20.50.35;	author leonardr;	state Exp;
branches;
next	1.21.2.5;

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


desc
@@


1.34
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 CollabNet.
 * 
 * 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 java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.turbine.util.*;

import org.apache.velocity.context.Context;

import org.tigris.helm.security.RedirectException;
import org.tigris.helm.tool.SessionManager;

import org.tigris.helm.*;
import org.tigris.helm.om.profile.*;
import org.tigris.helm.om.*;
import org.tigris.helm.security.*;
import org.tigris.helm.tool.DBFlag;
import org.tigris.helm.tool.ContextAPI;

/**
 * Fill out additional project information.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: ProjectAddStep2.java,v 1.33 2001/07/18 10:05:12 dlr Exp $
 */
public class ProjectAddStep2 extends ProjectAdd
{
    /**
     * The default project type key.
     */
    private static final String DEF_PROJ_TYPE_KEY = "development";

    /**
     * Display and process the project addition information.
     */
    protected String processRequest(Context context)
        throws TurbineException, RedirectException 
    {
        String templateName = super.processRequest(context);

        String action = getAction(context);

        HttpSession session = getSessionManager(context).getSession();
        String newProjectName = ContextAPI.processField
            (context, PROJECT_NAME, session);

        try
        {
            User loginUser = getLoginUser(context);
            String userID = loginUser.getID();

            // Gather any user input, adding it to the context as well.
            String license = ContextAPI.processRequiredField
                (context, LICENSE_ID, session, "License");
            String seenThisScreen = ContextAPI.processField
                (context, SEEN_SCREEN_2, session);
            String isPublic = ContextAPI.processField
                (context, IS_PUBLIC, session);
            String loginUserLoginName = loginUser.getLoginName();
            String projectOwner = ContextAPI.processField
                (context, PROJECT_OWNER, loginUserLoginName);
            String[] selectedCategories = 
                getParameterValues(context, SELECTED_CATEGORIES_FIELD);
            if (selectedCategories == null)
            {
                selectedCategories = 
                    (String[])session.getValue(SELECTED_CATEGORIES_FIELD);
                if (selectedCategories == null)
                {
                    selectedCategories = new String[0];
                }
            }
            context.put(SELECTED_CATEGORIES_FIELD, 
                    Arrays.asList(selectedCategories));


            List validationErrors = new ArrayList();
            if (NEXT_STEP.equals(action))
            {
                Domain domain = getCurrentDomain(context);
                if (!loginUserLoginName.equals(projectOwner) &&
                    !UserPeer.exists(domain, projectOwner))
                {
                    ContextAPI.addValidationError
                        (context, "Project owner does not exist");
                }

                session.putValue(SEEN_SCREEN_2, seenThisScreen);
                if (ContextAPI.isValidUserInput(context))
                {
                    Project project = null;
                    try
                    {
                        Project.assertNonexistance(domain, newProjectName);
                        session.putValue(LICENSE_ID, license);
                        session.putValue(IS_PUBLIC, isPublic);
                        session.putValue(PROJECT_OWNER, projectOwner);
                        session.putValue(SELECTED_CATEGORIES_FIELD,
                                         selectedCategories);

                        redirectToNextStep(context);
                    }
                    catch (AlreadyExists e)
                    {
                        addProjectNameJustRegistered(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.33
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.32 2001/07/17 17:55:45 leonardr Exp $
@


1.32
log
@Porting of domain package to new error handling API.
@
text
@d60 1
a60 1
import org.joist.security.RedirectException;
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.31 2001/07/05 22:21:38 leonardr Exp $
@


1.31
log
@Licenses are now contained in a database-managed table rather than in a custom Java class (yay!)
@
text
@d68 1
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.30 2001/06/21 00:22:14 leonardr Exp $
a84 16
     * A list of ProjectProfiles instances, keyed by ProjectProfile key.
     */
    //private ProjectProfiles projectProfiles;

    /**
     * Called on servlet startup by the servlet container.
     */
    //public void start() throws ServletException
    //{
    //super.start();
    //
    //// Load the project types.
    //projectProfiles = ProjectProfiles.getInstance();
    //}

    /**
d87 1
a87 1
    protected String processRequest(Context ctx)
d90 1
a90 1
        String templateName = super.processRequest(ctx);
d92 1
a92 1
        String action = getAction(ctx);
d94 3
a96 2
        HttpSession session = getSessionManager(ctx).getSession();
        String newProjectName = processField(ctx, PROJECT_NAME, session);
d100 1
a100 1
            User loginUser = getLoginUser(ctx);
d104 6
a109 5
            List missingFields = new ArrayList();
            String license = processField(ctx, LICENSE_ID, session, 
                                          "License", missingFields);
            String seenThisScreen = processField(ctx, SEEN_SCREEN_2, session);
            String isPublic = processField(ctx, IS_PUBLIC, session);
d111 2
a112 2
            String projectOwner = processField(ctx, PROJECT_OWNER,
                                               loginUserLoginName);
d114 1
a114 1
                getParameterValues(ctx, SELECTED_CATEGORIES_FIELD);
d124 1
a124 1
            ctx.put(SELECTED_CATEGORIES_FIELD, 
a126 4
            //String projectProfileKey = processField
            //(ctx, "projectProfileKey", DEF_PROJ_TYPE_KEY,
            //"Project Profile", missingFields);
            //ctx.put("projectProfList", projectProfiles.elements());
d131 1
a131 13
//                 ProjectProfile projectProfile = 
//                     projectProfiles.get(projectProfileKey);

//                 if (projectProfile != null)
//                 {
//                     session.putValue(PROJECT_PROFILE, projectProfile);
//                 }
//                 else
//                 {
//                     validationErrors.add("Project type is invalid.");
//                 }

                Domain domain = getCurrentDomain(ctx);
d135 2
a136 1
                    validationErrors.add("Project owner does not exist");
a138 1
                boolean ok = false;
d140 1
a140 1
                if (isValidUserInput(missingFields, validationErrors))
a141 1
                    Log.debug("putting stuff in session.");
a145 1
                        ok = true;
d152 1
a152 1
                        redirectToNextStep(ctx);
d156 1
a156 1
                        addProjectNameJustRegistered(validationErrors);
a158 7

                if (!ok)
                {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(ctx, missingFields, 
                                           validationErrors);
                }
d162 1
a162 1
                redirectToPreviousStep(ctx);
d172 1
a172 1
            appendToError(ctx, e.getMessage());
@


1.30
log
@Projects can now belong to more than one category.
@
text
@a63 1
import org.tigris.helm.om.*;
d74 1
a74 1
 * @@version $Id: ProjectAddStep2.java,v 1.29 2001/05/23 01:50:09 dlr Exp $
d110 1
a110 4
	String newProjectName = processField(ctx, PROJECT_NAME, session);
	String shortDescription = (String)session.getValue(SHORT_DESCRIP);
	String longDescription = (String)session.getValue(LONG_DESCRIP);
	String url = (String)session.getValue(URL);
d119 2
a120 2
            String license = processField(ctx, LICENSE, "License", 
                                          missingFields);
a144 3
            // Give the template lists of licenses, policies, and categories.
            Licenses.addToContext(ctx, "licenseList", true);

d171 1
a171 5
                    if (!Licenses.isValid(license))
                    {
                        license = Licenses.getDefault();
                    }

d177 1
a177 1
                        session.putValue(LICENSE, license);
@


1.29
log
@Ported Helm from WebMacro to Velocity.
@
text
@d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.28 2001/04/26 16:16:43 leonardr Exp $
d130 14
a143 2
            String catTypeID = processField(ctx, CAT_TYPE_ID, "Category", 
                                            missingFields);
d153 1
a153 1
            if (action != null && action.equals(NEXT_STEP))
d191 2
a192 1
                        session.putValue(CAT_TYPE_ID, catTypeID);
@


1.28
log
@Patches I forgot to commit before, for decoupling privateness from proprietariness.
@
text
@d58 1
a58 1
import org.webmacro.servlet.*;
d61 1
a61 1
import org.joist.session.SessionManager;
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.27 2001/03/09 22:31:15 dlr Exp $
d103 2
a104 2
    protected String processRequest(Connection conn, WebContext ctx)
        throws HandlerException, RedirectException 
d106 1
a106 1
        String templateName = super.processRequest(conn, ctx);
@


1.27
log
@Be sure to rethrow RedirectExceptions!
@
text
@d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.26 2001/03/07 01:53:20 lucas Exp $
a84 10
     * The license type key.
     */
    private static final String LICENSE_TYPE = "licenseType";

    /**
     * The default license type.
     */
    private static final String DEF_LICENSE_TYPE = "public";

    /**
a108 1
        Log.debug("action=" + action);
a122 2
            String licenseType = processField(ctx, LICENSE_TYPE,
                                              DEF_LICENSE_TYPE);
d125 2
d138 1
a138 1
            Licenses.addToContext(ctx, "licenseList", false);
a142 3
	        if (licenseType.equals("private"))
	            license = "Proprietary";

d163 1
d177 1
@


1.26
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.25 2001/02/27 02:21:06 dlr Exp $
d212 4
@


1.25
log
@Chagned loginUserLoginID to loginUserLoginName.
@
text
@d66 1
a66 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.24 2001/02/26 22:51:43 leonardr Exp $
@


1.24
log
@Commented out confusing and as-yet-unneccessary project profile selection *again*
@
text
@d76 1
a76 1
 * @@version $Id: ProjectAddStep2.java,v 1.23 2001/02/21 06:55:40 edk Exp $
d139 1
a139 1
            String loginUserLoginID = loginUser.getLoginName();
d141 1
a141 1
                                               loginUserLoginID);
d171 1
a171 1
                if (!loginUserLoginID.equals(projectOwner) &&
@


1.23
log
@rename projectName to newProjectName to avoid conflicts with HelmServlet's
heuristics for determining the current project
@
text
@d76 1
a76 1
 * @@version $Id: ProjectAddStep2.java,v 1.22 2001/02/21 01:08:21 dlr Exp $
d98 1
a98 1
    private ProjectProfiles projectProfiles;
d103 7
a109 7
    public void start() throws ServletException
    {
        super.start();

        // Load the project types.
        projectProfiles = ProjectProfiles.getInstance();
    }
d144 4
a147 4
            String projectProfileKey = processField
                (ctx, "projectProfileKey", DEF_PROJ_TYPE_KEY,
                 "Project Profile", missingFields);
            ctx.put("projectProfList", projectProfiles.elements());
d158 2
a159 2
                ProjectProfile projectProfile = 
                    projectProfiles.get(projectProfileKey);
d161 8
a168 8
                if (projectProfile != null)
                {
                    session.putValue(PROJECT_PROFILE, projectProfile);
                }
                else
                {
                    validationErrors.add("Project type is invalid.");
                }
@


1.22
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d76 1
a76 1
 * @@version $Id: ProjectAddStep2.java,v 1.21.2.5 2001/02/16 03:01:26 dlr Exp $
d123 1
a123 1
	String projectName = processField(ctx, PROJECT_NAME, session);
d188 1
a188 1
                        Project.assertNonexistance(domain, projectName);
@


1.21
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
d56 2
a57 1
import org.webmacro.util.*;
d60 1
a60 5
import com.workingdogs.village.*;

import org.joist.*;
import org.joist.util.*;
import org.joist.database.*;
a61 1
import org.joist.security.*;
d64 4
a67 1
import org.tigris.helm.database.*;
d69 1
a69 2
import org.tigris.helm.project.*;
import org.tigris.helm.tool.*;
d76 1
a76 1
 * @@version $Id: ProjectAddStep2.java,v 1.19 2001/01/17 23:48:37 dlr Exp $
a79 12
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.19 2001/01/17 23:48:37 dlr Exp $";

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

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

d103 1
a103 1
    public void start () throws ServletException
d112 1
a112 1
     * Display and process the project addition request.
d114 1
a114 1
    protected String processRequest (Connection conn, WebContext ctx)
d120 1
a120 1
        if (debug) log.debug("action=" + action);
d139 1
a139 1
            String loginUserLoginID = loginUser.getLoginID();
d170 1
d172 1
a172 2
                    !User.exists(conn, dMgr, getCurrentDomain(ctx).getID(),
                                 projectOwner))
d188 1
a188 3
                        String domainID = getCurrentDomain(ctx).getID();
                        Project.assertNonexistance(conn, dMgr, domainID,
                                                   projectName);
d214 1
a214 15
        catch (JoistDatabaseException e)
        {
            log.exception(e);
            String msg = e.getMessage();
            if (debug) log.info(msg);
            appendToMessage(ctx, msg);
        }
        catch (DataSetException e)
        {
            log.exception(e);
            String msg = e.getMessage();
            if (debug) log.info(msg);
            appendToMessage(ctx, msg);
        }
        catch (SQLException e)
d216 2
a217 4
            log.exception(e);
            String msg = e.getMessage();
            if (debug) log.info(msg);
            appendToMessage(ctx, msg);
@


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


1.21.2.2
log
@Fill out additional project information.
@
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
d56 2
a57 1
import org.apache.turbine.util.*;
d59 1
a59 1
import org.webmacro.servlet.*;
d61 3
a63 1
import org.joist.security.RedirectException;
d65 1
d68 1
a68 3
import org.tigris.helm.om.*;
import org.tigris.helm.om.profile.*;
import org.tigris.helm.om.peer.*;
d70 2
a71 1
import org.tigris.helm.tool.DBFlag;
d82 12
d126 1
a126 1
     * Display and process the project addition information.
d134 1
a134 1
        Log.debug("action=" + action);
d153 1
a153 1
            String loginUserLoginID = loginUser.getLoginName();
a183 1
                Domain domain = getCurrentDomain(ctx);
d185 2
a186 1
                    !UserPeer.exists(domain, projectOwner))
d202 3
a204 1
                        Project.assertNonexistance(domain, projectName);
d230 15
a244 1
        catch (Exception e)
d246 4
a249 2
            Log.error(e);
            appendToError(ctx, e.getMessage());
@


1.21.2.3
log
@whitespace change
@
text
@d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.21.2.2 2001/02/08 01:52:20 dlr Exp $
d102 1
a102 1
    public void start() throws ServletException
d113 1
a113 1
    protected String processRequest(Connection conn, WebContext ctx)
@


1.21.2.4
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.21.2.3 2001/02/09 02:40:17 dlr Exp $
@


1.21.2.5
log
@Added new imports necessitated by Torque.
@
text
@a66 1
import org.tigris.helm.om.base.*;
d75 1
a75 1
 * @@version $Id: ProjectAddStep2.java,v 1.21.2.4 2001/02/15 20:50:35 leonardr Exp $
@


1.20
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
@@


1.19
log
@Added check for existance of project owner.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.18 2001/01/17 23:30:39 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.18 2001/01/17 23:30:39 dlr Exp $";
@


1.18
log
@Whitespace aids in readability.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.17 2000/11/28 00:15:10 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.17 2000/11/28 00:15:10 dlr Exp $";
d153 1
d155 1
a155 1
                                               loginUser.getLoginID());
d184 7
d230 9
a238 1
        catch (SQLException e) {
d243 3
a245 1
        } catch (DataSetException e) {
@


1.17
log
@Handle session values used in step 4 correctly.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.16 2000/11/27 22:59:41 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.16 2000/11/27 22:59:41 dlr Exp $";
d225 1
a225 1
            if(debug) log.info(msg);
d230 1
a230 1
            if(debug) log.info(msg);
@


1.16
log
@Fixes and default settings for steps 2 and 3.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.15 2000/11/27 22:43:20 leonardr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.15 2000/11/27 22:43:20 leonardr Exp $";
d155 1
a155 1
            String catTypeID = processField(ctx, "catTypeID", "Category", 
d198 4
@


1.15
log
@Minor cosmetic changes to project creation; dlr is probably making the same changes.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.14 2000/11/27 20:46:07 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.14 2000/11/27 20:46:07 dlr Exp $";
d100 10
d112 1
a112 1
    ProjectProfiles projectProfiles;
d149 2
d157 3
a159 2
            String projectProfileKey = processField(ctx, "projectProfileKey", 
                                                 DEF_PROJ_TYPE_KEY);
a167 1
	        String licenseType = ctx.getForm("licenseType");
@


1.14
log
@Corrected build errors.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.13 2000/11/27 20:04:12 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.13 2000/11/27 20:04:12 dlr Exp $";
d146 1
a146 2
                                                 DEF_PROJ_TYPE_KEY, "Type", 
                                                 missingFields);
@


1.13
log
@Modifications to make project addition more wizard-like...small breakage on this commit, will fix immediatly.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.12 2000/11/23 11:29:25 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.12 2000/11/23 11:29:25 dlr Exp $";
d95 5
d145 1
a145 1
            String projectTypeKey = processField(ctx, "projectTypeKey", 
d160 2
a161 2
                ProjectProfile projectType = 
                    projectProfiles.get(projectTypeKey);
d163 5
a167 1
                if (projectType == null)
d183 3
a185 1
                        Project.assertNonexistance(conn, dMgr, domainID, name);
d187 1
a187 1
                        redirectToURL(ctx, getNextStep());
d204 1
a204 1
                redirectTo(getPreviousStep());
a211 10
        } catch (UpdateException e) {
            log.exception(e);
            String msg = e.getMessage();
            if(debug) log.info(msg);
            appendToMessage(ctx, msg);
        } catch (DoesNotExist e) {
            log.exception(e);
            String msg = e.getMessage();
            if(debug) log.info(msg);
            appendToMessage(ctx, msg);
a212 10
            log.exception(e);
            String msg = e.getMessage();
            if(debug) log.info(msg);
            appendToMessage(ctx, msg);
        } catch (JoistDatabaseException e) {
            log.exception(e);
            String msg = e.getMessage();
            if(debug) log.info(msg);
            appendToMessage(ctx, msg);            
        } catch (JoistException e) {
@


1.12
log
@Added period at end of sentence.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.11 2000/11/23 11:17:42 dlr Exp $
d82 1
a82 6
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.11 2000/11/23 11:17:42 dlr Exp $";

    /**
     * The default project type.
     */
    private static final String DEF_PROJ_TYPE_KEY = "development";
d87 1
a87 1
    private static Log log = new Log("prjAdd", "ProjectAddStep2");
d92 1
a92 1
    private static boolean debug = true;
a147 2
            Domain currentDomain = getCurrentDomain(ctx);

a170 1
                    // Add the project.
d174 1
a174 11
                        project = new Project(conn, dMgr, getACL(ctx, conn),
                                              projectType, 
                                              currentDomain.getID(), 
                                              projectName, 
                                              license,
                                              shortDescription, 
                                              longDescription, 
                                              null, //status
                                              url, 
                                              userID, 
                                              projectOwner);
d176 1
d180 1
a180 24
                        validationErrors.add
                            ("The project name you've chosen was just " + 
                             "registered.  Please click the back button on " + 
                             "your browser and use a different name.");
                    }

                    if (ok)
                    {
                        project.changeCategory
                            (new Category(conn, dMgr, catTypeID.toString()));
                    
                        StringBuffer buf = new StringBuffer();
                        if (project != null)
                        {
                            // Send the user to the next project addition step.
                            buf.append(myProperties.getProperty("nextStep"));
                            buf.append("?projectID=").append(project.getID());
                            if (debug) log.debug("redirecting to: " + buf);
                            redirectToURL(ctx, buf.toString());
                        }
                        else
                        {
                            redirectToError(ctx, "Could not add project");
                        }
d191 4
a194 1

@


1.11
log
@Fix compile errors.
- Reversed order of variable init.
- Removed unneeded catch block.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.10 2000/11/23 11:16:15 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.10 2000/11/23 11:16:15 dlr Exp $";
d200 1
a200 1
                             "your browser and use a different name");
@


1.10
log
@Major refactoring.  Disallow duplicate projects and other cleanup.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.9 2000/11/23 10:27:09 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.9 2000/11/23 10:27:09 dlr Exp $";
d134 1
a135 1
            User loginUser = getLoginUser(ctx);
a243 5
            log.exception(e);
            String msg = e.getMessage();
            if(debug) log.info(msg);
            appendToMessage(ctx, msg);
        } catch (AlreadyExists e) {
@


1.9
log
@Revised to make use of superclass functionality.
@
text
@d74 1
a74 1
 * The first step in adding a new project.  Fill out project information.
d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.8 2000/11/23 04:43:43 elicia Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.8 2000/11/23 04:43:43 elicia Exp $";
d118 1
a118 1
    protected String processRequest (Connection conn, WebContext context)
d121 1
a121 1
        String templateName = super.processRequest(conn, context);
d123 2
a124 2
        String action = (String)context.get("action");
        if (debug) log.debug("action=" + action );
d126 5
a130 7
        HttpSession session = getSessionManager(context).getSession();
	String projectName = session.getValue(PROJECT_NAME).toString();
	String shortDescription = 
            session.getValue(SHORT_DESCRIP).toString();
	String longDescription =
            session.getValue(LONG_DESCRIP).toString();
	String url = session.getValue(URL).toString();
a133 1
            User loginUser = getLoginUser(context);
d135 1
a135 12
            String loginID = loginUser.getLoginID();
            context.put("loginID", loginID);

            // If we are returning to this page as a result of an
            // error, we just want to refresh the display, without
            // doing any further action.
            String errorMessage = (String) context.get("Error");
            if (errorMessage != null)
            {
                action = null;
                appendToMessage(context, errorMessage);
            }
d139 5
a143 8
            String license = processField(context, LICENSE, "License", 
                                   missingFields);

            String projectOwner = (String)context.getForm("projectOwner");
            if (projectOwner == null) projectOwner = loginID;
            context.put("projectOwner", projectOwner);

            String catTypeID = processField(context, "catTypeID", "Category", 
d145 1
a145 1
            String projectTypeKey = processField(context, "projectTypeKey", 
d148 1
a148 1
            context.put("projectProfList", projectProfiles.elements());
d151 1
a151 1
            Licenses.addToContext(context, "licenseList", false);
d153 1
a153 1
            Domain currentDomain = getCurrentDomain(context);
d158 1
a158 1
	        String licenseType = context.getForm("licenseType");
d170 1
d172 3
a174 2
                {                   
                    if (!Licenses.isValid(license)) {
d177 1
a177 1
                    
d179 17
a195 18
                    Project project = 
                        new Project(conn, dMgr, getACL(context, conn),
                                    projectType, 
                                    currentDomain.getID(), 
                                    projectName, 
                                    license,
                                    shortDescription, 
                                    longDescription, 
                                    null, //status
                                    url, 
                                    userID,                                    
                                    projectOwner);

                    project.changeCategory
                        (new Category(conn, dMgr, catTypeID.toString()));
                    
                    StringBuffer buf = new StringBuffer();
                    if (project != null)
d197 4
a200 5
                        // Send the user to the next project addition step.
                        buf.append(myProperties.getProperty("nextStep"));
                        buf.append("?projectID=").append(project.getID());
                        if (debug) log.debug("redirecting to: " + buf);
                        redirectToURL(context, buf.toString());
d202 2
a203 1
                    else
d205 16
a220 1
                        redirectToError(context, "Could not add project");
d223 2
a224 1
                else
d227 1
a227 1
                    reportInvalidUserInput(context, missingFields, 
d233 36
a268 36
     catch (SQLException e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    } catch (UpdateException e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    } catch (DoesNotExist e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    } catch (AlreadyExists e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    } catch (DataSetException e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    } catch (JoistDatabaseException e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);            
    } catch (JoistException e) {
      log.exception(e);
      String message = "" + e.getMessage();
      if(debug) log.info(message);
      appendToMessage(context, message);
    }
a270 1

@


1.8
log
@radio button for license: Private and Public
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.7 2000/11/22 21:49:44 dlr Exp $
d80 1
a80 1
public class ProjectAddStep2 extends org.tigris.helm.security.HelmServlet
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.7 2000/11/22 21:49:44 dlr Exp $";
a89 5
     * The action which takes the user to the next step.
     */
    private static final String NEXT_STEP = "Next Step";

    /**
d127 1
a127 1
	String projectName = session.getValue("projectName").toString();
d129 1
a129 1
            session.getValue("shortDescription").toString();
d131 2
a132 2
            session.getValue("longDescription").toString();
	String url = session.getValue("url").toString();
d153 1
a153 1
            String license = processField(context, "license", "License", 
d157 2
a158 5
            if (projectOwner == null)
            {
                projectOwner = loginID;
                context.put("projectOwner", loginID);
            }
d175 1
a175 1
	        String licenseType = context.getForm("license_type");
@


1.7
log
@Project creation doesn't happen until a later step.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.6 2000/11/17 19:49:13 leonardr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.6 2000/11/17 19:49:13 leonardr Exp $";
d159 1
a159 1
                                          missingFields);
d176 1
a176 1
            Licenses.addToContext(context, "licenseList", true);
d183 4
@


1.6
log
@Send mail to domain admins on creation of unapproved project.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.5 2000/11/17 18:44:32 leonardr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.5 2000/11/17 18:44:32 leonardr Exp $";
d90 5
d181 1
a181 1
            if (action != null && action.equals("Create Project"))
@


1.5
log
@Can't proprietarize approved open source projects.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.4 2000/11/17 02:49:37 elicia Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.4 2000/11/17 02:49:37 elicia Exp $";
d262 5
@


1.4
log
@catching exceptions individually to avoid catching RedirectException
@
text
@d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.3 2000/11/15 18:47:22 dlr Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.3 2000/11/15 18:47:22 dlr Exp $";
d171 1
a171 1
            Licenses.addToContext(context, "licenseList");
@


1.3
log
@broke lines cleanly
@
text
@d63 1
d65 1
a65 1
import org.joist.security.RedirectException;
d67 1
d71 1
a71 1
import org.tigris.helm.tool.Licenses;
d78 1
a78 1
 * @@version $Id: ProjectAddStep2.java,v 1.2 2000/11/14 22:49:28 elicia Exp $
d82 1
a82 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.2 2000/11/14 22:49:28 elicia Exp $";
d232 31
a262 8
        catch (Exception e)
        {
            log.exception(e);
            String message = e.getMessage();
            if (debug) log.debug(message);
            appendToMessage(context, message);
        }

@


1.2
log
@broke up ProjectAdd into ProjectAdd and ProjectAddStep2.  Renamed later steps. Removed Member Policy field.
@
text
@d76 1
a76 1
 * @@version $Id: ProjectAddStep2.java,v 1.1.1.1 2000/11/12 21:15:33 dlr Exp $
d80 1
a80 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.1.1.1 2000/11/12 21:15:33 dlr Exp $";
d126 4
a129 2
	String shortDescription = session.getValue("shortDescription").toString();
	String longDescription = session.getValue("longDescription").toString();
@


1.1
log
@SelfServeProjectAddStep([23]) => ProjectAddStep$1
@
text
@d27 1
a27 1
 * permission of Collab.Net.
a46 1

d51 2
d59 2
d63 1
a63 4
import org.joist.session.*;

import com.workingdogs.village.*;

a64 2
import org.joist.database.DataManager;
import org.joist.database.UserManager;
d66 4
a69 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;
d72 1
a72 1
 * The second step in adding a new project.  Invite people to join.
d74 1
d76 1
a76 2
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: ProjectAddStep2.java,v 1.2 2000/11/13 21:16:52 edk Exp $
d78 1
a78 1
public class ProjectAddStep2 extends HelmServlet
d80 6
a85 1
    public static final  String versionID = "$Id: ProjectAddStep2.java,v 1.2 2000/11/13 21:16:52 edk Exp $";
d90 1
a90 1
    private static Log log = new Log("sspa2", "ProjectAddStep2");
d98 1
a98 1
     * The value for the action CGI query parameter.
d100 1
a100 1
    private static final String ACTION = "Next Step";
d103 12
a114 1
     * Display and process the project addition request, step 2.
d117 1
a117 1
        throws HandlerException, RedirectException
a118 1
        if (debug) log.debug("started");
d120 10
a129 1
    
a131 1
            if (debug) log.debug("Checking inputs and adding to context");
d133 9
a141 3
            String action = (String)context.get("action");

            if (debug)
d143 2
a144 2
                log.info("userID=" + loginUser.getUserID());
                log.info("action=" + action);
d147 1
d149 2
a150 5
            String inviteEmails = processField(context, "inviteEmails");
            String inviteMessage = processField(context, "inviteMessage");
            boolean isInviting = 
                (haveValue(inviteEmails) || haveValue(inviteMessage));
            if (debug) log.info("isInviting=" + isInviting);
d152 2
a153 2
            // If values are filled in for either field, require the other.
            if (isInviting)
d155 2
a156 4
                requireValue(inviteEmails, "List of email addresses", 
                             missingFields);
                requireValue(inviteMessage, "Invitation message", 
                             missingFields);
d159 9
a167 2
            Project project = getCurrentProject(context);
            context.put("project", project);
d169 4
a172 1
            if (action != null && action.equals(ACTION))
d174 4
a177 1
                if (isInviting)
d179 28
a206 1
                    if (isValidUserInput(missingFields, null))
d208 5
a212 12
                        // Send the invitation.
                        Domain domain = getCurrentDomain(context);
                        DataManager dMgr = getDataManager(context);
                        Invitation.sendInvitations(conn,
                                dMgr,
                                domain,
                                getRecipients(inviteEmails),
                                loginUser,
                                project,
                                inviteMessage);

                        redirectTo(myProperties.getProperty("nextStep"));
d216 1
a216 1
                        reportInvalidUserInput(context, missingFields, null);
d221 3
a223 1
                    redirectTo(myProperties.getProperty("nextStep"));
a226 6
            // Displaying the page.
            context.put("action", ACTION);
        }
        catch (RedirectException e)
        {
            throw e;
d231 3
a233 3
            String msg = "Could not send invitation: " + e.getMessage();
            appendToMessage(context, msg);
            throw new HandlerException(msg);
d235 1
a235 2
    
        if (debug) log.debug("done");
a238 17
    /**
     * 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.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/)."
d27 1
a27 1
 * permission of CollabNet.
d32 1
a32 1
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d47 1
a51 2
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
d55 6
a60 1
import org.apache.turbine.util.*;
d62 1
a62 1
import org.webmacro.servlet.*;
d65 2
a66 1
import org.joist.session.SessionManager;
d68 5
a72 7
import org.tigris.helm.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.profile.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
import org.tigris.helm.security.*;
import org.tigris.helm.tool.DBFlag;
d75 1
a75 1
 * Fill out additional project information.
d77 1
d79 1
a79 2
 * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
 * @@version $Id: ProjectAddStep2.java,v 1.21.2.5 2001/02/16 03:01:26 dlr Exp $
d81 1
a81 1
public class ProjectAddStep2 extends ProjectAdd
d83 1
a83 4
    /**
     * The default project type key.
     */
    private static final String DEF_PROJ_TYPE_KEY = "development";
d86 1
a86 1
     * The license type key.
d88 1
a88 1
    private static final String LICENSE_TYPE = "licenseType";
d91 1
a91 1
     * The default license type.
d93 1
a93 1
    private static final String DEF_LICENSE_TYPE = "public";
d96 1
a96 1
     * A list of ProjectProfiles instances, keyed by ProjectProfile key.
d98 1
a98 1
    private ProjectProfiles projectProfiles;
d101 1
a101 1
     * Called on servlet startup by the servlet container.
d103 2
a104 1
    public void start() throws ServletException
d106 3
a108 23
        super.start();

        // Load the project types.
        projectProfiles = ProjectProfiles.getInstance();
    }

    /**
     * Display and process the project addition information.
     */
    protected String processRequest(Connection conn, WebContext ctx)
        throws HandlerException, RedirectException 
    {
        String templateName = super.processRequest(conn, ctx);

        String action = getAction(ctx);
        Log.debug("action=" + action);

        HttpSession session = getSessionManager(ctx).getSession();
	String projectName = processField(ctx, PROJECT_NAME, session);
	String shortDescription = (String)session.getValue(SHORT_DESCRIP);
	String longDescription = (String)session.getValue(LONG_DESCRIP);
	String url = (String)session.getValue(URL);

d111 9
a119 2
            User loginUser = getLoginUser(ctx);
            String userID = loginUser.getID();
a120 1
            // Gather any user input, adding it to the context as well.
d122 5
a126 16
            String licenseType = processField(ctx, LICENSE_TYPE,
                                              DEF_LICENSE_TYPE);
            String license = processField(ctx, LICENSE, "License", 
                                          missingFields);
            String loginUserLoginID = loginUser.getLoginName();
            String projectOwner = processField(ctx, PROJECT_OWNER,
                                               loginUserLoginID);
            String catTypeID = processField(ctx, CAT_TYPE_ID, "Category", 
                                            missingFields);
            String projectProfileKey = processField
                (ctx, "projectProfileKey", DEF_PROJ_TYPE_KEY,
                 "Project Profile", missingFields);
            ctx.put("projectProfList", projectProfiles.elements());

            // Give the template lists of licenses, policies, and categories.
            Licenses.addToContext(ctx, "licenseList", false);
d128 2
a129 2
            List validationErrors = new ArrayList();
            if (action != null && action.equals(NEXT_STEP))
d131 5
a135 2
	        if (licenseType.equals("private"))
	            license = "Proprietary";
d137 2
a138 2
                ProjectProfile projectProfile = 
                    projectProfiles.get(projectProfileKey);
d140 3
a142 1
                if (projectProfile != null)
d144 1
a144 24
                    session.putValue(PROJECT_PROFILE, projectProfile);
                }
                else
                {
                    validationErrors.add("Project type is invalid.");
                }

                Domain domain = getCurrentDomain(ctx);
                if (!loginUserLoginID.equals(projectOwner) &&
                    !UserPeer.exists(domain, projectOwner))
                {
                    validationErrors.add("Project owner does not exist");
                }

                boolean ok = false;
                if (isValidUserInput(missingFields, validationErrors))
                {
                    if (!Licenses.isValid(license))
                    {
                        license = Licenses.getDefault();
                    }

                    Project project = null;
                    try
d146 10
a155 5
                        Project.assertNonexistance(domain, projectName);
                        ok = true;
                        session.putValue(LICENSE, license);
                        session.putValue(PROJECT_OWNER, projectOwner);
                        session.putValue(CAT_TYPE_ID, catTypeID);
d157 1
a157 1
                        redirectToNextStep(ctx);
d159 1
a159 1
                    catch (AlreadyExists e)
d161 1
a161 1
                        addProjectNameJustRegistered(validationErrors);
d164 1
a164 2

                if (!ok)
d166 1
a166 3
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(ctx, missingFields, 
                                           validationErrors);
d169 7
a175 4
            else if (action != null && action.equals(PREV_STEP))
            {
                redirectToPreviousStep(ctx);
            }
d179 4
a182 2
            Log.error(e);
            appendToError(ctx, e.getMessage());
d184 2
d187 18
@


