head	1.11;
access;
symbols
	TIGRIS_1_1_0RC2:1.5
	TIGRIS_1_1_0RC1:1.5
	TIGRIS_1_1:1.5.0.4
	TIGRIS_1_0_8:1.5
	TIGRIS_1_0_8RC3:1.5
	TIGRIS_1_0_8RC2:1.5
	TIGRIS_1_0_8RC1:1.5
	TIGRIS_1_0_7:1.5
	TIGRIS_1_0_7RC3:1.5
	TIGRIS_1_0_7RC2:1.5
	TIGRIS_1_0_7RC1:1.5
	TIGRIS_1_0_6:1.5
	TIGRIS_1_0_6RC5:1.5
	TIGRIS_1_0_6RC4:1.5
	TIGRIS_1_0_6RC3:1.5
	TIGRIS_1_0_6RC2:1.5
	TIGRIS_1_0_6RC1:1.5
	TIGRIS_1_0_5:1.5
	TIGRIS_1_0_5RC6:1.5
	TIGRIS_1_0_5RC5:1.5
	TIGRIS_1_0_5RC4:1.5
	TIGRIS_1_0_5RC3:1.5
	TIGRIS_1_0_5RC2:1.5
	TIGRIS_1_0_5RC1:1.5
	TIGRIS_1_0_4:1.5
	TIGRIS_1_0_3:1.5
	TIGRIS_1_0_2:1.5
	TIGRIS_1_0_1:1.5
	TIGRIS_1_0:1.5.0.6
	TIGRIS_1_0_0:1.5
	TIGRIS_1_0_0_RC1:1.5.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.1.2.1
	TIGRIS_0_9_2_3:1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1
	TURBINE_PEER:1.3
	TIGRIS_0_9_2_1:1.3
	TIGRIS_0_9_2:1.1.0.2;
locks; strict;
comment	@# @;


1.11
date	2001.07.16.02.23.42;	author jrobbins;	state dead;
branches;
next	1.10;

1.10
date	2001.07.13.16.59.20;	author leonardr;	state Exp;
branches;
next	1.9;

1.9
date	2001.07.13.16.55.23;	author leonardr;	state Exp;
branches;
next	1.8;

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

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

1.6
date	2001.05.08.23.09.00;	author elicia;	state Exp;
branches;
next	1.5;

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

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

1.3
date	2001.01.26.18.29.05;	author edk;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2001.01.26.05.24.06;	author edk;	state dead;
branches;
next	1.1;

1.1
date	2001.01.12.22.15.52;	author elicia;	state Exp;
branches
	1.1.1.1
	1.1.2.1;
next	;

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

1.1.2.1
date	2001.02.01.18.49.24;	author jrobbins;	state Exp;
branches;
next	;

1.3.2.1
date	2001.01.28.01.02.18;	author dlr;	state dead;
branches;
next	1.3.2.2;

1.3.2.2
date	2001.02.12.23.27.20;	author elicia;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2001.02.15.20.50.42;	author leonardr;	state Exp;
branches;
next	1.3.2.4;

1.3.2.4
date	2001.02.17.00.17.16;	author elicia;	state Exp;
branches;
next	1.3.2.5;

1.3.2.5
date	2001.02.17.00.45.05;	author elicia;	state Exp;
branches;
next	1.3.2.6;

1.3.2.6
date	2001.02.20.19.55.19;	author elicia;	state Exp;
branches;
next	;


desc
@@


1.11
log
@factoring project documents out to project nidaba.tigris.org
@
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 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 CollabNet.
 */


package org.tigris.helm.project;

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.turbine.util.TurbineException;
import org.apache.velocity.context.Context;

import org.tigris.helm.om.*;
import org.tigris.helm.security.HelmServlet;
import org.joist.security.RedirectException;

import org.tigris.helm.security.*;

public class ProjectSectionAdd extends HelmServlet
{
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.10 2001/07/13 16:59:20 leonardr Exp $";

    /**
     * The action which takes the user to the last step.
     */
    private static String SUBMIT_CHANGES_ACTION="Add Folder";

    /**
     * The section name key.
     */
    private static final String SECTION_NAME = "name";

    /**
     * The description key.
     */
    private static final String DESCRIPTION = "description";

    /**
     * The id of the parent section, if this is a subsection. 
     */
    private static final String PARENT_ID = "rootSectionID";

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


    protected String processRequest(Context ctx)
        throws TurbineException, RedirectException
    {
        if (debug) Log.debug("started");
        String templateName = super.processRequest(ctx);
    
        try
        {
            Project currentProject = getCurrentProject(ctx);
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = loginUser.getACL();
            String action = getAction(ctx);
            String parentID = "0";
            ProjectSection parent = null;

            if (currentProject == null)
                redirectToError(ctx, "ProjectDocumentSectionAdd: No project specified");

            if (debug) Log.debug("action=" + action);

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

            parentID = getParameter(ctx, PARENT_ID);
            if (parentID != null && !"0".equals(parentID))
            {
                parent = (ProjectSection)ProjectSectionPeer
                                             .getInstance(parentID);
            }

            String name = processField(ctx, SECTION_NAME,
                                       "Section Name",
                                        missingFields);

            String descrip = processField(ctx, DESCRIPTION);
            ctx.put("parent", parent);

            if (action != null && action.equals(SUBMIT_CHANGES_ACTION))
            {
                if (isValidUserInput(missingFields, validationErrors))
                {
                    // Add section
                    ProjectSection.add(acl, currentProject, parentID, 
                                       name, descrip);
                    StringBuffer urlBuf = new StringBuffer(
                                 "ProjectDocumentList?rootSectionID=");
                    urlBuf.append(parentID);
                    redirectToURL(ctx, urlBuf.toString());
                } else {
                    // Report missing fields and validation errors.
                    reportInvalidUserInput(ctx, missingFields, validationErrors);
                }
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            Log.error(e);
            String msg = e.getMessage();
            appendToMessage(ctx, msg);
            throw new TurbineException(e);
        }
    
        return templateName;
    }
  
} /* end class ProjectSectionAdd */
@


1.10
log
@Also, make sure your test is logically correct before you commit it.
@
text
@d68 1
a68 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.9 2001/07/13 16:55:23 leonardr Exp $";
@


1.9
log
@Always check for null _first_. Even better, make your test one which will work without having to code a special case for null.
@
text
@d68 1
a68 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.8 2001/05/31 19:12:28 elicia Exp $";
d120 1
a120 1
            if (!"0".equals(parentID))
@


1.8
log
@Many changes to the Project Documents component.  It is now replacing ProjectDownloads (will remove it from cvs after a while). Took out the "type" variable so that a Document can have a file upload attachment and/or a remote URL and/or pasted text, instead of only one of the three. Added fields for modified by and modified date. Also added isPublic field for file uploads, and a status field.

Document file uploads are now being saved in helm/data/fileserv/documents/[document_id]. Refactored htAccess file code to reflect that and to fix other bugs.
Dropped $type parameter from URL arguments."

UI has changed: ProjectDocumentList now has a 2-pane UI with a folder tree on the left pane and the document list on the right.  When in the list you have a "root folder" that is the root of the tree.  Folders can now be infinitely nested instead of just two levels deep.  You add a document or subfolder directly to the root section.
@
text
@d68 1
a68 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.7 2001/05/23 01:50:15 dlr Exp $";
d120 1
a120 1
            if (!parentID.equals("0") || parentID == null)
@


1.7
log
@Ported Helm from WebMacro to Velocity.
@
text
@d68 1
a68 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.6 2001/05/08 23:09:00 elicia Exp $";
d88 1
a88 1
    private static final String PARENT_ID = "parentID";
d108 2
d119 7
d131 1
a131 1
            String parentID = getParameter(ctx, PARENT_ID);
d138 6
a143 2
                    ProjectSection.add(acl, currentProject, parentID, name, descrip);
                    redirectToURL(ctx, "ProjectDocumentList");
@


1.6
log
@changed action names from "Section" to "Folder"
@
text
@d56 3
a58 1
import org.webmacro.servlet.*;
d68 1
a68 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.5 2001/02/21 01:08:23 dlr Exp $";
d96 2
a97 2
    protected String processRequest (Connection conn, WebContext ctx)
        throws HandlerException, RedirectException
d100 1
a100 1
        String templateName = super.processRequest(conn, ctx);
d122 1
a122 1
            String parentID = ctx.getForm(PARENT_ID);
d146 1
a146 1
            throw new HandlerException(msg);
@


1.5
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.6 2001/02/20 19:55:19 elicia Exp $";
d71 1
a71 1
    private static String SUBMIT_CHANGES_ACTION="Add Section";
@


1.4
log
@cleanup
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d55 1
a55 1
import org.webmacro.util.Log;
d58 1
a60 1
import org.joist.database.DataManager;
d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3 2001/01/26 18:29:05 edk Exp $";
a87 4
    /** Open the log file.
     */
    private static Log log = new Log("projSctnAdd", "ProjectSectionAdd");

d97 1
a97 1
        if (debug) log.info("started");
d103 2
a104 1
            AccessControlList acl = getACL(ctx, conn);
d110 1
a110 1
            if (debug) log.info("action=" + action);
d127 2
a128 2
                    currentProject.addSection(acl, parentID, name, descrip);
                    redirectToURL(ctx, "ProjectDocuments");
a130 2
                       log.info("parentID=" +parentID);
                    ctx.put("parentID", parentID);
d141 1
a141 1
            log.exception(e);
@


1.3
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.1 2001/01/12 22:15:52 elicia Exp $";
d117 1
d123 1
a123 4

            String parentID = ctx.getForm("parent_id");
            log.info("parentID=" + parentID);

d130 1
a130 2
                    currentProject.addSection(acl, parentID, 
                                              name, descrip);
d134 3
a136 2
                    reportInvalidUserInput(ctx, missingFields,
                                           validationErrors);
@


1.3.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3 2001/01/26 18:29:05 edk Exp $";
@


1.3.2.2
log
@ported to turbine
@
text
@d55 1
a55 1
import org.apache.turbine.util.Log;
a57 1
import org.tigris.helm.om.*;
d60 1
d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.4 2001/01/30 02:38:34 elicia Exp $";
d88 4
d101 1
a101 1
        if (debug) Log.debug("started");
d107 1
a107 2
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = loginUser.getACL();
d113 1
a113 1
            if (debug) Log.debug("action=" + action);
a116 1

d122 4
a125 1
            String parentID = ctx.getForm(PARENT_ID);
d132 2
a133 1
                    ProjectSection.add(acl, currentProject, parentID, name, descrip);
d137 2
a138 1
                    reportInvalidUserInput(ctx, missingFields, validationErrors);
d148 1
a148 1
            Log.error(e);
@


1.3.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.2 2001/02/12 23:27:20 elicia Exp $";
@


1.3.2.4
log
@changed link to ProjectDocuments (name changed to ProjectDocumentList)
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.3 2001/02/15 20:50:42 leonardr Exp $";
d128 1
a128 1
                    redirectToURL(ctx, "ProjectDocumentList");
@


1.3.2.5
log
@added approvedBy, parentID and proposedBy fields to add method
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.4 2001/02/17 00:17:16 elicia Exp $";
d86 1
a86 1
    private static final String PARENT_ID = "parent_id";
@


1.3.2.6
log
@changed name of parentID key
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.5 2001/02/17 00:45:05 elicia Exp $";
d86 1
a86 1
    private static final String PARENT_ID = "parentID";
@


1.2
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.1
log
@
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.2 2000/12/30 05:03:29 elicia Exp $";
@


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.
d55 1
a55 1
import org.apache.turbine.util.Log;
a57 1
import org.tigris.helm.om.*;
d60 1
d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.3.2.6 2001/02/20 19:55:19 elicia Exp $";
d88 4
d101 1
a101 1
        if (debug) Log.debug("started");
d107 1
a107 2
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = loginUser.getACL();
d113 1
a113 1
            if (debug) Log.debug("action=" + action);
a116 1

d122 4
a125 1
            String parentID = ctx.getForm(PARENT_ID);
d132 3
a134 2
                    ProjectSection.add(acl, currentProject, parentID, name, descrip);
                    redirectToURL(ctx, "ProjectDocumentList");
d137 2
a138 1
                    reportInvalidUserInput(ctx, missingFields, validationErrors);
d148 1
a148 1
            Log.error(e);
@


1.1.2.1
log
@moved changed from HEAD for ProjectDocuments and ProjectDownloads
@
text
@d66 1
a66 1
    public static final  String versionID = "$Id: ProjectSectionAdd.java,v 1.4 2001/01/30 02:38:34 elicia Exp $";
a116 1

d122 4
a125 1
            String parentID = ctx.getForm(PARENT_ID);
d132 2
a133 1
                    currentProject.addSection(acl, parentID, name, descrip);
d137 2
a138 3
                       log.info("parentID=" +parentID);
                    ctx.put("parentID", parentID);
                    reportInvalidUserInput(ctx, missingFields, validationErrors);
@


