List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getPpid
public String getPpid()
From source file:com.liferay.application.list.BasePanelCategory.java
License:Open Source License
@Override public boolean isActive(HttpServletRequest request, PanelCategoryHelper panelCategoryHelper, Group group) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String ppid = ParamUtil.getString(request, "selPpid", themeDisplay.getPpid()); return panelCategoryHelper.containsPortlet(ppid, getKey(), themeDisplay.getPermissionChecker(), group); }
From source file:com.liferay.application.list.taglib.servlet.taglib.PanelAppTag.java
License:Open Source License
@Override protected void setAttributes(HttpServletRequest request) { boolean active = false; ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); if (_active != null) { active = _active.booleanValue(); } else {/* w w w.ja v a 2 s . co m*/ active = Objects.equals(themeDisplay.getPpid(), _panelApp.getPortletId()); } request.setAttribute("liferay-application-list:panel-app:active", active); if (_data == null) { _data = new HashMap<>(); } if (Validator.isNull(_label) && (_panelApp != null)) { Portlet portlet = PortletLocalServiceUtil.getPortletById(themeDisplay.getCompanyId(), _panelApp.getPortletId()); _label = PortalUtil.getPortletTitle(portlet, servletContext, themeDisplay.getLocale()); if (!_data.containsKey("qa-id")) { _data.put("qa-id", "app"); } } if (!_data.containsKey("title")) { _data.put("title", _label); } request.setAttribute("liferay-application-list:panel-app:data", _data); if (Validator.isNull(_id)) { _id = "portlet_" + _panelApp.getPortletId(); } request.setAttribute("liferay-application-list:panel-app:id", _id); request.setAttribute("liferay-application-list:panel-app:label", _label); int notificationsCount = 0; if (_panelApp != null) { notificationsCount = _panelApp.getNotificationsCount(themeDisplay.getUser()); } request.setAttribute("liferay-application-list:panel-app:notificationsCount", notificationsCount); request.setAttribute("liferay-application-list:panel-app:panelApp", _panelApp); if (Validator.isNull(_url) && (_panelApp != null)) { PortletURL portletURL = null; try { portletURL = _panelApp.getPortletURL(request); } catch (PortalException pe) { _log.error("Unable to get portlet URL", pe); } _url = portletURL.toString(); } request.setAttribute("liferay-application-list:panel-app:url", _url); }
From source file:com.liferay.asset.publisher.web.portlet.AssetPublisherPortlet.java
License:Open Source License
public void subscribe(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); assetPublisherWebUtil.subscribe(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), themeDisplay.getPlid(), themeDisplay.getPpid()); }
From source file:com.liferay.asset.publisher.web.portlet.AssetPublisherPortlet.java
License:Open Source License
public void unsubscribe(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); assetPublisherWebUtil.unsubscribe(themeDisplay.getPermissionChecker(), themeDisplay.getPlid(), themeDisplay.getPpid()); }
From source file:com.liferay.calendar.web.internal.portlet.CalendarPortlet.java
License:Open Source License
protected String getEditCalendarURL(ActionRequest actionRequest, ActionResponse actionResponse, Calendar calendar) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String editCalendarURL = getRedirect(actionRequest, actionResponse); if (Validator.isNull(editCalendarURL)) { editCalendarURL = _portal.getLayoutFullURL(themeDisplay); }/*ww w . j a va2 s .c om*/ String namespace = actionResponse.getNamespace(); editCalendarURL = HttpUtil.setParameter(editCalendarURL, "p_p_id", themeDisplay.getPpid()); editCalendarURL = HttpUtil.setParameter(editCalendarURL, namespace + "mvcPath", templatePath + "edit_calendar.jsp"); editCalendarURL = HttpUtil.setParameter(editCalendarURL, namespace + "redirect", getRedirect(actionRequest, actionResponse)); editCalendarURL = HttpUtil.setParameter(editCalendarURL, namespace + "backURL", ParamUtil.getString(actionRequest, "backURL")); editCalendarURL = HttpUtil.setParameter(editCalendarURL, namespace + "calendarId", calendar.getCalendarId()); return editCalendarURL; }
From source file:com.liferay.calendar.web.internal.portlet.CalendarPortlet.java
License:Open Source License
protected String getViewCalendarBookingURL(ActionRequest actionRequest, CalendarBooking calendarBooking) throws WindowStateException { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletURL redirectURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); redirectURL.setParameter("mvcPath", "/view_calendar_booking.jsp"); redirectURL.setParameter("calendarBookingId", String.valueOf(calendarBooking.getCalendarBookingId())); redirectURL.setParameter("instanceIndex", "0"); redirectURL.setWindowState(LiferayWindowState.POP_UP); return redirectURL.toString(); }
From source file:com.liferay.dynamic.data.lists.form.web.internal.portlet.action.SaveRecordSetMVCActionCommand.java
License:Open Source License
@Override protected void doTransactionalCommand(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); String mvcPath = ParamUtil.getString(actionRequest, "mvcPath"); portletURL.setParameter("mvcPath", mvcPath); String redirect = ParamUtil.getString(actionRequest, "redirect"); DDLRecordSet ddlRecordSet = saveRecordSetMVCCommandHelper.saveRecordSet(actionRequest, actionResponse); portletURL.setParameter("recordSetId", String.valueOf(ddlRecordSet.getRecordSetId())); portletURL.setParameter("redirect", redirect); boolean saveAndPublish = ParamUtil.getBoolean(actionRequest, "saveAndPublish"); portletURL.setParameter("showPublishModal", String.valueOf(saveAndPublish)); actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString()); }
From source file:com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.SaveFormInstanceMVCActionCommand.java
License:Open Source License
@Override protected void doTransactionalCommand(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); String mvcPath = ParamUtil.getString(actionRequest, "mvcPath"); portletURL.setParameter("mvcPath", mvcPath); String redirect = ParamUtil.getString(actionRequest, "redirect"); DDMFormInstance formInstance = saveFormInstanceMVCCommandHelper.saveFormInstance(actionRequest, actionResponse, true);/*from w ww .jav a 2 s. com*/ portletURL.setParameter("formInstanceId", String.valueOf(formInstance.getFormInstanceId())); portletURL.setParameter("redirect", redirect); actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString()); }
From source file:com.liferay.dynamic.data.mapping.form.web.internal.portlet.action.SaveStructureMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ServiceContext serviceContext = ServiceContextFactory.getInstance(DDMStructure.class.getName(), actionRequest);/*from w w w. ja v a2 s .c om*/ long groupId = ParamUtil.getLong(actionRequest, "groupId"); long structureId = ParamUtil.getLong(actionRequest, "structureId"); String structureKey = ParamUtil.getString(actionRequest, "structureKey"); String name = ParamUtil.getString(actionRequest, "name"); String description = ParamUtil.getString(actionRequest, "description"); DDMForm ddmForm = getDDMForm(actionRequest); DDMFormLayout ddmFormLayout = getDDMFormLayout(actionRequest); Map<Locale, String> nameMap = getLocalizedMap(name, ddmForm.getAvailableLocales(), ddmForm.getDefaultLocale()); Map<Locale, String> descriptionMap = getLocalizedMap(description, ddmForm.getAvailableLocales(), ddmForm.getDefaultLocale()); DDMStructure ddmStructure = null; if (structureId == 0) { ddmStructure = _ddmStructureService.addStructure(groupId, DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID, _portal.getClassNameId(DDMFormInstance.class), structureKey, nameMap, descriptionMap, ddmForm, ddmFormLayout, StorageType.JSON.toString(), DDMStructureConstants.TYPE_FRAGMENT, serviceContext); } else { ddmStructure = _ddmStructureService.updateStructure(groupId, DDMStructureConstants.DEFAULT_PARENT_STRUCTURE_ID, _portal.getClassNameId(DDMFormInstance.class), structureKey, nameMap, descriptionMap, ddmForm, ddmFormLayout, serviceContext); } LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); String mvcPath = ParamUtil.getString(actionRequest, "mvcPath"); portletURL.setParameter("mvcPath", mvcPath); String redirect = ParamUtil.getString(actionRequest, "redirect"); portletURL.setParameter("structureId", String.valueOf(ddmStructure.getStructureId())); portletURL.setParameter("redirect", redirect); actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString()); }
From source file:com.liferay.dynamic.data.mapping.web.internal.portlet.action.CopyStructureMVCActionCommand.java
License:Open Source License
@Override protected String getSaveAndContinueRedirect(ActionRequest actionRequest, DDMStructure structure, String redirect) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/copy_structure"); long classNameId = _portal.getClassNameId(DDMStructure.class); portletURL.setParameter("classNameId", String.valueOf(classNameId), false); portletURL.setParameter("classPK", String.valueOf(structure.getStructureId()), false); portletURL.setParameter("copyFormTemplates", ParamUtil.getString(actionRequest, "copyFormTemplates"), false);/* w w w .j a v a 2 s . c om*/ portletURL.setParameter("copyDisplayTemplates", ParamUtil.getString(actionRequest, "copyDisplayTemplates"), false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }