implemented conference hotlists and SIG list management from the Top page;

cleaned up remaining SQL statements using text columns instead of column
indexes with the ResultSet; fleshed out specifics in the TODO for
SIG administration
This commit is contained in:
Eric J. Bowersox
2001-02-19 02:56:16 +00:00
parent 7b7e6be996
commit e23de5dae6
32 changed files with 1400 additions and 111 deletions

View File

@@ -149,4 +149,8 @@ public interface ConferenceContext
public abstract SIGContext getEnclosingSIG();
public abstract void removeFromHotlist() throws DataException;
public abstract void setHotlistSequence(int seq) throws DataException;
} // end interface ConferenceContext

View File

@@ -151,4 +151,6 @@ public interface SIGContext extends SearchMode
public abstract List getMemberList() throws DataException;
public abstract boolean canManageConferences();
} // end interface SIGContext

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
@@ -520,7 +520,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
{ // get a database connection
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) AS total FROM refcategory WHERE name ");
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM refcategory WHERE name ");
switch (mode)
{ // compose SQL in different ways depending on the search term
@@ -556,7 +556,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
if (!(rs.next()))
throw new InternalStateError("getSearchCategoryCount search failure (MUST have 1 row!)");
return rs.getInt("total");
return rs.getInt(1);
} // end try
catch (SQLException e)

View File

@@ -1288,7 +1288,7 @@ class ConferenceCoreData implements ConferenceData
rs = stmt.executeQuery(sql.toString());
if (!(rs.next()))
throw new InternalStateError("bogus query in createConference - must return at least 1 row!");
new_sequence = (short)(rs.getShort(1) + 100);
new_sequence = (short)(rs.getShort(1) + 10);
// insert the record into the conferences table!
sql.setLength(0);

View File

@@ -572,9 +572,23 @@ class ConferenceSIGContextImpl implements ConferenceSIGContext
public void setHideList(SIGBackend sig, boolean flag) throws DataException
{
if (logger.isDebugEnabled())
logger.debug("setHideList(conf #" + confid + ", " + flag + ")");
if (deleted)
{ // aiyaiyai - we're deleted
logger.error("conference deleted, can't change a thing");
throw new DataException("This conference has been deleted.");
} // end if
if (flag==hide_list)
{ // this is a no-op
logger.warn("setHideList for this conference is a no-op");
return;
} // end if
Connection conn = null; // database connection
AuditRecord ar = null; // audit record
@@ -585,8 +599,10 @@ class ConferenceSIGContextImpl implements ConferenceSIGContext
// create the SQL statement
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE sigtoconf SET hide_list = ");
sql.append(hide_list ? '1' : '0').append(" WHERE sigid = ").append(this.sig.realSIGID());
sql.append(flag ? '1' : '0').append(" WHERE sigid = ").append(this.sig.realSIGID());
sql.append(" AND confid = ").append(confid).append(';');
if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString());
// execute the update
stmt.executeUpdate(sql.toString());

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
@@ -1359,6 +1359,70 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end getEnclosingSIG
public void removeFromHotlist() throws DataException
{
Connection conn = null;
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the DELETE statement and just execute it blind (if this conference is not in the hotlist,
// the DELETE is a no-op).
StringBuffer sql = new StringBuffer("DELETE FROM confhotlist WHERE uid = ");
sql.append(sig.realUID()).append(" AND sigid = ").append(sig.realSIGID()).append(" AND confid = ");
sql.append(confid).append(';');
stmt.executeUpdate(sql.toString());
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error removing from hotlist: " + e.getMessage(),e);
throw new DataException("error removing from hotlist: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end removeFromHotlist
public void setHotlistSequence(int seq) throws DataException
{
Connection conn = null;
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the UPDATE statement and just execute it blind (if this conference is not in the hotlist,
// the UPDATE is a no-op).
StringBuffer sql = new StringBuffer("UPDATE confhotlist SET sequence = ");
sql.append(seq).append(" WHERE uid = ").append(sig.realUID()).append(" AND sigid = ");
sql.append(sig.realSIGID()).append(" AND confid = ").append(confid).append(';');
stmt.executeUpdate(sql.toString());
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error setting hotlist sequence: " + e.getMessage(),e);
throw new DataException("error setting hotlist sequence: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end setHotlistSequence
/*--------------------------------------------------------------------------------
* Implementations from interface UserBackend
*--------------------------------------------------------------------------------

View File

@@ -651,9 +651,9 @@ class ContactInfoImpl implements ContactInfo, Stashable
// now read back the contact ID we just added
int new_contactid;
ResultSet rs = stmt.executeQuery("SELECT LAST_INSERT_ID() AS blort;");
ResultSet rs = stmt.executeQuery("SELECT LAST_INSERT_ID();");
if (rs.next())
new_contactid = rs.getInt("blort");
new_contactid = rs.getInt(1);
else
throw new DataException("unable to read back new contact ID");

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
@@ -1280,7 +1280,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
{ // get a database connection and create the appropriate SELECT statement
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) AS total FROM sigmember WHERE sigid = ");
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM sigmember WHERE sigid = ");
sql.append(sigid);
if (!include_hidden)
sql.append(" AND hidden = 0");
@@ -1291,7 +1291,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
if (!(rs.next()))
throw new InternalStateError("getMemberCount query failure - must have ONE row!");
return rs.getInt("total");
return rs.getInt(1);
} // end try
catch (SQLException e)
@@ -1709,9 +1709,9 @@ class SIGCoreData implements SIGData, SIGDataBackend
stmt.executeUpdate(sql.toString()); // here we go!
// Get the SIGID of the new SIG!
rs = stmt.executeQuery("SELECT LAST_INSERT_ID() AS blort;");
rs = stmt.executeQuery("SELECT LAST_INSERT_ID();");
if (rs.next())
new_sigid = rs.getInt("blort");
new_sigid = rs.getInt(1);
else
{ // we should have gotten a SIGID back!
logger.error("readback of new SIGID failed!");

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
@@ -1124,6 +1124,20 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end getMemberList
public boolean canManageConferences()
{
SIGData sd = getSIGDataNE();
if (sd==null)
return false;
if (!(sd.checkMembership(level,is_member)))
return false;
if (sd.isFeaturePresent("CONF"))
return sd.canCreateSIGSubObjects(level);
else
return false;
} // end canManageConferences
/*--------------------------------------------------------------------------------
* Implementations from interface UserBackend
*--------------------------------------------------------------------------------
@@ -1241,20 +1255,18 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ // get a database connection
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT sm.sigid AS sigid, sm.granted_lvl AS level, "
+ "sm.locked AS locked, s.signame AS name, s.alias AS alias "
StringBuffer sql = new StringBuffer("SELECT sm.sigid, sm.granted_lvl, sm.locked, s.signame, s.alias "
+ "FROM sigmember sm, sigs s WHERE sm.sigid = s.sigid "
+ "AND sm.uid = ");
sql.append(user.realUID()).append(" ORDER BY s.signame;");
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // create the user contexts and add them to the return vector
int the_sigid = rs.getInt("sigid");
int the_sigid = rs.getInt(1);
if (logger.isDebugEnabled())
logger.debug("...found SIG #" + String.valueOf(the_sigid));
SIGContext tmp = new SIGUserContextImpl(engine,user,datapool,the_sigid,rs.getInt("level"),
rs.getBoolean("locked"),rs.getString("name"),
rs.getString("alias"));
SIGContext tmp = new SIGUserContextImpl(engine,user,datapool,the_sigid,rs.getInt(2),rs.getBoolean(3),
rs.getString(4),rs.getString(5));
rc.add(tmp);
} // end while
@@ -1457,7 +1469,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ // get a database connection
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) AS total FROM sigs WHERE ");
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM sigs WHERE ");
switch (field)
{
@@ -1506,7 +1518,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
if (!(rs.next()))
throw new InternalStateError("getSearchSIGCount search failure (MUST have 1 row!)");
return rs.getInt("total");
return rs.getInt(1);
} // end try
catch (SQLException e)
@@ -1590,7 +1602,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ // get a database connection
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("SELECT COUNT(*) AS total FROM sigs WHERE catid = ");
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM sigs WHERE catid = ");
sql.append(catid);
if (Capability.hideHiddenDirectorySIGs(user.realBaseLevel()))
sql.append(" AND hide_dir = 0");
@@ -1605,7 +1617,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
if (!(rs.next()))
throw new InternalStateError("getNumSIGsInCategory search failure (MUST have 1 row!)");
return rs.getInt("total");
return rs.getInt(1);
} // end try
catch (SQLException e)

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

@@ -100,6 +100,33 @@ public class ConfOperations extends VeniceServlet
} // end validateNewTopic
private static boolean getFlag(ServletRequest request, String param, String on_error) throws ErrorBox
{
String foo = request.getParameter(param);
if (foo==null)
throw new ErrorBox(null,"Parameter not specified!",on_error);
int value;
try
{ // try to get a numeric value
value = Integer.parseInt(foo);
} // end try
catch (NumberFormatException nfe)
{ // unable to decode value
throw new ErrorBox(null,"Invalid parameter value!",on_error);
} // end catch
if (value==0)
return false;
else if (value==1)
return true;
else
throw new ErrorBox(null,"Invalid parameter value!",on_error);
} // end getFlag
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
@@ -118,6 +145,26 @@ public class ConfOperations extends VeniceServlet
*--------------------------------------------------------------------------------
*/
/*
* ConfOperations commands:
* A = Manage Conference Aliases (requires conference parameter)
* C = Create conference
* DEL = Delete conference (requires conference parameter)
* E = Edit Conference Settings (requires conference parameter)
* FX = Fixseen (requires conference parameter)
* H = Add Conference to Hotlist (requires conference parameter)
* M = Manage Conference Membership (requires conference parameter)
* Q = Display Conference Manage menu (requires conference parameter)
* RP = Report on Posters (requires conference parameter)
* RR = Report on Readers (requires conference parameter)
* S = Manage conference ordering/sequence
* SDEL = Delete conference from sequence manager menu
* SH = Hide/show conference from sequence manager menu
* SS = Change conference sequence from sequence manager menu
* T = Create topic (requires conference parameter)
* Other = Display list of conferences in SIG
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
@@ -130,6 +177,167 @@ public class ConfOperations extends VeniceServlet
// get the command we want to use
String cmd = getStandardCommandParam(request);
if (cmd.equals("S"))
{ // "S" = Manage conferences sequence
if (!(sig.canManageConferences()))
return new ErrorBox("Access Error","You are not permitted to manage conferences in this SIG.",
on_error);
try
{ // display the Conference Sequence screen
setMyLocation(request,"confops?cmd=S&sig=" + sig.getSIGID());
return new ConferenceSequence(sig);
} // end try
catch (DataException de)
{ // oops - database error here
return new ErrorBox("Database Error","Database error getting conference list: " + de.getMessage(),
on_error);
} // 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
} // end if ("S" command)
if (cmd.equals("SH"))
{ // "SH" = Hide/show conference (requires conference parameter)
if (!(sig.canManageConferences()))
return new ErrorBox("Access Error","You are not permitted to manage conferences in this SIG.",
on_error);
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&cmd=S";
if (!(conf.canChangeConference()))
return new ErrorBox("Access Error","You do not have permission to modify this conference.",on_error);
boolean new_flag = getFlag(request,"flag",on_error);
try
{ // go set the hide flag
conf.setHideList(new_flag);
} // end try
catch (DataException de)
{ // database error - display appropriate dialog
return new ErrorBox("Database Error","Database error setting hide flag: " + de.getMessage(),
on_error);
} // 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
throw new RedirectResult(on_error); // trap back to the main display
} // end if ("SH" command)
if (cmd.equals("SS"))
{ // "SS" = Change conference sequence (requires conference parameter)
if (!(sig.canManageConferences()))
return new ErrorBox("Access Error","You are not permitted to manage conferences in this SIG.",
on_error);
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&cmd=S";
// we need a second conference parameter to exchange with
ConferenceContext other_conf = getConferenceParameter(request.getParameter("oc"),sig,true,on_error);
if (!(conf.canChangeConference()) || !(other_conf.canChangeConference()))
return new ErrorBox("Access Error","You do not have permission to modify this conference.",on_error);
try
{ // get the two sequences
short this_seq = conf.getSequence();
short other_seq = other_conf.getSequence();
// now exchange them
conf.setSequence(other_seq);
boolean restore = true;
try
{ // set the second conference sequence
other_conf.setSequence(this_seq);
restore = false;
} // end try
finally
{ // undo first set on error
if (restore)
conf.setSequence(this_seq);
} // end finally
} // end try
catch (DataException de)
{ // database error - display appropriate dialog
return new ErrorBox("Database Error","Database error changing sequence: " + de.getMessage(),
on_error);
} // 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
throw new RedirectResult(on_error); // trap back to the main display
} // end if ("SS" command)
if (cmd.equals("SDEL"))
{ // "SDEL" = Delete conference (requires conference parameter)
if (!(sig.canManageConferences()))
return new ErrorBox("Access Error","You are not permitted to manage conferences in this SIG.",
on_error);
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&cmd=S";
if (!(conf.canDeleteConference()))
return new ErrorBox("Access Error","You do not have permission to delete this conference.",on_error);
if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM))
{ // we are confirmed - delete the conference!
try
{ // tell it to go away
conf.delete();
} // end try
catch (DataException de)
{ // something wrong in the database
return new ErrorBox("Database Error","Database error deleting conference: " + de.getMessage(),
on_error);
} // end catch
catch (AccessError ae)
{ // some lack of access is causing problems
return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
// that's it - trap back to the main display
throw new RedirectResult(on_error);
} // end if
else
{ // generate a confirmation box and wait for confirmation
String message = "You are about to permanently delete the \"" + conf.getName() + "\" conference! "
+ "Are you sure you want to do this?";
return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Conference",message,
"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=SDEL",
on_error);
} // end else
} // end if ("SDEL" command)
if (cmd.equals("C"))
{ // "C" = "Create conference"
if (!(sig.canCreateConference()))

View File

@@ -0,0 +1,267 @@
/*
* 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;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class Settings extends VeniceServlet
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String UNJOIN_CONFIRM_ATTR = "servlets.Settings.unjoin.confirm";
private static final String UNJOIN_CONFIRM_PARAM = "confirm";
private static Category logger = Category.getInstance(Settings.class.getName());
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static int findHotlistIndex(List hotlist, ServletRequest request) throws ErrorBox
{
String foo = request.getParameter("sig");
if (foo==null)
throw new ErrorBox(null,"Parameter not specified!","settings?cmd=H");
int sigid;
try
{ // this is the SIG id of the hotlist entry
sigid = Integer.parseInt(foo);
} // end try
catch (NumberFormatException nfe)
{ // conversion error...
throw new ErrorBox(null,"Parameter invalid!","settings?cmd=H");
} // end catch
foo = request.getParameter("conf");
if (foo==null)
throw new ErrorBox(null,"Parameter not specified!","settings?cmd=H");
int confid;
try
{ // this is the conference id of the hotlist entry
confid = Integer.parseInt(foo);
} // end try
catch (NumberFormatException nfe)
{ // conversion error...
throw new ErrorBox(null,"Parameter invalid!","settings?cmd=H");
} // end catch
for (int i=0; i<hotlist.size(); i++)
{ // look at the hotlist entries to find the right index
ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(hotlist.get(i));
if ( (hle.getConference().getConfID()==confid)
&& (hle.getConference().getEnclosingSIG().getSIGID()==sigid))
return i;
} // end for
throw new ErrorBox(null,"Hotlist entry not found!","settings?cmd=H");
} // end findHotlistIndex
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public String getServletInfo()
{
String rc = "Settings servlet - Handles per-user customization and settings information\n"
+ "Part of the Venice Web Communities System\n";
return rc;
} // end getServletInfo
/*--------------------------------------------------------------------------------
* Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
String cmd = getStandardCommandParam(request);
if (cmd.equals("H"))
{ // "H" - Manage Conference Hotlist
try
{ // return the hotlist viewer
setMyLocation(request,"settings?cmd=H");
return new Hotlist(user);
} // end try
catch (DataException de)
{ // oops...can't get it!
return new ErrorBox("Database Error","Error getting hotlist: " + de.getMessage(),"top");
} // end catch
} // end if ("H" command)
if (cmd.equals("HU") || cmd.equals("HD") || cmd.equals("HX"))
{ // one of the commands for modifying the user hotlist
try
{ // start by getting the hotlist and localizing the entry we want to modify
List hotlist = user.getConferenceHotlist();
int ndx = findHotlistIndex(hotlist,request);
ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(hotlist.get(ndx));
ConferenceContext conf = hle.getConference();
if (cmd.equals("HX"))
conf.removeFromHotlist(); // pretty straightforward
else
{ // moving up or down - find the entry to switch places with
int other_ndx;
if (cmd.equals("HU"))
{ // moving up!
if (ndx==0)
return null; // can't move up from here
other_ndx = ndx - 1;
} // end if
else
{ // moving down
other_ndx = ndx + 1;
if (other_ndx==hotlist.size())
return null; // can't move down from here
} // end else
// find the sequence numbers and the other conference object
int my_seq = hle.getSequence();
hle = (ConferenceHotlistEntry)(hotlist.get(other_ndx));
ConferenceContext other_conf = hle.getConference();
int other_seq = hle.getSequence();
// now reset the sequences
conf.setHotlistSequence(other_seq);
boolean restore = true;
try
{ // reset the other conference sequence, too
other_conf.setHotlistSequence(my_seq);
restore = false;
} // end try
finally
{ // restore the original conference sequence on error
if (restore)
conf.setHotlistSequence(my_seq);
} // end finally
} // end else (moving up or down)
} // end try
catch (DataException de)
{ // there's a data exception somewhere
return new ErrorBox("Database Error","Error adjusting hotlist: " + de.getMessage(),"settings?cmd=H");
} // end catch
try
{ // return the hotlist viewer
setMyLocation(request,"settings?cmd=H");
return new Hotlist(user);
} // end try
catch (DataException de)
{ // oops...can't get it!
return new ErrorBox("Database Error","Error getting hotlist: " + de.getMessage(),"top");
} // end catch
} // end if (one of the "H" subcommands)
if (cmd.equals("S"))
{ // "S" - display the user's SIG list
try
{ // return the SIG list viewer
setMyLocation(request,"settings?cmd=S");
return new UserSIGList(user);
} // end try
catch (DataException de)
{ // oops...can't get it!
return new ErrorBox("Database Error","Error getting SIGs list: " + de.getMessage(),"top");
} // end catch
} // end if ("S" command)
if (cmd.equals("SX"))
{ // "SX" - unjoin the specified SIG
SIGContext sig = getSIGParameter(request,user,true,"settings?cmd=S");
if (!(sig.canUnjoin()))
return new ErrorBox("SIG Error","You cannot unjoin this SIG.","settings?cmd=S");
// OK, let's test for a confirmation...
if (ConfirmBox.isConfirmed(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM))
{ // OK, if you say so, let's unjoin!
try
{ // do the unjoin now...
sig.unjoin();
} // end try
catch (AccessError ae)
{ // access error
return new ErrorBox("Access Error","Unable to unjoin SIG: " + ae.getMessage(),"settings?cmd=S");
} // end catch
catch (DataException de)
{ // data exception doing something
return new ErrorBox("Database Error","Database error unjoining SIG: " + de.getMessage(),
"settings?cmd=S");
} // end catch
// after which, redirect back to the top
throw new RedirectResult("settings?cmd=S");
} // end if
else
{ // not a proper confirmation - display the confirm box
String message = "Are you sure you want to unjoin the '" + sig.getName() + "' SIG?";
return new ConfirmBox(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM,"Unjoining SIG",
message,"settings?cmd=SX&sig=" + sig.getSIGID(),"settings?cmd=S");
} // end else
} // end if ("SX" command)
// command not found!
logger.error("invalid command to Settings.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to Settings.doGet","top");
} // end doVeniceGet
} // end class Settings

View File

@@ -99,56 +99,6 @@ public abstract class VeniceServlet extends HttpServlet
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(String str, SIGContext sig, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no conference parameter
if (required)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ErrorBox(null,"No conference specified.",on_error);
} // end if
else
{ // a null ConferenceContext is permitted
if (logger.isDebugEnabled())
logger.debug("no conference specified");
return null;
} // end else
} // end if
ConferenceContext rc = null;
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
rc = sig.getConferenceContext(Integer.parseInt(str));
if (logger.isDebugEnabled())
logger.debug("found conf #" + rc.getConfID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid conference parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the conference
throw new ErrorBox("Database Error","Database error finding conference: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getConferenceParameter
private static TopicContext getTopicParameter(String str, ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
@@ -397,6 +347,56 @@ public abstract class VeniceServlet extends HttpServlet
} // end getSIGParameter
protected static ConferenceContext getConferenceParameter(String str, SIGContext sig, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no conference parameter
if (required)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ErrorBox(null,"No conference specified.",on_error);
} // end if
else
{ // a null ConferenceContext is permitted
if (logger.isDebugEnabled())
logger.debug("no conference specified");
return null;
} // end else
} // end if
ConferenceContext rc = null;
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
rc = sig.getConferenceContext(Integer.parseInt(str));
if (logger.isDebugEnabled())
logger.debug("found conf #" + rc.getConfID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid conference parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the conference
throw new ErrorBox("Database Error","Database error finding conference: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getConferenceParameter
protected final static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig,
boolean required, String on_error)
throws ErrorBox

View File

@@ -159,4 +159,10 @@ public class ConferenceListing implements JSPRender
} // end canCreateConference
public boolean canManageConferences()
{
return sig.canManageConferences();
} // end canManageConferences
} // end class ConferenceListing

View File

@@ -0,0 +1,170 @@
/*
* 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 ConferenceSequence implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.Hotlist";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SIGContext sig;
private List conf_list;
private Hashtable hidden_stat = new Hashtable();
private Hashtable next_id = new Hashtable();
private Hashtable prev_id = new Hashtable();
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ConferenceSequence(SIGContext sig) throws DataException, AccessError
{
this.sig = sig;
this.conf_list = sig.getConferences();
Integer last_id = null;
for (int i=0; i<conf_list.size(); i++)
{ // build up the "next_id" and "prev_id" mappings
ConferenceContext conf = (ConferenceContext)(conf_list.get(i));
Integer this_id = new Integer(conf.getConfID());
// save conference "hidden" status
hidden_stat.put(this_id,new Boolean(conf.getHideList()));
if (last_id!=null)
{ // establish the "next" and "prev" IDs for the conferences
next_id.put(last_id,this_id);
prev_id.put(this_id,last_id);
} // end if
last_id = this_id;
} // end for
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static ConferenceSequence retrieve(ServletRequest request)
{
return (ConferenceSequence)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Manage Conference List";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "conf_sequence.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getSIGID()
{
return sig.getSIGID();
} // end getSIGID
public int getNumConferences()
{
return conf_list.size();
} // end getNumConferences
public ConferenceContext getConference(int ndx)
{
return (ConferenceContext)(conf_list.get(ndx));
} // end getConference
public boolean isConferenceHidden(ConferenceContext conf)
{
Boolean value = (Boolean)(hidden_stat.get(new Integer(conf.getConfID())));
if (value==null)
return false;
else
return value.booleanValue();
} // end isConferenceHidden
public int getNextConfID(ConferenceContext conf)
{
Integer value = (Integer)(next_id.get(new Integer(conf.getConfID())));
if (value==null)
return 0;
else
return value.intValue();
} // end getNextConfID
public int getPrevConfID(ConferenceContext conf)
{
Integer value = (Integer)(prev_id.get(new Integer(conf.getConfID())));
if (value==null)
return 0;
else
return value.intValue();
} // end getPrevConfID
} // end class ConferenceSequence

View File

@@ -0,0 +1,112 @@
/*
* 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 Hotlist implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.Hotlist";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc;
private List hotlist;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public Hotlist(UserContext uc) throws DataException
{
this.uc = uc;
this.hotlist = uc.getConferenceHotlist();
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static Hotlist retrieve(ServletRequest request)
{
return (Hotlist)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Your Conference Hotlist";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "hotlist.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getHotlistSize()
{
return hotlist.size();
} // end getHotlistSize
public ConferenceContext getConference(int ndx)
{
ConferenceHotlistEntry tmp = (ConferenceHotlistEntry)(hotlist.get(ndx));
return tmp.getConference();
} // end getConference
} // end class Hotlist

View File

@@ -94,9 +94,12 @@ public class SideBoxConferences implements ContentRender
else
out.write(rdat.getStdFontTag(null,2) + "<EM>You have no conferences in your hotlist.</EM></FONT>\n");
// write the link at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\"" + rdat.getEncodedServletPath("TODO")
+ "\">Manage</A> ]</B></FONT>");
if (uc.isLoggedIn())
{ // write the link at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\""
+ rdat.getEncodedServletPath("settings?cmd=H") + "\">Manage</A> ]</B></FONT>");
} // end if
} // end renderHere

View File

@@ -92,10 +92,12 @@ public class SideBoxSIGs implements ContentRender
else
out.write(rdat.getStdFontTag(null,2) + "<EM>You are not a member of any SIGs.</EM></FONT>\n");
// write the two links at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\"" + rdat.getEncodedServletPath("TODO")
+ "\">Manage</A> | <A HREF=\"" + rdat.getEncodedServletPath("sigops?cmd=C")
+ "\">Create New</A> ]</B></FONT>");
if (uc.isLoggedIn())
{ // write the two links at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\""
+ rdat.getEncodedServletPath("settings?cmd=S") + "\">Manage</A> | <A HREF=\""
+ rdat.getEncodedServletPath("sigops?cmd=C") + "\">Create New</A> ]</B></FONT>");
} // end if
} // end renderHere

View File

@@ -0,0 +1,111 @@
/*
* 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 UserSIGList implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.Hotlist";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc;
private List sig_list;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public UserSIGList(UserContext uc) throws DataException
{
this.uc = uc;
this.sig_list = uc.getMemberSIGs();
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static UserSIGList retrieve(ServletRequest request)
{
return (UserSIGList)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Your SIGs";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "siglist.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getNumSIGs()
{
return sig_list.size();
} // end getNumSIGs
public SIGContext getSIG(int ndx)
{
return (SIGContext)(sig_list.get(ndx));
} // end getSIG
} // end class UserSIGList