head	1.8;
access;
symbols
	TIGRIS_1_1_0RC2:1.4
	TIGRIS_1_1_0RC1:1.4
	TIGRIS_1_1:1.4.0.4
	TIGRIS_1_0_8:1.4
	TIGRIS_1_0_8RC3:1.4
	TIGRIS_1_0_8RC2:1.4
	TIGRIS_1_0_8RC1:1.4
	TIGRIS_1_0_7:1.4
	TIGRIS_1_0_7RC3:1.4
	TIGRIS_1_0_7RC2:1.4
	TIGRIS_1_0_7RC1:1.4
	TIGRIS_1_0_6:1.4
	TIGRIS_1_0_6RC5:1.4
	TIGRIS_1_0_6RC4:1.4
	TIGRIS_1_0_6RC3:1.4
	TIGRIS_1_0_6RC2:1.4
	TIGRIS_1_0_6RC1:1.4
	TIGRIS_1_0_5:1.4
	TIGRIS_1_0_5RC6:1.4
	TIGRIS_1_0_5RC5:1.4
	TIGRIS_1_0_5RC4:1.4
	TIGRIS_1_0_5RC3:1.4
	TIGRIS_1_0_5RC2:1.4
	TIGRIS_1_0_5RC1:1.4
	TIGRIS_1_0_4:1.4
	TIGRIS_1_0_3:1.4
	TIGRIS_1_0_2:1.4
	TIGRIS_1_0_1:1.4
	TIGRIS_1_0:1.4.0.6
	TIGRIS_1_0_0:1.4
	TIGRIS_1_0_0_RC1:1.4.0.2
	dlr:1.1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1;
locks; strict;
comment	@# @;


1.8
date	2001.06.13.19.55.10;	author elicia;	state dead;
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.04.24.03.20.08;	author dlr;	state Exp;
branches;
next	1.5;

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

1.4
date	2001.03.07.01.53.24;	author lucas;	state Exp;
branches;
next	1.3;

1.3
date	2001.02.27.02.20.28;	author elicia;	state Exp;
branches;
next	1.2;

1.2
date	2001.02.21.01.08.23;	author dlr;	state Exp;
branches;
next	1.1;

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

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

1.1.2.1
date	2001.02.20.23.50.04;	author elicia;	state Exp;
branches;
next	;


desc
@@


1.8
log
@Deleting the deprecated ProjectDownload servlets. Pointing them at their ProjectDocument counterparts
@
text
@/* ================================================================
 * Copyright (c) 2000 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.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.turbine.util.*;
import org.apache.velocity.context.Context;

import com.workingdogs.village.*;

import org.joist.*;
import org.joist.util.*;
import org.tigris.helm.tool.SessionManager;
import org.joist.security.RedirectException;

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

public class ProjectDownloadApproval extends HelmServlet
{
    private static final boolean DEBUG = true;
    private static String DISAPPROVE_LIST="disapproveList";

    protected String processRequest(Context ctx)
	    throws TurbineException, RedirectException
    {
	    String templateName = super.processRequest(ctx);
	
	    String action = getAction(ctx);
	    if (DEBUG) Log.debug("ProjectDownloadApproval: action=" + action );

	    try
	    {
            boolean validAction = false;
            ArrayList disapproveList = new ArrayList();

            if (action.equals("none"))
            {
                validAction = true;
            }

            if (action.equals("Perform Actions"))
	        {
	        	validAction = true;
                User loginUser = getLoginUser(ctx);
		        Enumeration paramNames = getRequest(ctx).getParameterNames();
		        String paramName;

		        while (paramNames.hasMoreElements())
		        {
		            paramName = (String) paramNames.nextElement();
		            if (DEBUG) Log.debug("DLApproval: param name=" + paramName);
		            if (paramName.startsWith("action_"))
		            {
			            String desiredAction = getParameter(ctx, paramName);
			            if (DEBUG)
                        {
                           Log.debug("DLApproval: desired action=" +
                                     desiredAction);
                        }
			            String downloadID = paramName.substring(7);
                        if (DEBUG) Log.debug("downloadID=" + downloadID);

                        AccessControlList acl = loginUser.getACL();
                        ProjectDownload download = (ProjectDownload)
                            ProjectDownloadPeer.getInstance(downloadID);

			            if (desiredAction.equals("Approve"))
			            {
			               download.approve(acl);
			            }
			            if (desiredAction.equals("Disapprove"))
			            {
                           disapproveList.add((ProjectDownload)
                                               ProjectDownloadPeer
                                              .getInstance(downloadID));
			            }
		            }
		        }
                String url;
                Project currentProject = getCurrentProject(ctx);
                if (disapproveList.isEmpty())
                {
                    url = currentProject.getProjectPageURL
                          ("ProjectDownloadList").toString();
                } else {
                    url = currentProject.getProjectPageURL
                          ("ProjectDownloadApprovalReason").toString();
                    HttpSession session = getSessionManager(ctx).getSession();
                    session.putValue(DISAPPROVE_LIST, disapproveList); 
                }
		        redirectToURL(ctx, url);
	        } 

            if (!validAction) redirectToUnauthorized();
	    } 
        catch (RedirectException e)
        {
           throw e;
        }
        catch (Exception e)
        {
	       String message = "ProjectDownloadApproval: " + e.getMessage();
	       Log.error(message, e);
           throw new TurbineException(e);
        }

        return templateName;
    }
}
@


1.7
log
@Ported Helm from WebMacro to Velocity.
@
text
@@


1.6
log
@Removed duplicate import statement.
@
text
@d56 1
a56 1
import org.webmacro.servlet.*;
d62 1
a62 1
import org.joist.session.*;
d74 2
a75 2
    protected String processRequest (Connection conn, WebContext ctx)
	    throws HandlerException, RedirectException
d77 1
a77 1
	    String templateName = super.processRequest(conn, ctx);
d96 1
a96 2
		        Enumeration paramNames =
                    ctx.getRequest().getParameterNames();
d105 1
a105 1
			            String desiredAction = ctx.getForm(paramName);
d155 1
a155 1
           throw new HandlerException(message);
@


1.5
log
@Cleaned up outermost exception handling and some debug.
@
text
@d68 1
a68 1
import org.tigris.helm.om.*;
@


1.4
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d69 3
a71 2
public class ProjectDownloadApproval extends HelmServlet {
    private static boolean debug = true;
a76 2
	    if (debug) Log.debug("ProjectDownloadApproval: started!");

d79 2
a80 2
	    String action = (String)ctx.get("action");
	    if (debug) Log.debug("ProjectDownloadApproval: action=" + action );
d103 1
a103 1
		            if (debug) Log.debug("DLApproval: param name=" + paramName);
d107 5
a111 2
			            if (debug) 
                           Log.debug("DLApproval: desired action=" + desiredAction);
d113 1
a113 1
                        if (debug) Log.debug("downloadID=" + downloadID);
a153 1
	       Log.error(e);
d155 2
a156 2
	       if (debug) Log.debug(message);
	       ctx.put("message", message);
a158 2
        if (debug) Log.debug("ProjectDownloadApproval:  done");

d160 2
a161 3
   }
  
} /* end class ProjectDownloadApproval */
@


1.3
log
@added extra step to allow disapproving admin to provide reason for disapproval
@
text
@d68 1
a68 2
import org.tigris.helm.om.peer.*;

@


1.2
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d72 1
d87 1
a100 2
                String dlURL = 
                    URL.schemeAndServer(ctx) + "/servlets/ProjectDownload";
d124 3
a126 1
                           download.disapprove(acl, "", dlURL);
d130 1
d132 10
a141 1
                String url = currentProject.getProjectPageURL("ProjectDownloadList").toString();
@


1.1
log
@initial revision
@
text
@d55 1
a55 1
import org.webmacro.util.*;
a63 1
import org.joist.database.JoistDatabaseException;
d67 2
a68 2
import org.tigris.helm.project.Download;
import org.tigris.helm.domain.User;
a70 2
    public static final  String versionID = "$Id: ProjectDownloadApproval.java,v 1.6 2001/02/01 00:29:56 elicia Exp $";
    private static Log log = new Log("ProjectDownloadApproval", "DLApprvl");
a72 3
    /**
     * Process requests for download approval.
     */
d76 1
a76 1
	    if (debug) log.info("ProjectDownloadApproval: started!");
d81 1
a81 1
	    if (debug) log.info("ProjectDownloadApproval: action=" + action );
d99 3
d105 1
a105 1
		            if (debug) log.info("DLApproval: param name=" + paramName);
d110 1
a110 1
                           log.info("DLApproval: desired action=" + desiredAction);
d112 1
a112 1
                        if (debug) log.info("downloadID=" + downloadID);
d114 3
a116 3
                        AccessControlList acl = getACL(ctx, conn);
                        Download download = 
                            new Download(conn, dMgr, downloadID);
d124 1
a124 1
                           download.disapprove(acl, ctx);
d129 1
a129 1
                String url = currentProject.getProjectPageURL("ProjectDownload").toString();
d141 1
a141 1
	       log.exception(e);
d143 1
a143 1
	       if (debug) log.debug(message);
d147 1
a147 1
        if (debug) log.info("ProjectDownloadApproval:  done");
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d55 1
a55 1
import org.apache.turbine.util.*;
d64 1
d68 2
a69 2
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d72 2
d76 3
d82 1
a82 1
	    if (debug) Log.debug("ProjectDownloadApproval: started!");
d87 1
a87 1
	    if (debug) Log.debug("ProjectDownloadApproval: action=" + action );
a104 3
                String dlURL = 
                    URL.schemeAndServer(ctx) + "/servlets/ProjectDownload";

d108 1
a108 1
		            if (debug) Log.debug("DLApproval: param name=" + paramName);
d113 1
a113 1
                           Log.debug("DLApproval: desired action=" + desiredAction);
d115 1
a115 1
                        if (debug) Log.debug("downloadID=" + downloadID);
d117 3
a119 3
                        AccessControlList acl = loginUser.getACL();
                        ProjectDownload download = (ProjectDownload)
                            ProjectDownloadPeer.getInstance(downloadID);
d127 1
a127 1
                           download.disapprove(acl, "", dlURL);
d132 1
a132 1
                String url = currentProject.getProjectPageURL("ProjectDownloadList").toString();
d144 1
a144 1
	       Log.error(e);
d146 1
a146 1
	       if (debug) Log.debug(message);
d150 1
a150 1
        if (debug) Log.debug("ProjectDownloadApproval:  done");
@


1.1.2.1
log
@ported to turbine
@
text
@d55 1
a55 1
import org.apache.turbine.util.*;
d64 1
d68 2
a69 2
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d72 2
d76 3
d82 1
a82 1
	    if (debug) Log.debug("ProjectDownloadApproval: started!");
d87 1
a87 1
	    if (debug) Log.debug("ProjectDownloadApproval: action=" + action );
a104 3
                String dlURL = 
                    URL.schemeAndServer(ctx) + "/servlets/ProjectDownload";

d108 1
a108 1
		            if (debug) Log.debug("DLApproval: param name=" + paramName);
d113 1
a113 1
                           Log.debug("DLApproval: desired action=" + desiredAction);
d115 1
a115 1
                        if (debug) Log.debug("downloadID=" + downloadID);
d117 3
a119 3
                        AccessControlList acl = loginUser.getACL();
                        ProjectDownload download = (ProjectDownload)
                            ProjectDownloadPeer.getInstance(downloadID);
d127 1
a127 1
                           download.disapprove(acl, "", dlURL);
d132 1
a132 1
                String url = currentProject.getProjectPageURL("ProjectDownloadList").toString();
d144 1
a144 1
	       Log.error(e);
d146 1
a146 1
	       if (debug) Log.debug(message);
d150 1
a150 1
        if (debug) Log.debug("ProjectDownloadApproval:  done");
@

