implemented Conference E-Mail - automagically send E-mail to all readers
or posters in a conference or topic
This commit is contained in:
@@ -158,6 +158,7 @@ public class ConfOperations extends VeniceServlet
|
||||
* E = Edit Conference Settings (requires conference parameter)
|
||||
* FX = Fixseen (requires conference parameter)
|
||||
* H = Add Conference to Hotlist (requires conference parameter)
|
||||
* I = Conference E-Mail (requires conference parameter)
|
||||
* M = Manage Conference Membership (requires conference parameter)
|
||||
* Q = Display Conference Manage menu (requires conference parameter)
|
||||
* RP = Report on Posters (requires conference parameter)
|
||||
@@ -589,6 +590,30 @@ public class ConfOperations extends VeniceServlet
|
||||
|
||||
} // end if ("H" command)
|
||||
|
||||
if (cmd.equals("I"))
|
||||
{ // "I" = "Conference E-Mail" (requires conference parameter)
|
||||
ConferenceContext conf = getConferenceParameter(request,comm,true,on_error);
|
||||
on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q";
|
||||
|
||||
try
|
||||
{ // return the conference E-mail view
|
||||
return new ConferenceEMail(comm,conf);
|
||||
|
||||
} // end try
|
||||
catch (DataException de)
|
||||
{ // something wrong in the database
|
||||
return new ErrorBox("Database Error","Database error getting topic list " + de.getMessage(),
|
||||
on_error);
|
||||
|
||||
} // end catch
|
||||
catch (AccessError ae)
|
||||
{ // some lack of access is causing problems
|
||||
return new ErrorBox("Access Error",ae.getMessage(),on_error);
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if ("I" command)
|
||||
|
||||
if (cmd.equals("DEL"))
|
||||
{ // "DEL" = "Delete Conference (requires conference parameter)
|
||||
ConferenceContext conf = getConferenceParameter(request,comm,true,on_error);
|
||||
@@ -1040,6 +1065,80 @@ public class ConfOperations extends VeniceServlet
|
||||
|
||||
} // end if ("M" command)
|
||||
|
||||
if (cmd.equals("I"))
|
||||
{ // "I" = "Conference E-Mail"
|
||||
ConferenceContext conf = getConferenceParameter(request,comm,true,on_error);
|
||||
on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=I";
|
||||
|
||||
if (isImageButtonClicked(request,"cancel")) // "Cancel" button pressed - bail out
|
||||
throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID()
|
||||
+ "&cmd=Q");
|
||||
|
||||
if (isImageButtonClicked(request,"send"))
|
||||
{ // OK, figure out who we want to send E-mail to
|
||||
try
|
||||
{ // retrieve the topic we want to send to
|
||||
TopicContext topic = null;
|
||||
String s = request.getParameter("top");
|
||||
if ((s!=null) && !(s.equals("0")))
|
||||
topic = conf.getTopic(Short.parseShort(s));
|
||||
|
||||
// retrieve other parameters
|
||||
final String ZERO = "0";
|
||||
boolean posters = ZERO.equals(request.getParameter("porl"));
|
||||
final String YES = "Y";
|
||||
int ndays = -1;
|
||||
if (YES.equals(request.getParameter("xday")))
|
||||
{ // they selected "within the last X days"
|
||||
try
|
||||
{ // parse the number of days
|
||||
s = request.getParameter("day");
|
||||
if (s!=null)
|
||||
ndays = Integer.parseInt(s);
|
||||
else
|
||||
ndays = 0;
|
||||
|
||||
} // end try
|
||||
catch (NumberFormatException nfe)
|
||||
{ // always fail safe when doing e-mail parameters!
|
||||
ndays = 0;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
|
||||
if (topic!=null)
|
||||
topic.sendMailToParticipants(posters,ndays,request.getParameter("subj"),
|
||||
request.getParameter("pb"));
|
||||
else
|
||||
conf.sendMailToParticipants(posters,ndays,request.getParameter("subj"),
|
||||
request.getParameter("pb"));
|
||||
|
||||
} // end try
|
||||
catch (AccessError ae)
|
||||
{ // some sort of access error - display an error dialog
|
||||
return new ErrorBox("Access Error",ae.getMessage(),on_error);
|
||||
|
||||
} // end catch
|
||||
catch (DataException de)
|
||||
{ // database error creating the conference
|
||||
return new ErrorBox("Database Error","Database error sending E-mail: " + de.getMessage(),
|
||||
on_error);
|
||||
|
||||
} // end catch
|
||||
|
||||
// all done - bounce back to the menu
|
||||
throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID()
|
||||
+ "&cmd=Q");
|
||||
|
||||
} // end if ("send" pressed)
|
||||
|
||||
// we don't know what button was pressed
|
||||
logger.error("no known button click on ConfOperations.doPost, cmd=I");
|
||||
return new ErrorBox("Internal Error","Unknown command button pressed",on_error);
|
||||
|
||||
} // end if ("I" command)
|
||||
|
||||
// unrecognized command!
|
||||
logger.error("invalid command to ConfOperations.doPost: " + cmd);
|
||||
return new ErrorBox("Internal Error","Invalid command to ConfOperations.doPost",on_error);
|
||||
|
||||
152
src/com/silverwrist/venice/servlets/format/ConferenceEMail.java
Normal file
152
src/com/silverwrist/venice/servlets/format/ConferenceEMail.java
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.servlets.format;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
import com.silverwrist.venice.except.*;
|
||||
|
||||
public class ConferenceEMail implements JSPRender
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Attribute name for request attribute
|
||||
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceEMail";
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private CommunityContext comm; // the community we're in
|
||||
private ConferenceContext conf; // the conference being listed
|
||||
private List topics; // list of topics in that conference
|
||||
private String locator = null; // locator string
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public ConferenceEMail(CommunityContext comm, ConferenceContext conf) throws DataException, AccessError
|
||||
{
|
||||
this.comm = comm;
|
||||
this.conf = conf;
|
||||
this.topics = conf.getTopicList(ConferenceContext.DISPLAY_ALL,ConferenceContext.SORT_NAME);
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External static functions
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static ConferenceEMail retrieve(ServletRequest request)
|
||||
{
|
||||
return (ConferenceEMail)(request.getAttribute(ATTR_NAME));
|
||||
|
||||
} // end retrieve
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VeniceContent
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getPageTitle(RenderData rdat)
|
||||
{
|
||||
return "Conference E-Mail: " + conf.getName();
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
return null;
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface JSPRender
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void store(ServletRequest request)
|
||||
{
|
||||
request.setAttribute(ATTR_NAME,this);
|
||||
|
||||
} // end store
|
||||
|
||||
public String getTargetJSPName()
|
||||
{
|
||||
return "conf_email.jsp";
|
||||
|
||||
} // end getTargetJSPName
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public final int getCommunityID()
|
||||
{
|
||||
return comm.getCommunityID();
|
||||
|
||||
} // end getCommunityID
|
||||
|
||||
public final int getConferenceID()
|
||||
{
|
||||
return conf.getConfID();
|
||||
|
||||
} // end getConferenceID
|
||||
|
||||
public final String getConferenceName()
|
||||
{
|
||||
return conf.getName();
|
||||
|
||||
} // end getConferenceName
|
||||
|
||||
public final String getLocator()
|
||||
{
|
||||
if (locator==null)
|
||||
locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID();
|
||||
return locator;
|
||||
|
||||
} // end getLocator
|
||||
|
||||
public final void writeTopicChoices(Writer out) throws IOException
|
||||
{
|
||||
out.write("<OPTION VALUE=\"0\" SELECTED>(Entire conference)</OPTION>\n");
|
||||
Iterator it = topics.iterator();
|
||||
while (it.hasNext())
|
||||
{ // write out the entire topic list as a drop-down list
|
||||
TopicContext topic = (TopicContext)(it.next());
|
||||
out.write("<OPTION VALUE=\"" + topic.getTopicNumber() + "\">" + StringUtil.encodeHTML(topic.getName())
|
||||
+ "</OPTION>\n");
|
||||
|
||||
} // end while
|
||||
|
||||
} // end writeTopicChoices
|
||||
|
||||
} // end class ConferenceEMail
|
||||
Reference in New Issue
Block a user