head	1.16;
access;
symbols
	TIGRIS_1_1_0RC2:1.5.2.1.4.1
	TIGRIS_1_1_0RC1:1.5.2.1.4.1
	TIGRIS_1_1:1.5.2.1.4.1.0.2
	TIGRIS_1_0_8:1.5.2.1.4.1
	TIGRIS_1_0_8RC3:1.5.2.1.4.1
	TIGRIS_1_0_8RC2:1.5.2.1.4.1
	TIGRIS_1_0_8RC1:1.5.2.1.4.1
	TIGRIS_1_0_7:1.5.2.1.4.1
	TIGRIS_1_0_7RC3:1.5.2.1.4.1
	TIGRIS_1_0_7RC2:1.5.2.1.4.1
	TIGRIS_1_0_7RC1:1.5.2.1.4.1
	TIGRIS_1_0_6:1.5.2.1.4.1
	TIGRIS_1_0_6RC5:1.5.2.1.4.1
	TIGRIS_1_0_6RC4:1.5.2.1.4.1
	TIGRIS_1_0_6RC3:1.5.2.1.4.1
	TIGRIS_1_0_6RC2:1.5.2.1.4.1
	TIGRIS_1_0_6RC1:1.5.2.1.4.1
	TIGRIS_1_0_5:1.5.2.1
	TIGRIS_1_0_5RC6:1.5.2.1
	TIGRIS_1_0_5RC5:1.5.2.1
	TIGRIS_1_0_5RC4:1.5.2.1
	TIGRIS_1_0_5RC3:1.5.2.1
	TIGRIS_1_0_5RC2:1.5.2.1
	TIGRIS_1_0_5RC1:1.5.2.1
	TIGRIS_1_0_4:1.5.2.1
	TIGRIS_1_0_3:1.5.2.1
	TIGRIS_1_0_2:1.5.2.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
	dlr:1.1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1;
locks; strict;
comment	@# @;


1.16
date	2001.08.11.09.08.09;	author dlr;	state Exp;
branches;
next	1.15;

1.15
date	2001.08.03.00.37.00;	author ms;	state Exp;
branches;
next	1.14;

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

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

1.12
date	2001.06.20.01.49.32;	author ms;	state Exp;
branches;
next	1.11;

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

1.10
date	2001.05.21.20.37.57;	author ms;	state Exp;
branches;
next	1.9;

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

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

1.7
date	2001.05.05.08.43.59;	author ms;	state Exp;
branches;
next	1.6;

1.6
date	2001.03.28.01.58.02;	author ms;	state Exp;
branches;
next	1.5;

1.5
date	2001.03.27.13.20.16;	author ms;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2001.03.10.07.52.57;	author edk;	state Exp;
branches;
next	1.3;

1.3
date	2001.03.07.01.53.28;	author lucas;	state Exp;
branches;
next	1.2;

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

1.1
date	2001.02.13.12.26.39;	author ms;	state Exp;
branches
	1.1.1.1
	1.1.2.1;
next	;

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

1.1.2.1
date	2001.02.13.13.03.59;	author ms;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.13.13.19.38;	author ms;	state Exp;
branches;
next	;

1.5.2.1
date	2001.03.29.01.26.14;	author ms;	state Exp;
branches
	1.5.2.1.4.1;
next	;

1.5.2.1.4.1
date	2001.05.21.23.14.59;	author ms;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@package org.tigris.helm.tool.mail;

import java.sql.*;
import java.io.IOException;
import javax.servlet.http.*;

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

import org.apache.velocity.context.Context;

import com.quiotix.util.*;

import org.tigris.eyebrowse.EyebrowseDb;
import org.tigris.eyebrowse.core.SummarizeList;

import org.tigris.helm.security.RedirectException;

import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.MailingListPeer;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.om.Project;
import org.tigris.helm.tool.ContextAPI;

/** 
 * A thin wrapper for {@@link org.tigris.eyebrowse.core.SummarizeList}
 * designed to plug into the Tigris framework.
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbSummarizeList.java,v 1.15 2001/08/03 00:37:00 ms Exp $
 */
public class EbSummarizeList extends HelmServlet
{
  public static final int WINDOW_SIZE = 20;

  public String processRequest(Context context)
      throws NestableException, RedirectException
  {
      String templateName = super.processRequest(context);
      String listName = ContextAPI.getParameter(context, "listName");

      //verify that the list is in the same project as the current project.
      try
      {
          if (listName == null)
          {
              throw new NestableException("No list name specified");
          }
          Project currentProject = getCurrentProject(context);
          MailingList ml = MailingListPeer.getInstanceByName(currentProject,
                                                             listName);
          if (!ml.isViewableBy(getLoginUser(context).getACL()))
          {
              redirectToUnauthorized();
          }
          context.put("listName", ml.getAddress(null));
          context = SummarizeList.core(context);
          context.put("listName", listName);
          context.put("description", ml.getDescription());
       }
       catch (RedirectException e) 
       {
           throw e;
       }
       catch (Exception e)
       {
           throw new NestableException("Error verifying access", e);
       }
       String UserWarningMessage = PropUtil.getProperty("eyebrowse",
                                                        "UserWarningMessage",
                                                        "org.tigris.eyebrowse",
                                                        null);
       context.put("UserWarningMessage", UserWarningMessage);
       return templateName;
  }
}
@


1.15
log
@eyebrowse handles velocity now
@
text
@d8 1
a8 1
import org.apache.turbine.util.TurbineException;
d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.14 2001/07/23 20:32:56 dlr Exp $
d38 1
a38 1
      throws TurbineException, RedirectException
d48 1
a48 1
              throw new TurbineException("No list name specified");
d68 1
a68 1
           throw new TurbineException("Error verifying access", e);
@


1.14
log
@Removed Joist reference.
@
text
@a14 1
import org.tigris.eyebrowse.core.ContextAdaptor;
d23 1
d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.13 2001/07/18 10:05:16 dlr Exp $
d37 1
a37 1
  public String processRequest(Context ctx)
d40 2
a41 3
      String templateName = super.processRequest(ctx);
      ContextAdaptor context = new EbVelocityContext(ctx);
      String listName = context.getParameter("listName");
d50 1
a50 1
          Project currentProject = getCurrentProject(ctx);
d53 2
a54 1
          if (!ml.isViewableBy(getLoginUser(ctx).getACL()))
d56 1
a56 1

@


1.13
log
@Ported Joist Redirect*Exception to Helm.
@
text
@d26 2
a27 2
 * A thin wrapper for org.tigris.eyebrowse.core.SummarizeList
 * that is made to work for the joist framework.
d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.12 2001/06/20 01:49:32 ms Exp $
@


1.12
log
@very slight removal of coupling from eyebrowse into helm
@
text
@d18 1
a18 1
import org.joist.security.RedirectException;
d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.11 2001/05/23 01:50:22 dlr Exp $
@


1.11
log
@Ported Helm from WebMacro to Velocity.
@
text
@d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.10 2001/05/21 20:37:57 ms Exp $
a42 1
      context.put("listName", listName);
d57 1
a57 1
          context.put("fullListName", ml.getAddress(null));
d59 1
@


1.10
log
@used description from helm
@
text
@d7 2
a8 1
import org.joist.security.RedirectException;
d10 1
a10 2
import org.webmacro.servlet.WebContext;
import org.webmacro.servlet.HandlerException;
a14 1
import org.tigris.eyebrowse.EyebrowseWMContext;
d18 2
d31 1
a31 1
 * @@version $Id: EbSummarizeList.java,v 1.9 2001/05/21 17:19:41 dlr Exp $
d37 2
a38 2
  public String processRequest(Connection connection, WebContext ctx)
      throws HandlerException, RedirectException
d40 2
a41 2
      String templateName = super.processRequest(connection, ctx);
      ContextAdaptor context = new EyebrowseWMContext(ctx);
d50 1
a50 1
              throw new HandlerException("No listName specified");
d66 1
a66 1
           catch (Exception e)
d68 1
a68 4
           e.printStackTrace();
           throw new HandlerException(
                   "exception verifying access via MailingList obj: " +
                    e.getMessage());
a76 1

@


1.9
log
@HelmServlet methods take a specific type of context object, rather than the adaptor.
@
text
@d30 1
a30 1
 * @@version $Id: EbSummarizeList.java,v 1.8 2001/05/21 16:52:51 dlr Exp $
d59 1
@


1.8
log
@Made use of new ContextAdaptor class which was introduced so that EB could play nicely with other types of contexts.
@
text
@d30 1
a30 1
 * @@version $Id: EbSummarizeList.java,v 1.7 2001/05/05 08:43:59 ms Exp $
d51 1
a51 1
          Project currentProject = getCurrentProject(context);
d54 1
a54 1
          if (!ml.isViewableBy(getLoginUser(context).getACL()))
@


1.7
log
@skip out if the list isnt passed
@
text
@d12 7
a22 4
import com.quiotix.util.*;

import org.tigris.eyebrowse.core.SummarizeList;
import org.tigris.eyebrowse.EyebrowseDb;
d30 1
a30 1
 * @@version $Id: EbSummarizeList.java,v 1.6 2001/03/28 01:58:02 ms Exp $
d36 1
a36 1
  public String processRequest(Connection connection, WebContext context)
d39 3
a41 1
      String listName = context.getForm("listName");
a42 1
      String templateName = super.processRequest(connection, context);
@


1.6
log
@use method to get address that i didnt know of previously
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.5 2001/03/27 13:20:16 ms Exp $
d43 4
@


1.5
log
@Changed in eyebrowse the ability to lookup lists by both listId and by listName.
Greatly cleans up the coupling between the archives and helm IMO.

I also removed the useless projecID's in the templates.

This requires an update in eyebrowse also to compile.

note: SearchList is now a bit broken, will be fixed tomorow..

QA note. i tested this with two different lists, browsed by date author etc, it
showed no problems that dont already exist (date browsing).
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.4 2001/03/10 07:52:57 edk Exp $
d49 1
a49 4
          context.put("fullListName", 
                      ml.getEmailPrefix() + "@@" 
                      + currentProject.getName() + "." 
                      + getCurrentDomain(context).getName()); 
@


1.5.2.1
log
@Committing diff from head. basically more efficient gathering of
list address.
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.6 2001/03/28 01:58:02 ms Exp $
d49 4
a52 1
          context.put("fullListName", ml.getAddress(null));
@


1.5.2.1.4.1
log
@get description from helm
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.5.2.1 2001/03/29 01:26:14 ms Exp $
a50 1
          context.put("description", ml.getDescription());
@


1.4
log
@check isViewableBy, which helps us do a better job enforcing permissions
as well as the isPrivate flag
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.3 2001/03/07 01:53:28 lucas Exp $
d34 1
a34 1
    throws HandlerException, RedirectException
d36 7
a42 12
    try
    {
      if(context.getForm("listName") != null) {
        String listId = getListId(context.getForm("listName"));
        context.getResponse().
          sendRedirect("HelmSummarizeList?listId="+listId);
        return " ";
      } else {
        String templateName = super.processRequest(connection, context);
        String listId = context.getForm("listId");
        //verify that the list is in the same project as the current project.
        try {
d44 4
a47 23
          MailingList ml = MailingListPeer.getInstance(currentProject, listId);
          if (!ml.isViewableBy(getLoginUser(context).getACL())) {
            redirectToUnauthorized();
          }
        } catch (RedirectException e) {
          throw e;
        } catch (Exception e) {
          e.printStackTrace();
          throw new HandlerException(
              "exception verifying access via MailingList obj: " +
              e.getMessage());
        }
        context = SummarizeList.core(context);
        String UserWarningMessage = PropUtil.getProperty("eyebrowse",
            "UserWarningMessage", "org.tigris.eyebrowse", null);
        context.put("UserWarningMessage", UserWarningMessage);
        return templateName;
      }
    }catch(IOException ioError){
      ioError.printStackTrace();
    }
    return " ";
  }
d49 23
a71 30
  /**
   * Simple method to find listID in eyebrowse database that 
   * coorelates to the listName that came from the non-eyebrowse db.
   *
   * @@param listName the name of the list
   * @@return a String containing the listId
   */
  public String getListId(String listName)
  {
    ResultSet rs;
    EyebrowseDb connection;
    PreparedStatement ps;
    String listId="listNotFound";
    try
    {
      connection = EyebrowseDb.getConnection();
      ps  = connection.getJDBCConnection().
        prepareStatement("SELECT listId from List WHERE listName =?");
      ps.setString(1, listName);
      rs = ps.executeQuery();
      if (rs.next()) {
        listId = rs.getString(1);
      }
      rs.close();
    }
    catch (SQLException sqlError)
    {
      sqlError.printStackTrace();
    }
    return listId;
@


1.3
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.2 2001/02/21 01:08:26 dlr Exp $
d50 3
@


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
@d13 1
a13 1
import org.tigris.helm.om.peer.MailingListPeer;
a15 1

d27 1
a27 1
 * @@version $Id: EbSummarizeList.java,v 1.1.2.2 2001/02/13 13:19:38 ms Exp $
@


1.1
log
@Adding these to helm for logical organization and for build depdancy
flow. To install these servlets eyebrowse must be built and installed
with the helm top-level make target's "eyebrowse" and
"eyebrowse-install". If succesful these servlets will be installed also.
@
text
@a0 32
/*
 * Copyright (c) 2000, Quiotix Corporation
 *    All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 *    Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 *    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.
 * 
 *    Neither name of Quiotix Corporation nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS 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 THE COPYRIGHT
 * HOLDER OR 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.
 */

d3 3
a5 1
import org.tigris.helm.security.HelmServlet;
d7 1
a7 2
import org.tigris.helm.project.Project;
import org.tigris.helm.tool.mail.MailingList;
a8 1
import org.joist.security.RedirectException;
d12 6
a17 3
import java.sql.*;
import java.io.IOException;
import javax.servlet.http.*;
a20 1
import com.quiotix.util.*;
d24 5
a28 2
 * 
 * @@author Michael Salmon
d50 1
a50 2
          MailingList ml = new MailingList(connection,
              getDataManager(context), listId, currentProject);
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d1 32
d35 4
a38 3
import java.sql.*;
import java.io.IOException;
import javax.servlet.http.*;
a40 1

d44 3
a46 6
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.om.Project;

import com.quiotix.util.*;
d50 1
d54 2
a55 5
 * that is made to work for the joist framework.
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbSummarizeList.java,v 1.1.2.2 2001/02/13 13:19:38 ms Exp $
d77 2
a78 1
          MailingList ml = MailingListPeer.getInstance(currentProject, listId);
@


1.1.2.1
log
@Ported changes to HEAD to branch. Moved servlets into logical container
of org.tigris.helm.tool.mail and changed build system and jserv config
to match changes.
@
text
@@


1.1.2.2
log
@Merged Dlr's eyebrowse servlets that follow the peer model into helm.
@
text
@d1 32
d35 4
a38 3
import java.sql.*;
import java.io.IOException;
import javax.servlet.http.*;
a40 1

d44 3
a46 6
import org.tigris.helm.om.MailingList;
import org.tigris.helm.om.peer.MailingListPeer;
import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.om.Project;

import com.quiotix.util.*;
d50 1
d54 2
a55 5
 * that is made to work for the joist framework.
 *
 * @@author <a href="mailto:ms@@collab.net">Michael Salmon</a>
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: EbSummarizeList.java,v 1.4.6.1 2001/02/09 20:50:22 dlr Exp $
d77 2
a78 1
          MailingList ml = MailingListPeer.getInstance(currentProject, listId);
@


