/* * 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.io.*; import java.util.*; import com.silverwrist.util.StringUtil; import com.silverwrist.venice.core.*; public class SideBoxConferences implements ContentRender { /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ private UserContext uc; private List hotlist; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ public SideBoxConferences(UserContext uc, String parameter) throws DataException { this.uc = uc; this.hotlist = uc.getConferenceHotlist(); } // end constructor /*-------------------------------------------------------------------------------- * Implementations from interface VeniceContent *-------------------------------------------------------------------------------- */ public String getPageTitle(RenderData rdat) { if (uc.isLoggedIn()) return "Your Conference Hotlist:"; else return "Featured Conferences:"; } // end getPageTitle /*-------------------------------------------------------------------------------- * Implementations from interface ContentRender *-------------------------------------------------------------------------------- */ public void renderHere(Writer out, RenderData rdat) throws IOException { out.write(rdat.getStdFontTag(null,2) + "\n"); if (hotlist.size()>0) { // display the list of conferences out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\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("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\"" + rdat.getFullImagePath("purple-ball.gif") + "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n"); out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(null,2) + "<B><A HREF=\"" + rdat.getEncodedServletPath(href) + "\">" + StringUtil.encodeHTML(conf.getName()) + "</A></B> (" + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")</FONT>\n"); if (conf.anyUnread()) out.write(" <A HREF=\"" + rdat.getEncodedServletPath(href + "&rnm=1") + "\"><IMG SRC=\"" + rdat.getFullImagePath("tag_new.gif") + "\" ALT=\"New!\" BORDER=0 WIDTH=40 HEIGHT=20></A>\n"); out.write("</TD>\n</TR>\n"); } // end while out.write("</TABLE>\n"); } // end if else out.write(rdat.getStdFontTag(null,2) + "<EM>You have no conferences in your hotlist.</EM></FONT>\n"); 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 } // end class SideBoxConferences