Search in sources :

Example 41 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class LiferayPortlet method translate.

protected String translate(PortletRequest portletRequest, String key, Object argument) {
    PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    return LanguageUtil.format(portletConfig, themeDisplay.getLocale(), key, argument);
}
Also used : PortletConfig(javax.portlet.PortletConfig) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 42 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class LiferayActivityService method doGetActivity.

public Activity doGetActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken securityToken) throws Exception {
    ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
    long activityIdLong = GetterUtil.getLong(activityId);
    SocialActivity socialActivity = SocialActivityLocalServiceUtil.getActivity(activityIdLong);
    return getActivity(themeDisplay, socialActivity);
}
Also used : ThemeDisplay(com.liferay.portal.theme.ThemeDisplay) SocialActivity(com.liferay.portlet.social.model.SocialActivity)

Example 43 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class AdminPortlet method doAddGadget.

protected Gadget doAddGadget(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String url = ParamUtil.getString(actionRequest, "url");
    String portletCategoryNames = ParamUtil.getString(actionRequest, "portletCategoryNames");
    ServiceContext serviceContext = ServiceContextFactory.getInstance(Gadget.class.getName(), actionRequest);
    Gadget gadget = GadgetServiceUtil.addGadget(themeDisplay.getCompanyId(), url, portletCategoryNames, serviceContext);
    return gadget;
}
Also used : Gadget(com.liferay.opensocial.model.Gadget) ServiceContext(com.liferay.portal.service.ServiceContext) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 44 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class AdminPortlet method updateOAuthConsumers.

public void updateOAuthConsumers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
    long gadgetId = ParamUtil.getLong(actionRequest, "gadgetId");
    GadgetPermission.check(permissionChecker, themeDisplay.getScopeGroupId(), gadgetId, ActionKeys.UPDATE);
    ShindigUtil.updateOAuthConsumers(actionRequest, actionResponse);
}
Also used : PermissionChecker(com.liferay.portal.security.permission.PermissionChecker) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 45 with ThemeDisplay

use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.

the class EditorPortlet method serveAddFileEntry.

protected void serveAddFileEntry(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long folderId = ParamUtil.getLong(resourceRequest, "folderId");
    Folder folder = DLAppServiceUtil.getFolder(folderId);
    String fileEntryTitle = ParamUtil.getString(resourceRequest, "fileEntryTitle");
    String content = ParamUtil.getString(resourceRequest, "content");
    byte[] bytes = content.getBytes(StringPool.UTF8);
    ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest);
    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);
    serviceContext.setAttribute("sourceFileName", fileEntryTitle);
    serviceContext.setScopeGroupId(folder.getGroupId());
    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
    FileEntry fileEntry = DLAppServiceUtil.addFileEntry(folder.getRepositoryId(), folderId, fileEntryTitle, resourceRequest.getContentType(), fileEntryTitle, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
    jsonObject.put("fileEntryId", fileEntry.getFileEntryId());
    String portalURL = PortalUtil.getPortalURL(themeDisplay);
    String fileEntryURL = ShindigUtil.getFileEntryURL(portalURL, fileEntry.getFileEntryId());
    jsonObject.put("fileEntryURL", fileEntryURL);
    writeJSON(resourceRequest, resourceResponse, jsonObject);
}
Also used : JSONObject(com.liferay.portal.kernel.json.JSONObject) ServiceContext(com.liferay.portal.service.ServiceContext) FileEntry(com.liferay.portal.kernel.repository.model.FileEntry) Folder(com.liferay.portal.kernel.repository.model.Folder) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Aggregations

ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)63 PermissionChecker (com.liferay.portal.security.permission.PermissionChecker)10 ServiceContext (com.liferay.portal.service.ServiceContext)7 JSONObject (com.liferay.portal.kernel.json.JSONObject)6 PortletURL (javax.portlet.PortletURL)6 PortalException (com.liferay.portal.kernel.exception.PortalException)5 User (com.liferay.portal.model.User)5 Gadget (com.liferay.opensocial.model.Gadget)4 SystemException (com.liferay.portal.kernel.exception.SystemException)4 UploadPortletRequest (com.liferay.portal.kernel.upload.UploadPortletRequest)4 PortletConfig (javax.portlet.PortletConfig)4 KBArticle (com.liferay.knowledgebase.model.KBArticle)3 KBFolder (com.liferay.knowledgebase.model.KBFolder)3 Role (com.liferay.portal.model.Role)3 HashMap (java.util.HashMap)3 LiferayPortletURL (com.liferay.portal.kernel.portlet.LiferayPortletURL)2 FileEntry (com.liferay.portal.kernel.repository.model.FileEntry)2 Folder (com.liferay.portal.kernel.repository.model.Folder)2 Layout (com.liferay.portal.model.Layout)2 SocialActivity (com.liferay.portlet.social.model.SocialActivity)2