added controls for Invite from the conference and topic levels

This commit is contained in:
Eric J. Bowersox 2001-12-03 22:21:02 +00:00
parent 1db18b7fb9
commit 89eb0b23d2
13 changed files with 205 additions and 31 deletions

View File

@ -438,6 +438,23 @@ Hope to see you in "${community.name}" soon!
<!-- Parameters: community.name = name of community --> <!-- Parameters: community.name = name of community -->
<subj-invite>Invitation to "${community.name}" Community</subj-invite> <subj-invite>Invitation to "${community.name}" Community</subj-invite>
<!-- What to add above the "personal" message for a conference-specific invite. -->
<!-- Parameters: community.name, conference.name -->
<add-conf-invite><![CDATA[
After you've joined the "${community.name}" community, check out the "${conference.name}" conference.
To find it, after joining the community, click "Conferences" on the left menu bar, then click on the
"${conference.name}" conference name in the conference list.
]]></add-conf-invite>
<!-- What to add above the "personal" message for a topic-specific invite. -->
<!-- Parameters: community.name, conference.name, topic.name -->
<add-topic-invite><![CDATA[
After you've joined the "${community.name}" community, check out the "${topic.name}" topic in the
"${conference.name}" conference. To find it, after joining the community, click "Conferences" on the
left menu bar, then click on the "${conference.name}" conference name in the conference list, then click
on the "${topic.name}" topic name in the topic list.
]]></add-topic-invite>
<!-- Template used for E-mailing posts to users (top half of E-mail) --> <!-- Template used for E-mailing posts to users (top half of E-mail) -->
<!-- Parameters: message.poster, topic.name, topic.locator, conference.name, community.name --> <!-- Parameters: message.poster, topic.name, topic.locator, conference.name, community.name -->
<mail-post-top> <mail-post-top>

View File

@ -21,6 +21,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.silverwrist.venice.except.AccessError; import com.silverwrist.venice.except.AccessError;
import com.silverwrist.venice.except.DataException; import com.silverwrist.venice.except.DataException;
import com.silverwrist.venice.except.EmailException;
import com.silverwrist.venice.htmlcheck.HTMLChecker; import com.silverwrist.venice.htmlcheck.HTMLChecker;
public interface ConferenceContext public interface ConferenceContext
@ -165,4 +166,9 @@ public interface ConferenceContext
public abstract SecurityInfo getSecurityInfo(); public abstract SecurityInfo getSecurityInfo();
public abstract void sendInvitation(String address, String personal_message)
throws AccessError, DataException, EmailException;
public abstract boolean canSendInvitation();
} // end interface ConferenceContext } // end interface ConferenceContext

View File

@ -21,6 +21,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.silverwrist.venice.except.AccessError; import com.silverwrist.venice.except.AccessError;
import com.silverwrist.venice.except.DataException; import com.silverwrist.venice.except.DataException;
import com.silverwrist.venice.except.EmailException;
import com.silverwrist.venice.htmlcheck.HTMLChecker; import com.silverwrist.venice.htmlcheck.HTMLChecker;
public interface TopicContext public interface TopicContext
@ -104,5 +105,10 @@ public interface TopicContext
public abstract void setSubscribed(boolean flag) throws DataException; public abstract void setSubscribed(boolean flag) throws DataException;
public abstract void sendInvitation(String address, String personal_message)
throws AccessError, DataException, EmailException;
public abstract boolean canSendInvitation();
} // end interface TopicContext } // end interface TopicContext

View File

@ -20,6 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
import com.silverwrist.venice.core.internals.*; import com.silverwrist.venice.core.internals.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
@ -1462,6 +1463,32 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end getSecurityInfo } // end getSecurityInfo
public void sendInvitation(String address, String personal_message)
throws AccessError, DataException, EmailException
{
if (!(env.getCommunity().selfCommunity().canSendInvitation()))
throw new AccessError("You are not permitted to send a conference invitation.");
// Format the added "conference name" message.
HashMap vars = new HashMap();
vars.put("community.name",env.getCommunityName());
vars.put("conference.name",getName());
String extra_msg = env.getEngine().getStockMessage("add-conf-invite");
String msg = StringUtil.replaceAllVariables(extra_msg,vars);
if (!StringUtil.isStringEmpty(personal_message))
msg += ("\n\n" + personal_message);
// now send it as if it were a community invitation
env.getCommunity().selfCommunity().sendInvitation(address,msg);
} // end sendInvitation
public boolean canSendInvitation()
{
return env.getCommunity().selfCommunity().canSendInvitation();
} // end canSendInvitation
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface ConferenceBackend * Implementations from interface ConferenceBackend
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -1283,6 +1283,33 @@ class TopicUserContextImpl implements TopicContext
} // end setSubscribed } // end setSubscribed
public void sendInvitation(String address, String personal_message)
throws AccessError, DataException, EmailException
{
if (!(env.getCommunity().selfCommunity().canSendInvitation()))
throw new AccessError("You are not permitted to send a topic invitation.");
// Format the added "conference name" message.
HashMap vars = new HashMap();
vars.put("community.name",env.getCommunityName());
vars.put("conference.name",env.getConferenceName());
vars.put("topic.name",name);
String extra_msg = env.getEngine().getStockMessage("add-topic-invite");
String msg = StringUtil.replaceAllVariables(extra_msg,vars);
if (!StringUtil.isStringEmpty(personal_message))
msg += ("\n\n" + personal_message);
// now send it as if it were a community invitation
env.getCommunity().selfCommunity().sendInvitation(address,msg);
} // end sendInvitation
public boolean canSendInvitation()
{
return env.getCommunity().selfCommunity().canSendInvitation();
} // end canSendInvitation
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* External operations usable only from within the package * External operations usable only from within the package
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -23,11 +23,6 @@ import com.silverwrist.venice.security.SecurityMonitor;
public class EnvConference extends EnvCommunity public class EnvConference extends EnvCommunity
{ {
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -208,8 +208,15 @@ public class CommunityOperations extends VeniceServlet
return new ErrorBox("Community Error","You are not permitted to send an invitation.", return new ErrorBox("Community Error","You are not permitted to send an invitation.",
"sig/" + comm.getAlias()); "sig/" + comm.getAlias());
// get conference and topic parameters
ConferenceContext conf = getConferenceParameter(request,comm,false,"sig/" + comm.getAlias());
TopicContext topic = null;
if (conf!=null)
topic = getTopicParameter(request,conf,false,
"confops?cmd=Q&sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID());
// present the "Invitation" dialog // present the "Invitation" dialog
return new Invitation(comm); return new Invitation(comm,conf,topic);
} // end if ("I" command) } // end if ("I" command)
@ -369,6 +376,20 @@ public class CommunityOperations extends VeniceServlet
setMyLocation(request,"sigops?cmd=I&sig=" + comm.getCommunityID()); setMyLocation(request,"sigops?cmd=I&sig=" + comm.getCommunityID());
String on_error = "sig/" + comm.getAlias(); String on_error = "sig/" + comm.getAlias();
// get conference and topic parameters
ConferenceContext conf = getConferenceParameter(request,comm,false,on_error);
if (conf!=null)
on_error = "confops?cmd=Q&sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID();
TopicContext topic = null;
if (conf!=null)
{ // try and get a topic parameter
topic = getTopicParameter(request,conf,false,on_error);
if (topic!=null)
on_error = "topicops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top="
+ topic.getTopicNumber();
} // end if
if (isImageButtonClicked(request,"cancel")) // cancel - go back to community opening page if (isImageButtonClicked(request,"cancel")) // cancel - go back to community opening page
throw new RedirectResult(on_error); throw new RedirectResult(on_error);
@ -376,6 +397,11 @@ public class CommunityOperations extends VeniceServlet
{ // the "send" button was pressed { // the "send" button was pressed
try try
{ // send out the invitation { // send out the invitation
if (topic!=null)
topic.sendInvitation(request.getParameter("addr"),request.getParameter("pb"));
else if (conf!=null)
conf.sendInvitation(request.getParameter("addr"),request.getParameter("pb"));
else
comm.sendInvitation(request.getParameter("addr"),request.getParameter("pb")); comm.sendInvitation(request.getParameter("addr"),request.getParameter("pb"));
} // end try } // end try

View File

@ -17,6 +17,8 @@
*/ */
package com.silverwrist.venice.servlets.format; package com.silverwrist.venice.servlets.format;
import java.io.IOException;
import java.io.Writer;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
@ -37,15 +39,19 @@ public class Invitation implements JSPRender
*/ */
private CommunityContext comm; // the community context private CommunityContext comm; // the community context
private ConferenceContext conf; // the conference context
private TopicContext topic; // the topic context
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public Invitation(CommunityContext comm) public Invitation(CommunityContext comm, ConferenceContext conf, TopicContext topic)
{ {
this.comm = comm; this.comm = comm;
this.conf = conf;
this.topic = topic;
} // end constructor } // end constructor
@ -73,7 +79,16 @@ public class Invitation implements JSPRender
public String getPageQID() public String getPageQID()
{ {
return "sigops?cmd=I&sig=" + comm.getCommunityID(); String rc = "sigops?cmd=I&sig=" + comm.getCommunityID();
if (conf!=null)
{ // add conference and topic parameters, as needed
rc += ("&conf=" + conf.getConfID());
if (topic!=null)
rc += ("&top=" + topic.getTopicNumber());
} // end if
return rc;
} // end getPageQID } // end getPageQID
@ -99,16 +114,36 @@ public class Invitation implements JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public int getCommunityID() public final void writeHeader(Writer out, RenderData rdat) throws IOException
{
if (topic!=null)
rdat.writeContentHeader(out,"Send Topic Invitation:",
topic.getName() + " (in " + conf.getName() + ", in " + comm.getName() + ")");
else if (conf!=null)
rdat.writeContentHeader(out,"Send Conference Invitation:",
conf.getName() + " (in " + comm.getName() + ")");
else
rdat.writeContentHeader(out,"Send Community Invitation:",comm.getName());
} // end writeHeader
public final int getCommunityID()
{ {
return comm.getCommunityID(); return comm.getCommunityID();
} // end getCommunityID } // end getCommunityID
public String getCommunityName() public final String getParameters()
{ {
return comm.getName(); String rc = "<INPUT TYPE=\"HIDDEN\" NAME=\"sig\" VALUE=\"" + comm.getCommunityID() + "\">";
if (conf==null)
return rc;
rc += ("\n<INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"" + conf.getConfID() + "\">");
if (topic==null)
return rc;
rc += ("\n<INPUT TYPE=\"HIDDEN\" NAME=\"top\" VALUE=\"" + topic.getTopicNumber() + "\">");
return rc;
} // end getCommunityName } // end getAdditionalParameters
} // end class Invitation } // end class Invitation

View File

@ -103,25 +103,25 @@ public class ManageConference implements JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public int getCommunityID() public final int getCommunityID()
{ {
return comm.getCommunityID(); return comm.getCommunityID();
} // end getCommunityID } // end getCommunityID
public int getConfID() public final int getConfID()
{ {
return conf.getConfID(); return conf.getConfID();
} // end getConfID } // end getConfID
public String getConfName() public final String getConfName()
{ {
return conf.getName(); return conf.getName();
} // end getConfName } // end getConfName
public String getLocator() public final String getLocator()
{ {
if (locator==null) if (locator==null)
locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID();
@ -129,13 +129,19 @@ public class ManageConference implements JSPRender
} // end getLocator } // end getLocator
public String getDefaultPseud() public final String getDefaultPseud()
{ {
return conf.getDefaultPseud(); return conf.getDefaultPseud();
} // end getDefaultPseud } // end getDefaultPseud
public boolean displayAdminSection() public final boolean displayInviteSection()
{
return conf.canSendInvitation();
} // end displayInviteSection
public final boolean displayAdminSection()
{ {
return conf.canChangeConference() || conf.canDeleteConference(); return conf.canChangeConference() || conf.canDeleteConference();

View File

@ -128,31 +128,31 @@ public class ManageTopic implements JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public int getCommunityID() public final int getCommunityID()
{ {
return comm.getCommunityID(); return comm.getCommunityID();
} // end getCommunityID } // end getCommunityID
public int getConfID() public final int getConfID()
{ {
return conf.getConfID(); return conf.getConfID();
} // end getConfID } // end getConfID
public int getTopicNumber() public final int getTopicNumber()
{ {
return topic.getTopicNumber(); return topic.getTopicNumber();
} // end getTopicID } // end getTopicID
public String getTopicName() public final String getTopicName()
{ {
return topic.getName(); return topic.getName();
} // end getConfName } // end getConfName
public String getLocator() public final String getLocator()
{ {
if (locator==null) if (locator==null)
locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top="
@ -161,22 +161,28 @@ public class ManageTopic implements JSPRender
} // end getLocator } // end getLocator
public int getNumBozos() public final int getNumBozos()
{ {
return bozos_list.size(); return bozos_list.size();
} // end getNumBozos() } // end getNumBozos()
public Iterator getBozosIterator() public final Iterator getBozosIterator()
{ {
return bozos_list.iterator(); return bozos_list.iterator();
} // end getBozosIterator } // end getBozosIterator
public boolean isSubscribed() public final boolean isSubscribed()
{ {
return topic.isSubscribed(); return topic.isSubscribed();
} // end isSubscribed } // end isSubscribed
public final boolean displayInviteSection()
{
return topic.canSendInvitation();
} // end displayInviteSection
} // end class ManageTopic } // end class ManageTopic

View File

@ -26,9 +26,9 @@
RenderData rdat = RenderConfig.createRenderData(application,request,response); RenderData rdat = RenderConfig.createRenderData(application,request,response);
%> %>
<% if (rdat.useHTMLComments()) { %><!-- Send invitation to community #<%= data.getCommunityID() %> --><% } %> <% if (rdat.useHTMLComments()) { %><!-- Send invitation to community #<%= data.getCommunityID() %> --><% } %>
<% rdat.writeContentHeader(out,"Send Community Invitation:",data.getCommunityName()); %> <% data.writeHeader(out,rdat); %>
<FORM METHOD=POST ACTION="<%= rdat.getEncodedServletPath("sigops") %>"><DIV CLASS="content"> <FORM METHOD=POST ACTION="<%= rdat.getEncodedServletPath("sigops") %>"><DIV CLASS="content">
<INPUT TYPE="HIDDEN" NAME="sig" VALUE="<%= data.getCommunityID() %>"> <%= data.getParameters() %>
<INPUT TYPE="HIDDEN" NAME="cmd" VALUE="I"> <INPUT TYPE="HIDDEN" NAME="cmd" VALUE="I">
<TABLE BORDER=0 CELLPADDING=0> <TABLE BORDER=0 CELLPADDING=0>
<TR VALIGN=MIDDLE> <TR VALIGN=MIDDLE>

View File

@ -52,6 +52,17 @@
entire conference as read (fixseen)</A> entire conference as read (fixseen)</A>
</B></FONT><P> </B></FONT><P>
<% if (data.displayInviteSection()) { %>
<% if (rdat.useHTMLComments()) { %><!-- Invitation Section --><% } %>
<% rdat.writeContentHeader(out,"Send Invitation",null); %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
You may send an invitation via E-mail to outside individuals to join this community and
read this conference.<P>
<B><A HREF="<%= rdat.getEncodedServletPath("sigops?cmd=I&" + data.getLocator()) %>">Click here to
send an invitation</A></B>
</FONT><P>
<% } // end if %>
<% if (data.displayAdminSection()) { %> <% if (data.displayAdminSection()) { %>
<% if (rdat.useHTMLComments()) { %><!-- Host Tools Section --><% } %> <% if (rdat.useHTMLComments()) { %><!-- Host Tools Section --><% } %>
<% rdat.writeContentHeader(out,"Host Tools",null); %> <% rdat.writeContentHeader(out,"Host Tools",null); %>

View File

@ -44,9 +44,21 @@
posts to that topic via E-mail.<P> posts to that topic via E-mail.<P>
<B><A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=SY") %>">Click Here <B><A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=SY") %>">Click Here
to Start Subscribing To This Topic</A></B> to Start Subscribing To This Topic</A></B>
<% } // end if %><P>
<% if (data.displayInviteSection()) { %>
<% if (rdat.useHTMLComments()) { %><!-- Invitation Section --><% } %>
<% rdat.writeContentHeader(out,"Send Invitation",null); %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
You may send an invitation via E-mail to outside individuals to join this community and
read this topic in the conference.<P>
<B><A HREF="<%= rdat.getEncodedServletPath("sigops?cmd=I&" + data.getLocator()) %>">Click here to
send an invitation</A></B>
</FONT><P>
<% } // end if %> <% } // end if %>
<BR><HR WIDTH="80%">
<DIV ALIGN="LEFT"><B>Filtered Users:</B></DIV> <% if (rdat.useHTMLComments()) { %><!-- Filtered Users Section --><% } %>
<% rdat.writeContentHeader(out,"Filtered Users",null); %>
<% if (data.getNumBozos()>0) { %> <% if (data.getNumBozos()>0) { %>
<TABLE BORDER=0 ALIGN=CENTER CELLPADDING=0 CELLSPACING=2> <TABLE BORDER=0 ALIGN=CENTER CELLPADDING=0 CELLSPACING=2>
<% Iterator it = data.getBozosIterator(); %> <% Iterator it = data.getBozosIterator(); %>