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


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

1.11
date	2001.07.13.19.47.34;	author leonardr;	state Exp;
branches;
next	1.10;

1.10
date	2001.05.31.19.12.28;	author elicia;	state Exp;
branches;
next	1.9;

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

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

1.7
date	2001.03.07.01.53.25;	author lucas;	state Exp;
branches;
next	1.6;

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

1.5
date	2001.01.30.02.38.52;	author elicia;	state Exp;
branches;
next	1.4;

1.4
date	2001.01.26.18.29.05;	author edk;	state Exp;
branches
	1.4.2.1;
next	1.3;

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

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

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

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

1.4.2.1
date	2001.01.28.01.02.18;	author dlr;	state dead;
branches;
next	1.4.2.2;

1.4.2.2
date	2001.02.13.01.17.20;	author elicia;	state Exp;
branches;
next	1.4.2.3;

1.4.2.3
date	2001.02.13.04.06.03;	author elicia;	state Exp;
branches;
next	1.4.2.4;

1.4.2.4
date	2001.02.15.20.50.42;	author leonardr;	state Exp;
branches;
next	1.4.2.5;

1.4.2.5
date	2001.02.16.03.01.34;	author dlr;	state Exp;
branches;
next	1.4.2.6;

1.4.2.6
date	2001.02.17.00.18.29;	author elicia;	state Exp;
branches;
next	1.4.2.7;

1.4.2.7
date	2001.02.20.02.30.37;	author dlr;	state Exp;
branches;
next	1.4.2.8;

1.4.2.8
date	2001.02.20.03.52.08;	author dlr;	state Exp;
branches;
next	1.4.2.9;

1.4.2.9
date	2001.02.20.04.46.47;	author elicia;	state Exp;
branches;
next	;


desc
@@


1.12
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 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.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.joist.security.*;

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

public class ProjectSectionEdit extends HelmServlet
{
    /**
     * The action which takes the user to the last step.
     */
    private static String SUBMIT_CHANGES_ACTION="Edit Folder";

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

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

    /**
     * The location key.
     */
    private static final String LOCATION = "location";

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

    /**
     * The url where the section is located.
     */
    private static final String URL = "url";

    /**
     * The text of the section.
     */
    private static final String TEXT = "text";

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

    /**
     * Edits a section.
     */
    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();
            ProjectSection section = getCurrentSection(ctx);

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

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

            String name = processField(ctx, DOCUMENT_NAME,
                                       "Section Name",
                                        missingFields);
            String descrip = processField(ctx, DESCRIPTION);
            String parentID = getParameter(ctx, PARENT_ID);

            if (action != null && action.equals(SUBMIT_CHANGES_ACTION))
            {
                if (isValidUserInput(missingFields, validationErrors))
                {
                    // Edit section
                    section.edit(acl, parentID, name, descrip);
                    StringBuffer urlBuf = new StringBuffer(
                                 "ProjectDocumentList?rootSectionID=");
                    urlBuf.append(section.getID());
                    redirectToURL(ctx, urlBuf.toString());
                } 
                else 
                {
                    // Report missing fields and validation errors.
                    ctx.put("parentID", parentID);
                    reportInvalidUserInput(ctx, missingFields,
                                           validationErrors);
                }
            }
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            String msg = "Error editing section: " + e.getMessage();
            Log.error(msg, e);
            appendToMessage(ctx, msg);
            throw new TurbineException(e);
        }
    
        return templateName;
    }
}
@


1.11
log
@Minor new functionality avaliable to servlets to automatically check for the presence of 'current' values for business objects.
@
text
@@


1.10
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
@a120 2
            if (currentProject == null)
                redirectToError(ctx, "ProjectSectionEdit: No project specified");
d123 1
a123 6
            String sectionID = getParameter(ctx, "sectionID");
            if (sectionID == null)
               appendToMessage(ctx, "No section specified");
            ProjectSection section = (ProjectSection)ProjectSectionPeer
                                                     .getInstance(sectionID);
            ctx.put("section", section);
d145 1
a145 1
                    urlBuf.append(sectionID);
d147 3
a149 1
                } else {
d163 1
a163 1
            String msg = "Error editting section: " + e.getMessage();
@


1.9
log
@Ported Helm from WebMacro to Velocity.
@
text
@d150 4
a153 1
                    redirectToURL(ctx, "ProjectDocumentList");
@


1.8
log
@changed action names from "Section" to "Folder"
@
text
@d56 2
d59 1
a59 1
import org.webmacro.servlet.*;
d112 2
a113 2
    protected String processRequest (Connection conn, WebContext ctx)
        throws HandlerException, RedirectException
d116 1
a116 1
        String templateName = super.processRequest(conn, ctx);
d125 1
a125 1
            String sectionID = ctx.getForm("sectionID");
d142 1
a142 1
            String parentID = ctx.getForm(PARENT_ID);
d168 1
a168 1
            throw new HandlerException(msg);
@


1.7
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d70 1
a70 1
    private static String SUBMIT_CHANGES_ACTION="Edit Section";
@


1.6
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d62 1
a62 3
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;

@


1.5
log
@cleanup
@
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 5
a63 3
import org.tigris.helm.security.HelmServlet;
import org.joist.security.RedirectException;
import org.joist.database.DataManager;
a65 1
import org.tigris.helm.database.ProjectSectionManager;
a68 2
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.4 2001/01/26 18:29:05 edk Exp $";

d104 2
a105 1
    /** Open the log file.
d107 1
a107 1
    private static Log log = new Log("projDocEdit", "ProjectSectionEdit");
d110 1
a110 1
     * Whether to log debugging information.
a111 3
    private static boolean debug = true;


d115 1
a115 1
        if (debug) log.info("started");
d121 4
a124 1
            AccessControlList acl = getACL(ctx, conn);
d128 2
a129 1
            Section section = new Section(conn, dMgr, sectionID);
d133 1
a133 4
            if (debug) log.info("action=" + action);

            if (currentProject == null)
                redirectToError(ctx, "ProjectSectionEdit: No project specified");
d137 1
a140 1

d150 1
a150 1
                    redirectToURL(ctx, "ProjectDocuments");
d165 2
a166 2
            log.exception(e);
            String msg = e.getMessage();
d173 1
a173 2
  
} /* end class ProjectSectionEdit */
@


1.4
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d67 1
a67 1
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.1 2001/01/12 22:15:52 elicia Exp $";
d90 5
a129 4
            ProjectSectionManager docMgr = (ProjectSectionManager)
               getDataManager (ctx).getManager
               ("org.tigris.helm.database.ProjectSectionManager");

a141 3
            String location = processField(ctx, LOCATION);
            String url = processField(ctx, URL);
            String text = processField(ctx, TEXT);
d143 1
a143 1
            String parentID = ctx.getForm("parent_id");
d154 1
@


1.4.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d67 1
a67 1
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.4 2001/01/26 18:29:05 edk Exp $";
@


1.4.2.2
log
@ported to turbine
@
text
@d55 1
a55 1
import org.apache.turbine.util.Log;
d58 3
a60 3
import org.joist.security.*;

import org.tigris.helm.om.*;
d63 1
d67 1
a89 5
     * The id of the parent section, if this is a subsection. 
     */
    private static final String PARENT_ID = "parentID";

    /**
d99 4
d112 1
a112 1
        if (debug) Log.debug("started");
d118 1
a118 4
            if (currentProject == null)
                redirectToError(ctx, "ProjectSectionEdit: No project specified");
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = loginUser.getACL();
d122 1
a122 2
            ProjectSection section = (ProjectSection)ProjectSectionPeer
                                                     .getInstance(sectionID);
d125 4
d130 4
a133 1
            if (debug) Log.debug("action=" + action);
a136 1

d140 4
d145 1
a145 1
            String parentID = ctx.getForm(PARENT_ID);
d167 1
a167 1
            Log.error(e);
@


1.4.2.3
log
@commented out code that is breaking the built until we can find a fix for the confusing ProjectDocumentSectionPeer naming issue
@
text
@a60 1
import org.tigris.helm.om.peer.*;
d124 1
a124 2
            /*
            ProjectSection section = (ProjectSection)ProjectDocumentSectionPeer
d126 1
a126 2
            */
            //ctx.put("section", section);
d145 1
a145 1
                    //section.edit(acl, parentID, name, descrip);
@


1.4.2.4
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
@


1.4.2.5
log
@Added new imports necessitated by Torque.
@
text
@a61 1
import org.tigris.helm.om.base.*;
@


1.4.2.6
log
@fixed edit method
@
text
@d126 2
a127 1
            ProjectSection section = (ProjectSection)ProjectSectionPeer
d129 2
a130 1
            ctx.put("section", section);
d149 1
a149 1
                    section.edit(acl, parentID, name, descrip);
@


1.4.2.7
log
@Cleaned up.
@
text
@a55 1

d68 1
d107 2
a108 1
    private static final boolean DEBUG = true;
a109 3
    /**
     * Edits a section.
     */
d113 1
a113 1
        if (DEBUG) Log.debug("started");
d131 1
a131 1
            if (DEBUG) Log.debug("action=" + action);
d149 1
a149 3
                }
                else
                {
d162 2
a163 2
            String msg = "Error editting section: " + e.getMessage();
            Log.error(msg, e);
d170 2
a171 1
}
@


1.4.2.8
log
@Changed copyright and added parentID to context.
@
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
a154 1
                    ctx.put("parentID", parentID);
@


1.4.2.9
log
@changed redirect url to list page
@
text
@d150 4
a153 2
                    redirectToURL(ctx, "ProjectDocumentList");
                } else {
@


1.3
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
@d67 1
a67 1
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.2 2001/01/26 02:01:31 elicia Exp $";
d122 1
a122 1
            Section section = new Section(dMgr, sectionID);
@


1.2
log
@no longer passing connection
@
text
@d67 1
a67 1
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.1 2001/01/12 22:15:52 elicia Exp $";
@


1.1
log
@
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d67 1
a67 1
    public static final  String versionID = "$Id: ProjectSectionEdit.java,v 1.2 2000/12/30 05:02:17 elicia Exp $";
d122 1
a122 1
            Section section = new Section(conn, dMgr, sectionID);
@


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
d55 1
a55 2
import org.apache.turbine.util.Log;

d58 3
a60 5
import org.joist.security.*;

import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d63 1
d67 2
a89 5
     * The id of the parent section, if this is a subsection. 
     */
    private static final String PARENT_ID = "parentID";

    /**
d99 4
d106 2
a107 1
    private static final boolean DEBUG = true;
a108 3
    /**
     * Edits a section.
     */
d112 1
a112 1
        if (DEBUG) Log.debug("started");
d118 1
a118 4
            if (currentProject == null)
                redirectToError(ctx, "ProjectSectionEdit: No project specified");
            User loginUser = getLoginUser(ctx);
            AccessControlList acl = loginUser.getACL();
d122 1
a122 2
            ProjectSection section = (ProjectSection)ProjectSectionPeer
                                                     .getInstance(sectionID);
d125 4
d130 4
a133 1
            if (DEBUG) Log.debug("action=" + action);
a136 1

d140 4
d145 1
a145 1
            String parentID = ctx.getForm(PARENT_ID);
d153 1
a153 1
                    redirectToURL(ctx, "ProjectDocumentList");
a155 1
                    ctx.put("parentID", parentID);
d167 2
a168 2
            String msg = "Error editting section: " + e.getMessage();
            Log.error(msg, e);
d175 2
a176 1
}
@


