1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.taglib.theme;
16  
17  import com.liferay.portal.kernel.util.WebKeys;
18  import com.liferay.portal.theme.ThemeDisplay;
19  
20  import javax.servlet.http.HttpServletRequest;
21  import javax.servlet.jsp.tagext.TagSupport;
22  
23  /**
24   * <a href="DefineObjectsTag.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   */
28  public class DefineObjectsTag extends TagSupport {
29  
30      public int doStartTag() {
31          HttpServletRequest request =
32              (HttpServletRequest)pageContext.getRequest();
33  
34          ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
35              WebKeys.THEME_DISPLAY);
36  
37          if (themeDisplay != null) {
38              pageContext.setAttribute("themeDisplay", themeDisplay);
39              pageContext.setAttribute("company", themeDisplay.getCompany());
40              pageContext.setAttribute("account", themeDisplay.getAccount());
41              pageContext.setAttribute("user", themeDisplay.getUser());
42              pageContext.setAttribute("realUser", themeDisplay.getRealUser());
43              pageContext.setAttribute("contact", themeDisplay.getContact());
44  
45              if (themeDisplay.getLayout() != null) {
46                  pageContext.setAttribute("layout", themeDisplay.getLayout());
47              }
48  
49              if (themeDisplay.getLayouts() != null) {
50                  pageContext.setAttribute("layouts", themeDisplay.getLayouts());
51              }
52  
53              pageContext.setAttribute("plid", new Long(themeDisplay.getPlid()));
54  
55              if (themeDisplay.getLayoutTypePortlet() != null) {
56                  pageContext.setAttribute(
57                      "layoutTypePortlet", themeDisplay.getLayoutTypePortlet());
58              }
59  
60              pageContext.setAttribute(
61                  "scopeGroupId", new Long(themeDisplay.getScopeGroupId()));
62              pageContext.setAttribute(
63                  "permissionChecker", themeDisplay.getPermissionChecker());
64              pageContext.setAttribute("locale", themeDisplay.getLocale());
65              pageContext.setAttribute("timeZone", themeDisplay.getTimeZone());
66              pageContext.setAttribute("theme", themeDisplay.getTheme());
67              pageContext.setAttribute(
68                  "colorScheme", themeDisplay.getColorScheme());
69              pageContext.setAttribute(
70                  "portletDisplay", themeDisplay.getPortletDisplay());
71  
72              // Deprecated
73  
74              pageContext.setAttribute(
75                  "portletGroupId", new Long(themeDisplay.getScopeGroupId()));
76          }
77  
78          return SKIP_BODY;
79      }
80  
81  }