01: /* Copyright 2003 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout.channels.locales;
07:
08: import java.util.Locale;
09:
10: import org.jasig.portal.Constants;
11: import org.jasig.portal.PortalException;
12: import org.jasig.portal.channels.BaseChannel;
13: import org.jasig.portal.i18n.LocaleManager;
14: import org.jasig.portal.utils.XSLT;
15: import org.w3c.dom.Document;
16: import org.xml.sax.ContentHandler;
17:
18: /**
19: * Changes the locale preferences for the current session.
20: * Any changes made via this channel will not be persisted
21: * between sessions.
22: * @author Shoji Kajita <a href="mailto:">kajita@itc.nagoya-u.ac.jp</a>
23: * @author Ken Weiner, kweiner@unicon.net
24: * @version $Revision: 34761 $
25: */
26: public class CSessionLocalesSelector extends BaseChannel {
27:
28: protected final String sslUri = "sessionLocales.ssl";
29:
30: public void renderXML(ContentHandler out) throws PortalException {
31: Locale[] locales = runtimeData.getLocales();
32: Document doc = LocaleManager.xmlValueOf(locales, locales[0]);
33: XSLT xslt = XSLT.getTransformer(this , runtimeData.getLocales());
34: xslt.setXML(doc);
35: xslt.setXSL(sslUri, runtimeData.getBrowserInfo());
36: xslt.setTarget(out);
37: xslt.setStylesheetParameter("baseActionURL", runtimeData
38: .getBaseActionURL());
39: xslt.setStylesheetParameter("localesParam",
40: Constants.LOCALES_PARAM);
41: xslt.transform();
42: }
43:
44: }
|