How to add preference option to the liferay portlet - liferay

I want to create a portlet where the portlet allow access to the remote application. That is the content of the portlet should be dynamic so for the same reason I want to add one option "Preferences" in the portlet (Where the look and feel and configuration options exists). In that preference page If will give some http url (http://localhost:8080/Myapp/Mypage) then on click of save button, the URL page should display in the portlet. How can I do that? Note I am going to use same portlet in different pages with different URLs.

Liferay's "Preferences" link shows the portlet in JSR-286 "edit" mode. That's all there is: If you implement this mode, you'll automatically get the Preferences link.
Why are they named differently? IMHO Edit-Mode is rather misleading as you're editing the preferences rather than any data displayed in the portlet.

You can use Liferay Iframe Portlet which allow access to the remote application.
Refer following url for detail description of look and feel and configuration options : Iframe Portlet

Related

liferay move portlets in a page

I have the next requirement: every user can change position of portlet in a page but this change is only applied for this user no for all. I know that it is possible with layout and it works fine (the portlets are possible move ), but my main problem is when "x" user changes the position of a portlet because it is applied for all users. so you have any idea for how do I this?
I work with liferay 6.2 CE
From liferay 6.1 onwards,it provides for page customizations,where in admin can defined certain sections of the page layout as customizable allowing users to add/move/delete portlets,in specific sections.These changes will be specific to the particular user and will not be visible for others.The user has the option to anytime view the default page or to reset his customizations as well.
In order to enable this,Edit page->customization settings->Show Customizable settings and check the required sections.
Please refer the Liferay documentation for further details.

Liferay: Page to portlet mapping

I have a requirement in liferay portal to allow user to add some specific portlets on a particular page. Same can be done in 2 ways:
This will require some custom code to be plugged in add panel code
create a custom portlet which will be present on left hand
side of page and allows portlet to be added and dragged on page.
On add of portlet it checks if the page can have this portlet and accordingly remove it
The question I have is which of these 2 approaches shall be used, and how?
Note: I was unable to find much about this on google as well
I believe Liferay permission system is strong enough to express what you need.
The portlet list shown in "Add more portlets" menu can be customized through a Regular Role. See How to customize which portlets to show in “Add more portlets” menu for detailed info.
To restrict the options for a single page (or several pages), modify its permissions, so that only the new Regular Role is be able to update it.
Based on your comment to Tomáš Piňos's answer, my suggestion would be to create a custom portlet that uses Liferay's API and enables you to do just this: On the page where it's available, use it to enable/disable the portlets you'd like to be there by use of Liferay's API. You'll find quite a lot of sample when you're looking for the old sevencogs example (that sadly does not compile any more, but in general the API has only changed marginally). The most up to date resources with further links to the ancient code are these 2 blog articles.
About your third option (as you ask in the comments): Yes, it's possible: You can override Liferay's Services as well as react to model changes. This means that you could add your own check on updates. However, I'd feel it inappropriate to offer the option to add any portlet only to prohibit it whenever a user indeed uses the offered option. That's why I didn't include this option in my initial answer.

How to render a web page in a portlet view?

Can any one please guide me that how can we render the custom web page view in the portlet?
For example, I have a input text box in my where user can enter the target URL and on click of the submit button the portlet content should display the target URL page.
I don't want to use the existing core portlet (IFrame). I need to design my own with some business logic.
Any guidelines or suggestions on how to render a webpage in the portlet?
This sounds like a question on how to build a basic portlet. Please check a tutorial (step-by-step).
If this is not your question, please specify further - your question is way too broad to assume that you have a specific (other) problem.

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

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