protected String getWindowJS(PortletRequest portletRequest, JournalArticle article) { StringBundler sb = new StringBundler(13); sb.append("Liferay.Util.Window.getWindow({bodyCssClass: "); sb.append("'dialog-with-footer', destroyOnHide: true, dialog: "); sb.append(getDialogJS(article)); sb.append(", id: '"); ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); sb.append(HtmlUtil.escape(portletDisplay.getNamespace())); sb.append("viewSource', namespace: '"); sb.append(portletDisplay.getNamespace()); sb.append("', portlet: '#p_p_id_"); sb.append(portletDisplay.getId()); sb.append("_', portletId: '"); sb.append(portletDisplay.getId()); sb.append("', title: '"); sb.append(HtmlUtil.escapeJS(HtmlUtil.escape(article.getTitle(themeDisplay.getLocale())))); sb.append("'});"); return sb.toString(); }
@Override public void populateConfigJSONObject( JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes, ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) { JSONObject autoCompleteConfigJSONObject = JSONFactoryUtil.createJSONObject(); autoCompleteConfigJSONObject.put("requestTemplate", "query={query}"); JSONArray triggerJSONArray = JSONFactoryUtil.createJSONArray(); JSONObject triggerJSONObject = JSONFactoryUtil.createJSONObject(); triggerJSONObject.put("resultFilters", "function(query, results) {return results;}"); triggerJSONObject.put("resultTextLocator", "title"); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); ResourceURL autoCompletePageTitleURL = (ResourceURL) requestBackedPortletURLFactory.createResourceURL(portletDisplay.getId()); Map<String, String> fileBrowserParams = (Map<String, String>) inputEditorTaglibAttributes.get("liferay-ui:input-editor:fileBrowserParams"); autoCompletePageTitleURL.setParameter("nodeId", fileBrowserParams.get("nodeId")); autoCompletePageTitleURL.setResourceID("/wiki/autocomplete_page_title"); String source = autoCompletePageTitleURL.toString() + "&" + _portal.getPortletNamespace(portletDisplay.getId()); triggerJSONObject.put("source", source); triggerJSONObject.put("term", "["); triggerJSONObject.put("tplReplace", "<a href=\"{title}\">{title}</a>"); triggerJSONObject.put("tplResults", "<span class=\"h5 truncate-text\">{title}</span>"); triggerJSONArray.put(triggerJSONObject); autoCompleteConfigJSONObject.put("trigger", triggerJSONArray); jsonObject.put("autocomplete", autoCompleteConfigJSONObject); String extraPlugins = jsonObject.getString("extraPlugins"); if (Validator.isNotNull(extraPlugins)) { extraPlugins += ",autocomplete"; } else { extraPlugins = "autocomplete,ae_placeholder,ae_selectionregion,ae_uicore"; } jsonObject.put("extraPlugins", extraPlugins); }
@Override public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); Portlet portlet = _portletLocalService.getPortletById(portletDisplay.getId()); PortletURL portletURL = PortletURLFactoryUtil.create( portletRequest, PortletProviderUtil.getPortletId( DDMStructure.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/view.jsp"); portletURL.setParameter("backURL", themeDisplay.getURLCurrent()); portletURL.setParameter("groupId", String.valueOf(themeDisplay.getScopeGroupId())); portletURL.setParameter("refererPortletName", DLPortletKeys.DOCUMENT_LIBRARY); portletURL.setParameter("refererWebDAVToken", WebDAVUtil.getStorageToken(portlet)); portletURL.setParameter("showAncestorScopes", Boolean.TRUE.toString()); portletURL.setParameter("showManageTemplates", Boolean.FALSE.toString()); return portletURL.toString(); }
protected String getPortletId() { ThemeDisplay themeDisplay = getThemeDisplay(); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); return portletDisplay.getId(); }
public static List<BreadcrumbEntry> getPortletBreadcrumbEntries(HttpServletRequest request) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String name = WebKeys.PORTLET_BREADCRUMBS; List<BreadcrumbEntry> breadcrumbEntries = (List<BreadcrumbEntry>) request.getAttribute(name); if (Validator.isNotNull(portletDisplay.getId()) && !portletDisplay.isFocused() && !Validator.equals( portletDisplay.getId(), PortletProviderUtil.getPortletId( BreadcrumbEntry.class.getName(), PortletProvider.Action.VIEW))) { name = name.concat(StringPool.UNDERLINE.concat(portletDisplay.getId())); List<BreadcrumbEntry> portletBreadcrumbEntries = (List<BreadcrumbEntry>) request.getAttribute(name); if (portletBreadcrumbEntries != null) { breadcrumbEntries = portletBreadcrumbEntries; } } if (breadcrumbEntries == null) { return Collections.emptyList(); } for (int i = 0; i < breadcrumbEntries.size() - 1; i++) { BreadcrumbEntry portletBreadcrumbEntry = breadcrumbEntries.get(i); String url = portletBreadcrumbEntry.getURL(); if (Validator.isNotNull(url) && !CookieKeys.hasSessionId(request)) { HttpSession session = request.getSession(); portletBreadcrumbEntry.setURL(PortalUtil.getURLWithSessionId(url, session.getId())); } } return breadcrumbEntries; }
@Override public String getOnClick(PortletRequest portletRequest, PortletResponse portletResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); return "Liferay.Portlet.close('#p_p_id_" .concat(portletDisplay.getId()) .concat("_'); return false;"); }
public boolean isDefaultAssetPublisher() { if (_defaultAssetPublisher != null) { return _defaultAssetPublisher; } ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _defaultAssetPublisher = AssetUtil.isDefaultAssetPublisher( themeDisplay.getLayout(), portletDisplay.getId(), getPortletResource()); return _defaultAssetPublisher; }
public boolean isShowActions() throws PortalException { PortletDisplay portletDisplay = _themeDisplay.getPortletDisplay(); String portletName = portletDisplay.getPortletName(); if (portletName.equals(DLPortletKeys.DOCUMENT_LIBRARY_ADMIN)) { return true; } Settings settings = SettingsFactoryUtil.getSettings( new PortletInstanceSettingsLocator(_themeDisplay.getLayout(), portletDisplay.getId())); TypedSettings typedSettings = new TypedSettings(settings); return typedSettings.getBooleanValue("showActions"); }