Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-71633 Add Layout selector to item selector tabs #48074

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,7 @@
dependencies {
provided group: "com.liferay", name: "com.liferay.item.selector.api", version: "2.0.0"
provided group: "com.liferay", name: "com.liferay.item.selector.criteria.api", version: "2.0.0"
provided group: "com.liferay", name: "com.liferay.layout.item.selector.api", version: "1.0.0"
provided group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
provided group: "javax.portlet", name: "portlet-api", version: "2.0"
provided group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.liferay.item.selector.ItemSelectorReturnType;
import com.liferay.item.selector.criteria.URLItemSelectorReturnType;
import com.liferay.item.selector.criteria.file.criterion.FileItemSelectorCriterion;
import com.liferay.layout.item.selector.criterion.LayoutItemSelectorCriterion;
import com.liferay.portal.kernel.editor.configuration.EditorConfigContributor;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.portlet.RequestBackedPortletURLFactory;
Expand Down Expand Up @@ -52,10 +53,16 @@ public void populateConfigJSONObject(

desiredItemSelectorReturnTypes.add(new URLItemSelectorReturnType());

ItemSelectorCriterion itemSelectorCriterion =
ItemSelectorCriterion fileItemSelectorCriterion =
new FileItemSelectorCriterion();

itemSelectorCriterion.setDesiredItemSelectorReturnTypes(
fileItemSelectorCriterion.setDesiredItemSelectorReturnTypes(
desiredItemSelectorReturnTypes);

ItemSelectorCriterion layoutItemSelectorCriterion =
new LayoutItemSelectorCriterion();

layoutItemSelectorCriterion.setDesiredItemSelectorReturnTypes(
desiredItemSelectorReturnTypes);

String namespace = GetterUtil.getString(
Expand All @@ -67,7 +74,7 @@ public void populateConfigJSONObject(

PortletURL itemSelectorURL = _itemSelector.getItemSelectorURL(
requestBackedPortletURLFactory, namespace + name + "selectItem",
itemSelectorCriterion);
fileItemSelectorCriterion, layoutItemSelectorCriterion);

jsonObject.put("filebrowserBrowseUrl", itemSelectorURL.toString());
}
Expand Down
Expand Up @@ -5,6 +5,7 @@ configJSModules {
dependencies {
provided group: "com.liferay", name: "com.liferay.item.selector.api", version: "2.0.0"
provided group: "com.liferay", name: "com.liferay.item.selector.criteria.api", version: "2.0.0"
provided group: "com.liferay", name: "com.liferay.layout.item.selector.api", version: "1.0.0"
provided group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
provided group: "javax.portlet", name: "portlet-api", version: "2.0"
provided group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.liferay.item.selector.ItemSelectorReturnType;
import com.liferay.item.selector.criteria.URLItemSelectorReturnType;
import com.liferay.item.selector.criteria.file.criterion.FileItemSelectorCriterion;
import com.liferay.layout.item.selector.criterion.LayoutItemSelectorCriterion;
import com.liferay.portal.kernel.editor.configuration.BaseEditorConfigContributor;
import com.liferay.portal.kernel.editor.configuration.EditorConfigContributor;
import com.liferay.portal.kernel.json.JSONArray;
Expand Down Expand Up @@ -117,14 +118,21 @@ protected void populateFileBrowserURL(

desiredItemSelectorReturnTypes.add(new URLItemSelectorReturnType());

ItemSelectorCriterion itemSelectorCriterion =
ItemSelectorCriterion fileItemSelectorCriterion =
new FileItemSelectorCriterion();

itemSelectorCriterion.setDesiredItemSelectorReturnTypes(
fileItemSelectorCriterion.setDesiredItemSelectorReturnTypes(
desiredItemSelectorReturnTypes);

LayoutItemSelectorCriterion layoutItemSelectorCriterion =
new LayoutItemSelectorCriterion();

layoutItemSelectorCriterion.setDesiredItemSelectorReturnTypes(
desiredItemSelectorReturnTypes);

PortletURL itemSelectorURL = _itemSelector.getItemSelectorURL(
requestBackedPortletURLFactory, eventName, itemSelectorCriterion);
requestBackedPortletURLFactory, eventName,
fileItemSelectorCriterion, layoutItemSelectorCriterion);

jsonObject.put("documentBrowseLinkUrl", itemSelectorURL.toString());
}
Expand Down
Expand Up @@ -124,6 +124,7 @@
}
}
},
title: Liferay.Language.get('select-item'),
eventName: editor.name + 'selectDocument',
url: url
}
Expand Down
Expand Up @@ -230,6 +230,8 @@ private JSONArray _getLayoutsJSONArray(
jsonObject.put("layoutId", layout.getLayoutId());
jsonObject.put("name", layout.getName(themeDisplay.getLocale()));
jsonObject.put("privateLayout", layout.isPrivateLayout());
jsonObject.put(
"url", layout.getFriendlyURL(themeDisplay.getLocale()));

if (Objects.equals(layout.getUuid(), selectedLayoutUuid)) {
jsonObject.put("selected", true);
Expand Down
Expand Up @@ -36,9 +36,8 @@ Portlet portlet = PortletLocalServiceUtil.getPortletById(company.getCompanyId(),
</aui:fieldset-group>
</aui:form>

<aui:script require="journal-web/js/CardsTreeView.es,metal-dom/src/dom">
<aui:script require="journal-web/js/CardsTreeView.es">
var CardsTreeView = journalWebJsCardsTreeViewEs.default;
var dom = metalDomSrcDom.default;

new CardsTreeView(
{
Expand All @@ -51,7 +50,8 @@ Portlet portlet = PortletLocalServiceUtil.getPortletById(company.getCompanyId(),
id: node.id,
layoutId: node.layoutId,
name: node.value,
privateLayout: node.privateLayout
privateLayout: node.privateLayout,
value: node.url
};

Liferay.Util.getOpener().Liferay.fire(
Expand All @@ -62,7 +62,8 @@ Portlet portlet = PortletLocalServiceUtil.getPortletById(company.getCompanyId(),
);
}
},
nodes: [<%= layoutItemSelectorViewDisplayContext.getLayoutsJSONObject() %>]
nodes: [<%= layoutItemSelectorViewDisplayContext.getLayoutsJSONObject() %>],
pathThemeImages: '<%= themeDisplay.getPathThemeImages() %>'
},
'#<portlet:namespace />displayPageContainer'
);
Expand Down
1 change: 1 addition & 0 deletions portal-impl/src/content/Language.properties
Expand Up @@ -4100,6 +4100,7 @@ select-file=Select File
select-files=Select Files
select-folder=Select Folder
select-in-x=Select in {0}
select-item=Select Item
select-layout=Select Page
select-list=Select List
select-more-than-one=Select More Than One
Expand Down