Finding specfic jsp page and extenting functionality using hook - liferay

I am using liferay. I want to add new functionality to existing jsp page.
I will be using hooks for that purpose.
The problem is how to find existing jsp pages locations?
For example
I want to locate "Add regular Organization" page.
Pls help
Thank you

jsp files under source folder : html\portlet\users_admin\organization and html\portlet\users_admin\edit_organization.jsp are jsps for "Add regular Organization" page.
There are certain ways, liferay provides its functionalities using default portlets that comes with liferay-bundle. You can look at folder portal-web\docroot\html\portlet under portal-src, it will give you idea to locate jsp page locations.
Moreover you can look at portal-web\docroot\WEB-INF\portlet-custom.xml, portal-web\docroot\WEB-INF\struts-config.xml and portal-web\docroot\WEB-INF\tiles-defs.xml for portlet specific actions and respective jsps.

Related

Liferay : How to see which portlets are composing a page?

I'm new to liferay.
I imported a big lar into my liferay instance but, for the moment, have none of the required portlets : there are a lot of portlets in the project I'm joining.
Currently, I have the site structure, but the pages display the message that the portlet is not here (logical).
For comprehension purposes, I wanted to build my portlets one after the other, on the need, to see them appear by the grace of liferay ;-)
But for that I wanted to know which portlet is missing.
This thread : How can i find - which portlets are deployed on which pages in Liferay 6.1? explain how to achieve this through the DB.
Is there really no built-in solution to do it through the liferay interface? Have we really to hack in the DB to get the info or install plugin?
Thanks!
In your browser console, Liferay.Portlet.list contains all portlets in the page.
This value is generated by themeDisplay.getLayoutTypePortlet().getAllPortlets() on the server.
As an alternative you can also look at the HTML code of the page and look for elements with the class portlet-boundary. For example this belongs to an instance of the Journal Content Portlet (Portlet name 56):
<div class="portlet-boundary portlet-boundary_56_ portlet-static portlet-static-end portlet-borderless portlet-journal-content full-screen" id="p_p_id_56_INSTANCE_WdRdMGe86kDa_">

Call Custom aAction from Liferay Theme

I have A Custom Theme project & A Custom portlet project in liferay.
I want to call a custom action which is in Custom portlet from navigation.vm File of Theme Project.
actionurl is : /c/journal/upload_article which is called from same portlet project successfully.
How to call this from theme project?
Any help is really appreciated.
It sounds weird to "call" an action from a theme. If you embed a form to upload content on every page, naturally, you'd need a target for the upload. But still, the theme seems to be the wrong place to do so.
Nevertheless: It seems that you're using a non-custom URL for uploading (/c/journal/upload_article). You can do so from wherever in HTML. The big question then is: Where will you end up after the upload, as it doesn't happen from within a page.
If you need a proper portlet URL on an individual page, and want to return to the same page, the best way forward is to embed a portlet in the theme (which makes a great search term for Liferay's documentation). From that portlet you can utilize Liferay's API to do what you're trying to achieve. Make it a very lightweight portlet, because, well, it will be embedded on every single page.

Use a web content portlet

I am using web content portlet to develop a portal.
Each page has common theme (which includes header and footer) and we have many portlets placed on each page.
One of the portlet on right side is menu which is common on many pages.
I could have kept it as a part of theme but the menu can be subject to change in future and the end user who will be handling the portal is non-developer.
So if they want to change some data in that menu portlet, they will have to change it on every page which leads to duplication of effort.
Like I said, since end user is a non-developer, I cannot make that portlet part of the theme.
So is there any way where one web content portlet be created once and used on many pages?
You can embed web-content in theme as per link
Here articleId as in above link, you can set in theme-setting, refer to link
I have found a solution right now. If anyone has abetter solution than this..they are most welcome. I would like people to share alternate and better solutions
I am using Liferay 6.2
What I did was added a new web content display portlet which like I said created a new blank web content display portlet.
So my usual method was to add content to this portlet. THis was the method I followed. You can click on Select Web Content button and then select the already created portal from the list and you are done. NO need to create duplicate portlets

Which is the Liferay equivalent of a IBM WebSphere Portal / WCM Menu?

I've developed with WPS and WCM for several years and now I am also learning Liferay. I can't help but compare the features and I understand that in Liferay some things are done differently.
I would like to know the best practices to manage the following simple example:
A simple page with a carrousel with several images and links
Google analytics inserted in the page (Reusable in most pages)
The following is how I'd solve it in IBM WPS:
A HTML component with the Google Analytics code that is called in every page (I can't find how to do this in Liferay)
A content definition of an image and a link.
Create several contents for each image and link.
Create a menu that shows the list of content in the form of a carrousel (I can't find how to do this either in Liferay)
I am aware that Liferay has a list portlet and content that has repeatable items. I know I could use these, however its much more usable if I can have on content for each image/link and one reusable HTML snippet of code.
How should I solve this in liferay in the most efficient way?
Thanks!
You have to use Liferay Web Content portlet for creating the carousel. This is available in Control Panel. For your particular requirememnt you have to create a dynamic web content, which involves using of Velocity language and javascript to iterate over a set of images. Infact if you see Liferay's website, the home page has this kind of stuff.
For Google Analytics there are two ways. Liferay is not just meant for creating one site, it caters creation of multiple sites. Each site has a group of pages. You can create site from Control panel again. In the site settings you have this option to add google analytics id. So with each site can have different google analytics id.
If you want to do it at a global level, we add the google analytics script snippet in the Theme of liferay.
To get a better understanding of all the jargons used in Liferay, you have to atleast go through Liferay's documentation. And while going through it you have unlearn what you have previously learned. Liferay has hell lot of features than Websphere portal.
http://www.liferay.com/documentation/liferay-portal/6.1/user-guide

Liferay : custom Web content Display List Portlet

I'm beginner in Liferay, and I need to customize the portlet webcontent display list.
I added a portlet in my page Home, and I managed to see the recent news that I created.
The news is displayed in a table (title, author and date display).
I want to display the news like this:
- The date of the news (above the title of the news)
- The title of the news (which is a link to the news)
I tried to create a structure, but I do not see commits its work?
Thank you to enlighten me?
PS: sorry for this English !!
Liferay is available in source - did you look at the implementation of the webcontent list portlet? You can either create a jsp hook for that portlet or just reimplement a similar one based on what you find in there...
As you say you'd like to customize Webcontent display list I assume you don't want its default behaviour. Once you know what to change in this portlet, read about jsp hooks, create a hook with the jsp changes you'd like (if it's limited to jsp changes) and deploy it.
Liferay's development documentation should have the information that you need, otherwise continue in the wiki on liferay.com
Edit: Also, you might want to look at AssetPublisher - maybe this provides a few more options for formatting your output.
Generally Liferay web content in journalarticle table. I have referred Liferay 6.0 Version.
Now, for showing liferay custom portlet view, you should use Liferay Portlet Creation and Liferay Service Builder.
Here are two useful article on those -
1> Liferay MVC Portlet
2> Liferay Service Builder
Now make the service for journalarticle table and use those in your portlet.
Some useful fields of journalarticle table for your reference are - title, createDate etc.

Resources