001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portal.kernel.util.PrefsPropsUtil;
019 import com.liferay.portal.kernel.util.PropsKeys;
020 import com.liferay.taglib.util.IncludeTag;
021
022 import javax.servlet.http.HttpServletRequest;
023
024
027 public class LogoSelectorTag extends IncludeTag {
028
029 public void setCurrentLogoURL(String currentLogoURL) {
030 _currentLogoURL = currentLogoURL;
031 }
032
033 public void setDefaultLogo(boolean defaultLogo) {
034 _defaultLogo = defaultLogo;
035 }
036
037 public void setDefaultLogoURL(String defaultLogoURL) {
038 _defaultLogoURL = defaultLogoURL;
039 }
040
041 public void setEditLogoFn(String editLogoFn) {
042 _editLogoFn = editLogoFn;
043 }
044
045 public void setLogoDisplaySelector(String logoDisplaySelector) {
046 _logoDisplaySelector = logoDisplaySelector;
047 }
048
049 public void setMaxFileSize(long maxFileSize) {
050 _maxFileSize = maxFileSize;
051 }
052
053 public void setShowBackground(boolean showBackground) {
054 _showBackground = showBackground;
055 }
056
057 public void setShowButtons(boolean showButtons) {
058 _showButtons = showButtons;
059 }
060
061 public void setTempImageFileName(String tempImageFileName) {
062 _tempImageFileName = tempImageFileName;
063 }
064
065 @Override
066 protected void cleanUp() {
067 _currentLogoURL = null;
068 _defaultLogo = false;
069 _defaultLogoURL = null;
070 _editLogoFn = null;
071 _logoDisplaySelector = null;
072 _maxFileSize = 0;
073 _showBackground = true;
074 _showButtons = true;
075 _tempImageFileName = null;
076 }
077
078 @Override
079 protected String getPage() {
080 return _PAGE;
081 }
082
083 @Override
084 protected void setAttributes(HttpServletRequest request) {
085 request.setAttribute(
086 "liferay-ui:logo-selector:currentLogoURL", _currentLogoURL);
087 request.setAttribute(
088 "liferay-ui:logo-selector:defaultLogo",
089 String.valueOf(_defaultLogo));
090 request.setAttribute(
091 "liferay-ui:logo-selector:defaultLogoURL", _defaultLogoURL);
092 request.setAttribute(
093 "liferay-ui:logo-selector:editLogoFn", _editLogoFn);
094 request.setAttribute(
095 "liferay-ui:logo-selector:logoDisplaySelector",
096 _logoDisplaySelector);
097
098 if (_maxFileSize == 0) {
099 try {
100 _maxFileSize = PrefsPropsUtil.getLong(
101 PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_MAX_SIZE);
102 }
103 catch (SystemException se) {
104 }
105 }
106
107 request.setAttribute(
108 "liferay-ui:logo-selector:maxFileSize",
109 String.valueOf(_maxFileSize));
110
111 request.setAttribute(
112 "liferay-ui:logo-selector:showBackground",
113 String.valueOf(_showBackground));
114 request.setAttribute(
115 "liferay-ui:logo-selector:showButtons",
116 String.valueOf(_showButtons));
117 request.setAttribute(
118 "liferay-ui:logo-selector:tempImageFileName", _tempImageFileName);
119 }
120
121 private static final String _PAGE =
122 "/html/taglib/ui/logo_selector/page.jsp";
123
124 private String _currentLogoURL;
125 private boolean _defaultLogo;
126 private String _defaultLogoURL;
127 private String _editLogoFn;
128 private String _logoDisplaySelector;
129 private long _maxFileSize;
130 private boolean _showBackground = true;
131 private boolean _showButtons = true;
132 private String _tempImageFileName;
133
134 }