head	1.16;
access;
symbols
	TIGRIS_1_1_0RC2:1.5.2.1.4.3
	TIGRIS_1_1_0RC1:1.5.2.1.4.3
	TIGRIS_1_1:1.5.2.1.4.3.0.2
	TIGRIS_1_0_8:1.5.2.1.4.3
	TIGRIS_1_0_8RC3:1.5.2.1.4.3
	TIGRIS_1_0_8RC2:1.5.2.1.4.3
	TIGRIS_1_0_8RC1:1.5.2.1.4.3
	TIGRIS_1_0_7:1.5.2.1.4.3
	TIGRIS_1_0_7RC3:1.5.2.1.4.3
	TIGRIS_1_0_7RC2:1.5.2.1.4.3
	TIGRIS_1_0_7RC1:1.5.2.1.4.3
	TIGRIS_1_0_6:1.5.2.1.4.3
	TIGRIS_1_0_6RC5:1.5.2.1.4.3
	TIGRIS_1_0_6RC4:1.5.2.1.4.3
	TIGRIS_1_0_6RC3:1.5.2.1.4.3
	TIGRIS_1_0_6RC2:1.5.2.1.4.3
	TIGRIS_1_0_6RC1:1.5.2.1.4.3
	TIGRIS_1_0_5:1.5.2.1.4.1
	TIGRIS_1_0_5RC6:1.5.2.1.4.1
	TIGRIS_1_0_5RC5:1.5.2.1.4.1
	TIGRIS_1_0_5RC4:1.5.2.1.4.1
	TIGRIS_1_0_5RC3:1.5.2.1.4.1
	TIGRIS_1_0_5RC2:1.5.2.1.4.1
	TIGRIS_1_0_5RC1:1.5.2.1.4.1
	TIGRIS_1_0_4:1.5.2.1.4.1
	TIGRIS_1_0_3:1.5.2.1.4.1
	TIGRIS_1_0_2:1.5.2.1.4.1
	TIGRIS_1_0_1:1.5.2.1
	TIGRIS_1_0:1.5.2.1.0.4
	TIGRIS_1_0_0:1.5.2.1
	TIGRIS_1_0_0_RC1:1.5.0.2
	TIGRIS_0_9_2_4:1.1.1.1.6.1
	TIGRIS_0_9_2_3:1.1.1.1
	HELM_PEER_PORT_BRANCH:1.3.0.2
	TURBINE_PEER:1.3
	TIGRIS_0_9_2_1:1.3
	TIGRIS_0_9_2:1.1.1.1.0.6
	TIGRIS_0_9_0:1.1.1.1.0.4
	TIGRIS_0_8_4:1.1.1.1.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.16
date	2001.06.13.19.55.10;	author elicia;	state dead;
branches;
next	1.15;

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

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

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

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

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

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

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

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

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

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

1.5
date	2001.03.07.01.53.24;	author lucas;	state Exp;
branches
	1.5.2.1;
next	1.4;

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

1.3
date	2001.01.26.18.29.04;	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	2000.11.12.21.16.03;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.16.03;	author dlr;	state Exp;
branches
	1.1.1.1.6.1;
next	;

1.1.1.1.6.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.5.2.1
date	2001.03.28.23.30.12;	author dlr;	state Exp;
branches
	1.5.2.1.4.1;
next	;

1.5.2.1.4.1
date	2001.04.24.20.57.40;	author dlr;	state Exp;
branches;
next	1.5.2.1.4.2;

1.5.2.1.4.2
date	2001.06.04.05.37.53;	author dlr;	state Exp;
branches;
next	1.5.2.1.4.3;

1.5.2.1.4.3
date	2001.06.04.06.00.35;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Deleting the deprecated ProjectDownload servlets. Pointing them at their ProjectDocument counterparts
@
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 CollabNet (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.project;

import java.io.*;
import java.util.*;
import java.net.InetAddress;
import java.net.URLEncoder;
import java.sql.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.turbine.util.Log;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.upload.FileItem;
import org.apache.turbine.services.upload.TurbineUpload;

import org.apache.velocity.context.Context;

import org.joist.util.*;
import org.joist.security.*;

import org.tigris.helm.security.*;
import org.tigris.helm.om.Project;
import org.tigris.helm.om.ProjectDownload;
import org.tigris.helm.om.ProjectDownloadPeer;
import org.tigris.helm.om.User;
import org.tigris.helm.tool.ContextAPI;
import org.tigris.helm.tool.DBFlag;
import org.tigris.helm.tool.FileArtifactTool;

/**
 * Handles project uploads and downloads.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@author <a href="mailto:elicia@@collab.net">Elicia David</a>
 */
public class ProjectDownloadAdd extends FileArtifactManipulate
{
    /**
     * The action key for adding a new download.
     */
    private static final String ADD_DOWNLOAD = "Upload File";

    /**
     * Key for whether the download is private.
     */
    private static final String IS_PUBLIC = "isPublic";

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

    /**
     * Display and process project downloads screen.
     */
    protected String processRequest(Context ctx)
        throws TurbineException, RedirectException
    {
        String templateName = super.processRequest(ctx);

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

        try
        {
            String descrip = null;
            String isPublic = null;
            Project project = getCurrentProject(ctx);
            User user = getLoginUser(ctx);
            AccessControlList acl = user.getACL();

            if (action != null && action.equals(ADD_DOWNLOAD))
            {
                // Do not allow overwrites of existing downloads.
                File saveDir = new File
                    (project.getUploadDirectory(getBaseSaveDir(), user));
                if (!saveDir.exists()) saveDir.mkdirs();
                String fsPerms = 
                    myProperties.getProperty("filesystemPermissions");
                // TODO: Duplicate getMaxPostSize() and fsPerms functionality
                // using Turbine's UploadService interface.
                ParameterParser params =
                    ContextAPI.getRunData(ctx).getParameters();
                TurbineUpload.parseRequest(req, params,
                                           saveDir.getAbsolutePath());
                FileItem[] files = params.getFileItems(FILES_FIELD);

                descrip = params.getString("description");
                isPublic = params.getString(IS_PUBLIC);
                if (DEBUG) Log.debug("isPublic=" + isPublic);

                // HELP: The user actually may have uploaded many files, 
                // but the current UI doesn't support this.  Punting, 
                // handling only the first upload for now.
                switch (files.length)
                {
                case 1:
                    File f = (File) files[0].getStoreLocation();
                    //Log.debug("ProjectDownloadAdd: file=" + f);
                    if (isValidFileName(f.getName()))
                    {
                        processUpload(ctx, project, f, descrip, isPublic);

                        // No need to redisplay the user input.
                        descrip = "";
                        isPublic = null;
                    }
                    else
                    {
                        appendToMessage(ctx, "Invalid file name '" +
                                        f.getName() + '\'');
                    }
                    break;
                case 0:
                    appendToMessage(ctx, "No file uploaded");
                    break;
                default:
                    appendToError
                        (ctx, "Please upload only one file at a time");
                }
            }

            ctx.put("description", descrip != null ? descrip : "");
            if (isPublic != null) ctx.put(IS_PUBLIC, DBFlag.ON);
        }
        catch (ACLException e)
        {
            throw e;
        }
        catch (RedirectURLException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            throw new TurbineException(e);
        }

        return templateName;
    }

    /**
     * Processes the registration of a single file artifact.
     */
    protected void processUpload(Context ctx, Project project,
                                 File artifactFile,
                                 String descrip, String isPublic)
        throws ACLException, Exception
    {
        User user = getLoginUser(ctx);
        AccessControlList acl = user.getACL();
        String url = URL.schemeAndServer(getRequest(ctx)) + "/servlets/" +
            getArtifactListServletName();
        String fileName = artifactFile.getName();

        // Check for overwritten files.
        ProjectDownload artifact =
            ProjectDownloadPeer.getInstanceByFileName(project, user, fileName);
        if (artifact == null)
        {
            ProjectDownload.add(acl, project, descrip, artifactFile, isPublic,
                                url);
        }
        else
        {
            // Found a matching download in the DB...replacing.
            appendToMessage(ctx, artifactFile + " was overwritten " +
                            "by your upload");
            artifact.edit(acl, descrip, user, isPublic, url, artifactFile);
        }

        redirectToURL(ctx, getArtifactListServletName());
    }

    protected final String getArtifactListServletName()
    {
        return "ProjectDownloadList";
    }
}
@


1.15
log
@Swapped debug trace.
@
text
@@


1.14
log
@Super class was renamed.
@
text
@d148 1
a148 1
                    Log.debug("ProjectDownloadAdd: file=" + f);
a187 1
	    if (DEBUG) Log.debug("done");
@


1.13
log
@Corrected compilation error (from a mis-merge).
@
text
@a82 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.12 2001/05/23 01:50:15 dlr Exp $
d84 1
a84 1
public class ProjectDownloadAdd extends ProjectFileArtifactAdd
d148 1
@


1.12
log
@Ported Helm from WebMacro to Velocity.
@
text
@d83 1
a83 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.11 2001/05/23 00:21:55 dlr Exp $
d148 1
a148 1
                    File f = (File) files.get(0);
@


1.11
log
@File names now disallow some .htaccess glob characters (IZ #3588).
@
text
@d59 4
d64 1
a64 3
import org.webmacro.servlet.*;

import com.oreilly.servlet.MultipartRequest;
d74 1
d83 1
a83 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.10 2001/05/04 22:09:19 dlr Exp $
d105 2
a106 2
    protected String processRequest (Connection conn, WebContext ctx)
        throws HandlerException, RedirectException
d108 1
a108 1
        String templateName = super.processRequest(conn, ctx);
d112 1
a112 1
        HttpServletRequest req = ctx.getRequest();
d125 21
a145 1
                if (FileUpload.isValidContentType(ctx))
d147 3
a149 19
                    File saveDir = new File
                        (project.getUploadDirectory(getBaseSaveDir(), user));
                    if (!saveDir.exists()) saveDir.mkdirs();
                    String fsPerms = 
                        myProperties.getProperty("filesystemPermissions");
                    FileUpload upload = 
                        new FileUpload(conn, ctx, getMaxPostSize(),
                                       saveDir.getAbsolutePath(), fsPerms);
                    List files = upload.getFiles();
                    MultipartRequest mreq = upload.getMultipartRequest();
                    descrip = mreq.getParameter("description");

                    isPublic = mreq.getParameter(IS_PUBLIC);
                    if (DEBUG) Log.debug("isPublic=" + isPublic);

                    // HELP: The user actually may have uploaded many files, 
                    // but the current UI doesn't support this.  Punting, 
                    // handling only the first upload for now.
                    switch (files.size())
d151 5
a155 22
                    case 1:
                        File f = (File) files.get(0);
                        if (isValidFileName(f.getName()))
                        {
                            processUpload(ctx, project, f, descrip, isPublic);

                            // No need to redisplay the user input.
                            descrip = "";
                            isPublic = null;
                        }
                        else
                        {
                            appendToMessage(ctx, "Invalid file name '" +
                                            f.getName() + '\'');
                        }
                        break;
                    case 0:
                        appendToMessage(ctx, "No file uploaded");
                        break;
                    default:
                        appendToError
                            (ctx, "Please upload only one file at a time");
d157 12
a168 4
                }
                else
                {
                    Log.warn("Incorrect content type for file upload");
a173 1

a182 4
        catch (HandlerException e)
        {
            throw e;
        }
d185 1
a185 2
            Log.error(e);
            throw new HandlerException(e.getMessage());
d195 1
a195 1
    protected void processUpload(WebContext ctx, Project project,
d202 1
a202 1
        String url = URL.schemeAndServer(ctx) + "/servlets/" +
@


1.10
log
@Leveraged getMaxPostSize() method I'm adding to ProjectFileArtifactAdd
super class which makes use of the new attribute stuff.
@
text
@d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.9 2001/04/24 03:49:23 dlr Exp $
d145 14
a158 6
                        processUpload(ctx, project, (File) files.get(0), 
                                      descrip, isPublic);

                        // No need to redisplay the user input.
                        descrip = "";
                        isPublic = null;
@


1.9
log
@Sync'd with changes to ProjectDownloadPeer.getInstanceByFile API
changes (method renamed, etc.).
@
text
@d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.8 2001/04/24 03:12:42 dlr Exp $
a126 2
                    int maxPostSize = Integer.parseInt
                        (myProperties.getProperty("maxPostSize"));
d130 1
a130 1
                        new FileUpload(conn, ctx, maxPostSize, 
@


1.8
log
@* Cleaned up imports.

* Extended ProjectFileArtifactAdd.

* Refactored processUpload().  It no longer deletes databse entries.
@
text
@d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.7 2001/04/19 19:13:52 dlr Exp $
d206 1
d210 1
a210 1
            ProjectDownloadPeer.getInstanceByFile(project, artifactFile);
d219 1
a219 1
            appendToMessage(ctx, artifactFile.getName() + " was overwritten " +
@


1.7
log
@The mod_auth_mda message is used by the List servlet.
@
text
@d17 1
a17 1
 * software developed by Collab.Net (http://www.Collab.Net/)."
d27 1
a27 1
 * permission of Collab.Net.
d58 2
a60 1
import org.apache.turbine.util.Log;
a63 2
import com.workingdogs.village.*;

d65 1
a66 1
import org.joist.security.*;
d68 4
a71 2
import org.tigris.helm.om.*;
import org.tigris.helm.tool.MDACookie;
d73 1
d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.6 2001/03/28 19:08:04 dlr Exp $
d82 1
a82 1
public class ProjectDownloadAdd extends HelmServlet
d103 1
a103 1
	throws HandlerException, RedirectException
d147 1
a147 1
                        processUpload(conn, ctx, project, (File)files.get(0), 
a193 1

d195 1
a195 1
     * Processes a single uploaded file.
d197 3
a199 3
    private void processUpload (Connection conn, WebContext ctx,
                                Project project, File fileToAdd,
                                String descrip, String isPublic)
d204 2
a205 1
        String url = URL.schemeAndServer(ctx) + "/servlets/ProjectDownloadList";
d208 13
a220 19
        String fileName = fileToAdd.getName();
        String filePath = ProjectDownload.extractLocation(fileToAdd);
        if (DEBUG) Log.debug("fileName=" + fileName);
        List downloads = project.getProjectDownloads();
        int nbrDownloads = downloads.size();
        for (int i = 0; i < nbrDownloads; i++)
        {
            ProjectDownload dl = (ProjectDownload)downloads.get(i);
            if (DEBUG) Log.debug("dl.getFileName()=" + dl.getFileName());
            if (filePath.equals(dl.getLocation()) &&
                fileName.equals(dl.getFileName()))
            {
                // The file has already been overwritten--no need to delete it
                // from disk.                
                dl.delete(acl, false, url);
                appendToMessage(ctx, fileName + 
                                " was overwritten by your upload");
                break;
            }
d223 1
a223 3
        // Add the download to the project.
        ProjectDownload.add(acl, project, descrip, fileToAdd, isPublic, url);
        redirectToURL(ctx, "ProjectDownloadList");
d226 1
a226 5

    /**
     * Macro to return the upload directory.
     */
    private final String getBaseSaveDir ()
d228 1
a228 1
        return myProperties.getProperty("baseSaveDir");
a229 1

@


1.6
log
@As the comment says, no reason to delete the file from disk when it
has just been overwritten by the upload (IZ #2868).
@
text
@d78 1
a78 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.5 2001/03/07 01:53:24 lucas Exp $
a107 3
        // TODO: figure out better way to do this!
        //String msg = req.getParameter(Project.MESSAGE);
        //if (haveValue(msg)) appendToMessage(ctx, msg);
@


1.5
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d78 1
a78 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.4 2001/03/06 23:26:26 elicia Exp $
d223 1
a223 1
                dl.delete(acl, true, url);
@


1.5.2.1
log
@Merged in bug fixes and clean up from HEAD.
@
text
@d78 1
a78 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.6 2001/03/28 19:08:04 dlr Exp $
d223 1
a223 1
                dl.delete(acl, false, url);
@


1.5.2.1.4.1
log
@Refactored to not delete database entries, to make use of new ProjectFileArtifactAdd class, and to sync w/ changed APIs.
@
text
@d17 1
a17 1
 * software developed by CollabNet (http://www.collab.net/)."
d27 1
a27 1
 * permission of CollabNet.
d58 1
d61 1
a61 1
import org.webmacro.servlet.*;
d63 1
a63 1
import com.oreilly.servlet.MultipartRequest;
d66 1
a67 1

d69 2
a70 4
import org.tigris.helm.om.Project;
import org.tigris.helm.om.ProjectDownload;
import org.tigris.helm.om.ProjectDownloadPeer;
import org.tigris.helm.om.User;
a71 1
import org.tigris.helm.tool.FileArtifactTool;
d78 1
a78 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.9 2001/04/24 03:49:23 dlr Exp $
d80 1
a80 1
public class ProjectDownloadAdd extends ProjectFileArtifactAdd
d101 1
a101 1
        throws HandlerException, RedirectException
d108 3
d148 1
a148 1
                        processUpload(ctx, project, (File) files.get(0), 
d195 1
d197 1
a197 1
     * Processes the registration of a single file artifact.
d199 3
a201 3
    protected void processUpload(WebContext ctx, Project project,
                                 File artifactFile,
                                 String descrip, String isPublic)
d206 1
a206 3
        String url = URL.schemeAndServer(ctx) + "/servlets/" +
            getArtifactListServletName();
        String fileName = artifactFile.getName();
d209 19
a227 13
        ProjectDownload artifact =
            ProjectDownloadPeer.getInstanceByFileName(project, user, fileName);
        if (artifact == null)
        {
            ProjectDownload.add(acl, project, descrip, artifactFile, isPublic,
                                url);
        }
        else
        {
            // Found a matching download in the DB...replacing.
            appendToMessage(ctx, artifactFile + " was overwritten " +
                            "by your upload");
            artifact.edit(acl, descrip, user, isPublic, url, artifactFile);
d230 3
a232 1
        redirectToURL(ctx, getArtifactListServletName());
d235 5
a239 1
    protected final String getArtifactListServletName()
d241 1
a241 1
        return "ProjectDownloadList";
d243 1
@


1.5.2.1.4.2
log
@ProjectFileArtifactAdd renamed to FileArtifactManipulate--changed
super class as appropriate.
@
text
@d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.5.2.1.4.1 2001/04/24 20:57:40 dlr Exp $
d82 1
a82 1
public class ProjectDownloadAdd extends FileArtifactManipulate
@


1.5.2.1.4.3
log
@* Removed extraneous debug trace.

* Check file name for validity when processing file.  Redirect on
success; otherwise, delete uploaded file and notify user of validtion
errors.
@
text
@d80 1
a80 1
 * @@version $Id: ProjectDownloadAdd.java,v 1.5.2.1.4.2 2001/06/04 05:37:53 dlr Exp $
d190 1
d202 4
d207 5
a211 1
        if (isValidFileName(fileName))
d213 2
a214 23
            User user = getLoginUser(ctx);
            AccessControlList acl = user.getACL();
            String url = URL.schemeAndServer(ctx) + "/servlets/" +
                getArtifactListServletName();

            // Check for overwritten files.
            ProjectDownload artifact =
                ProjectDownloadPeer.getInstanceByFileName(project, user,
                                                          fileName);
            if (artifact == null)
            {
                ProjectDownload.add(acl, project, descrip, artifactFile,
                                    isPublic, url);
            }
            else
            {
                // Found a matching download in the DB...replacing.
                appendToMessage(ctx, artifactFile + " was overwritten " +
                                "by your upload");
                artifact.edit(acl, descrip, user, isPublic, url, artifactFile);
            }

            redirectToURL(ctx, getArtifactListServletName());
d218 4
a221 2
            appendToError(ctx, "Invalid file name '" + fileName + '\'');
            artifactFile.delete();
d223 2
@


1.4
log
@added methods to process new downlaods
@
text
@a69 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d78 1
a78 1
 * @@version $Id: ProjectDownloadList.java,v 1.2 2001/02/21 03:02:29 edk Exp $
@


1.3
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.
d32 1
a32 1
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
d52 2
d55 2
a56 2
import javax.servlet.*;
import javax.servlet.http.*;
a57 1
import org.webmacro.util.Log;
d59 5
a64 1
import org.joist.*;
a65 3
import org.joist.session.SessionManager;
import org.joist.database.DataManager;
import org.joist.security.RedirectException;
d67 7
a73 1
import org.tigris.helm.security.HelmServlet;
d76 5
a80 3
 * ProjectDownload will be the main display page.  Uploads will be
 * submitted to ProjectDownloadAdd, which will do its thing and do
 * a server-side redirect back to ProjectDownload.
d84 4
a87 1
    public static final String versionID = "$Id: ProjectDownloadAdd.java,v 1.1.1.1 2000/11/12 21:16:03 dlr Exp $";
d89 4
a92 1
    private static Log log = new Log("ProjectDownloadAdd", "Tigris StartPage");
d94 4
a97 1
    private static final boolean debug = true;
d100 1
a100 1
     * Handles project downloads addition.
d103 1
a103 1
        throws HandlerException, RedirectException
a104 1
        if (debug) log.info("started");
d107 6
a112 5
        HttpServletRequest request = ctx.getRequest();
        HttpServletResponse response = ctx.getResponse();
        HttpSession session = ctx.getSession();
        SessionManager sMgr = getSessionManager(ctx);
        DataManager dMgr = sMgr.getDataManager();
d114 59
a172 2
        String action = (String)ctx.get("action");
        if (debug) log.info("action=" + action);
d174 10
a183 1
        try
d185 1
a185 4
            String userID = sMgr.getUserID();
            if (debug) log.info("userID=" + userID);
            String loginID = sMgr.getLoginID();
            if (debug) log.info("loginID=" + loginID);
d189 3
a191 5
            log.exception(e);
            String msg = "Couldn't accept upload: " + e.getMessage();
            if (debug) log.info(msg);
            appendToMessage(ctx, msg);
        }    
d193 1
a193 1
        if (debug) log.info("done");
d196 50
@


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


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
@d74 1
a74 1
    public static final String versionID = "$Id: ProjectDownloadAdd.java,v 1.1 2000/11/12 21:16:03 dlr Exp $";
@


1.1
log
@Initial revision
@
text
@d74 1
a74 1
    public static final String versionID = "$Id: ProjectDownloadAdd.java,v 1.7 2000/11/09 02:39:55 dlr Exp $";
@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@@


1.1.1.1.6.1
log
@moved changed from HEAD for ProjectDocuments and ProjectDownloads
@
text
@d74 1
a74 1
    public static final String versionID = "$Id: ProjectDownloadAdd.java,v 1.3 2001/01/26 18:29:04 edk Exp $";
@

