,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@@ -18,9 +18,12 @@
package com.silverwrist.venice.core.impl;
import com.silverwrist.venice.core.DataException;
+import com.silverwrist.venice.core.SIGContext;
public interface SIGBackend extends UserBackend
{
+ public abstract SIGContext selfSIG();
+
public abstract int realSIGID();
public abstract boolean userHideHiddenConferences();
diff --git a/src/com/silverwrist/venice/core/impl/SIGUserContextImpl.java b/src/com/silverwrist/venice/core/impl/SIGUserContextImpl.java
index 243a38e..0454bf6 100644
--- a/src/com/silverwrist/venice/core/impl/SIGUserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/SIGUserContextImpl.java
@@ -229,6 +229,38 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end testConferenceAccess
+ private static SIGUserContextImpl getSIGPrivate(EngineBackend engine, UserBackend user, DataPool datapool,
+ Connection conn, int sigid) throws DataException
+ {
+ try
+ { // create the query to find the SIG in the table
+ Statement stmt = conn.createStatement();
+ StringBuffer sql = new StringBuffer("SELECT signame, alias FROM sigs WHERE sigid = ");
+ sql.append(sigid).append(';');
+ ResultSet rs = stmt.executeQuery(sql.toString());
+ if (!(rs.next()))
+ { // the SIG entry was not found
+ logger.error("SIG " + String.valueOf(sigid) + " not found in database");
+ throw new DataException("SIG #" + String.valueOf(sigid) + " was not found in the database.");
+
+ } // end if
+
+ // initialize the object and check membership info
+ SIGUserContextImpl sc = new SIGUserContextImpl(engine,user,datapool,sigid,rs.getString("signame"),
+ rs.getString("alias"));
+ sc.checkMembership(conn);
+ return sc;
+
+ } // end try
+ catch (SQLException e)
+ { // turn SQLException into data exception
+ logger.error("DB error reading SIG entry: " + e.getMessage(),e);
+ throw new DataException("unable to retrieve SIG information: " + e.getMessage(),e);
+
+ } // end catch
+
+ } // end getSIGPrivate
+
/*--------------------------------------------------------------------------------
* Implementations from class SIGContext
*--------------------------------------------------------------------------------
@@ -1132,6 +1164,12 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
*--------------------------------------------------------------------------------
*/
+ public SIGContext selfSIG()
+ {
+ return this;
+
+ } // end selfsig;
+
public int realSIGID()
{
return sigid;
@@ -1248,23 +1286,8 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ // get a database connection
conn = datapool.getConnection();
- // create the query to find the SIG in the table
- Statement stmt = conn.createStatement();
- StringBuffer sql = new StringBuffer("SELECT signame, alias FROM sigs WHERE sigid = ");
- sql.append(sigid).append(';');
- ResultSet rs = stmt.executeQuery(sql.toString());
- if (!(rs.next()))
- { // the SIG entry was not found
- logger.error("SIG " + String.valueOf(sigid) + " not found in database");
- throw new DataException("SIG #" + String.valueOf(sigid) + " was not found in the database.");
-
- } // end if
-
- // initialize the object and check membership info
- SIGUserContextImpl sc = new SIGUserContextImpl(engine,user,datapool,sigid,rs.getString("signame"),
- rs.getString("alias"));
- sc.checkMembership(conn);
- return sc;
+ // return the SIG we want
+ return getSIGPrivate(engine,user,datapool,conn,sigid);
} // end try
catch (SQLException e)
@@ -1325,6 +1348,13 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end getSIGContext
+ static SIGBackend getSIGBackend(EngineBackend engine, UserBackend user, DataPool datapool, Connection conn,
+ int sigid) throws DataException
+ {
+ return getSIGPrivate(engine,user,datapool,conn,sigid);
+
+ } // end getSIGBackend
+
static List searchForSIGs(EngineBackend engine, UserBackend user, DataPool datapool, int field,
int mode, String term, int offset, int count) throws DataException
{
diff --git a/src/com/silverwrist/venice/core/impl/UserContextImpl.java b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
index a05be7d..7c9da46 100644
--- a/src/com/silverwrist/venice/core/impl/UserContextImpl.java
+++ b/src/com/silverwrist/venice/core/impl/UserContextImpl.java
@@ -862,6 +862,12 @@ class UserContextImpl implements UserContext, UserBackend
} // end getSideBoxList
+ public List getConferenceHotlist() throws DataException
+ {
+ return ConferenceUserContextImpl.getUserHotlist(engine,this,datapool);
+
+ } // end getConferenceHotlist
+
/*--------------------------------------------------------------------------------
* Implementations from interface UserBackend
*--------------------------------------------------------------------------------
diff --git a/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java b/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
index 201a99b..88d0102 100644
--- a/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
+++ b/src/com/silverwrist/venice/core/impl/VeniceEngineImpl.java
@@ -874,7 +874,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{ // look to see if the user name is already present
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
- stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, sideboxes WRITE;");
+ stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, sideboxes WRITE, "
+ + "confhotlist WRITE;");
try
{ // make sure the user name isn't there already
ResultSet rs = stmt.executeQuery("SELECT uid FROM users WHERE username = '" + encode_username + "';");
@@ -967,6 +968,31 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug("...loaded default sidebox config");
+ // get the hotlist configuration for this user
+ rs = stmt.executeQuery("SELECT confhotlist.sequence, confhotlist.sigid, confhotlist.confid FROM "
+ + "confhotlist, users WHERE confhotlist.uid = users.uid AND users.is_anon = 1;");
+ sql.setLength(0);
+ while (rs.next())
+ { // set up to insert into the confhotlist table
+ if (sql.length()==0)
+ sql.append("INSERT INTO confhotlist (uid, sequence, sigid, confid) VALUES ");
+ else
+ sql.append(", ");
+ sql.append('(').append(new_uid).append(", ").append(rs.getInt(1)).append(", ").append(rs.getInt(2));
+ sql.append(", ").append(rs.getInt(3)).append(')');
+
+ } // end while
+
+ if (sql.length()>0)
+ { // execute the big update
+ sql.append(';');
+ stmt.executeUpdate(sql.toString());
+
+ } // end if
+
+ if (logger.isDebugEnabled())
+ logger.debug("...loaded default hotlist config");
+
} // end try
finally
{ // make sure the tables get unlocked before we go
diff --git a/src/com/silverwrist/venice/servlets/ConfOperations.java b/src/com/silverwrist/venice/servlets/ConfOperations.java
index bc22bcf..ac8dfd1 100644
--- a/src/com/silverwrist/venice/servlets/ConfOperations.java
+++ b/src/com/silverwrist/venice/servlets/ConfOperations.java
@@ -326,6 +326,28 @@ public class ConfOperations extends VeniceServlet
} // end if ("M" command)
+ if (cmd.equals("H"))
+ { // "H" = "Add Conference To Hotlist" (requires conference parameter)
+ ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
+ on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
+
+ try
+ { // add to the hotlist
+ conf.addToHotlist();
+
+ // and trap back to the conference display
+ throw new RedirectResult(on_error);
+
+ } // end try
+ catch (DataException de)
+ { // something wrong in the database
+ return new ErrorBox("Database Error","Database error adding to hotlist: " + de.getMessage(),
+ on_error);
+
+ } // end catch
+
+ } // end if ("H" command)
+
if (cmd.equals("DEL"))
{ // "DEL" = "Delete Conference (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
diff --git a/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java b/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java
index f027339..44d69ea 100644
--- a/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java
+++ b/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java
@@ -19,6 +19,7 @@ package com.silverwrist.venice.servlets.format;
import java.io.*;
import java.util.*;
+import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
public class SideBoxConferences implements ContentRender
@@ -29,15 +30,17 @@ public class SideBoxConferences implements ContentRender
*/
private UserContext uc;
+ private List hotlist;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
- public SideBoxConferences(UserContext uc, String parameter)
+ public SideBoxConferences(UserContext uc, String parameter) throws DataException
{
this.uc = uc;
+ this.hotlist = uc.getConferenceHotlist();
} // end constructor
@@ -62,14 +65,34 @@ public class SideBoxConferences implements ContentRender
public void renderHere(Writer out, RenderData rdat) throws IOException
{
- /* BEGIN TEMP */
- out.write("\n");
- out.write("- BOFH (Benevolent Dictators)
\n");
- out.write("- Playground (Electric Minds)
\n");
- out.write("- Commons (Electric Minds)
\n");
- out.write("- Top Ten Lists (Pamela's Lounge)
\n");
- out.write("
\n");
- /* END TEMP */
+ out.write(rdat.getStdFontTag(null,2) + "\n");
+ if (hotlist.size()>0)
+ { // display the list of conferences
+ out.write("\n");
+ Iterator it = hotlist.iterator();
+ while (it.hasNext())
+ { // display the names of the conferences and SIGs one by one
+ ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next());
+ ConferenceContext conf = hle.getConference();
+ String href = "confdisp?sig=" + conf.getEnclosingSIG().getSIGID() + "&conf=" + conf.getConfID();
+ out.write("\n | \n");
+ out.write("\n" + rdat.getStdFontTag(null,2) + "" + StringUtil.encodeHTML(conf.getName())
+ + " (" + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")\n");
+ if (conf.anyUnread())
+ out.write(" \n");
+ out.write(" | \n
\n");
+
+ } // end while
+
+ out.write("
\n");
+
+ } // end if
+ else
+ out.write(rdat.getStdFontTag(null,2) + "You have no conferences in your hotlist.\n");
// write the link at the end
out.write("" + rdat.getStdFontTag(null,1) + "[ " ALT="Read New" WIDTH=80 HEIGHT=24
BORDER=0>
<% } // end if %>
- ">">" ALT="Manage" WIDTH=80 HEIGHT=24
BORDER=0>
<% if (data.canAddToHotlist()) { %>
- "
- ALT="Add to HotList" WIDTH=80 HEIGHT=24 BORDER=0>
+ ">" ALT="Add to HotList" WIDTH=80
+ HEIGHT=24 BORDER=0>
<% } // end if %>
<% if (data.anyTopics()) { %>
diff --git a/web/images/tag_new.gif b/web/images/tag_new.gif
new file mode 100644
index 0000000..26ba084
Binary files /dev/null and b/web/images/tag_new.gif differ