implemented most of the Manage Conference functions - set pseud, fixseen,

conference edit, alias management, poster and lurker reports
This commit is contained in:
Eric J. Bowersox
2001-02-12 01:50:10 +00:00
parent f706cdaf5f
commit 0070e4fb44
31 changed files with 1260 additions and 47 deletions

View File

@@ -0,0 +1,32 @@
/*
* 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.core;
import java.util.Date;
public interface ActiveUser
{
public abstract int getUID();
public abstract String getName();
public abstract Date getLastRead();
public abstract Date getLastWrite();
} // end interface ActiveUser

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -119,4 +119,16 @@ public interface ConferenceContext
public abstract void fixSeen() throws DataException;
public abstract List getActivePosters(int skip, int limit) throws DataException;
public abstract List getActivePosters(int limit) throws DataException;
public abstract List getActivePosters() throws DataException;
public abstract List getActiveReaders(int skip, int limit) throws DataException;
public abstract List getActiveReaders(int limit) throws DataException;
public abstract List getActiveReaders() throws DataException;
} // end interface ConferenceContext

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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

View File

@@ -0,0 +1,78 @@
/*
* 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.core.impl;
import java.util.Date;
import com.silverwrist.venice.core.ActiveUser;
class ActiveUserImpl implements ActiveUser
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int uid;
private String name;
private Date last_read;
private Date last_write;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
ActiveUserImpl(int uid, String name, Date last_read, Date last_write)
{
this.uid = uid;
this.name = name;
this.last_read = last_read;
this.last_write = last_write;
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface ActiveUser
*--------------------------------------------------------------------------------
*/
public int getUID()
{
return uid;
} // end getUID
public String getName()
{
return name;
} // end getName
public Date getLastRead()
{
return last_read;
} // end getLastRead
public Date getLastWrite()
{
return last_write;
} // end getLastWrite
} // end class ActiveUserImpl

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -633,7 +633,7 @@ class ConferenceCoreData implements ConferenceData
// OK, go delete the row (or not, if this alias is not in the table)
sql.setLength(0);
sql.append("DELETE FROM confalias WHERE confid = ").append(confid).append("AND alias = '");
sql.append("DELETE FROM confalias WHERE confid = ").append(confid).append(" AND alias = '");
sql.append(SQLUtil.encodeString(alias)).append("';");
did_it = (stmt.executeUpdate(sql.toString())>0);
@@ -648,7 +648,7 @@ class ConferenceCoreData implements ConferenceData
if (did_it)
{ // set the database's update date and generate a new audit record
touchUpdate(conn);
if (cached_alias.equals(alias))
if ((cached_alias!=null) && cached_alias.equals(alias))
cached_alias = null; // also release the cached alias and force a re-get
ar = new AuditRecord(AuditRecord.CONF_ALIAS,sig.realUID(),sig.userRemoteAddress(),sig.realSIGID(),
"conf=" + String.valueOf(confid),"remove=" + alias);

View File

@@ -738,6 +738,9 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
public void setDefaultPseud(String val) throws DataException
{
if (sig.userIsAnonymous())
return; // anonymous user can't change pseud
Connection conn = null; // pooled database connection
try
@@ -952,6 +955,9 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
public void fixSeen() throws DataException
{
if (sig.userIsAnonymous())
return; // anonymous user can't fixseen
Connection conn = null;
try
@@ -1012,6 +1018,126 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end fixSeen
public List getActivePosters(int skip, int limit) throws DataException
{
Connection conn = null;
Vector rc = new Vector();
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the SQL statement to retrieve all posters
StringBuffer sql =
new StringBuffer("SELECT s.uid, u.username, s.last_read, s.last_post FROM confsettings s, "
+ "users u WHERE u.uid = s.uid AND s.confid = ");
sql.append(confid).append(" AND u.is_anon = 0 AND ISNULL(s.last_post) = 0 ORDER BY s.last_post DESC");
if ((skip>=0) && (limit>0))
sql.append(" LIMIT ").append(skip).append(", ").append(limit);
sql.append(';');
// execute the statement
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // return all the records as ActiveUser data elements
ActiveUser usr = new ActiveUserImpl(rs.getInt(1),rs.getString(2),SQLUtil.getFullDateTime(rs,3),
SQLUtil.getFullDateTime(rs,4));
rc.add(usr);
} // end while
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error getting active poster list: " + e.getMessage(),e);
throw new DataException("unable to get active poster listing: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return new ReadOnlyVector(rc);
} // end getActivePosters
public List getActivePosters(int limit) throws DataException
{
return getActivePosters(0,limit);
} // end getActivePosters
public List getActivePosters() throws DataException
{
return getActivePosters(-1,-1);
} // end getActivePosters
public List getActiveReaders(int skip, int limit) throws DataException
{
Connection conn = null;
Vector rc = new Vector();
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the SQL statement to retrieve all readers
StringBuffer sql =
new StringBuffer("SELECT s.uid, u.username, s.last_read, s.last_post FROM confsettings s, "
+ "users u WHERE u.uid = s.uid AND s.confid = ");
sql.append(confid).append(" AND u.is_anon = 0 AND ISNULL(s.last_read) = 0 ORDER BY s.last_read DESC");
if ((skip>=0) && (limit>0))
sql.append(" LIMIT ").append(skip).append(", ").append(limit);
sql.append(';');
// execute the statement
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // return all the records as ActiveUser data elements
ActiveUser usr = new ActiveUserImpl(rs.getInt(1),rs.getString(2),SQLUtil.getFullDateTime(rs,3),
SQLUtil.getFullDateTime(rs,4));
rc.add(usr);
} // end while
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error getting active reader list: " + e.getMessage(),e);
throw new DataException("unable to get active reader listing: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return new ReadOnlyVector(rc);
} // end getActiveReaders
public List getActiveReaders(int limit) throws DataException
{
return getActiveReaders(0,limit);
} // end getActiveReaders
public List getActiveReaders() throws DataException
{
return getActiveReaders(-1,-1);
} // end getActiveReaders
/*--------------------------------------------------------------------------------
* Implementations from interface UserBackend
*--------------------------------------------------------------------------------
@@ -1041,6 +1167,12 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end userDefaultPseud
public boolean userIsAnonymous()
{
return sig.userIsAnonymous();
} // end userIsAnonymous
/*--------------------------------------------------------------------------------
* Implementations from interface SIGBackend
*--------------------------------------------------------------------------------
@@ -1104,6 +1236,9 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
public void touchRead(Connection conn) throws SQLException
{
if (sig.userIsAnonymous())
return; // anonymous user can't update squat
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer();
@@ -1133,6 +1268,9 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
public void touchPost(Connection conn, java.util.Date post_date) throws SQLException
{
if (sig.userIsAnonymous())
return; // anonymous user can't update squat
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer();

View File

@@ -1102,6 +1102,12 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end userDefaultPseud
public boolean userIsAnonymous()
{
return user.userIsAnonymous();
} // end userIsAnonymous
/*--------------------------------------------------------------------------------
* Implementations from interface SIGBackend
*--------------------------------------------------------------------------------

View File

@@ -443,13 +443,13 @@ class TopicMessageUserContextImpl implements TopicMessageContext
public boolean canHide()
{
return ((creator_uid==conf.realUID()) || conf.userCanHide());
return (((creator_uid==conf.realUID()) && (!conf.userIsAnonymous())) || conf.userCanHide());
} // end canHide
public boolean canScribble()
{
return ((creator_uid==conf.realUID()) || conf.userCanScribble());
return (((creator_uid==conf.realUID()) && (!conf.userIsAnonymous())) || conf.userCanScribble());
} // end canScribble
@@ -461,6 +461,8 @@ class TopicMessageUserContextImpl implements TopicMessageContext
public void setHidden(boolean flag) throws DataException, AccessError
{
if (conf.userIsAnonymous())
return; // no-op
if ((creator_uid!=conf.realUID()) && !(conf.userCanHide()))
{ // we can't change the hidden status!
logger.error("trying to set hidden status of post w/o permission!");
@@ -468,7 +470,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
} // end if
if (nuked || (scribble_date!=null))
if (nuked || (scribble_date!=null) || (hidden==flag))
return; // changing the status of a nuked or scribbled post is futile
Connection conn = null;
@@ -539,6 +541,8 @@ class TopicMessageUserContextImpl implements TopicMessageContext
public void scribble() throws DataException, AccessError
{
if (conf.userIsAnonymous())
return; // no-op
if ((creator_uid!=conf.realUID()) && !(conf.userCanScribble()))
{ // we can't scribble this post
logger.error("trying to scribble post w/o permission!");

View File

@@ -398,7 +398,7 @@ class TopicUserContextImpl implements TopicContext
public void setHidden(boolean flag) throws DataException
{
if ((hidden==flag) || deleted)
if ((hidden==flag) || deleted || conf.userIsAnonymous())
return; // no-op
Connection conn = null; // pooled database connection
@@ -474,6 +474,8 @@ class TopicUserContextImpl implements TopicContext
public void setUnreadMessages(int count) throws DataException
{
if (conf.userIsAnonymous())
return; // no-op
if (count>(top_message+1)) // constrain count to [0, top_message+1]
count = top_message + 1;
else if (count<0)

View File

@@ -29,4 +29,6 @@ public interface UserBackend
public abstract String userDefaultPseud() throws DataException;
public abstract boolean userIsAnonymous();
} // end interface UserBackend

View File

@@ -924,6 +924,12 @@ class UserContextImpl implements UserContext, UserBackend
} // end userDefaultPseud
public boolean userIsAnonymous()
{
return is_anon;
} // end userIsAnonymous
/*--------------------------------------------------------------------------------
* Operations private to implementation package
*--------------------------------------------------------------------------------

View File

@@ -153,7 +153,7 @@ public class Role implements Comparable, SecLevels
if (conf_high==null)
{ // initialize the "conference highband" vector
conf_high = new Vector(1);
conf_high = new Vector(2);
conf_high.addElement(new Role(CONFERENCE_ANYADMIN,"Any Conference Administrator"));
conf_high.addElement(new Role(CONFERENCE_HOST,"Conference Host"));
conf_high.trimToSize();
@@ -278,4 +278,69 @@ public class Role implements Comparable, SecLevels
} // end getSIGJoinList
public static List getConferenceReadList()
{
initAllSets();
Vector rc = new Vector();
rc.addAll(global_low);
rc.addAll(sig_low);
rc.addAll(conf_low);
rc.add(unrestricted_user);
return new ReadOnlyVector(rc);
} // end getConferenceReadList
public static List getConferencePostList()
{
initAllSets();
Vector rc = new Vector();
rc.addAll(global_low);
rc.addAll(sig_low);
rc.addAll(conf_low);
rc.add(unrestricted_user);
rc.addAll(conf_high);
return new ReadOnlyVector(rc);
} // return getConferencePostList
public static List getConferenceCreateList()
{
return getConferencePostList();
} // end getConferenceChangeList
public static List getConferenceHideList()
{
initAllSets();
Vector rc = new Vector();
rc.addAll(conf_high);
rc.addAll(sig_high);
rc.add(global_high.firstElement());
return new ReadOnlyVector(rc);
} // end getConferenceHideList
public static List getConferenceNukeList()
{
return getConferenceHideList();
} // end getConferenceNukeList
public static List getConferenceChangeList()
{
return getConferenceHideList();
} // end getConferenceChangeList
public static List getConferenceDeleteList()
{
initAllSets();
Vector rc = new Vector();
rc.addAll(sig_high);
rc.addAll(global_high);
rc.add(no_access);
return new ReadOnlyVector(rc);
} // end getConferenceDeleteList
} // end class Role

View File

@@ -21,6 +21,7 @@ import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
@@ -56,6 +57,23 @@ public class ConfOperations extends VeniceServlet
} // end makeCreateConferenceDialog
private EditConferenceDialog makeEditConferenceDialog() throws ServletException
{
final String desired_name = "EditConferenceDialog";
DialogCache cache = DialogCache.getDialogCache(getServletContext());
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
EditConferenceDialog template = new EditConferenceDialog();
cache.saveTemplate(template);
} // end if
// return a new copy
return (EditConferenceDialog)(cache.getNewDialog(desired_name));
} // end makeEditConferenceDialog
private static boolean validateNewTopic(ServletRequest request, String on_error) throws ErrorBox
{
boolean is_title_null, is_zp_null;
@@ -98,7 +116,7 @@ public class ConfOperations extends VeniceServlet
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
throws ServletException, IOException, VeniceServletResult
{
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
@@ -167,6 +185,106 @@ public class ConfOperations extends VeniceServlet
} // end if ("FX" command)
if (cmd.equals("E"))
{ // "E" = "Edit Conference Settings" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
if (!(conf.canChangeConference()))
return new ErrorBox("Access Error","You are not permitted to change this conference's settings.",
on_error);
// create and return the Edit Conference dialog
EditConferenceDialog dlg = makeEditConferenceDialog();
try
{ // set up and return the dialog
dlg.setupDialog(sig,conf);
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=E");
return dlg;
} // 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 retrieving the conference information
return new ErrorBox("Database Error","Database error getting conference information: "
+ de.getMessage(),on_error);
} // end catch
} // end if ("E" command)
if (cmd.equals("A"))
{ // "A" = "Manage Aliases" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
if (!(conf.canChangeConference()))
return new ErrorBox("Access Error","You are not permitted to change this conference's aliases.",
on_error);
// process alias removal link
String remove = request.getParameter("rem");
if (!(StringUtil.isStringEmpty(remove)))
{ // do removal of an alias
try
{ // go ahead and remove the alias!
conf.removeAlias(remove);
} // 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 removing alias: " + de.getMessage(),
on_error);
} // end catch
} // end if (removing an alias)
// display the "Manage Conference Aliases" display
try
{ // generate the display box
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=A");
return new ManageConferenceAliases(sig,conf);
} // end try
catch (DataException de)
{ // error generating the display box
return new ErrorBox("Database Error","Database error displaying aliases: " + de.getMessage(),
on_error);
} // end catch
} // end if ("A" command)
if (cmd.equals("RP") || cmd.equals("RR"))
{ // "RP" = "Report Posters," "RR" = "Report Readers" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
try
{ // generate the listing on this page
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=" + cmd);
return new ConferenceActivity(sig,conf,cmd.equals("RP"));
} // end try
catch (DataException de)
{ // unable to get the data for the list
return new ErrorBox("Database Error","Database error displaying conference users: " + de.getMessage(),
on_error);
} // end catch
} // end if ("RP" and "RR" commands)
// Any unrecognized command shows us the conference list.
on_error = "sigprofile?sig=" + sig.getSIGID();
try
@@ -190,7 +308,7 @@ public class ConfOperations extends VeniceServlet
protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
throws ServletException, IOException, VeniceServletResult
{
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
@@ -331,12 +449,129 @@ public class ConfOperations extends VeniceServlet
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
// TODO: finish this later
try
{ // go set the pseud!
String pseud = request.getParameter("pseud");
if (pseud!=null)
conf.setDefaultPseud(pseud);
return null;
} // end try
catch (DataException de)
{ // oops - there was a problem!
return new ErrorBox("Database Error","Database error setting pseud: " + de.getMessage(),on_error);
} // end catch
return null; // don't change the view
} // end if ("P" command)
if (cmd.equals("E"))
{ // "E" = "Edit Conference Settings" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
if (!(conf.canChangeConference()))
return new ErrorBox("Access Error","You are not permitted to change this conference's settings.",
on_error);
// create the dialog class
EditConferenceDialog dlg = makeEditConferenceDialog();
if (dlg.isButtonClicked(request,"cancel"))
throw new RedirectResult(on_error); // they chickened out - go back to the conference list
if (dlg.isButtonClicked(request,"update"))
{ // they're changing the conference - do what you have to
dlg.loadValues(request); // load the form data
try
{ // run that baby!
dlg.doDialog(conf);
// success - return back to where we started from
throw new RedirectResult(on_error);
} // end try
catch (ValidationException ve)
{ // validation error - throw it back to the user
dlg.resetOnError(sig,conf,ve.getMessage() + " Please try again.");
} // end catch
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 updating conference: " + de.getMessage(),
on_error);
} // end catch
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=E");
return dlg; // redisplay the dialog
} // end if
} // end if ("E" command)
if (cmd.equals("A"))
{ // "A" = "Add Alias" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
if (!(conf.canChangeConference()))
return new ErrorBox("Access Error","You are not permitted to change this conference's settings.",
on_error);
String new_alias = request.getParameter("alias");
if (StringUtil.isStringEmpty(new_alias))
return null; // this is a no-op
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=A";
String error_message = null;
if (IDUtils.isValidVeniceID(new_alias))
{ // the alias we have netered is perfectly valid...
try
{ // go ahead and add the alias!
conf.addAlias(new_alias);
} // 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 adding alias: " + de.getMessage(),
on_error);
} // end catch
} // end if
else // alias is not valid
error_message = "The alias you have entered is not a valid identifier. Please try again.";
// redisplay the "Manage Conference Aliases" display
try
{ // generate the display box
setMyLocation(request,on_error);
return new ManageConferenceAliases(sig,conf);
} // end try
catch (DataException de)
{ // error generating the display box
return new ErrorBox("Database Error","Database error displaying aliases: " + de.getMessage(),
"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q");
} // end catch
} // end if ("A" command)
// unrecognized command!
logger.error("invalid command to ConfOperations.doPost: " + cmd);
return new ErrorBox("Internal Error","Invalid command to ConfOperations.doPost",on_error);

View File

@@ -0,0 +1,139 @@
/*
* 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.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.venice.core.*;
public class ConferenceActivity implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceActivity";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed
private boolean posters; // is this a list of posters?
private List records; // the actual data records
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ConferenceActivity(SIGContext sig, ConferenceContext conf, boolean posters) throws DataException
{
this.sig = sig;
this.conf = conf;
this.posters = posters;
if (posters)
this.records = conf.getActivePosters();
else
this.records = conf.getActiveReaders();
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static ConferenceActivity retrieve(ServletRequest request)
{
return (ConferenceActivity)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
if (posters)
return "Users Posting in Conference " + conf.getName();
else
return "Users Reading Conference " + conf.getName();
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "conf_activity.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public String getConfName()
{
return conf.getName();
} // end getConfName
public String getLocator()
{
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
} // end getLocator
public boolean isPosterReport()
{
return posters;
} // end isPosterReport
public boolean anyElements()
{
return (records.size()>0);
} // end anyElements
public Iterator getRecordsIterator()
{
return records.iterator();
} // end getRecordsIterator
} // end class ConferenceActivity

View File

@@ -225,6 +225,12 @@ public class ContentDialog implements Cloneable, ContentRender
*--------------------------------------------------------------------------------
*/
public void setTitle(String title)
{
this.title = title;
} // end setTitle
public void setErrorMessage(String message)
{
this.error_message = message;

View File

@@ -0,0 +1,149 @@
/*
* 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.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.security.Role;
import com.silverwrist.venice.core.*;
public class EditConferenceDialog extends ContentDialog
{
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public EditConferenceDialog()
{
super("Edit Conference:",null,"editconfform","confops");
setHiddenField("cmd","E");
setHiddenField("sig","");
setHiddenField("conf","");
addFormField(new CDFormCategoryHeader("Basic Information"));
addFormField(new CDTextFormField("name","Conference Name",null,true,32,128));
addFormField(new CDTextFormField("descr","Description",null,false,32,255));
addFormField(new CDCheckBoxFormField("hide","Hide conference in the SIG's conference list",null,"Y"));
addFormField(new CDFormCategoryHeader("Security Information"));
addFormField(new CDRoleListFormField("read_lvl","Security level required to read conference",null,true,
Role.getConferenceReadList()));
addFormField(new CDRoleListFormField("post_lvl","Security level required to post to conference",null,true,
Role.getConferencePostList()));
addFormField(new CDRoleListFormField("create_lvl",
"Security level required to create new topics in conference",null,
true,Role.getConferenceCreateList()));
addFormField(new CDRoleListFormField("hide_lvl",
"Security level required to archive or freeze topics",
"(or to hide posts of which you are not the owner)",true,
Role.getConferenceHideList()));
addFormField(new CDRoleListFormField("nuke_lvl",
"Security level required to delete topics or nuke posts",
"(or to scribble posts of which you are not the owner)",true,
Role.getConferenceNukeList()));
addFormField(new CDRoleListFormField("change_lvl",
"Security level required to change conference attributes",null,true,
Role.getConferenceChangeList()));
addFormField(new CDRoleListFormField("delete_lvl",
"Security level required to delete conference",null,true,
Role.getConferenceDeleteList()));
addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24));
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
} // end constructor
protected EditConferenceDialog(EditConferenceDialog other)
{
super(other);
} // end constructor
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public void setupDialog(SIGContext sig, ConferenceContext conf) throws DataException, AccessError
{
setHiddenField("sig",String.valueOf(sig.getSIGID()));
setHiddenField("conf",String.valueOf(conf.getConfID()));
setTitle("Edit Conference: " + conf.getName());
setFieldValue("name",conf.getName());
setFieldValue("descr",conf.getDescription());
if (conf.getHideList())
setFieldValue("hide","Y");
else
setFieldValue("hide","");
setFieldValue("read_lvl",String.valueOf(conf.getReadLevel()));
setFieldValue("post_lvl",String.valueOf(conf.getPostLevel()));
setFieldValue("create_lvl",String.valueOf(conf.getCreateLevel()));
setFieldValue("hide_lvl",String.valueOf(conf.getHideLevel()));
setFieldValue("nuke_lvl",String.valueOf(conf.getNukeLevel()));
setFieldValue("change_lvl",String.valueOf(conf.getChangeLevel()));
setFieldValue("delete_lvl",String.valueOf(conf.getDeleteLevel()));
} // end setupDialog
public void doDialog(ConferenceContext conf) throws ValidationException, DataException, AccessError
{
final String yes = "Y"; // the "yes" string
validate(); // validate the dialog entries
int read_lvl, post_lvl, create_lvl, hide_lvl, nuke_lvl, change_lvl, delete_lvl;
try
{ // get all the security levels out of their form fields
read_lvl = Integer.parseInt(getFieldValue("read_lvl"));
post_lvl = Integer.parseInt(getFieldValue("post_lvl"));
create_lvl = Integer.parseInt(getFieldValue("create_lvl"));
hide_lvl = Integer.parseInt(getFieldValue("hide_lvl"));
nuke_lvl = Integer.parseInt(getFieldValue("nuke_lvl"));
change_lvl = Integer.parseInt(getFieldValue("change_lvl"));
delete_lvl = Integer.parseInt(getFieldValue("delete_lvl"));
} // end try
catch (NumberFormatException nfe)
{ // how rude!
throw new InternalStateError("somehow we got a non-numeric result from a numeric dropdown list!");
} // end catch
// sweep through the conference and set the appropriate changes
conf.setName(getFieldValue("name"));
conf.setDescription(getFieldValue("descr"));
conf.setHideList(yes.equals(getFieldValue("hide")));
conf.setSecurityLevels(read_lvl,post_lvl,create_lvl,hide_lvl,nuke_lvl,change_lvl,delete_lvl);
} // end doDialog
public void resetOnError(SIGContext sig, ConferenceContext conf, String message)
{
setHiddenField("sig",String.valueOf(sig.getSIGID()));
setHiddenField("conf",String.valueOf(conf.getConfID()));
setTitle("Edit Conference: " + conf.getName());
setErrorMessage(message);
} // end resetOnError
public Object clone()
{
return new EditConferenceDialog(this);
} // end clone
} // end class EditConferenceDialog

View File

@@ -120,6 +120,12 @@ public class ManageConference implements JSPRender
} // end getLocator
public String getDefaultPseud()
{
return conf.getDefaultPseud();
} // end getDefaultPseud
public boolean displayAdminSection()
{
return conf.canChangeConference();

View File

@@ -0,0 +1,154 @@
/*
* 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.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.venice.core.*;
public class ManageConferenceAliases implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ManageConferenceAliases";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed
private List aliases; // list of aliases generated
private String error_message; // error message to display
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public ManageConferenceAliases(SIGContext sig, ConferenceContext conf) throws DataException
{
this.sig = sig;
this.conf = conf;
this.aliases = conf.getAliases();
this.error_message = null;
} // end constructor
public ManageConferenceAliases(SIGContext sig, ConferenceContext conf, String message) throws DataException
{
this.sig = sig;
this.conf = conf;
this.aliases = conf.getAliases();
this.error_message = message;
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static ManageConferenceAliases retrieve(ServletRequest request)
{
return (ManageConferenceAliases)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Manage Conference Aliases: " + conf.getName();
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "manage_aliases.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getSIGID()
{
return sig.getSIGID();
} // end getSIGID
public int getConfID()
{
return conf.getConfID();
} // end getConfID
public String getConfName()
{
return conf.getName();
} // end getConfName
public String getLocator()
{
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
} // end getLocator
public boolean canRemoveAliases()
{
return (aliases.size()>1);
} // end canRemoveAliases
public Iterator getAliasIterator()
{
return aliases.iterator();
} // end getAliasIterator
public String getErrorMessage()
{
return error_message;
} // end getErrorMessage
} // end class ManageConferenceAliases