added controls for Invite from the conference and topic levels
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,11 +23,6 @@ import com.silverwrist.venice.security.SecurityMonitor;
|
||||
|
||||
public class EnvConference extends EnvCommunity
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = "<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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user