com.liferay.taglib.ui.UserPortraitTag Maven / Gradle / Ivy
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.taglib.ui;
import com.liferay.petra.string.CharPool;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.language.LanguageConstants;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.UserConstants;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.kernel.util.ServiceProxyFactory;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.taglib.util.IncludeTag;
import com.liferay.taglib.util.LexiconUtil;
import com.liferay.taglib.util.TagResourceBundleUtil;
import com.liferay.users.admin.kernel.file.uploads.UserFileUploadsSettings;
import java.util.ResourceBundle;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
/**
* @author Eudaldo Alonso
*/
public class UserPortraitTag extends IncludeTag {
public static String getUserPortraitHTML(
User user, String cssClass, Supplier userInitialsSupplier,
Supplier userPortraitURLSupplier) {
StringBundler sb = new StringBundler(7);
sb.append("");
sb.append(userInitialsSupplier.get());
sb.append("");
}
else {
sb.append(cssClass);
sb.append(" aspect-ratio-bg-cover user-icon\" ");
sb.append("style=\"background-image:url(");
sb.append(HtmlUtil.escape(userPortraitURLSupplier.get()));
sb.append(")\">