use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class KBArticleAssetRendererFactory method getURLAdd.
@Override
public PortletURL getURLAdd(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse) throws PortalException, SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!AdminPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.ADD_KB_ARTICLE)) {
return null;
}
PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest, PortletKeys.KNOWLEDGE_BASE_ADMIN, getControlPanelPlid(themeDisplay), PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcPath", "/admin/edit_article.jsp");
return portletURL;
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method unsubscribeGroupKBArticles.
public void unsubscribeGroupKBArticles(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
String portletId = PortalUtil.getPortletId(actionRequest);
KBArticleServiceUtil.unsubscribeGroupKBArticles(themeDisplay.getScopeGroupId(), portletId);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method importFile.
public void importFile(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
InputStream inputStream = null;
try {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
long parentKBFolderId = ParamUtil.getLong(uploadPortletRequest, "parentKBFolderId", KBFolderConstants.DEFAULT_PARENT_FOLDER_ID);
String fileName = uploadPortletRequest.getFileName("file");
if (Validator.isNull(fileName)) {
throw new KBArticleImportException("File name is null");
}
boolean prioritizeByNumericalPrefix = ParamUtil.getBoolean(uploadPortletRequest, "prioritizeByNumericalPrefix");
inputStream = uploadPortletRequest.getFileAsStream("file");
ServiceContext serviceContext = ServiceContextFactory.getInstance(AdminPortlet.class.getName(), actionRequest);
serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW });
int kbArticleCount = KBArticleServiceUtil.addKBArticlesMarkdown(themeDisplay.getScopeGroupId(), parentKBFolderId, fileName, prioritizeByNumericalPrefix, inputStream, serviceContext);
SessionMessages.add(actionRequest, "importedKBArticlesCount", kbArticleCount);
} catch (KBArticleImportException kbaie) {
SessionErrors.add(actionRequest, kbaie.getClass(), kbaie);
} finally {
StreamUtil.cleanUp(inputStream);
}
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method subscribeGroupKBArticles.
public void subscribeGroupKBArticles(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
String portletId = PortalUtil.getPortletId(actionRequest);
KBArticleServiceUtil.subscribeGroupKBArticles(themeDisplay.getScopeGroupId(), portletId);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method deleteKBArticles.
public void deleteKBArticles(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long[] resourcePrimKeys = StringUtil.split(ParamUtil.getString(actionRequest, "resourcePrimKeys"), 0L);
KBArticleServiceUtil.deleteKBArticles(themeDisplay.getScopeGroupId(), resourcePrimKeys);
}
Aggregations