How to show a file browser and Select files from Liferay Document Library in my custom portlet using ItemSelector - liferay

I want to display a file browser to show the Liferay Document Library files and folders and let the user select or upload his files, in my custom portlet.
There is such implementation in the Liferay portal itself now, but I could not find its source code in the Liferay portal source code. (see attached photo)
I need to have both the frontend and backend implementation of ItemSelector for such a use case. I searched Liferay documents but did not find any examples.
I use Liferay 7.3, React and PrimeReact components in the front-end and REST Services in the back-end and have not used JSP in the back-end. (should I use JSP to open the selection modal in the front-end?)

Related

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.

How to change 6.1 Documents and Media Display view like 6.0.6

I have installed Liferay 6.1 in my personal site.
But i need Documents and Media Display view same as Liferay 6.0.6 not like 6.1 format ,Because when i click Liferay 6.1 documents at Documents and Media Display it is drive to another details page, i need to download documents when i click documents (same as 6.0.6)
How to change 6.1 Documents and Media Display view like 6.0.6 .
Generally speaking, in order to "override" the out-of-the-box functionality of Liferay portlets you will need to hook the respective JSP pages.
The Document Display renders file entries in a search container with rowHREF(line 111) controlling the navigation to the details page. The download URL (line 473) within that page doesn't appear to use anything that you wouldn't have access too "higher" up.
So, you should be able to do something similar to the following in place of the if/else.
rowHREF = DLUtil.getPreviewURL(fileEntry , fileEntry.getLatestFileVersion(), themeDisplay, StringPool.BLANK);
Of course, this assumes you'll always want the latest version of the file. If you want to provide the ability to download "archived" versions, then I would suggest leaving the details navigation in place and consider alternative means by which to provide download functionality. For example, we use Category Navigation + Asset Publisher with a custom Display Template to allow a browsable/filterable alternative to directly exposing Documents and Media Display as we wanted to restrict that portlet's scope of use to admin-only.

Finding specfic jsp page and extenting functionality using hook

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.

Adding pages and templates to a portlet

I am using eclipse ide and I have created a liferay project Test-portlet. I haven't written any code for this project
When I ran this project I got the usual welcome screen and I added the Test-portlet to the page and removed other stuff from the page.
I actually want to create a website using liferay. The website already exists which should be rewritten in liferay.
So when I load the project I get this welcome screen and the Test-portlet. At the top of this page I get the the menu-Admin,Sites,.... and LIferay logo on LHS.
I wish to remove all of these and displa only the web page data of the website. I know I can use themes and layouts for such purpose.
If I should use portlet to create this website , how should I keep adding pages and designs?
Also how should I add pages,themes,templates to this portlet?
Before creating this Test-portlet project, I had created pages using control panel.
How should I create this website? Using portlet by creating project?
EDIT:
Also this Test-portlet is displayed as a small portlet on the entire page. WHen click on the gear symbol and click on maximise, it only maximises during that time and when project is run again, it comes back to its original size.
Should I create this websiste using portlets?
Data for website comes from database. Few pages have static data.
Subsequent pages may be added in future.
HOw should the pages be added if I use portlet to create the website?
Please go through liferay themes and liferay layouts

Liferay portlet for creating web content

I use Liferay to manage web content. I would like my end users to create web content but I don't want them to go to back office to manage it.
So I would like a portlet that I can setup in public pages and which allows the end users to create web content directly in public pages.
Is there a simple way to do it using Liferay 6.1 or code is needed ?
Have you tried OOTB Web Content Display portlet? You can add Web Content Display portlet on any page and content can be created in that portlet itself which on publishing(if no workflow involved) will be visible on the page.
If Sandeep's answer is not what you're after (but I suspect it is) then you can write a custom portlet that uses Liferay's JournalArticleLocalServiceUtil methods to interact with Liferay Web Content. However I'd go with Sandeep's suggestion first as it doesn't involve coding! :)
If you want to develope another webcontent portlet as avaiable in control panel. You have to go for custom portlet creation and use the db tables like JournalArticle, JournalArticleImage, JournalArticleStructure and JournalArticleTemplate.

Resources