001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.util.GetterUtil;
018 import com.liferay.portal.kernel.util.PropsKeys;
019 import com.liferay.portal.kernel.util.PropsUtil;
020 import com.liferay.portal.kernel.util.WebKeys;
021 import com.liferay.portal.theme.ThemeDisplay;
022 import com.liferay.taglib.util.IncludeTag;
023
024 import javax.servlet.http.HttpServletRequest;
025
026
029 public class LayoutCommonTag extends IncludeTag {
030
031 @Override
032 protected void cleanUp() {
033 _includeStaticPortlets = false;
034 _includeWebServerDisplayNode = false;
035 }
036
037 @Override
038 protected String getPage() {
039 return _PAGE;
040 }
041
042 @Override
043 protected boolean isCleanUpSetAttributes() {
044 return _CLEAN_UP_SET_ATTRIBUTES;
045 }
046
047 @Override
048 protected void setAttributes(HttpServletRequest request) {
049 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
050 WebKeys.THEME_DISPLAY);
051
052 if (!themeDisplay.isFacebook() && !themeDisplay.isStateExclusive() &&
053 !themeDisplay.isStatePopUp() && !themeDisplay.isWidget()) {
054
055 _includeStaticPortlets = true;
056 }
057
058 request.setAttribute(
059 "liferay-ui:layout-common:includeStaticPortlets",
060 _includeStaticPortlets);
061
062 if (_WEB_SERVER_DISPLAY_NODE && !themeDisplay.isStatePopUp()) {
063 _includeWebServerDisplayNode = true;
064 }
065
066 request.setAttribute(
067 "liferay-ui:layout-common:includeWebServerDisplayNode",
068 _includeWebServerDisplayNode);
069 }
070
071 private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
072
073 private static final String _PAGE =
074 "/html/taglib/ui/layout_common/page.jsp";
075
076 private static final boolean _WEB_SERVER_DISPLAY_NODE =
077 GetterUtil.getBoolean(PropsUtil.get(PropsKeys.WEB_SERVER_DISPLAY_NODE));
078
079 private boolean _includeStaticPortlets;
080 private boolean _includeWebServerDisplayNode;
081
082 }