
META-INF.resources.add_asset_selector.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
%>
<%
PortletURL redirectURL = renderResponse.createRenderURL();
redirectURL.setParameter("hideDefaultSuccessMessage", Boolean.TRUE.toString());
redirectURL.setParameter("mvcPath", "/add_asset_redirect.jsp");
redirectURL.setParameter("redirect", redirect);
redirectURL.setWindowState(LiferayWindowState.POP_UP);
List addPortletURLsGroupIds = new ArrayList();
%>
<%
long[] groupIds = assetPublisherDisplayContext.getGroupIds();
for (long groupId : groupIds) {
Map addPortletURLs = AssetUtil.getAddPortletURLs(liferayPortletRequest, liferayPortletResponse, groupId, assetPublisherDisplayContext.getClassNameIds(), assetPublisherDisplayContext.getClassTypeIds(), assetPublisherDisplayContext.getAllAssetCategoryIds(), assetPublisherDisplayContext.getAllAssetTagNames(), redirectURL.toString());
if ((addPortletURLs != null) && !addPortletURLs.isEmpty()) {
addPortletURLsGroupIds.add(groupId);
%>
<%
}
}
%>
<%
for (Long groupId : addPortletURLsGroupIds) {
Map addPortletURLs = AssetUtil.getAddPortletURLs(liferayPortletRequest, liferayPortletResponse, groupId, assetPublisherDisplayContext.getClassNameIds(), assetPublisherDisplayContext.getClassTypeIds(), assetPublisherDisplayContext.getAllAssetCategoryIds(), assetPublisherDisplayContext.getAllAssetTagNames(), redirectURL.toString());
%>
" id="<%= liferayPortletResponse.getNamespace() + groupId %>">
<%
for (Map.Entry entry : addPortletURLs.entrySet()) {
AssetRendererFactory> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(AssetUtil.getClassName(entry.getKey()));
String message = AssetUtil.getClassNameMessage(entry.getKey(), locale);
long curGroupId = groupId;
Group group = GroupLocalServiceUtil.fetchGroup(groupId);
if (!group.isStagedPortlet(assetRendererFactory.getPortletId()) && !group.isStagedRemotely()) {
curGroupId = group.getLiveGroupId();
}
Map data = new HashMap();
data.put("title", LanguageUtil.format((HttpServletRequest)pageContext.getRequest(), "new-x", HtmlUtil.escape(message), false));
data.put("url", AssetUtil.getAddURLPopUp(curGroupId, plid, entry.getValue(), assetRendererFactory.getPortletId(), false, null));
%>
<%
}
%>
Liferay.Util.toggleSelectBox(' selectScope', '<%= groupId %>', ' <%= groupId %>');
<%
}
%>
function addAssetEntry() {
var A = AUI();
var visibleItem = A.one('.asset-entry-type:not(.hide)');
var assetEntryTypeSelector = visibleItem.one('.asset-entry-type-select');
var index = assetEntryTypeSelector.get('selectedIndex');
var selectedOption = assetEntryTypeSelector.get('options').item(index);
var title = selectedOption.attr('data-title');
var url = selectedOption.attr('data-url');
var dialog = Liferay.Util.getWindow();
dialog.iframe.set('uri', url);
dialog.titleNode.html(title);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy