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


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

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

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

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

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

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

1.9
date	2001.04.17.00.19.40;	author leonardr;	state Exp;
branches;
next	1.8;

1.8
date	2001.03.23.00.03.08;	author leonardr;	state Exp;
branches;
next	1.7;

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

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

1.5
date	2001.01.26.18.29.04;	author edk;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2001.01.26.05.24.06;	author edk;	state dead;
branches;
next	1.3;

1.3
date	2001.01.22.22.26.05;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2001.01.22.22.01.39;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2001.01.22.21.12.36;	author leonardr;	state Exp;
branches
	1.1.1.1;
next	;

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

1.5.2.1
date	2001.01.28.01.02.18;	author dlr;	state dead;
branches;
next	1.5.2.2;

1.5.2.2
date	2001.02.20.00.06.11;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.15
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
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.host;

import java.util.*;
import java.sql.*;
import javax.servlet.http.*;

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

import org.apache.velocity.context.Context;

import org.tigris.helm.om.MessagePeer;
import org.tigris.helm.tool.ContextAPI;

import org.tigris.helm.security.HelmServlet;
import org.tigris.helm.security.RedirectException;

/**
  * Allows a domain administrator to enter a message to be broadcast to
  * all users.
  *
  * @@author <a href="mailto:davidp@@collab.net">David C. Pellegrini</a>
  * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson</a>
  * @@version $Revision: 1.14 $
  *
  * Copyright (c) 1999 dataweb systems, inc.
  * Copyright (c) 1999-2001 CollabNet, Inc.  
  */
public class BroadcastMessage extends HelmServlet 
{
    private static final boolean DEBUG = true;
   
    private static final String NEW_MESSAGE_KEY = "broadcastMessage";

    /**
     *  Allows the administrator to set and clear broadcast messages.
     * @@param    connection  A connection to a JDBC database
     * @@param    context  A Context partially populated by WMServlet
     * @@return    the template name
     * @@exception    HandlerException
     * @@exception    RedirectException
     */
    protected String processRequest(Context context)
        throws NestableException, RedirectException
    {
        // Let the superclass do its part.
        String templateName = super.processRequest(context);

        // Determine which button was pushed
        String action = getAction(context);

        // Handle the button request
        try
        {
            // Set the broadcast message.
            if (action.equals("Broadcast"))
            {
                String message = ContextAPI.processField
                    (context, NEW_MESSAGE_KEY, "");
                MessagePeer.setBroadcastMessage(message);
                action = "View";
            }

            // Clear the broadcast message
            if (action.equals("Clear"))
            {
                MessagePeer.clearBroadcastMessage();
                action = "View";
            }

            // Display the current message, if any.
            String msg = MessagePeer.getBroadcastMessage().getMessageText();
            if (msg == null) msg = "";
            context.put(BROADCAST_MESSAGE_KEY, msg);
        }
        catch (Exception e)
        {
            String errMsg = "Broadcast message error: " + e.getMessage();
            Log.error(errMsg, e);
            throw new NestableException(e);
        }

        return templateName;
    }
}
@


1.14
log
@Removed Joist references.
@
text
@d54 1
a54 1
import org.apache.turbine.util.TurbineException;
d70 1
a70 1
  * @@version $Revision: 1.13 $
d90 1
a90 1
        throws TurbineException, RedirectException
d126 1
a126 1
            throw new TurbineException(e);
@


1.13
log
@Ported Joist Redirect*Exception to Helm.
@
text
@a57 2
import org.joist.util.*;

d70 1
a70 1
  * @@version $Revision: 1.12 $
@


1.12
log
@Ported servlet to new error-handling mechanism.
@
text
@a54 1
import org.apache.turbine.util.TurbineException;
a57 1
import org.joist.security.*;
d59 1
d64 1
d72 1
a72 1
  * @@version $Revision: 1.11 $
@


1.11
log
@Ported Helm from WebMacro to Velocity.
@
text
@d62 1
d72 1
a72 1
  * @@version $Revision: 1.10 $
d106 2
a107 1
                String message = processField(context, NEW_MESSAGE_KEY, "");
@


1.10
log
@Cleaned up.
@
text
@d54 2
d57 1
a57 1
import org.webmacro.servlet.*;
d71 1
a71 1
  * @@version $Revision: 1.9 $
d85 1
a85 1
     * @@param    context  A WebContext partially populated by WMServlet
d90 2
a91 2
    protected String processRequest (Connection connection, WebContext context)
        throws HandlerException, RedirectException
d94 1
a94 1
        String templateName = super.processRequest(connection, context);
d126 1
a126 1
            throw new HandlerException(errMsg);
@


1.9
log
@Moved from Message, the last of the Joist tables, to HELM_MESSAGE. A few minor problems with Joist servlets remain.
@
text
@d69 1
a69 1
  * @@version $Revision: 1.8 $
d82 5
a86 5
     * @@param	connection  A connection to a JDBC database
     * @@param	context  A WebContext partially populated by WMServlet
     * @@return	the template name
     * @@exception	HandlerException
     * @@exception	RedirectException
d89 1
a89 1
	throws HandlerException, RedirectException
d91 2
a92 2
	// Let the superclass do its part.
	String templateName = super.processRequest(connection, context);
d94 2
a95 2
	// Determine which button was pushed
	String action = getAction(context);
d97 6
a102 6
	// Handle the button request
	try
	{
	    // Set the broadcast message.
	    if (action.equals("Broadcast"))
	    {
d104 10
a113 10
		MessagePeer.setBroadcastMessage(message);
		action = "View";
	    }

	    // Clear the broadcast message
	    if (action.equals("Clear"))
	    {
		MessagePeer.clearBroadcastMessage();
		action = "View";
	    }
d115 1
a115 1
	    // Display the current message, if any.
d124 1
a124 1
	    throw new HandlerException(errMsg);
d127 1
a127 1
	return templateName;
@


1.8
log
@BroadcastMessage now requires Domain - Administrate, and there are now roles that actually have that permission.
@
text
@d59 1
a59 1
import org.joist.admin.MessageManager;
d68 2
a69 2
  * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson.net</a>
  * @@version $Revision: 1.7 $
d78 2
a93 3
	MessageManager mMgr = (MessageManager)getDataManager(context)
            .getManager("org.joist.admin.MessageManager");

d103 2
a104 1
		mMgr.setBroadcastMessage(connection, context);
d111 1
a111 1
		mMgr.clearBroadcastMessage(connection);
d116 1
a116 1
            String msg = mMgr.getBroadcastMessage(connection);
d118 1
a118 1
            context.put("broadcastMessage", msg);
@


1.7
log
@This is the highest revision from the HELM_PEER_PORT_BRANCH.  The previous import caused too many conflicts to resolve manually
@
text
@d64 1
a64 1
  * Allows a site administrator to enter a message to be broadcast to
d69 1
a69 1
  * @@version $Revision: 1.5.2.2 $
@


1.6
log
@Removed davidp-ism.  ;P
@
text
@d2 1
a2 1
 * Copyright (c) 2000 CollabNet.  All rights reserved.
d50 1
d53 3
a55 1
import java.sql.*;
a60 3
import org.webmacro.util.*;
import org.webmacro.servlet.*;

d67 3
a69 3
  * @@author David C. Pellegrini <A HREF="mailto:davidp@@collab.net">davidp@@collab.net</A>,
  * @@author Leonard Richardson <A HREF="mailto:leonardr@@collab.net">leonardr@@collab.net</A>,
  * @@version $Revision: 1.5 $
a73 1

d76 1
a76 2
    private static Log log = new Log("brdcast", "BroadcastMessage");
    private static final boolean debug = true;
d122 3
a124 4
            log.exception(e);
	    String message ="Broadcast: " + e.getMessage();
	    if (debug) log.debug(message);
	    throw new HandlerException(message);
@


1.5
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@d69 1
a69 1
  * @@version $Revision: 1.3 $
d77 2
a78 2
    static private Log log = new Log("brdcast", "BroadcastMessage");
    static private boolean debug = true;
@


1.5.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@d69 1
a69 1
  * @@version $Revision: 1.5 $
@


1.5.2.2
log
@Ported BroadcastMessage servlet, with latest changes from the HEAD.
MessageManager and supporting table needs to be merged into Helm as
well.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
a49 1
import java.sql.*;
d52 1
a52 3
import org.apache.turbine.util.Log;

import org.webmacro.servlet.*;
d58 3
d67 3
a69 3
  * @@author <a href="mailto:davidp@@collab.net">David C. Pellegrini</a>
  * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson.net</a>
  * @@version $Revision: 1.6 $
d74 1
d77 2
a78 1
    private static final boolean DEBUG = true;
d124 4
a127 3
            String errMsg = "Broadcast message error: " + e.getMessage();
            Log.error(errMsg, e);
	    throw new HandlerException(errMsg);
@


1.4
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
@@


1.3
log
@Catch the new exception thrown by Joist.
@
text
@d69 1
a69 1
  * @@version $Revision: 1.2 $
@


1.2
log
@Made the input box nicer.
@
text
@d69 1
a69 1
  * @@version $Revision: 1.1 $
d122 1
a122 1
        catch (SQLException e)
@


1.1
log
@BroadcastMessage servlet ported from Joist.
@
text
@d69 1
a69 1
  * @@version $Revision: 1.7 $
d118 3
a120 6
	    if (action.equals("View") || 
		action.equals("none"))
	    {
		context.put("broadcastMessage", 
			    mMgr.getBroadcastMessage(connection));
	    }
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
a49 1
import java.sql.*;
d52 1
a52 3
import org.apache.turbine.util.Log;

import org.webmacro.servlet.*;
d58 3
d67 3
a69 3
  * @@author <a href="mailto:davidp@@collab.net">David C. Pellegrini</a>
  * @@author <a href="mailto:leonardr@@collab.net">Leonard Richardson.net</a>
  * @@version $Revision: 1.5.2.2 $
d74 1
d77 2
a78 1
    private static final boolean DEBUG = true;
d118 6
a123 3
            String msg = mMgr.getBroadcastMessage(connection);
            if (msg == null) msg = "";
            context.put("broadcastMessage", msg);
d125 1
a125 1
        catch (Exception e)
d127 4
a130 3
            String errMsg = "Broadcast message error: " + e.getMessage();
            Log.error(errMsg, e);
	    throw new HandlerException(errMsg);
@


