Link Liferay tag cloud links to a different page - liferay

When putting the liferay tag cloud portlet on a page, clicking the links in the tag cloud will just render the result in the same page if and only if I have an asset publisher portlet on the same page.
What I would want is that when I click a link in the tag cloud, it should take me to a different page showing the results, eg. a search result page.
Is there a way of doing this using the standard components? Or will I have to write my own tag cloud portlet to support this feature?

You dont have to create a new portlet. Please follow these steps
1) By using hooks, modify the links that are generated in the tag cloud portlet for the tags. Instead of current layout, redirect to the designated page (for eg. If you are on /web/guest/tag page, then all tags link will start from the /web/guest/tag?..... Make this to /web/guest/search?....)
2) on the search page, put the asset publisher
So now, when you click any tag link, it will go the search page, since this page has asset publisher, it reads all the parameters from the request url and from the session, and it will show results on the search page.

The code for this hook :
File liferay-hook.xml:
<hook>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
</hook>
File /docroot/META-INF/custom_jsps/html/taglib/ui/asset_tags_navigation/page.jsp:
<%# include file="/html/taglib/ui/asset_tags_navigation/init.jsp" %>
<%# taglib uri="<http://liferay.com/tld/util>"
prefix="liferay-util" %>
<%# page import="com.liferay.portal.kernel.util.StringUtil" %>
<%# page import="com.liferay.portal.service.LayoutLocalServiceUtil"%>
<liferay-util:buffer var="html">
<liferay-util:include page="/html/taglib/ui/asset_tags_navigation/page.portal.jsp"/>
</liferay-util:buffer>
<% Layout searchLayout =
LayoutLocalServiceUtil.getFriendlyURLLayout(scopeGroupId, false,
"/search");
html = StringUtil.replace(html,layout.getRegularURL(request),searchLayout.getRegularURL(request));
%>
<%= html %>

Related

Accessing logged in user roles and include in page source

We are intergrating an external JavaScript application into Acumatica and we have a need to be able to access the logged in users authorization / user access roles. Our thought is that if we can write the logged in users access roles to the page source as global scope variables our JavaScript app can handle the rest, but we are a bit challenged in figuring out how to do that. We know we can write the roles to the trace screen, but that doesn't help as we need it literally in the page source for this to work (ideally the page source and not the DOM - but we can look into if the DOM could work too).
Any help would be much appreciated.
The page source in ASP.Net is a ASPX.CS file that resides on the server, I doubt your JavaScript can hook into that. The communication from the server to the UI layer is a template engine.
You define the fields in the ASPX file and these template fields are populated with the DataViews current record. The minified JavaScript that is in the page runs that templating engine.
You can't simply generate dynamic HTML or access the JavaScript side of things from the server. So having fields values in the DOM is probably your best bet. You can make the controls invisible if required.
Example to read UI control values using JavaScript:
<%# MasterType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:content id="cont1" contentplaceholderid="phDS" runat="Server">
<script language="javascript" type="text/javascript">
window.addEventListener('load', function () {
// Fetch a value from UI control
var control = px_alls["edControlID"];
var value = control.getValue();
});
</script>
[...]
</asp:content>

Embed Acumatica New Screen page in Website

I am trying to build a Support page for my website which should have Acumatica New Case Screen for customers to create a new Case. I tried using iFrame but when logged in, Selectors and dropdown don't respond. Any Suggestions how do I get New Case screen for my Support page just like in Acumatica Partner's portal.
This is working for me:
1) Create an acumatica portal web site; Make sure sp203000 page is accessible and works fine.
2) Create a simple html page and assign iframe src to be sp203000 screen url:
<!DOCTYPE html>
<html>
<body>
<style>
iframe {height:800px; width:1200px;}
</style>
<iframe src="http://localhost/AcuPortal/pages/sp/sp203000.aspx?CaseCD=null&CaseClassID=BILLING">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
And it works fine:
New Case form embedded into frame
First time you will see the login screen in the frame. If you want users to see the form without logging in you need to think about some SSO solution for your site and acumatica.

Websphere Portal - How to retrieve portal title/friendly URL?

How do we get the friendly url or portal title using java?
For example if I go to websphere to put the title and friendly url, how do I exactly retrieve it (using jsp)
The WebSphere Portal Server has concept of NavigationSelectionModel SPI that you can use to know about the current page.This SPI is used by the theme to know the page which should be displayed to the user.Can be used in portlet application. To get the page title / unique name where your portlet is getting rendered, here is the code:
Step 1. Include portal taglib on JSP
<%# taglib uri="/WEB-INF/tld/portal.tld" prefix="wps" %>
Step 2. Use <wps:navigation> tag.
<wps:navigation>
<wps:navigationloop>
<%if (wpsSelectionModel.isNodeSelected(wpsNavNode)){
String pageTitle = com.ibm.wps.model.LocaleHelper.getTitle
((com.ibm.portal.Localized)wpsNavNode, request);
String uniqueName = wpsNavNode.getContentNode().getObjectID().getUniqueName();
System.out.println("pageTitle : " + pageTitle);
System.out.println("uniqueName : " + uniqueName);
}%>
</wps:navigationloop>
</wps:navigation>

Current theme for Liferay error page

I have a liferay service with many sites. Those sites has the same theme but each has different color scheme. How to set a theme to a /html/portal/status.jsp ( error page) of the current site ? I don't want to create an error page for each site and I don't want all the sites to have the same error page.
One way is override this JSP (using hook / ext) and create themeCSSPath using themeDisplay, as following:
themeCSSPath is the path of the main.css of the theme applied on current page.
CSS path
String themeCSSPath = themeDisplay.getPortalURL() +
themeDisplay.getPathThemeCss() + "/main.css";
CSS link
<link rel="stylesheet" type="text/css" href="<%=themeCSSPath %>" />
I don't want to create an error page for each site and I don't want
all the sites to have the same error page."
This doesn't make sense.
"/html/portal/status.jsp" is an external JSP page, not part of Portal/Site pages. So, Liferay theme plugin won't work here. You have to design the JSP pages similar to you have on Portal/Site pages.

Redirecting from one portlet to another Liferay 6.2

I have two public pages, each having a portlet.
For the first portlet, on click of a button, I want to open up the other portlet.
Is there any simple way to do this in liferay 6.2?
So far, I tried -
Currently from the group/game/portal page ->
<script>
function manageGame() {
response.sendRedirect('group/games/manage');
}
</script>
<button onClick="manageGame()">Manage</button>
Either you can create URL in controller and pass it to JSP as below
PortletURL liferayURL = PortletURLFactoryUtil.create(renderRequest,<<portlet-name>>, <<Plid>>,PortletRequest.RENDER_PHASE);
renderRequest.setAttribute("anotherPortletUrl", liferayURL);
JSP
click here
OR
You can create Liferay Portlet Render URL in JSP as below
<%#page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%# taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<liferay-portlet:renderURL plid="10180" portletName="portlet-name" var="openForm" windowState="<%=LiferayWindowState.POP_UP.toString()%>"></liferay-portlet:renderURL>
With above two methods you can create a url on click of which portlet on other page will be opened.
If you portlet is instanciable add instance with portletname

Resources