Showing posts with label Liferay. Show all posts
Showing posts with label Liferay. Show all posts

Tuesday, 15 December 2015

Liferay 7 - First look with basic explanation


Hello,

Today, first time I started Liferay 7 in my machine so thought to share basic walk through with Liferay 7 portal, in this walk through I have covered different sections of Liferay 7, play with couple of component like Blogs, Page, Document and Media,Control Panel, Mobile preview etc , Enjoy video !!

What version I have used in this video ? It is Lifeay 7 Alpha-2 Community Version

Where to download ? Well, I got it from Liferay team in Liferay Symposium workshop but I am sure you will find all latest LR7 community version here.

New features in Liferay 7, 
(Note : Trying to highlight as much as I know, there must be more than these for sure  )
  • Technically Liferay 7 has lot of new things like Micro services (Modularity) 
    • Means no more need of portlet.xml , liferay-portlet.xml etc
    • Everything is decoupled
  • Look and feel brand new (Please refer video)
  • Change in site template 
  • Configuration of navigation 
  • Create content is more easy with alloy editors 
  • Different view facilities like List, Descriptive, Icon view.
  • New localize language search
  • Approval workflow subscription base on folders
  • Geolocation content creation 
  • Blog experience is improved (Please refer video) 
  • End user interaction is improved like you can refer person with "@" annotation in comment section.
    • Ex. @Sagar Vyas
  • Document and Media library 
              Basic walk through of Liferay7 with brief description on each component.



Have a happy learning !!

Thanks,
Sagar Vyas

Saturday, 14 September 2013

Liferay : Tag cloud OOB integration with custom MVC portlet

Hi There,

Hope you are doing good.
In “Hi I am Liferay” we have seen last two things which might be small but equaly important for Liferay developer.

  1. Next we will see how to integrate tag portlet [OOB portlet] with any custom portlet. [Liferay 6.1]


Requirement description : I have my own custom MVC portlet called fruit portlet which will describe all fruit characteristics and items which made from it, which will be filter base on tag, when user will click on any tag for example an apple all entries which tagged as an apple will display along with description,and only those tags should be display on the page which are associated with custom entity.


Solution :
Step 1) As Tag [Tag cloud or Tag navigation] portlet is different entity we need to work on IPC so when user click on any tag your portlet[custom portlet] should know at time of render page.
To accomplish it you need to do certain things as below.
In portlet.xml of your portlet you need to have following entries.
<portlet-app  ........>
<portlet>
 <portlet-name>Fruit</portlet-name>
 <display-name>This is fruit decstiption</display-name>
                       |
                       |

 <supported-public-render-parameter>tag</supported-public-render-parameter>

</portlet> 

<public-render-parameter>
   <identifier>tag</identifier>
   <qname xmlns:x="http://www.liferay.com/public-render-parameters">x:tag</qname>
</public-render-parameter> 

</portlet-app  ........>

Step 2) In JSP of your portlet where you want to display tags related to your entity you need to write following code.


 <liferay-ui:asset-tags-navigation
    classNameId="<%= classNameId %>"
    displayStyle="<%= displayStyle %>"
    hidePortletWhenEmpty="<%= true %>"
    maxAssetTags="<%= maxAssetTags %>"
    showAssetCount="<%= showAssetCount %>"
    showZeroAssetCount="<%= showZeroAssetCount %>"
/>



Where
1.classNameId (long) = your entity class name id for which you need to display tags, in our case we will get it as below 

long clssNameId = com.liferay.portal.util.PortalUtil.getClassNameId(FruitEntry.class.getName());
 
2.displayStyle (String) = We will give here "cloud" as we want tag cloud look rather navigation.

3.hidePortletWhenEmpty (Boolean)= if true it will hide portlet when there is no related tags found 

4.maxAssetTags (int) =  number of tags to be displayed on the page.

5.showAssetCount (Boolean) =  true 
 
6.showZeroAssetCount (Bollean) = false

 
Step 3) In controller class in doView() method of portlet every time you need to check as follow.
 

String tagName = renderRequest.getParameter("tag");

when user click on any tag [on tag cloud portlet] you will get tag name in doView() 
as tagName as shown in code above, now you can right some code which will bring list of assets
which is associated with clicked tag.

Hope this helps.

For more information you can contact on sagar.vyas.blogspot@gmail.com

Thanks,
Sagar Vyas 

Friday, 6 September 2013

Liferay : Solution:Error while integrate Liferay OOB comment functionality with MVC portlet ?



Hello There,

            Couple of days ago I was working with MVC portlet and I had to integrate comment [<Liferay-ui:discussion ….> tag] functionality with it in Liferay [6.1 GA2]. I thought it would be cake walk for me but no it was not L, cause simple way this is working very well but not with search-container or I guess not within for loop.

I tried to get ans. from various place but could not get it.



Problem description:

Step 1) Create MVC portlet.
Step 2) view.jsp which contains search container.
Step 3) In each row of search container I kept below code.

<portlet:actionURL var="discussionURL"  name="invokeTaglibDiscussion"></portlet:actionURL>
 
 <liferay-ui:discussion
                 className="<%=objEntry.class.getName() %>"
                 classPK="<%= obj.getEntryId() %>"
                 formAction="<%= discussionURL %>"
                 formName="fm2"
                ratingsEnabled="<%= false %>"
                redirect="<%= currentURL %>"
                subject="<%= obj.getTitle() %>"
                userId="<%= obj.getUserId() %>"
               
            />

Step 4) Deploy portlet and check js console of browser I was getting two errors as describe below




Java script Error 1)

“TypeError: document.****************_parentMessageId0 is undefined”


Resolution:
-    It was OOB issue and since we were using EE version we got patch for above error.




Java script Error 2)

“TypeError : d.one(…) null” [Please find screen shot for same.]

 

Resolution:
-        After even applying patch I was facing error-2,so debug further and
Found following solution

Reason:
While you are using <Liferay-ui:discussion…/> tag inside the for loop or inside the search container that time "formName" always remain same in mine case its always "fm2" that the issue.

Solution:

Try to keep “formName” element unique with primary key of that object,
Following code worked for me in mine case, you can use the same.



<portlet:actionURL var="discussionURL"  name="invokeTaglibDiscussion"></portlet:actionURL>
 
        <liferay-ui:discussion
                 className="<%=objEntry.class.getName() %>"
                 classPK="<%= obj.getEntryId() %>"
                 formAction="<%= discussionURL %>"
                 formName="<%= primaryKeyOfMyObj %>"
                ratingsEnabled="<%= false %>"
                redirect="<%= currentURL %>"
                subject="<%= obj.getTitle() %>"
                userId="<%= obj.getUserId() %>"
               
            />

Hope this helps.

For more information you can contact on sagar.vyas.blogspot@gmail.com

Thanks,
Sagar Vyas