List of usage examples for com.liferay.portal.kernel.model ThemeConstants TOKEN_THEME_IMAGES_PATH
String TOKEN_THEME_IMAGES_PATH
To view the source code for com.liferay.portal.kernel.model ThemeConstants TOKEN_THEME_IMAGES_PATH.
Click Source Link
From source file:com.gleo.groupphoto.web.portlet.action.ViewUserDetailsActionMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { long userId = ParamUtil.getLong(renderRequest, "userId"); ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); String organizationsHTML = StringPool.BLANK; Contact contact = null;//from w w w. ja v a2s . c o m List<Organization> organizations = null; User user = null; Company company = null; Locale locale = themeDisplay.getLocale(); String birthday = null; String jobTitle = null; String gender = null; String comments = null; // Get User if (userId > 0) { try { user = UserLocalServiceUtil.getUser(userId); company = CompanyLocalServiceUtil.getCompany(user.getCompanyId()); } catch (PortalException e) { LOGGER.error(e); } if (user != null) { // Get Contact try { contact = user.getContact(); } catch (PortalException e) { LOGGER.error(e); } // Get Organizations organizations = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); StringBundler organizationsHTMLBundler = new StringBundler(organizations.size() * 2); if (!organizations.isEmpty()) { organizationsHTMLBundler.append(organizations.get(0).getName()); } for (int i = 1; i < organizations.size(); i++) { organizationsHTMLBundler.append(", "); organizationsHTMLBundler.append(organizations.get(i).getName()); } organizationsHTML = organizationsHTMLBundler.toString(); // Fields setFields(renderRequest, contact, user, company, locale, birthday, gender, jobTitle); // Contact String className = Contact.class.getName(); long classPK = contact.getContactId(); List<Address> personalAddresses = Collections.emptyList(); List<Address> organizationAddresses = new ArrayList<Address>(); List<EmailAddress> emailAddresses = Collections.emptyList(); List<Website> websites = Collections.emptyList(); List<Phone> personalPhones = Collections.emptyList(); List<Phone> organizationPhones = new ArrayList<Phone>(); if (classPK > 0) { try { personalAddresses = AddressServiceUtil.getAddresses(className, classPK); } catch (PortalException pe) { LOGGER.error(pe); } try { emailAddresses = EmailAddressServiceUtil.getEmailAddresses(className, classPK); } catch (PortalException pe) { LOGGER.error(pe); } try { websites = WebsiteServiceUtil.getWebsites(className, classPK); } catch (PortalException pe) { LOGGER.error(pe); } try { personalPhones = PhoneServiceUtil.getPhones(className, classPK); } catch (PortalException pe) { LOGGER.error(pe); } } for (int i = 0; i < organizations.size(); i++) { try { organizationAddresses.addAll(AddressServiceUtil.getAddresses(Organization.class.getName(), organizations.get(i).getOrganizationId())); } catch (Exception e) { } } for (int i = 0; i < organizations.size(); i++) { try { organizationPhones.addAll(PhoneServiceUtil.getPhones(Organization.class.getName(), organizations.get(i).getOrganizationId())); } catch (Exception e) { } } // Comments comments = user.getComments(); LOGGER.info("comments" + comments); if (comments != null && !comments.trim().equals(StringPool.BLANK)) { comments = StringUtil.replace(BBCodeTranslatorUtil.getHTML(user.getComments()), ThemeConstants.TOKEN_THEME_IMAGES_PATH + EMOTICONS, themeDisplay.getPathThemeImages() + EMOTICONS); } renderRequest.setAttribute("organizationAddresses", organizationAddresses); renderRequest.setAttribute("personalAddresses", personalAddresses); renderRequest.setAttribute("emailAddresses", emailAddresses); renderRequest.setAttribute("organizationAddresses", organizationAddresses); renderRequest.setAttribute("websites", websites); renderRequest.setAttribute("personalPhones", personalPhones); renderRequest.setAttribute("organizationPhones", organizationPhones); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("userId =" + userId); LOGGER.debug("birthday =" + birthday); LOGGER.debug("gender =" + gender); LOGGER.debug("jobTitle =" + jobTitle); LOGGER.debug("comments =" + comments); } renderRequest.setAttribute("organizations", organizations); renderRequest.setAttribute("organizationsHTML", organizationsHTML); renderRequest.setAttribute("user2", user); renderRequest.setAttribute("contact", contact); renderRequest.setAttribute("languageUtil", LanguageUtil.getLanguage()); renderRequest.setAttribute("locale", locale); renderRequest.setAttribute("comments", comments); renderRequest.setAttribute("htmlUtil", HtmlUtil.getHtml()); return "/userdetails/jsp/user_details.jsp"; }
From source file:com.liferay.message.boards.parser.bbcode.internal.HtmlBBCodeTranslatorImpl.java
License:Open Source License
public HtmlBBCodeTranslatorImpl() { _bbCodeCharacters = new HashMap<>(); _bbCodeCharacters.put("&", "&"); _bbCodeCharacters.put("<", "<"); _bbCodeCharacters.put(">", ">"); _bbCodeCharacters.put("\"", """); _bbCodeCharacters.put("'", "'"); _bbCodeCharacters.put("/", "/"); _bbCodeCharacters.put("`", "`"); _bbCodeCharacters.put("[", "["); _bbCodeCharacters.put("]", "]"); _bbCodeCharacters.put("(", "("); _bbCodeCharacters.put(")", ")"); for (int i = 0; i < _EMOTICONS.length; i++) { String[] emoticon = _EMOTICONS[i]; _emoticonDescriptions[i] = emoticon[2]; _emoticonFiles[i] = emoticon[0]; _emoticonSymbols[i] = emoticon[1]; String image = emoticon[0]; StringBuilder sb = new StringBuilder(6); sb.append("<img alt=\"emoticon\" src=\""); sb.append(ThemeConstants.TOKEN_THEME_IMAGES_PATH); sb.append(MBUtil.EMOTICONS);/*from w w w . j a v a2s .c o m*/ sb.append("/"); sb.append(image); sb.append("\" >"); emoticon[0] = sb.toString(); } _excludeNewLineTypes = new HashMap<>(); _excludeNewLineTypes.put("*", BBCodeParser.TYPE_TAG_START_END); _excludeNewLineTypes.put("li", BBCodeParser.TYPE_TAG_START_END); _excludeNewLineTypes.put("table", BBCodeParser.TYPE_TAG_END); _excludeNewLineTypes.put("td", BBCodeParser.TYPE_TAG_START_END); _excludeNewLineTypes.put("th", BBCodeParser.TYPE_TAG_START_END); _excludeNewLineTypes.put("tr", BBCodeParser.TYPE_TAG_START_END); _imageAttributes = new HashSet<String>(Arrays.asList("alt", "class", "dir", "height", "id", "lang", "longdesc", "style", "title", "width")); _orderedListStyles = new HashMap<>(); _orderedListStyles.put("a", "list-style: lower-alpha outside;"); _orderedListStyles.put("A", "list-style: upper-alpha outside;"); _orderedListStyles.put("1", "list-style: decimal outside;"); _orderedListStyles.put("i", "list-style: lower-roman outside;"); _orderedListStyles.put("I", "list-style: upper-roman outside;"); _unorderedListStyles = new HashMap<>(); _unorderedListStyles.put("circle", "list-style: circle outside;"); _unorderedListStyles.put("disc", "list-style: disc outside;"); _unorderedListStyles.put("square", "list-style: square outside;"); }