@Override protected void setAttributes(HttpServletRequest request) { request.setAttribute( "liferay-ui:input-editor:allowBrowseDocuments", String.valueOf(_allowBrowseDocuments)); request.setAttribute("liferay-ui:input-editor:autoCreate", String.valueOf(_autoCreate)); request.setAttribute("liferay-ui:input-editor:configParams", _configParams); request.setAttribute("liferay-ui:input-editor:contents", _contents); request.setAttribute("liferay-ui:input-editor:contentsLanguageId", getContentsLanguageId()); request.setAttribute("liferay-ui:input-editor:cssClass", _cssClass); request.setAttribute("liferay-ui:input-editor:cssClasses", getCssClasses()); request.setAttribute("liferay-ui:input-editor:editorName", getEditorName(request)); request.setAttribute("liferay-ui:input-editor:fileBrowserParams", _fileBrowserParams); request.setAttribute("liferay-ui:input-editor:height", _height); request.setAttribute("liferay-ui:input-editor:initMethod", _initMethod); request.setAttribute("liferay-ui:input-editor:inlineEdit", String.valueOf(_inlineEdit)); request.setAttribute("liferay-ui:input-editor:inlineEditSaveURL", _inlineEditSaveURL); request.setAttribute("liferay-ui:input-editor:name", _name); request.setAttribute("liferay-ui:input-editor:onBlurMethod", _onBlurMethod); request.setAttribute("liferay-ui:input-editor:onChangeMethod", _onChangeMethod); request.setAttribute("liferay-ui:input-editor:onFocusMethod", _onFocusMethod); request.setAttribute("liferay-ui:input-editor:onInitMethod", _onInitMethod); ResourceBundle resourceBundle = TagResourceBundleUtil.getResourceBundle(pageContext); if (Validator.isNull(_placeholder)) { _placeholder = LanguageUtil.get(resourceBundle, "write-your-content-here"); } request.setAttribute("liferay-ui:input-editor:placeholder", _placeholder); request.setAttribute("liferay-ui:input-editor:resizable", String.valueOf(_resizable)); request.setAttribute("liferay-ui:input-editor:showSource", String.valueOf(_showSource)); request.setAttribute( "liferay-ui:input-editor:skipEditorLoading", String.valueOf(_skipEditorLoading)); request.setAttribute("liferay-ui:input-editor:toolbarSet", getToolbarSet()); request.setAttribute("liferay-ui:input-editor:width", _width); request.setAttribute("liferay-ui:input-editor:data", getData()); }
protected Map<String, Object> getData() { Map<String, Object> data = null; if (_data != null) { data = new HashMap<>(_data); } else { data = new HashMap<>(1); } if (_useDialog && Validator.isNull(data.get("title"))) { String message = getProcessedMessage(); ResourceBundle resourceBundle = TagResourceBundleUtil.getResourceBundle(pageContext); if (_localizeMessage) { message = LanguageUtil.get(resourceBundle, message); } data.put("title", HtmlUtil.stripHtml(message)); } return data; }
protected String getDetails() { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); ResourceBundle resourceBundle = TagResourceBundleUtil.getResourceBundle(pageContext); String details = null; if (_alt != null) { details = " alt=\"" + LanguageUtil.get(resourceBundle, _alt) + "\""; } else if (isLabel()) { details = " alt=\"\""; } else { StringBundler sb = new StringBundler(5); sb.append(" alt=\""); sb.append(LanguageUtil.get(resourceBundle, getProcessedMessage())); sb.append("\" title=\""); sb.append(LanguageUtil.get(resourceBundle, getProcessedMessage())); sb.append("\""); details = sb.toString(); } if (Validator.isNull(_src) || !themeDisplay.isThemeImagesFastLoad() || isAUIImage()) { return details; } SpriteImage spriteImage = null; String spriteFileName = null; String spriteFileURL = null; String imageFileName = StringUtil.replace(_src, "common/../", ""); if (imageFileName.contains(Http.PROTOCOL_DELIMITER)) { String portalURL = PortalUtil.getPortalURL(request); if (imageFileName.startsWith(portalURL)) { imageFileName = imageFileName.substring(portalURL.length()); } else { URL imageURL = null; try { imageURL = new URL(imageFileName); imageFileName = imageURL.getPath(); } catch (MalformedURLException murle) { } } } Theme theme = themeDisplay.getTheme(); String contextPath = theme.getContextPath(); String imagesPath = contextPath.concat(theme.getImagesPath()); if (imageFileName.startsWith(imagesPath)) { spriteImage = theme.getSpriteImage(imageFileName); if (spriteImage != null) { spriteFileName = spriteImage.getSpriteFileName(); if (BrowserSnifferUtil.isIe(request) && (BrowserSnifferUtil.getMajorVersion(request) < 7)) { spriteFileName = StringUtil.replace(spriteFileName, ".png", ".gif"); } String cdnBaseURL = themeDisplay.getCDNBaseURL(); spriteFileURL = cdnBaseURL.concat(spriteFileName); } } if (spriteImage == null) { Portlet portlet = (Portlet) request.getAttribute("liferay-portlet:icon_portlet:portlet"); if (portlet == null) { portlet = (Portlet) request.getAttribute(WebKeys.RENDER_PORTLET); } if (portlet != null) { PortletApp portletApp = portlet.getPortletApp(); spriteImage = portletApp.getSpriteImage(imageFileName); if (spriteImage != null) { spriteFileName = spriteImage.getSpriteFileName(); if (BrowserSnifferUtil.isIe(request) && (BrowserSnifferUtil.getMajorVersion(request) < 7)) { spriteFileName = StringUtil.replace(spriteFileName, ".png", ".gif"); } String cdnBaseURL = themeDisplay.getCDNBaseURL(); spriteFileURL = cdnBaseURL.concat(spriteFileName); } } } if (spriteImage != null) { String themeImagesPath = themeDisplay.getPathThemeImages(); _src = themeImagesPath.concat("/spacer.png"); StringBundler sb = new StringBundler(10); sb.append(details); sb.append(" style=\"background-image: url('"); sb.append(spriteFileURL); sb.append("'); background-position: 50% -"); sb.append(spriteImage.getOffset()); sb.append("px; background-repeat: no-repeat; height: "); sb.append(spriteImage.getHeight()); sb.append("px; width: "); sb.append(spriteImage.getWidth()); sb.append("px;\""); details = sb.toString(); } return details; }
@Override public int doEndTag() { try { SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this, SearchContainerRowTag.class); ResultRow resultRow = searchContainerRowTag.getRow(); if (Validator.isNotNull(_property)) { _value = String.valueOf(BeanPropertiesUtil.getObject(resultRow.getObject(), _property)); } else if (Validator.isNotNull(_buffer)) { _value = _sb.toString(); } else if (_value == null) { BodyContent bodyContent = getBodyContent(); if (bodyContent != null) { _value = bodyContent.getString(); } else { Object object = BeanPropertiesUtil.getObject(resultRow.getObject(), getName()); _value = String.valueOf(object); } } if (_translate) { ResourceBundle resourceBundle = TagResourceBundleUtil.getResourceBundle(pageContext); _value = LanguageUtil.get(resourceBundle, _value); } if (index <= -1) { List<SearchEntry> searchEntries = resultRow.getEntries(); index = searchEntries.size(); } if (resultRow.isRestricted()) { _href = null; } TextSearchEntry textSearchEntry = new TextSearchEntry(); textSearchEntry.setAlign(getAlign()); textSearchEntry.setColspan(getColspan()); textSearchEntry.setCssClass(getCssClass()); textSearchEntry.setHref(String.valueOf(getHref())); textSearchEntry.setName(getValue()); textSearchEntry.setTarget(getTarget()); textSearchEntry.setTitle(getTitle()); textSearchEntry.setTruncate(getTruncate()); textSearchEntry.setValign(getValign()); resultRow.addSearchEntry(index, textSearchEntry); return EVAL_PAGE; } finally { index = -1; _value = null; if (!ServerDetector.isResin()) { align = SearchEntry.DEFAULT_ALIGN; _buffer = null; colspan = SearchEntry.DEFAULT_COLSPAN; cssClass = SearchEntry.DEFAULT_CSS_CLASS; _href = null; name = null; _orderable = false; _orderableProperty = null; _property = null; _sb = null; _target = null; _title = null; _translate = false; valign = SearchEntry.DEFAULT_VALIGN; } } }