added user session list and user list sidebox

This commit is contained in:
Eric J. Bowersox 2004-06-25 06:18:21 +00:00
parent 9e5d4f9f57
commit aa186601a4
14 changed files with 472 additions and 45 deletions

View File

@ -10,9 +10,9 @@
The Original Code is the Venice Web Communities System.
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
@ -40,6 +40,14 @@
<new-image width="40" height="20" alt="New!" fixup="true">tag_new.gif</new-image>
</sidebox>
<sidebox id="3">
<title>Users Logged In</title>
<factory-class>com.silverwrist.venice.ui.sidebox.UserListBox</factory-class>
<bullet width="14" height="14" fixup="true">purple-ball.gif</bullet>
<summary>${cur} total (max ${max})</summary>
<anon-label>Not logged in</anon-label>
</sidebox>
<!-- test sidebox only, do not use -->
<!--
<sidebox id="-1">

View File

@ -935,7 +935,7 @@ INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcod
# Provide the default view for Anonymous Honyak. This view will be copied to all
# new users.
INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (1, 1, 100, NULL), (1, 2, 200, NULL);
VALUES (1, 1, 100, NULL), (1, 2, 200, NULL), (1, 3, 300, NULL);
INSERT INTO confhotlist (uid, sequence, sigid, confid)
VALUES (1, 100, 2, 2);
@ -950,7 +950,7 @@ INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcod
# Create the default view for Administrator.
INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (2, 1, 100, NULL), (2, 2, 200, NULL);
VALUES (2, 1, 100, NULL), (2, 2, 200, NULL), (2, 3, 300, NULL);
INSERT INTO confhotlist (uid, sequence, sigid, confid)
VALUES (2, 100, 2, 2);
@ -1053,7 +1053,7 @@ INSERT INTO propuser (uid, ndx, data) VALUES (3, 0, '');
INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcode, country, email, owner_uid)
VALUES (5, 'Test', 'User', 'Denver', 'CO', '80231', 'US', 'testuser@example.com', 3);
INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (3, 1, 100, NULL), (3, 2, 200, NULL);
VALUES (3, 1, 100, NULL), (3, 2, 200, NULL), (3, 3, 300, NULL);
INSERT INTO confhotlist (uid, sequence, sigid, confid)
VALUES (3, 100, 2, 2);
INSERT INTO sigmember (sigid, uid, granted_lvl, locked)

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,12 +23,12 @@ public interface Content
public static final int MENU_SELECTOR_TOP = 0;
public static final int MENU_SELECTOR_COMMUNITY = 1;
public abstract boolean needFrame();
public boolean needFrame();
public abstract int getMenuSelector();
public int getMenuSelector();
public abstract String getPageTitle(RequestOutput ro);
public String getPageTitle(RequestOutput ro);
public abstract String getPageQID();
public String getPageQID();
} // end interface Content

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,6 @@ import java.io.IOException;
public interface ContentDirect extends Content
{
public abstract void render(RequestOutput out) throws IOException;
public void render(RequestOutput out) throws IOException;
} // end interface ContentDirect

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@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui;
import java.util.Iterator;
public interface VeniceUISessionList
{
public static final String APP_ATTR_NAME = "session.list";
public int getSessionCount();
public int getMaxSessionCount();
public Iterator listSessions();
} // end interface VeniceUISessionList

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -25,6 +25,7 @@ import com.silverwrist.venice.core.VeniceEngine;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.Content;
import com.silverwrist.venice.ui.RequestInput;
import com.silverwrist.venice.ui.sidebox.SideBoxFactory;
import com.silverwrist.venice.util.XMLLoader;
@ -115,13 +116,12 @@ public class SideBoxManager
*--------------------------------------------------------------------------------
*/
public final Content createSideBox(int id, VeniceEngine engine, UserContext uc)
throws AccessError, DataException
public final Content createSideBox(int id, RequestInput ri) throws AccessError, DataException
{
SideBoxFactory fact = (SideBoxFactory)(factories.get(new Integer(id)));
if (fact==null)
throw new DataException("invalid sidebox ID!");
return fact.create(engine,uc);
return fact.create(ri);
} // end createSideBox

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2002-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -28,7 +28,7 @@ import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.*;
import com.silverwrist.venice.ui.script.*;
class HttpVeniceUISession implements VeniceUISession
class HttpVeniceUISession implements VeniceUISession, HttpSessionBindingListener
{
/*--------------------------------------------------------------------------------
* Static data members
@ -47,6 +47,7 @@ class HttpVeniceUISession implements VeniceUISession
private HttpSession session; // HTTP session value
private UserContext user; // user context associated with this session
private boolean new_session = true; // is this a new session?
private HttpVeniceUISessionList m_session_list = null;
/*--------------------------------------------------------------------------------
* Constructor
@ -200,6 +201,10 @@ class HttpVeniceUISession implements VeniceUISession
} // end finally
// add this session to the global list
m_session_list = HttpVeniceUISessionList.get(ri);
m_session_list.joinSession(this);
} // end if
} // end preprocess
@ -215,6 +220,9 @@ class HttpVeniceUISession implements VeniceUISession
public void valueUnbound(HttpSessionBindingEvent event)
{
if (m_session_list!=null)
m_session_list.partSession(this);
m_session_list = null;
this.session = null;
this.user = null;

View File

@ -0,0 +1,103 @@
/*
* 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@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.servlet;
import java.util.*;
import com.silverwrist.venice.ui.*;
class HttpVeniceUISessionList implements VeniceUISessionList
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int m_max = 0; // maximum session count
private HashSet m_set = new HashSet(); // hash set
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
private HttpVeniceUISessionList(RequestInput ri)
{
ri.setAppAttribute(APP_ATTR_NAME,this);
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceUISessionList
*--------------------------------------------------------------------------------
*/
public synchronized int getSessionCount()
{
return m_set.size();
} // end getSessionCount
public synchronized int getMaxSessionCount()
{
return m_max;
} // end getMaxSessionCount
public synchronized Iterator listSessions()
{
if (m_set.isEmpty())
return Collections.EMPTY_LIST.iterator();
ArrayList tmp = new ArrayList(m_set);
return Collections.unmodifiableList(tmp).iterator();
} // end listSessions
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
synchronized void joinSession(VeniceUISession session)
{
m_set.add(session);
if (m_set.size()>m_max)
m_max = m_set.size();
} // end joinSession
synchronized void partSession(VeniceUISession session)
{
m_set.remove(session);
} // end partSession
/*--------------------------------------------------------------------------------
* External static operations
*--------------------------------------------------------------------------------
*/
static synchronized HttpVeniceUISessionList get(RequestInput ri)
{
HttpVeniceUISessionList rc = (HttpVeniceUISessionList)(ri.getAppAttribute(APP_ATTR_NAME));
if (rc==null)
rc = new HttpVeniceUISessionList(ri);
return rc;
} // end get
} // end class HttpVeniceUISessionList

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001-04 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -1409,7 +1409,7 @@ public class RequestImpl implements RequestInput
for (int i=0; i<descrs.size(); i++)
{ // get all the sideboxes created
SideBoxDescriptor d = (SideBoxDescriptor)(descrs.get(i));
rc[i] = sbmgr.createSideBox(d.getID(),engine,user);
rc[i] = sbmgr.createSideBox(d.getID(),this);
} // end for

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -34,11 +34,21 @@ public class CommunityBox implements SideBoxFactory
*--------------------------------------------------------------------------------
*/
class CommunityBoxImpl implements ContentDirect
private class CommunityBoxImpl implements ContentDirect
{
/*====================================================================
* Attributes
*====================================================================
*/
private UserContext uc;
private List comm_list;
/*====================================================================
* Constructor
*====================================================================
*/
CommunityBoxImpl(UserContext uc) throws DataException
{
this.uc = uc;
@ -46,6 +56,11 @@ public class CommunityBox implements SideBoxFactory
} // end constructor
/*====================================================================
* Implementations from interface Content
*====================================================================
*/
public boolean needFrame()
{
return false;
@ -81,6 +96,11 @@ public class CommunityBox implements SideBoxFactory
} // end getPageQID
/*====================================================================
* Implementations from interface ContentDirect
*====================================================================
*/
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
@ -207,9 +227,9 @@ public class CommunityBox implements SideBoxFactory
} // end setConfiguration
public Content create(VeniceEngine engine, UserContext uc) throws DataException
public Content create(RequestInput ri) throws DataException
{
return new CommunityBoxImpl(uc);
return new CommunityBoxImpl(ri.getUser());
} // end create

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -34,11 +34,21 @@ public class ConferenceBox implements SideBoxFactory
*--------------------------------------------------------------------------------
*/
class ConferenceBoxImpl implements ContentDirect
private class ConferenceBoxImpl implements ContentDirect
{
/*====================================================================
* Attributes
*====================================================================
*/
private UserContext uc; // current user context
private List hotlist; // current conference hotlist
/*====================================================================
* Constructor
*====================================================================
*/
ConferenceBoxImpl(UserContext uc) throws DataException
{
this.uc = uc;
@ -46,6 +56,11 @@ public class ConferenceBox implements SideBoxFactory
} // end constructor
/*====================================================================
* Implementations from interface Content
*====================================================================
*/
public boolean needFrame()
{
return false;
@ -81,6 +96,11 @@ public class ConferenceBox implements SideBoxFactory
} // end getPageQID
/*====================================================================
* Implementations from interface ContentDirect
*====================================================================
*/
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
@ -205,9 +225,9 @@ public class ConferenceBox implements SideBoxFactory
} // end setConfiguration
public Content create(VeniceEngine engine, UserContext uc) throws DataException
public Content create(RequestInput ri) throws DataException
{
return new ConferenceBoxImpl(uc);
return new ConferenceBoxImpl(ri.getUser());
} // end create

View File

@ -9,9 +9,9 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -153,9 +153,9 @@ public class JSPSideBoxFactory implements SideBoxFactory
} // end setConfiguration
public Content create(VeniceEngine engine, UserContext uc)
public Content create(RequestInput ri)
{
return new JSPSideBox(this,engine,uc);
return new JSPSideBox(this,ri.getEngine(),ri.getUser());
} // end create

View File

@ -9,24 +9,23 @@
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.sidebox;
import org.w3c.dom.*;
import com.silverwrist.venice.core.VeniceEngine;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.Content;
import com.silverwrist.venice.ui.RequestInput;
public interface SideBoxFactory
{
public abstract void setConfiguration(Element cfg) throws ConfigException;
public void setConfiguration(Element cfg) throws ConfigException;
public abstract Content create(VeniceEngine engine, UserContext uc) throws AccessError, DataException;
public Content create(RequestInput ri) throws AccessError, DataException;
} // end interface SideBoxFactory

View File

@ -0,0 +1,237 @@
/*
* 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@ricochet.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.sidebox;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.helpers.ImageHandler;
public class UserListBox implements SideBoxFactory
{
/*--------------------------------------------------------------------------------
* Internal class that implements the actual sidebox
*--------------------------------------------------------------------------------
*/
private class UserListBoxImpl implements ContentDirect
{
/*====================================================================
* Attributes
*====================================================================
*/
private boolean m_logged_in;
private int m_total_count;
private int m_max_count;
private int m_anon_count = 0;
private TreeSet m_users = new TreeSet();
/*====================================================================
* Constructor
*====================================================================
*/
UserListBoxImpl(boolean logged_in, VeniceUISessionList slist)
{
m_logged_in = logged_in;
Iterator it = null;
synchronized (slist)
{ // get user information
m_total_count = slist.getSessionCount();
m_max_count = slist.getMaxSessionCount();
it = slist.listSessions();
} // end synchronized block
while (it.hasNext())
{ // build the user list and the anon user count
UserContext uc = ((VeniceUISession)(it.next())).getUser();
if (uc.isLoggedIn())
m_users.add(uc.getUserName());
else
m_anon_count++;
} // end while
} // end constructor
/*====================================================================
* Implementations from interface Content
*====================================================================
*/
public boolean needFrame()
{
return false;
} // end needFrame
public int getMenuSelector()
{
return MENU_SELECTOR_NOCHANGE;
} // end getMenuSelector
public String getPageTitle(RequestOutput ro)
{
if (m_title_image!=null)
{ // return an image rendering
ImageHandler ih = (m_logged_in ? m_title_image : m_anon_title_image);
return ih.getRendering(ro);
} // end if
else
{ // return a title string
String rc = (m_logged_in ? m_title : m_anon_title);
return StringUtil.encodeHTML(rc);
} // end else
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
/*====================================================================
* Implementations from interface ContentDirect
*====================================================================
*/
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
String norm_font = html.getFontTag(html.SIDEBOX_CONTENT_FOREGROUND,"sidebox");
String hilite = html.getFontTag(html.SIDEBOX_CONTENT_LINK,"sidebox");
out.write("<table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\"><tr valign=\"middle\">"
+ "<td align=\"left\" class=\"sidebox\" colspan=\"2\">" + norm_font + "<b>");
HashMap m = new HashMap();
m.put("cur",String.valueOf(m_total_count));
m.put("max",String.valueOf(m_max_count));
out.write(StringUtil.replaceAllVariables(m_summary,m) + "</b></FONT></td></tr>");
if (m_anon_count>0)
{ // write the anonymous user count
out.write("<tr valign=\"middle\"><td align=\"center\" width=\"" + m_bullet.getWidth() + "\">");
m_bullet.render(out);
out.write("</td><td align=\"left\" class=\"sidebox\">" + norm_font + m_anon_label + " (" + m_anon_count
+ ")</FONT></td></tr>");
} // end if
for (Iterator it=m_users.iterator(); it.hasNext(); )
{ // get user name and write it out to the list
String uname = (String)(it.next());
out.write("<tr valign=\"middle\"><td align=\"center\" width=\"" + m_bullet.getWidth() + "\">");
m_bullet.render(out);
out.write("</td><td align=\"left\" class=\"sidebox\"><a class=\"sidebox\" target=\"_blank\" href=\"");
out.write(html.formatURL("user/" + uname,html.SERVLET));
out.write("\">" + hilite + uname + "</FONT></a></td></tr>");
} // end for
out.write("</table>\n");
} // end render
} // end class UserListBoxImpl
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private ImageHandler m_title_image; // title image for sidebox for logged-in users
private ImageHandler m_anon_title_image; // title image for sidebox for not-logged-in users
private String m_title; // title of sidebox for logged-in users
private String m_anon_title; // title of sidebox for not-logged-in users
private ImageHandler m_bullet; // bullet image
private String m_summary; // summary message
private String m_anon_label; // anonymous label
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public UserListBox()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface SideBoxFactory
*--------------------------------------------------------------------------------
*/
public void setConfiguration(Element cfg) throws ConfigException
{
DOMElementHelper cfg_h = new DOMElementHelper(cfg);
m_title_image = new ImageHandler(cfg_h.getSubElement("title-image"));
if (m_title_image.isDefined())
{ // we're using image titles...
m_title = m_anon_title = null;
m_anon_title_image = new ImageHandler(cfg_h.getSubElement("anon-title-image"));
if (!(m_anon_title_image.isDefined()))
m_anon_title_image = m_title_image;
} // end if
else
{ // standard textual title
m_title_image = m_anon_title_image = null;
m_title = cfg_h.getSubElementText("title");
if (m_title==null)
throw new ConfigException("no <title/> specified for conference list sidebox",cfg);
m_title += ":";
m_anon_title = cfg_h.getSubElementText("anon-title");
if (m_anon_title==null)
m_anon_title = m_title;
else
m_anon_title += ":";
} // end else
m_bullet = new ImageHandler(cfg_h.getSubElement("bullet"),"purple-ball.gif","*",14,14);
m_summary = cfg_h.getSubElementText("summary");
if (m_summary==null)
m_summary = "${cur} total (max ${max})";
m_anon_label = cfg_h.getSubElementText("anon-label");
if (m_anon_label==null)
m_anon_label = "Anonymous";
} // end setConfiguration
public Content create(RequestInput ri) throws AccessError, DataException
{
VeniceUISessionList slist = (VeniceUISessionList)(ri.getAppAttribute(VeniceUISessionList.APP_ATTR_NAME));
if (slist==null)
throw new DataException("session list object not found");
return new UserListBoxImpl(ri.getUser().isLoggedIn(),slist);
} // end create
} // end class UserListBox