01: package pygmy.nntp.http;
02:
03: import pygmy.nntp.Forum;
04: import pygmy.nntp.NewsGroup;
05: import pygmy.core.HttpRequest;
06:
07: import java.io.IOException;
08: import java.util.Iterator;
09:
10: public class ForumView extends View {
11:
12: Forum forum = null;
13:
14: public ForumView(String urlPrefix, Forum forum) {
15: super (urlPrefix);
16: this .forum = forum;
17: }
18:
19: public String getForumUrl() {
20: return getForumUrl("/");
21: }
22:
23: public String render(HttpRequest request) throws IOException {
24: buffer.append("<div class=\"box2\">");
25: buffer
26: .append("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" border=\"0\" >\n");
27: addTableRow("navigationbar");
28: addTableColumn("<b><font class=\"title\">Forums</font></b>",
29: null, "align=\"left\" colspan=\"2\"");
30: tableRowEnd();
31: for (Iterator i = forum.newsgroupIterator(); i.hasNext();) {
32: NewsGroup t = (NewsGroup) i.next();
33: addTableRow("tableheader");
34: buffer.append("\n<td align=\"center\" valign=\"top\">");
35: buffer.append(createIcon(request
36: .createUrl("/linkOpaque.gif"), 6, 11));
37: buffer.append("</td>\n");
38: buffer.append("\n<td nowrap align=\"left\"><p><small>");
39: // createLink( t.getName(), getForumUrl( t.getUrl() ), null );
40: buffer.append("<br> created by ");
41: // buffer.append( t.getCreator() );
42: buffer.append("<br> ");
43: buffer.append(t.size());
44: buffer.append(" Messages");
45: buffer.append("<br> last modified (");
46: buffer.append(t.getLastModified());
47: buffer.append(")");
48: buffer.append("</small></p></td>\n");
49: tableRowEnd();
50: }
51: buffer.append("</table>\n");
52: buffer.append("</div>\n");
53: return buffer.toString();
54: }
55: }
|