01: package com.sun.portal.providers.compass;
02:
03: import java.net.*;
04: import java.util.*;
05: import java.text.*;
06: import java.io.*;
07:
08: import javax.servlet.*;
09: import javax.servlet.http.*;
10:
11: import com.sun.portal.util.Locale;
12: import com.sun.portal.profile.*;
13: import com.sun.portal.session.*;
14: import com.sun.portal.desktop.util.*;
15: import com.sun.portal.providers.*;
16:
17: public class CompassProvider extends ProfileProviderAdapter implements
18: Provider {
19:
20: private static ResourceHandler handler = new ResourceHandler(
21: "iwtCompassProvider");
22:
23: public CompassProvider() {
24: }
25:
26: public void init(String n, Session s) throws ProviderException {
27: super .init(n, s);
28: }
29:
30: public StringBuffer getContent(Map m) throws ProviderException {
31:
32: StringBuffer content = new StringBuffer();
33: Hashtable tagTable = new Hashtable();
34:
35: String windowPref = getStringProperty("windowPref", "all_new");
36: String target;
37: if (windowPref.equals("same"))
38: target = "_self";
39: else if (windowPref.equals("one_new"))
40: target = "gvwin";
41: else
42: target = "_blank";
43:
44: Vector categories = getListProperty("categories", new Vector());
45: for (int x = 0; x < categories.size(); x++) {
46: String cat = (String) categories.elementAt(x);
47:
48: content.append("<LI><A HREF=\"javascript:browse(""
49: + cat + "")\">");
50:
51: StringTokenizer st = new StringTokenizer(cat, ":");
52: while (st.hasMoreTokens()) {
53: content.append(st.nextToken());
54: if (st.hasMoreTokens())
55: content.append(" > ");
56: }
57: content.append("</A>\n");
58: }
59:
60: tagTable.put("target", target);
61: tagTable.put("categories", content.toString());
62: TagSwapper swap = new TagSwapper(getSession());
63: return swap.doSwap(getTemplate("display.template"), tagTable);
64: }
65:
66: }
|