001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.staging;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import java.util.Map;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Levente Hud??k
025     */
026    public class ContentTag extends IncludeTag {
027    
028            public void setDisableInputs(boolean disableInputs) {
029                    _disableInputs = disableInputs;
030            }
031    
032            public void setParameterMap(Map<String, String[]> parameterMap) {
033                    _parameterMap = parameterMap;
034            }
035    
036            public void setType(String type) {
037                    _type = type;
038            }
039    
040            @Override
041            protected void cleanUp() {
042                    _disableInputs = false;
043                    _parameterMap = null;
044                    _type = null;
045            }
046    
047            @Override
048            protected String getPage() {
049                    return _PAGE;
050            }
051    
052            @Override
053            protected void setAttributes(HttpServletRequest request) {
054                    request.setAttribute(
055                            "liferay-staging:content:disableInputs", _disableInputs);
056                    request.setAttribute(
057                            "liferay-staging:content:parameterMap", _parameterMap);
058                    request.setAttribute(
059                            "liferay-staging:content:renderRequest",
060                            pageContext.getAttribute("renderRequest"));
061                    request.setAttribute("liferay-staging:content:type", _type);
062            }
063    
064            private static final String _PAGE = "/html/taglib/staging/content/page.jsp";
065    
066            private boolean _disableInputs;
067            private Map<String, String[]> _parameterMap;
068            private String _type;
069    
070    }