head	1.16;
access;
symbols
	TIGRIS_1_1_0RC2:1.6.2.1
	TIGRIS_1_1_0RC1:1.6.2.1
	TIGRIS_1_1:1.6.2.1.0.2
	TIGRIS_1_0_8:1.6.2.1
	TIGRIS_1_0_8RC3:1.6.2.1
	TIGRIS_1_0_8RC2:1.6.2.1
	TIGRIS_1_0_8RC1:1.6.2.1
	TIGRIS_1_0_7:1.6.2.1
	TIGRIS_1_0_7RC3:1.6.2.1
	TIGRIS_1_0_7RC2:1.6.2.1
	TIGRIS_1_0_7RC1:1.6.2.1
	TIGRIS_1_0_6:1.6.2.1
	TIGRIS_1_0_6RC5:1.6.2.1
	TIGRIS_1_0_6RC4:1.6.2.1
	TIGRIS_1_0_6RC3:1.6.2.1
	TIGRIS_1_0_6RC2:1.6.2.1
	TIGRIS_1_0_6RC1:1.6.2.1
	TIGRIS_1_0_5:1.6.2.1
	TIGRIS_1_0_5RC6:1.6.2.1
	TIGRIS_1_0_5RC5:1.6.2.1
	TIGRIS_1_0_5RC4:1.6.2.1
	TIGRIS_1_0_5RC3:1.6.2.1
	TIGRIS_1_0_5RC2:1.6.2.1
	TIGRIS_1_0_5RC1:1.6.2.1
	TIGRIS_1_0_4:1.6.2.1
	TIGRIS_1_0_3:1.6.2.1
	TIGRIS_1_0_2:1.6.2.1
	TIGRIS_1_0_1:1.6.2.1
	TIGRIS_1_0:1.6.2.1.0.4
	TIGRIS_1_0_0:1.6.2.1
	TIGRIS_1_0_0_RC1:1.6.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.18.10.05.16;	author dlr;	state Exp;
branches;
next	1.13;

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

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

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

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

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

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

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

1.6
date	2001.03.27.20.30.21;	author ms;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2001.03.27.13.25.36;	author ms;	state Exp;
branches;
next	1.4;

1.4
date	2001.03.27.13.20.16;	author ms;	state Exp;
branches;
next	1.3;

1.3
date	2001.03.10.07.52.57;	author edk;	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.24;	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.6.2.1
date	2001.03.29.01.26.14;	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 org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;

import org.apache.velocity.context.Context;

import org.tigris.helm.security.RedirectException;

import org.tigris.helm.security.HelmServlet;

import org.tigris.eyebrowse.core.SearchList;

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

import com.quiotix.util.*;


/**
 * SearchListServlet
 * 
 * A WebMacro servlet which searches an (indexed) list, and 
 * puts into the webmacro context a list of messages which 
 * match the specified search query.
 * 
 * The servlet takes the following input parameters:
 * listId:       List ID of the desired list to search
 * searchText:   A search query
 * defaultField: The default message field to search (supported
 *               values are subject, author, and body)
 * 
 * The servlet deposits into the webmacro context the following items:
 * listInfo:     A ListInfo object describing the list
 * searchText:   The value of the input searchText parameter
 * errorMessage: An error message, if there was an error
 * hits:         An array of MessageInfo objects, if there was
 *               no error.
 * 
 * @@author Brian Goetz - Quiotix Corp
 * @@version 1.0
 */
public class EbSearchList extends HelmServlet
{
    public String processRequest(Context context)
        throws NestableException, RedirectException 
    {
        String templateName = super.processRequest(context);
        String listName = ContextAPI.getParameter(context, "listName");
        context.put("searchString", 
                    ContextAPI.getParameter(context, "searchString"));

        //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("fullListName", ml.getAddress(null));
            context = SearchList.core(context);
            context.put("listName", listName);
        }
        catch (RedirectException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            throw new NestableException("Error verifying access", e);
        }
        return templateName;
    }
}
@


1.15
log
@eyebrowse handles velocity now
@
text
@d4 1
a4 1
import org.apache.turbine.util.TurbineException;
d48 1
a48 1
        throws TurbineException, RedirectException 
d60 1
a60 1
                throw new TurbineException("No list name specified");
d79 1
a79 1
            throw new TurbineException("Error verifying access", e);
@


1.14
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a11 2
import org.tigris.eyebrowse.EyebrowseWMContext;
import org.tigris.eyebrowse.core.ContextAdaptor;
d17 1
d47 1
a47 1
    public String processRequest(Context ctx)
d50 4
a53 4
        String templateName = super.processRequest(ctx);
        ContextAdaptor context = new EbVelocityContext(ctx);
        String listName = context.getParameter("listName");
        context.put("listName", listName);
d62 1
a62 1
            Project currentProject = getCurrentProject(ctx);
d65 1
a65 1
            if (!ml.isViewableBy(getLoginUser(ctx).getACL()))
d71 1
@


1.13
log
@Ported Helm from WebMacro to Velocity.
@
text
@d8 1
a8 1
import org.joist.security.RedirectException;
@


1.12
log
@description not used in these servlets.
@
text
@d3 5
a7 1
import org.tigris.helm.security.HelmServlet;
a8 1
import java.sql.Connection;
d10 1
a10 2
import org.webmacro.servlet.HandlerException;
import org.webmacro.servlet.WebContext;
d48 2
a49 2
    public String processRequest(Connection connection, WebContext ctx)
        throws HandlerException, RedirectException 
d51 2
a52 2
        String templateName = super.processRequest(connection, ctx);
        ContextAdaptor context = new EyebrowseWMContext(ctx);
d61 1
a61 1
                throw new HandlerException("No listName specified");
d79 1
a79 4
            e.printStackTrace();
            throw new HandlerException(
                    "exception verifying access via MailingList obj: " +
                    e.getMessage());
a82 1

@


1.11
log
@used description from helm
@
text
@a69 1
            context.put("description", ml.getDescription());
@


1.10
log
@HelmServlet methods take a specific type of context object, rather than the adaptor.
@
text
@d70 1
@


1.9
log
@Made use of new ContextAdaptor class which was introduced so that EB could play nicely with other types of contexts.
@
text
@d61 1
a61 1
            Project currentProject = getCurrentProject(context);
d64 1
a64 1
            if (!ml.isViewableBy(getLoginUser(context).getACL()))
@


1.8
log
@skip out if the list isnt passed
@
text
@d10 2
d46 1
a46 1
    public String processRequest(Connection connection, WebContext context) 
d49 3
a51 2
        String templateName = super.processRequest(connection, context);
        String listName = context.getForm("listName");
@


1.7
log
@use method to get address that i didnt know of previously
@
text
@d54 4
@


1.6
log
@Fixed searching by listname not id, please up Eyebrowse to get working.
@
text
@d61 1
a61 6
            context.put("fullListName",
                         ml.getEmailPrefix() + "@@"
                         + currentProject.getName()
                         + "." + getCurrentDomain(context).getName()
                        );
            
@


1.6.2.1
log
@Committing diff from head. basically more efficient gathering of
list address.
@
text
@d61 6
a66 1
            context.put("fullListName", ml.getAddress(null));
@


1.5
log
@fixed method call error, whoops !
@
text
@d44 37
a80 20
  public String processRequest(Connection connection, WebContext context) 
    throws HandlerException, RedirectException 
  {
    String templateName = super.processRequest(connection, context);
    context = SearchList.core(context);
    String listName = context.getForm("listName");
    context.put("listName", listName);
    try { //verify that the list is in the same project as the current project.
      Project currentProject = getCurrentProject(context);
      MailingList ml = MailingListPeer.getInstanceByName(currentProject, listName);
      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());
d82 1
a82 2
    return templateName;
  }
@


1.4
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
@d53 1
a53 1
      MailingList ml = MailingListPeer.getInstance(currentProject, listId);
@


1.3
log
@check isViewableBy, which helps us do a better job enforcing permissions
as well as the isPrivate flag
@
text
@d49 2
a50 1
    String listId = context.getForm("listId");
@


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
@d12 4
d47 19
a65 4
      String templateName = super.processRequest(connection, context);
      context = SearchList.core(context);
      return templateName;
   }
@


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.
 */

d18 16
a33 2
 * see org.tigris.eyebrowse.core.SearchList for data put in context
 * @@author Michael Salmon - CollabNet
d35 2
a37 1

@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d1 32
d50 2
a51 16
 * A WebMacro servlet which searches an (indexed) list, and 
 * puts into the webmacro context a list of messages which 
 * match the specified search query.
 * 
 * The servlet takes the following input parameters:
 * listId:       List ID of the desired list to search
 * searchText:   A search query
 * defaultField: The default message field to search (supported
 *               values are subject, author, and body)
 * 
 * The servlet deposits into the webmacro context the following items:
 * listInfo:     A ListInfo object describing the list
 * searchText:   The value of the input searchText parameter
 * errorMessage: An error message, if there was an error
 * hits:         An array of MessageInfo objects, if there was
 *               no error.
a52 2
 * @@author Brian Goetz - Quiotix Corp
 * @@version 1.0
d54 1
@


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
d50 2
a51 16
 * A WebMacro servlet which searches an (indexed) list, and 
 * puts into the webmacro context a list of messages which 
 * match the specified search query.
 * 
 * The servlet takes the following input parameters:
 * listId:       List ID of the desired list to search
 * searchText:   A search query
 * defaultField: The default message field to search (supported
 *               values are subject, author, and body)
 * 
 * The servlet deposits into the webmacro context the following items:
 * listInfo:     A ListInfo object describing the list
 * searchText:   The value of the input searchText parameter
 * errorMessage: An error message, if there was an error
 * hits:         An array of MessageInfo objects, if there was
 *               no error.
a52 2
 * @@author Brian Goetz - Quiotix Corp
 * @@version 1.0
d54 1
@


