01: /**
02: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining a copy
05: * of this software and associated documentation files (the "Software"), to deal
06: * in the Software without restriction, including without limitation the rights
07: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
08: * copies of the Software, and to permit persons to whom the Software is
09: * furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in
12: * all copies or substantial portions of the Software.
13: *
14: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20: * SOFTWARE.
21: */package com.liferay.taglib.theme;
22:
23: import com.liferay.portal.theme.ThemeDisplay;
24: import com.liferay.portal.util.WebKeys;
25:
26: import javax.servlet.ServletRequest;
27: import javax.servlet.jsp.tagext.TagSupport;
28:
29: /**
30: * <a href="DefineObjectsTag.java.html"><b><i>View Source</i></b></a>
31: *
32: * @author Brian Wing Shun Chan
33: *
34: */
35: public class DefineObjectsTag extends TagSupport {
36:
37: public int doStartTag() {
38: ServletRequest req = pageContext.getRequest();
39:
40: ThemeDisplay themeDisplay = (ThemeDisplay) req
41: .getAttribute(WebKeys.THEME_DISPLAY);
42:
43: if (themeDisplay != null) {
44: pageContext.setAttribute("themeDisplay", themeDisplay);
45: pageContext.setAttribute("company", themeDisplay
46: .getCompany());
47: pageContext.setAttribute("account", themeDisplay
48: .getAccount());
49: pageContext.setAttribute("user", themeDisplay.getUser());
50: pageContext.setAttribute("realUser", themeDisplay
51: .getRealUser());
52: pageContext.setAttribute("contact", themeDisplay
53: .getContact());
54:
55: if (themeDisplay.getLayout() != null) {
56: pageContext.setAttribute("layout", themeDisplay
57: .getLayout());
58: }
59:
60: if (themeDisplay.getLayouts() != null) {
61: pageContext.setAttribute("layouts", themeDisplay
62: .getLayouts());
63: }
64:
65: pageContext.setAttribute("plid", new Long(themeDisplay
66: .getPlid()));
67:
68: if (themeDisplay.getLayoutTypePortlet() != null) {
69: pageContext.setAttribute("layoutTypePortlet",
70: themeDisplay.getLayoutTypePortlet());
71: }
72:
73: pageContext.setAttribute("portletGroupId", new Long(
74: themeDisplay.getPortletGroupId()));
75: pageContext.setAttribute("permissionChecker", themeDisplay
76: .getPermissionChecker());
77: pageContext
78: .setAttribute("locale", themeDisplay.getLocale());
79: pageContext.setAttribute("timeZone", themeDisplay
80: .getTimeZone());
81: pageContext.setAttribute("theme", themeDisplay.getTheme());
82: pageContext.setAttribute("colorScheme", themeDisplay
83: .getColorScheme());
84: pageContext.setAttribute("portletDisplay", themeDisplay
85: .getPortletDisplay());
86: }
87:
88: return SKIP_BODY;
89: }
90:
91: public int doEndTag() {
92: return EVAL_PAGE;
93: }
94:
95: }
|