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 setTempImageFileName(String tempImageFileName) {
058 _tempImageFileName = tempImageFileName;
059 }
060
061 @Override
062 protected void cleanUp() {
063 _currentLogoURL = null;
064 _defaultLogo = false;
065 _defaultLogoURL = null;
066 _editLogoFn = null;
067 _logoDisplaySelector = null;
068 _maxFileSize = 0;
069 _showBackground = true;
070 _tempImageFileName = null;
071 }
072
073 @Override
074 protected String getPage() {
075 return _PAGE;
076 }
077
078 @Override
079 protected void setAttributes(HttpServletRequest request) {
080 request.setAttribute(
081 "liferay-ui:logo-selector:currentLogoURL", _currentLogoURL);
082 request.setAttribute(
083 "liferay-ui:logo-selector:defaultLogo",
084 String.valueOf(_defaultLogo));
085 request.setAttribute(
086 "liferay-ui:logo-selector:defaultLogoURL", _defaultLogoURL);
087 request.setAttribute(
088 "liferay-ui:logo-selector:editLogoFn", _editLogoFn);
089 request.setAttribute(
090 "liferay-ui:logo-selector:logoDisplaySelector",
091 _logoDisplaySelector);
092
093 if (_maxFileSize == 0) {
094 try {
095 _maxFileSize = PrefsPropsUtil.getLong(
096 PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_MAX_SIZE);
097 }
098 catch (SystemException se) {
099 }
100 }
101
102 request.setAttribute(
103 "liferay-ui:logo-selector:maxFileSize",
104 String.valueOf(_maxFileSize));
105
106 request.setAttribute(
107 "liferay-ui:logo-selector:showBackground",
108 String.valueOf(_showBackground));
109 request.setAttribute(
110 "liferay-ui:logo-selector:tempImageFileName", _tempImageFileName);
111 }
112
113 private static final String _PAGE =
114 "/html/taglib/ui/logo_selector/page.jsp";
115
116 private String _currentLogoURL;
117 private boolean _defaultLogo;
118 private String _defaultLogoURL;
119 private String _editLogoFn;
120 private String _logoDisplaySelector;
121 private long _maxFileSize;
122 private boolean _showBackground = true;
123 private String _tempImageFileName;
124
125 }