Skip to content

Commit

Permalink
LPS-98834 Support condition field based on user tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rotty3000 committed Oct 2, 2019
1 parent e114c5e commit dddcb0a
Show file tree
Hide file tree
Showing 52 changed files with 314 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ public AssetTagsSelectorDisplayContext(
RenderRequest renderRequest, RenderResponse renderResponse,
HttpServletRequest httpServletRequest) {

this(renderRequest, renderResponse, httpServletRequest, true);
}

public AssetTagsSelectorDisplayContext(
RenderRequest renderRequest, RenderResponse renderResponse,
HttpServletRequest httpServletRequest, boolean rowChecker) {

_renderRequest = renderRequest;
_renderResponse = renderResponse;
_httpServletRequest = httpServletRequest;
_rowChecker = rowChecker;
}

public String getEventName() {
Expand All @@ -71,6 +79,18 @@ public String getOrderByType() {
return _orderByType;
}

public PortletURL getPortletURL() {
PortletURL portletURL = _renderResponse.createRenderURL();

portletURL.setParameter("eventName", getEventName());
portletURL.setParameter("groupIds", StringUtil.merge(_getGroupIds()));
portletURL.setParameter("mvcPath", _getMvcPath());
portletURL.setParameter(
"selectedTagNames", StringUtil.merge(getSelectedTagNames()));

return portletURL;
}

public String[] getSelectedTagNames() {
if (ArrayUtil.isNotEmpty(_selectedTagNames)) {
return _selectedTagNames;
Expand All @@ -92,7 +112,7 @@ public SearchContainer getTagsSearchContainer() {
WebKeys.THEME_DISPLAY);

SearchContainer tagsSearchContainer = new SearchContainer(
_renderRequest, _getPortletURL(), null, "there-are-no-tags");
_renderRequest, getPortletURL(), null, "there-are-no-tags");

String orderByCol = _getOrderByCol();

Expand All @@ -111,8 +131,10 @@ public SearchContainer getTagsSearchContainer() {

tagsSearchContainer.setOrderByType(orderByType);

tagsSearchContainer.setRowChecker(
new EntriesChecker(_renderRequest, _renderResponse));
if (_rowChecker) {
tagsSearchContainer.setRowChecker(
new EntriesChecker(_renderRequest, _renderResponse));
}

int tagsCount = AssetTagServiceUtil.getTagsCount(
themeDisplay.getScopeGroupId(), _getKeywords());
Expand Down Expand Up @@ -160,6 +182,17 @@ private String _getKeywords() {
return _keywords;
}

private String _getMvcPath() {
if (Validator.isNotNull(_mvcPath)) {
return _mvcPath;
}

_mvcPath = ParamUtil.getString(
_httpServletRequest, "mvcPath", "/view.jsp");

return _mvcPath;
}

private String _getOrderByCol() {
if (Validator.isNotNull(_orderByCol)) {
return _orderByCol;
Expand All @@ -171,24 +204,16 @@ private String _getOrderByCol() {
return _orderByCol;
}

private PortletURL _getPortletURL() {
PortletURL portletURL = _renderResponse.createRenderURL();

portletURL.setParameter("eventName", getEventName());
portletURL.setParameter(
"selectedTagNames", StringUtil.merge(getSelectedTagNames()));

return portletURL;
}

private String _eventName;
private long[] _groupIds;
private final HttpServletRequest _httpServletRequest;
private String _keywords;
private String _mvcPath;
private String _orderByCol;
private String _orderByType;
private final RenderRequest _renderRequest;
private final RenderResponse _renderResponse;
private final boolean _rowChecker;
private String[] _selectedTagNames;
private SearchContainer _tagsSearchContainer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ page import="com.liferay.portal.kernel.dao.search.SearchContainer" %><%@
page import="com.liferay.portal.kernel.json.JSONFactoryUtil" %><%@
page import="com.liferay.portal.kernel.util.HtmlUtil" %>
<%@ page import="java.util.HashMap" %><%@
page import="java.util.Map" %>
<liferay-frontend:defineObjects />
<liferay-theme:defineObjects />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<%--
/**
* 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" %>

<%
assetTagsSelectorDisplayContext = new AssetTagsSelectorDisplayContext(renderRequest, renderResponse, request, false);
%>

<clay:management-toolbar
displayContext="<%= new AssetTagsSelectorManagementToolbarDisplayContext(liferayPortletRequest, liferayPortletResponse, request, assetTagsSelectorDisplayContext) %>"
/>

<aui:form action="<%= assetTagsSelectorDisplayContext.getPortletURL() %>" cssClass="container-fluid-1280" method="post" name="selectAssetTagFm">
<liferay-ui:search-container
searchContainer="<%= assetTagsSelectorDisplayContext.getTagsSearchContainer() %>"
>
<liferay-ui:search-container-row
className="com.liferay.asset.kernel.model.AssetTag"
escapedModel="<%= true %>"
keyProperty="name"
modelVar="tag"
rowIdProperty="friendlyURL"
rowVar="row"
>

<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("entityid", tag.getTagId());
data.put("entityname", tag.getName());
%>

<liferay-ui:search-container-column-text
name="name"
truncate="<%= true %>"
>
<aui:a cssClass="selector-button" data="<%= data %>" href="javascript:;">
<%= HtmlUtil.escape(tag.getName()) %>
</aui:a>
</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>

<liferay-ui:search-iterator
displayStyle="list"
markupView="lexicon"
/>
</liferay-ui:search-container>
</aui:form>

<aui:script>
const Util = Liferay.Util;

Util.selectEntityHandler('#<portlet:namespace />selectAssetTagFm', '<%= HtmlUtil.escapeJS(assetTagsSelectorDisplayContext.getEventName()) %>', true);
</aui:script>
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest.
equals=Equals
estimated-time-to-declare-winner=Estimated Time to Declare Winner
field.asset-tag-ids=Tag
field.browser=Browser
field.cookies=Cookies
field.date-modified=Date Modified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=تمكين توصية المحتوى (Automatic Tr
enable-content-recommendation-help=تمكين هذا الخيار لتصفية المحتوى مع شروط اهتمام المستخدم. (Automatic Translation)
equals=يساوي
estimated-time-to-declare-winner=الوقت المقدر لإعلان الفائز
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=المتصفح
field.cookies=ملفات تعريف الارتباط
field.date-modified=تاريخ التعديل
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Разрешаване на препоръка з
enable-content-recommendation-help=Активирайте тази опция, за да филтрирате съдържанието с условията на потребителя за интерес. (Automatic Translation)
equals=Е равно (Automatic Translation)
estimated-time-to-declare-winner=Очаквано време за обявяване на победителя (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Браузър (Automatic Translation)
field.cookies=Бисквитки (Automatic Translation)
field.date-modified=Дата на промяна (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Habiliteu la recomanació de contingut
enable-content-recommendation-help=Habiliteu aquesta opció per filtrar el contingut amb els termes d'interès de l'usuari.
equals=Iguals
estimated-time-to-declare-winner=Temps estimat per declarar el guanyador
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Navegador
field.cookies=Galetes
field.date-modified=Data de modificació
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Povolit doporučení obsahu (Automatic Translation
enable-content-recommendation-help=Povolte tuto volbu, pokud chcete filtrovat obsah s úrokovými podmínkami uživatele. (Automatic Translation)
equals=Rovná se (Automatic Translation)
estimated-time-to-declare-winner=Odhadovaný čas pro deklaraci vítěze (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Prohlížeč (Automatic Translation)
field.cookies=Soubory cookie (Automatic Translation)
field.date-modified=Datum změny (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation (Automatic Copy)
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest. (Automatic Copy)
equals=Equals (Automatic Copy)
estimated-time-to-declare-winner=Estimated Time to Declare Winner (Automatic Copy)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Copy)
field.cookies=Cookies (Automatic Copy)
field.date-modified=Date Modified (Automatic Copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Inhaltsempfehlung aktivieren
enable-content-recommendation-help=Aktivieren Sie diese Option, um den Inhalt nach den Interessen des Benutzers zu filtern.
equals=Ist gleich
estimated-time-to-declare-winner=Geschätzte Zeit bis zur Verkündung des Siegers
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser
field.cookies=Cookies
field.date-modified=Änderungsdatum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Ενεργοποίηση σύστασης περι
enable-content-recommendation-help=Ενεργοποιήστε αυτήν την επιλογή για να φιλτράρετε το περιεχόμενο με τους όρους ενδιαφέροντος του χρήστη. (Automatic Translation)
equals=Ισούται με (Automatic Translation)
estimated-time-to-declare-winner=Εκτιμώμενος χρόνος για τη διακήρυξη του νικητή (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Πρόγραμμα περιήγησης (Automatic Translation)
field.cookies=Τα cookies (Automatic Translation)
field.date-modified=Ημερομηνία τροποποίησης (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest.
equals=Equals
estimated-time-to-declare-winner=Estimated Time to Declare Winner
field.asset-tag-ids=Tag
field.browser=Browser
field.cookies=Cookies
field.date-modified=Date Modified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Habilitar recomendación de contenido
enable-content-recommendation-help=Habilite esta opción para filtrar el contenido con las condiciones de interés del usuario.
equals=Igual
estimated-time-to-declare-winner=Tiempo estimado para declarar el ganador
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Navegador
field.cookies=Cookies
field.date-modified=Fecha de modificación
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Luba Sisusoovitus (Automatic Translation)
enable-content-recommendation-help=Lubage see suvand sisu filtreerimiseks kasutaja huvide tingimustega. (Automatic Translation)
equals=Võrdub (Automatic Translation)
estimated-time-to-declare-winner=Hinnanguline aeg võitja deklareerimiseks (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Brauser (Automatic Translation)
field.cookies=Küpsised (Automatic Translation)
field.date-modified=Muutmise kuupäev (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation (Automatic Copy)
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest. (Automatic Copy)
equals=Equals (Automatic Copy)
estimated-time-to-declare-winner=Estimated Time to Declare Winner (Automatic Copy)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Copy)
field.cookies=Cookies (Automatic Copy)
field.date-modified=Date Modified (Automatic Copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=فعال کردن توصیه محتوا (Automatic
enable-content-recommendation-help=این گزینه را برای فیلتر کردن محتوا با شرایط مورد علاقه کاربر فعال کنید. (Automatic Translation)
equals=برابر است
estimated-time-to-declare-winner=زمان تخمینی برای اعلام برنده (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=مرورگر
field.cookies=کوکی ها
field.date-modified=تاریخ ویرایش (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Ota Käyttöön Sisältösuositus
enable-content-recommendation-help=Ota käyttöön tämä vaihtoehto suodattaaksesi sisältöä käyttäjän kiinnostuksen kohteiden mukaan.
equals=Yhtä suuri kuin
estimated-time-to-declare-winner=Arvioitu Aika Voittajan Julistamiseen
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Selain
field.cookies=Evästeet
field.date-modified=Muokkauspäivämäärä
Expand Down Expand Up @@ -158,4 +159,4 @@ x-member={0} Jäsen
x-members={0} Jäsentä
x-properties={0} Ominaisuutta
x-with-property-x={0} Ominaisuudella {1}
x-with-property-x-x-x={0} Ominaisuudella {1} {2} {3}
x-with-property-x-x-x={0} Ominaisuudella {1} {2} {3}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Activer les recommandation de contenu
enable-content-recommendation-help=Activez cette option pour filtrer le contenu en fonction des conditions d'intérêt de l'utilisateur.
equals=Égal à
estimated-time-to-declare-winner=Temps estimé pour déclarer le gagnant (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Navigateur
field.cookies=Cookies
field.date-modified=Date de modification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation (Automatic Copy)
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest. (Automatic Copy)
equals=Equals (Automatic Copy)
estimated-time-to-declare-winner=Estimated Time to Declare Winner (Automatic Copy)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Copy)
field.cookies=Cookies (Automatic Copy)
field.date-modified=Date Modified (Automatic Copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=सामग्री अनुशंसा सक
enable-content-recommendation-help=उपयोगकर्ता की रुचि की शर्तों के साथ सामग्री फ़िल्टर करने के लिए इस विकल्प को सक्षम करें। (Automatic Translation)
equals=बराबर (Automatic Translation)
estimated-time-to-declare-winner=विजेता घोषित करने के लिए अनुमानित समय (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=ब्राउज़र (Automatic Translation)
field.cookies=कुकीज़ (Automatic Translation)
field.date-modified=दिनांक संशोधित (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation (Automatic Copy)
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest. (Automatic Copy)
equals=Equals (Automatic Copy)
estimated-time-to-declare-winner=Estimated Time to Declare Winner (Automatic Copy)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Copy)
field.cookies=Cookies (Automatic Copy)
field.date-modified=Date Modified (Automatic Copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Tartalomajánlat engedélyezése
enable-content-recommendation-help=Engedélyezze a lehetőséget a tartalom felhasználó érdeklődése alapján történő szűréséhez.
equals=Egyenlő
estimated-time-to-declare-winner=A győztes kihirdetésének becsült időpontja
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Böngésző
field.cookies=Cookie-k
field.date-modified=Módosítás dátuma
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Aktifkan rekomendasi konten (Automatic Translation
enable-content-recommendation-help=Aktifkan opsi ini untuk memfilter konten dengan persyaratan minat pengguna. (Automatic Translation)
equals=Sama dengan (Automatic Translation)
estimated-time-to-declare-winner=Perkiraan waktu untuk mengumumkan pemenang (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Translation)
field.cookies=Cookie (Automatic Translation)
field.date-modified=Tanggal dimodifikasi (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Abilita raccomandazione sui contenuti (Automatic T
enable-content-recommendation-help=Attivare questa opzione per filtrare il contenuto in base alle condizioni di interesse dell'utente. (Automatic Translation)
equals=È uguale a (Automatic Translation)
estimated-time-to-declare-winner=Tempo stimato per dichiarare il vincitore (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Translation)
field.cookies=Cookie (Automatic Translation)
field.date-modified=Data di modifica (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=אפשר המלצת תוכן (Automatic Translatio
enable-content-recommendation-help=הפוך אפשרות זו לזמינה כדי לסנן את התוכן עם תנאי העניין של המשתמש. (Automatic Translation)
equals=שווה ל- (Automatic Translation)
estimated-time-to-declare-winner=זמן משוער להכריז על הזוכה (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=דפדפן (Automatic Translation)
field.cookies=עוגיות (Automatic Translation)
field.date-modified=התאריך שונה (Automatic Translation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=コンテンツ推薦を有効にする
enable-content-recommendation-help=ユーザーが関心のある言葉でコンテンツを絞り込むには、このオプションを有効にしてください。
equals=等しい
estimated-time-to-declare-winner=勝者を宣言するための予想時間
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=ブラウザ
field.cookies=Cookie
field.date-modified=変更日
Expand Down Expand Up @@ -158,4 +159,4 @@ x-member=メンバー{0}名
x-members=メンバー{0}名
x-properties={0}件のプロパティ
x-with-property-x=プロパティ {1} の {0}
x-with-property-x-x-x=プロパティ {1} {2} {3} の {0}
x-with-property-x-x-x=プロパティ {1} {2} {3} の {0}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=Enable Content Recommendation (Automatic Copy)
enable-content-recommendation-help=Enable this option to filter the content with user's terms of interest. (Automatic Copy)
equals=Equals (Automatic Copy)
estimated-time-to-declare-winner=Estimated Time to Declare Winner (Automatic Copy)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=Browser (Automatic Copy)
field.cookies=Cookies (Automatic Copy)
field.date-modified=Date Modified (Automatic Copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ enable-content-recommendation=콘텐츠 추천 사용 (Automatic Translation)
enable-content-recommendation-help=이 옵션을 사용하여 사용자의 관심 조건으로 콘텐츠를 필터링합니다. (Automatic Translation)
equals=같음 (Automatic Translation)
estimated-time-to-declare-winner=우승자를 선언할 예상 시간 (Automatic Translation)
field.asset-tag-ids=Tag (Automatic Copy)
field.browser=브라우저 (Automatic Translation)
field.cookies=쿠키 (Automatic Translation)
field.date-modified=최종 수정 날짜 (Automatic Translation)
Expand Down
Loading

0 comments on commit dddcb0a

Please sign in to comment.