diff --git a/etc/venice-config.xml b/etc/venice-config.xml index f188011..790fe0a 100644 --- a/etc/venice-config.xml +++ b/etc/venice-config.xml @@ -438,6 +438,23 @@ Hope to see you in "${community.name}" soon! Invitation to "${community.name}" Community + + + + + + + + diff --git a/src/com/silverwrist/venice/core/ConferenceContext.java b/src/com/silverwrist/venice/core/ConferenceContext.java index 4dcb6ab..d38dbb7 100644 --- a/src/com/silverwrist/venice/core/ConferenceContext.java +++ b/src/com/silverwrist/venice/core/ConferenceContext.java @@ -21,6 +21,7 @@ import java.util.Date; import java.util.List; import com.silverwrist.venice.except.AccessError; import com.silverwrist.venice.except.DataException; +import com.silverwrist.venice.except.EmailException; import com.silverwrist.venice.htmlcheck.HTMLChecker; public interface ConferenceContext @@ -165,4 +166,9 @@ public interface ConferenceContext public abstract SecurityInfo getSecurityInfo(); + public abstract void sendInvitation(String address, String personal_message) + throws AccessError, DataException, EmailException; + + public abstract boolean canSendInvitation(); + } // end interface ConferenceContext diff --git a/src/com/silverwrist/venice/core/TopicContext.java b/src/com/silverwrist/venice/core/TopicContext.java index 4c82181..ea61cf4 100644 --- a/src/com/silverwrist/venice/core/TopicContext.java +++ b/src/com/silverwrist/venice/core/TopicContext.java @@ -21,6 +21,7 @@ import java.util.Date; import java.util.List; import com.silverwrist.venice.except.AccessError; import com.silverwrist.venice.except.DataException; +import com.silverwrist.venice.except.EmailException; import com.silverwrist.venice.htmlcheck.HTMLChecker; public interface TopicContext @@ -104,5 +105,10 @@ public interface TopicContext 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 diff --git a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java index 87ba787..193f7a4 100644 --- a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java @@ -20,6 +20,7 @@ package com.silverwrist.venice.core.impl; import java.sql.*; import java.util.*; import org.apache.log4j.*; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.internals.*; import com.silverwrist.venice.db.*; @@ -1462,6 +1463,32 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend } // 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 *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/core/impl/TopicUserContextImpl.java b/src/com/silverwrist/venice/core/impl/TopicUserContextImpl.java index 0301c1f..0eb4fde 100644 --- a/src/com/silverwrist/venice/core/impl/TopicUserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/TopicUserContextImpl.java @@ -1283,6 +1283,33 @@ class TopicUserContextImpl implements TopicContext } // 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 *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/core/internals/EnvConference.java b/src/com/silverwrist/venice/core/internals/EnvConference.java index d8f00b4..2ed59b9 100644 --- a/src/com/silverwrist/venice/core/internals/EnvConference.java +++ b/src/com/silverwrist/venice/core/internals/EnvConference.java @@ -23,11 +23,6 @@ import com.silverwrist.venice.security.SecurityMonitor; public class EnvConference extends EnvCommunity { - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/servlets/CommunityOperations.java b/src/com/silverwrist/venice/servlets/CommunityOperations.java index f801b89..0c44ce0 100644 --- a/src/com/silverwrist/venice/servlets/CommunityOperations.java +++ b/src/com/silverwrist/venice/servlets/CommunityOperations.java @@ -208,8 +208,15 @@ public class CommunityOperations extends VeniceServlet return new ErrorBox("Community Error","You are not permitted to send an invitation.", "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 - return new Invitation(comm); + return new Invitation(comm,conf,topic); } // end if ("I" command) @@ -369,6 +376,20 @@ public class CommunityOperations extends VeniceServlet setMyLocation(request,"sigops?cmd=I&sig=" + comm.getCommunityID()); 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 throw new RedirectResult(on_error); @@ -376,7 +397,12 @@ public class CommunityOperations extends VeniceServlet { // the "send" button was pressed try { // send out the invitation - comm.sendInvitation(request.getParameter("addr"),request.getParameter("pb")); + 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")); } // end try catch (AccessError ae) diff --git a/src/com/silverwrist/venice/servlets/format/Invitation.java b/src/com/silverwrist/venice/servlets/format/Invitation.java index 41469f7..ee1f172 100644 --- a/src/com/silverwrist/venice/servlets/format/Invitation.java +++ b/src/com/silverwrist/venice/servlets/format/Invitation.java @@ -17,6 +17,8 @@ */ package com.silverwrist.venice.servlets.format; +import java.io.IOException; +import java.io.Writer; import javax.servlet.ServletRequest; import com.silverwrist.util.StringUtil; import com.silverwrist.venice.core.*; @@ -37,15 +39,19 @@ public class Invitation implements JSPRender */ private CommunityContext comm; // the community context + private ConferenceContext conf; // the conference context + private TopicContext topic; // the topic context /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public Invitation(CommunityContext comm) + public Invitation(CommunityContext comm, ConferenceContext conf, TopicContext topic) { this.comm = comm; + this.conf = conf; + this.topic = topic; } // end constructor @@ -73,7 +79,16 @@ public class Invitation implements JSPRender 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 @@ -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(); } // end getCommunityID - public String getCommunityName() + public final String getParameters() { - return comm.getName(); + String rc = ""; + if (conf==null) + return rc; + rc += ("\n"); + if (topic==null) + return rc; + rc += ("\n"); + return rc; - } // end getCommunityName + } // end getAdditionalParameters } // end class Invitation diff --git a/src/com/silverwrist/venice/servlets/format/ManageConference.java b/src/com/silverwrist/venice/servlets/format/ManageConference.java index 70cb7bc..9200342 100644 --- a/src/com/silverwrist/venice/servlets/format/ManageConference.java +++ b/src/com/silverwrist/venice/servlets/format/ManageConference.java @@ -103,25 +103,25 @@ public class ManageConference implements JSPRender *-------------------------------------------------------------------------------- */ - public int getCommunityID() + public final int getCommunityID() { return comm.getCommunityID(); } // end getCommunityID - public int getConfID() + public final int getConfID() { return conf.getConfID(); } // end getConfID - public String getConfName() + public final String getConfName() { return conf.getName(); } // end getConfName - public String getLocator() + public final String getLocator() { if (locator==null) locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); @@ -129,13 +129,19 @@ public class ManageConference implements JSPRender } // end getLocator - public String getDefaultPseud() + public final String getDefaultPseud() { return conf.getDefaultPseud(); } // end getDefaultPseud - public boolean displayAdminSection() + public final boolean displayInviteSection() + { + return conf.canSendInvitation(); + + } // end displayInviteSection + + public final boolean displayAdminSection() { return conf.canChangeConference() || conf.canDeleteConference(); diff --git a/src/com/silverwrist/venice/servlets/format/ManageTopic.java b/src/com/silverwrist/venice/servlets/format/ManageTopic.java index 1e73ee2..da215e7 100644 --- a/src/com/silverwrist/venice/servlets/format/ManageTopic.java +++ b/src/com/silverwrist/venice/servlets/format/ManageTopic.java @@ -128,31 +128,31 @@ public class ManageTopic implements JSPRender *-------------------------------------------------------------------------------- */ - public int getCommunityID() + public final int getCommunityID() { return comm.getCommunityID(); } // end getCommunityID - public int getConfID() + public final int getConfID() { return conf.getConfID(); } // end getConfID - public int getTopicNumber() + public final int getTopicNumber() { return topic.getTopicNumber(); } // end getTopicID - public String getTopicName() + public final String getTopicName() { return topic.getName(); } // end getConfName - public String getLocator() + public final String getLocator() { if (locator==null) locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" @@ -161,22 +161,28 @@ public class ManageTopic implements JSPRender } // end getLocator - public int getNumBozos() + public final int getNumBozos() { return bozos_list.size(); } // end getNumBozos() - public Iterator getBozosIterator() + public final Iterator getBozosIterator() { return bozos_list.iterator(); } // end getBozosIterator - public boolean isSubscribed() + public final boolean isSubscribed() { return topic.isSubscribed(); } // end isSubscribed + public final boolean displayInviteSection() + { + return topic.canSendInvitation(); + + } // end displayInviteSection + } // end class ManageTopic diff --git a/web/format/invitation.jsp b/web/format/invitation.jsp index b15b5ad..c3f4559 100644 --- a/web/format/invitation.jsp +++ b/web/format/invitation.jsp @@ -26,9 +26,9 @@ RenderData rdat = RenderConfig.createRenderData(application,request,response); %> <% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Send Community Invitation:",data.getCommunityName()); %> +<% data.writeHeader(out,rdat); %>
">
- + <%= data.getParameters() %> diff --git a/web/format/manage_conf.jsp b/web/format/manage_conf.jsp index e113d9e..a73640b 100644 --- a/web/format/manage_conf.jsp +++ b/web/format/manage_conf.jsp @@ -52,6 +52,17 @@ entire conference as read (fixseen)

+<% if (data.displayInviteSection()) { %> + <% if (rdat.useHTMLComments()) { %><% } %> + <% 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.

+ ">Click here to + send an invitation +

+<% } // end if %> + <% if (data.displayAdminSection()) { %> <% if (rdat.useHTMLComments()) { %><% } %> <% rdat.writeContentHeader(out,"Host Tools",null); %> diff --git a/web/format/manage_topic.jsp b/web/format/manage_topic.jsp index 6d5835d..aac046e 100644 --- a/web/format/manage_topic.jsp +++ b/web/format/manage_topic.jsp @@ -44,9 +44,21 @@ posts to that topic via E-mail.

">Click Here to Start Subscribing To This Topic + <% } // end if %>

+ + <% if (data.displayInviteSection()) { %> + <% if (rdat.useHTMLComments()) { %><% } %> + <% 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.

+ ">Click here to + send an invitation +

<% } // end if %> -


-
Filtered Users:
+ + <% if (rdat.useHTMLComments()) { %><% } %> + <% rdat.writeContentHeader(out,"Filtered Users",null); %> <% if (data.getNumBozos()>0) { %>
<% Iterator it = data.getBozosIterator(); %>