head	1.16;
access;
symbols
	TIGRIS_1_1_0RC2:1.10
	TIGRIS_1_1_0RC1:1.10
	TIGRIS_1_1:1.10.0.4
	TIGRIS_1_0_8:1.10
	TIGRIS_1_0_8RC3:1.10
	TIGRIS_1_0_8RC2:1.10
	TIGRIS_1_0_8RC1:1.10
	TIGRIS_1_0_7:1.10
	TIGRIS_1_0_7RC3:1.10
	TIGRIS_1_0_7RC2:1.10
	TIGRIS_1_0_7RC1:1.10
	TIGRIS_1_0_6:1.10
	TIGRIS_1_0_6RC5:1.10
	TIGRIS_1_0_6RC4:1.10
	TIGRIS_1_0_6RC3:1.10
	TIGRIS_1_0_6RC2:1.10
	TIGRIS_1_0_6RC1:1.10
	TIGRIS_1_0_5:1.10
	TIGRIS_1_0_5RC6:1.10
	TIGRIS_1_0_5RC5:1.10
	TIGRIS_1_0_5RC4:1.10
	TIGRIS_1_0_5RC3:1.10
	TIGRIS_1_0_5RC2:1.10
	TIGRIS_1_0_5RC1:1.10
	TIGRIS_1_0_4:1.10
	TIGRIS_1_0_3:1.10
	TIGRIS_1_0_2:1.10
	TIGRIS_1_0_1:1.10
	TIGRIS_1_0:1.10.0.6
	TIGRIS_1_0_0:1.10
	TIGRIS_1_0_0_RC1:1.10.0.2
	dlr:1.1.1
	TIGRIS_0_9_2_4:1.3
	TIGRIS_0_9_2_3:1.3
	HELM_PEER_PORT_BRANCH:1.1.1.2
	TURBINE_PEER:1.8
	TIGRIS_0_9_2_1:1.8
	TIGRIS_0_9_2:1.3.0.6
	TIGRIS_0_9_0:1.3.0.4
	TIGRIS_0_8_4:1.3.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1;
locks; strict;
comment	@# @;


1.16
date	2001.08.28.17.45.17;	author leonardr;	state Exp;
branches;
next	1.15;

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

1.14
date	2001.07.24.00.02.28;	author leonardr;	state Exp;
branches;
next	1.13;

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

1.12
date	2001.07.10.20.54.22;	author leonardr;	state Exp;
branches;
next	1.11;

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

1.10
date	2001.03.07.01.53.25;	author lucas;	state Exp;
branches;
next	1.9;

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

1.8
date	2001.01.26.18.29.05;	author edk;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2001.01.26.05.24.06;	author edk;	state dead;
branches;
next	1.6;

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

1.5
date	2001.01.25.02.18.16;	author lucas;	state Exp;
branches;
next	1.4;

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

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

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

1.1
date	2000.11.12.21.16.15;	author dlr;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.16.15;	author dlr;	state Exp;
branches;
next	1.1.1.2;

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

1.8.2.1
date	2001.01.28.01.02.18;	author dlr;	state dead;
branches;
next	1.8.2.2;

1.8.2.2
date	2001.02.10.01.50.15;	author elicia;	state Exp;
branches;
next	1.8.2.3;

1.8.2.3
date	2001.02.15.20.50.42;	author leonardr;	state Exp;
branches;
next	1.8.2.4;

1.8.2.4
date	2001.02.16.03.01.34;	author dlr;	state Exp;
branches;
next	1.8.2.5;

1.8.2.5
date	2001.02.16.19.55.11;	author elicia;	state Exp;
branches;
next	;


desc
@@


1.16
log
@More methods migrated to ContextAPI.
@
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 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 javax.servlet.*;

import org.apache.velocity.context.Context;

import org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;

import org.tigris.helm.DoesNotExist;
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.tool.ContextAPI;

/**
 * Delete a news item.
 */
public class ProjectNewsDelete extends HelmServlet 
{
    private static final boolean DEBUG = true;
    private static final String CONFIRM_DELETE_ACTION = "Confirm Delete";
  
    protected String processRequest(Context context)
        throws NestableException, RedirectException 
    {
        
        String templateName = super.processRequest(context);
        
        String newsID = ContextAPI.getParameter(context, "newsID");
        
        if (newsID == null) 
        {
            ContextAPI.addFatalError(context, "No news item specified");
        }
        
        // Determine which button was pushed
        String action = (String)getAction(context);
        
        try 
        {
            Project currentProject = getCurrentProject(context);
            User loginUser = getLoginUser(context);
            AccessControlList acl = loginUser.getACL();
            NewsItem newsItem = (NewsItem)NewsItemPeer.getInstance(newsID);
            context.put("newsItem", newsItem);
            
            if (CONFIRM_DELETE_ACTION.equals(action))
            {                        
                newsItem.delete(acl);
                StringBuffer url = new StringBuffer("ProjectNewsList");
                url.append("?projectID=").append(currentProject.getID());
                redirectToURL(context, url.toString());
            }          
            
        } 
        catch (RedirectException e) 
        {
            throw e;
        } 
        catch (Exception e) 
        {
            throw new NestableException(e);
        }
        
        return templateName;
    }   
}
@


1.15
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@d76 1
a76 1
        String newsID = getParameter(context, "newsID");
@


1.14
log
@The final pieces of the error handling revolution.
@
text
@d55 1
a55 1
import org.apache.turbine.util.TurbineException;
d71 1
a71 1
        throws TurbineException, RedirectException 
d109 1
a109 1
            throw new TurbineException(e);
@


1.13
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d60 1
d80 1
a80 1
            appendToMessage(context, "No news item specified");
@


1.12
log
@Minor cleanup, and rethrowing of RedirectException.
@
text
@a50 1
import java.sql.*;
a55 3
import com.workingdogs.village.*;

import org.joist.security.*;
@


1.11
log
@Ported Helm from WebMacro to Velocity.
@
text
@a56 1
import org.apache.turbine.util.TurbineException;
d64 1
a64 1
import org.tigris.helm.om.*;
d68 4
a71 38
public class ProjectNewsDelete extends HelmServlet {

  private static final boolean debug = true;
  
  protected String processRequest(Context ctx)
    throws TurbineException, RedirectException {
    
      String templateName = super.processRequest(ctx);

      String newsID = getParameter(ctx, "newsID");
      
      if (newsID == null) {
          appendToMessage(ctx, "No news item specified");
      }
      
      // Determine which button was pushed
      String action = (String)getAction(ctx);

      try {
         Project currentProject = getCurrentProject(ctx);
         User loginUser = getLoginUser(ctx);
         AccessControlList acl = loginUser.getACL();
         NewsItem newsItem = (NewsItem)NewsItemPeer.getInstance(newsID);
         ctx.put("newsItem", newsItem);

         if (action.equals("Confirm Delete"))
         {                        
            newsItem.delete(acl);
            StringBuffer url = new StringBuffer("ProjectNewsList");
            url.append("?projectID=").append(currentProject.getID());
            redirectToURL(ctx, url.toString());
         }          

      } catch (DoesNotExist e) {
         throw new TurbineException(e);
      } catch (Exception e) {
         throw new TurbineException(e);
      }
d73 45
a117 3
      return templateName;
  }   
} /* end class ProjectNewsDelete */
@


1.10
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d53 1
a53 1
import org.webmacro.servlet.*;
d56 2
d73 2
a74 2
  protected String processRequest(Connection conn, WebContext ctx)
    throws HandlerException, RedirectException {
d76 1
a76 1
      String templateName = super.processRequest(conn, ctx);
d78 1
a78 1
      String newsID = ctx.getForm("newsID");
d103 1
a103 1
         throw new HandlerException(e.getMessage());
d105 1
a105 1
         throw new HandlerException(e.getMessage());
@


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

@


1.8
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.
a49 3
import org.webmacro.util.*;
import org.webmacro.servlet.*;

d51 1
a51 1
import javax.servlet.http.*;
d53 1
a53 1
import java.sql.*;
d55 1
d58 2
a59 1
import org.joist.security.RedirectException;
d61 4
a64 4
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.database.ProjectNewsManager;
import org.tigris.helm.domain.NewsItem;
import org.tigris.helm.security.AccessControlList;
a70 1
  private static Log log = new Log("projNewsdel", "Project News Delete");
d73 1
a73 1
  protected String processRequest(Connection conn, WebContext context)
d76 1
a76 1
      String templateName = super.processRequest(conn, context);
d78 1
a78 1
      String newsID = context.getForm("newsID");
d81 1
a81 1
          appendToMessage(context, "No news item specified");
d85 1
a85 5
      String action = (String) context.get("action");

      ProjectNewsManager newsMgr = (ProjectNewsManager)
        getDataManager (context).getManager
        ("org.tigris.helm.database.ProjectNewsManager");
d88 5
a92 3
         Project currentProject = getCurrentProject(context);
         NewsItem newsItem = new NewsItem(conn, dMgr, newsID);
         context.put("newsItem", newsItem);
d96 2
a97 2
            newsMgr.deleteNewsItem(conn, newsID);   
	    StringBuffer url = new StringBuffer("ProjectNews");
d99 1
a99 1
            redirectToURL(context, url.toString());
d104 1
a104 4
      } catch (SQLException e) {
         throw new HandlerException(e.getMessage());
      }
      catch (DataSetException e) {
@


1.8.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@@


1.8.2.2
log
@ported to turbine
@
text
@d50 3
d54 2
a57 3
import org.webmacro.servlet.*;

import org.apache.turbine.util.Log;
d60 1
a60 2
import org.joist.security.*;

d62 4
a65 3
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
d72 1
d75 1
a75 1
  protected String processRequest(Connection conn, WebContext ctx)
d78 1
a78 1
      String templateName = super.processRequest(conn, ctx);
d80 1
a80 1
      String newsID = ctx.getForm("newsID");
d83 1
a83 1
          appendToMessage(ctx, "No news item specified");
d87 5
a91 1
      String action = (String)getAction(ctx);
d94 3
a96 5
         Project currentProject = getCurrentProject(ctx);
         User loginUser = getLoginUser(ctx);
         AccessControlList acl = loginUser.getACL();
         NewsItem newsItem = (NewsItem)NewsItemPeer.getInstance(newsID);
         ctx.put("newsItem", newsItem);
d100 2
a101 2
            newsItem.delete(acl);
            StringBuffer url = new StringBuffer("ProjectNews");
d103 1
a103 1
            redirectToURL(ctx, url.toString());
d108 4
a111 1
      } catch (Exception e) {
@


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


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


1.8.2.5
log
@changed name of List page
@
text
@d97 1
a97 1
            StringBuffer url = new StringBuffer("ProjectNewsList");
@


1.7
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
@a63 1
import org.tigris.helm.database.DBException;
d95 1
a95 1
         NewsItem newsItem = new NewsItem(dMgr, newsID);
d100 1
a100 1
            newsMgr.deleteNewsItem(newsID);   
d108 4
a111 1
      } catch (DBException e) {
@


1.6
log
@no longer passing connection
@
text
@@


1.5
log
@helps to actual import the class
@
text
@d101 1
a101 1
            newsMgr.deleteNewsItem(conn, newsID);   
@


1.4
log
@fixed the catching of DBException
@
text
@d64 1
@


1.3
log
@modernized files--using NewsItem business object
@
text
@d95 1
a95 1
         NewsItem newsItem = new NewsItem(conn, dMgr, newsID);
d108 1
a108 4
      } catch (SQLException e) {
         throw new HandlerException(e.getMessage());
      }
      catch (DataSetException e) {
@


1.2
log
@using currentProject.getID() instead of getting projectID from the Form.
@
text
@d75 1
a75 1
  protected String processRequest(Connection connection, WebContext context)
d78 1
a78 1
      String templateName = super.processRequest(connection, context);
d95 2
a96 10
         DataSet newsItemSet = newsMgr.getNewsItem(connection, newsID);
         if (!newsItemSet.containsRecord(0))
         {
            appendToMessage(context, "News item does not exist.");
	 } 
	 else {
            Record r = newsItemSet.getRecord(0);
            NewsItem newsItem = new NewsItem(connection, dMgr, r);
            context.put("newsItem", newsItem);
	 }
d100 1
a100 1
            newsMgr.deleteNewsItem(connection, newsID);   
@


1.1
log
@Initial revision
@
text
@d94 1
d105 9
a121 13

      if (action.equals("Confirm Delete")) {                        
            
	 String projectID = context.getForm("projectID");
         try {
             newsMgr.deleteNewsItem(connection, newsID);   
         } catch (Exception e) {
             throw new HandlerException(e.getMessage());
         }
	StringBuffer url = new StringBuffer("ProjectNews");
        url.append("?projectID=").append(projectID);
        redirectToURL(context, url.toString());
      }          
@


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.2
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d50 3
d54 2
a57 3
import org.webmacro.servlet.*;

import org.apache.turbine.util.Log;
d60 1
a60 2
import org.joist.security.*;

d62 4
a65 4
import org.tigris.helm.security.*;
import org.tigris.helm.om.*;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
d72 1
d75 1
a75 1
  protected String processRequest(Connection conn, WebContext ctx)
d78 1
a78 1
      String templateName = super.processRequest(conn, ctx);
d80 1
a80 1
      String newsID = ctx.getForm("newsID");
d83 1
a83 1
          appendToMessage(ctx, "No news item specified");
d87 5
a91 1
      String action = (String)getAction(ctx);
d94 10
a103 14
         Project currentProject = getCurrentProject(ctx);
         User loginUser = getLoginUser(ctx);
         AccessControlList acl = loginUser.getACL();
         NewsItem newsItem = (NewsItem)NewsItemPeer.getInstance(newsID);
         ctx.put("newsItem", newsItem);

         if (action.equals("Confirm Delete"))
         {                        
            newsItem.delete(acl);
            StringBuffer url = new StringBuffer("ProjectNewsList");
            url.append("?projectID=").append(currentProject.getID());
            redirectToURL(ctx, url.toString());
         }          

d106 1
a106 1
      } catch (Exception e) {
d109 16
@

