There are few scenarios that you might want to modify the JSPs to override which are no longer in Liferay’s core and you can do core JSP customizations to a specific site.

portal-web/docroot/html

 


As you can see, the above screen represents before you begin crafting a module to override core JSPs.

In the below example you can restrict global vocabularies and categories with in site scope and it was achieved by implementing hook in Liferay 7 environment.

If you’re overriding,

htmltaglibuiasset_categories_selectorpage.jsp

put the overridden JSP in this folder of your module: to achieve it.

Plain text
1long[] groupIds = (long[])request.getAttribute("liferay-ui:asset-categories-selector:groupIds");
2if (ArrayUtil.isEmpty(groupIds)) {
3groupIds = PortalUtil.getCurrentAndAncestorSiteGroupIds(scopeGroupId);
4}
5else {
6groupIds = PortalUtil.getCurrentAndAncestorSiteGroupIds(groupIds);
7}
8long grpId = GetterUtil.getLong(PropsUtil.get("extranet.groupid"));
9if(grpId==scopeGroupId){
10long globalGrpId = GetterUtil.getLong(PropsUtil.get("global.groupid"));
11groupIds = ArrayUtil.remove(groupIds, globalGrpId);
12}
13List<AssetVocabulary> vocabularies = AssetVocabularyServiceUtil.getGroupVocabularies(groupIds);
14<aui:script use="liferay-asset-categories-selector">
15new Liferay.AssetCategoriesSelector(
16{
17className: '<%= className %>',
18contentBox: '#<%= namespace + randomNamespace %>assetCategoriesSelector_<%= vocabulary.getVocabularyId() %>',
19curEntries: '<%= HtmlUtil.escapeJS(categoryIdsTitles[1]) %>',
20curEntryIds: '<%= categoryIdsTitles[0] %>',
21hiddenInput: '#<%= namespace + hiddenInput + StringPool.UNDERLINE + vocabulary.getVocabularyId() %>',
22instanceVar: '<%= namespace + randomNamespace %>',
23labelNode: '#<%= namespace %>assetCategoriesLabel_<%= vocabulary.getVocabularyId() %>',
24maxEntries: <%= maxEntries %>,
25moreResultsLabel: '<%= UnicodeLanguageUtil.get(resourceBundle, "load-more-results") %>',
26portalModelResource: <%= Validator.isNotNull(className) && (ResourceActionsUtil.isPortalModelResource(className) || className.equals(Group.class.getName())) %>,
27singleSelect: <%= !vocabulary.isMultiValued() %>,
28title: '<%= UnicodeLanguageUtil.format(request, "select-x", vocabulary.getTitle(locale), false) %>',
29vocabularyGroupIds: '<%= StringUtil.merge(groupIds) %>',
30vocabularyIds: '<%= String.valueOf(vocabulary.getVocabularyId()) %>'
31}
32).render();
33</aui:script>

You should see the below screen once you have modify the JSPs.