Foren

How to Create a new portlet using the existing out of box message board por

suresh vadlamudi, geändert vor 13 Jahren.

How to Create a new portlet using the existing out of box message board por

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Hi Experts,

I need some assistace to achieve the following thing.Please help me in this friends.

Here is the scnerio.
1. I have made some jsp level UI chages to the existing out of box portlet(Message Board) provided by liferay(6.0).

2. As per our project requirements i have to place the original message board (Out of box) and the modified portlet also on the page.

i am not getting how to bring the both the things...if i do jsp modifications to the original one ..how can i get the both the things configured.

Please help me on this.

Thanks & Regards
Suresh.Vadlamudi
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

in 5.2.3 I would create a copy of the original portlet and place all modifications there. To make a copy of a default liferay portlet you have to modify some xml ("webapps \ ROOT \ WEB-INF") files or place the changes in the ext-environment.

  • liferay-portlet.xml: change the struts_path to e.g. /message_boards_modified
  • portlet-custom.xml
  • liferay-display.xml

Always copy the complete xml block (message board portlet id: 19) -e.g. in the ext-files- but change the portlet-id to a not used new number.

The next step is to create a new folder inside this path: "webapps \ ROOT \ html \ portlet" and name it e.g. "message_boards_modified". Place your modified files there.

The last step is to change the struts path to link to your modified jsps.

If you have e.g. modified the view.jsp:

Look for the struts_path "/message_boards/view" inside struts_config.xml copy it and rename the copy to "/message_boards_modified/view". Now you have to do the same with the tiles-defs.xml.

<definition name="portlet.message_boards_modified.view" extends="portlet.message_boards">
	<put name="portlet_content" value="/portlet/message_boards_modified/view.jsp" />
</definition>

In this file you can change the path to the jsp file you modified.

HTH Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Hi Oliver,

I am very much happy to see your reply,really thanks to you.

I tried to follow the steps you have given here..when i do like that liferay out of box (message board) portlet and the one which i modified both the portlets are getting effected with my new jsp changes.But i wants to see some thing which my old portlet should not get effected with my new changes.
Here are the steps which i perfomed.
1.I have given new entry in my liferay-display.xml(webapps \ ROOT \ WEB-INF) like this
<portlet id="457" />
2.And in my liferay-portlet.xml i have given entry like this

<portlet>
<portlet-name>457</portlet-name>
<icon>/html/icons/message_boards.png</icon>
<struts-path>message_boards_modified</struts-path>
<configuration-action-class>com.liferay.portlet.messageboards.action.ConfigurationActionImpl</configuration-action-class>
<indexer-class>com.liferay.portlet.messageboards.util.MBIndexer</indexer-class>
<open-search-class>com.liferay.portlet.messageboards.util.MBOpenSearchImpl</open-search-class>
<scheduler-entry>
<scheduler-event-listener-class>com.liferay.portlet.messageboards.messaging.ExpireBanMessageListener</scheduler-event-listener-class>
<trigger>
<simple>
<property-key>message.boards.expire.ban.job.interval</property-key>
<time-unit>minute</time-unit>
</simple>
</trigger>
</scheduler-entry>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>message_boards</friendly-url-mapping>
<friendly-url-routes>com/liferay/portlet/messageboards/message-boards-friendly-url-routes.xml</friendly-url-routes>
<portlet-data-handler-class>com.liferay.portlet.messageboards.lar.MBPortletDataHandlerImpl</portlet-data-handler-class>
<pop-message-listener-class>com.liferay.portlet.messageboards.pop.MessageListenerImpl</pop-message-listener-class>
<social-activity-interpreter-class>com.liferay.portlet.messageboards.social.MBActivityInterpreter</social-activity-interpreter-class>
<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight>6.0</control-panel-entry-weight>
<asset-renderer-factory>com.liferay.portlet.messageboards.asset.MBDiscussionAssetRendererFactory</asset-renderer-factory>
<asset-renderer-factory>com.liferay.portlet.messageboards.asset.MBMessageAssetRendererFactory</asset-renderer-factory>
<custom-attributes-display>com.liferay.portlet.messageboards.MBCategoryCustomAttributesDisplay</custom-attributes-display>
<custom-attributes-display>com.liferay.portlet.messageboards.MBMessageCustomAttributesDisplay</custom-attributes-display>
<workflow-handler>com.liferay.portlet.messageboards.workflow.MBDiscussionWorkflowHandler</workflow-handler>
<workflow-handler>com.liferay.portlet.messageboards.workflow.MBMessageWorkflowHandler</workflow-handler>
<use-default-template>false</use-default-template>
<scopeable>true</scopeable>
<!--<user-principal-strategy>screenName</user-principal-strategy>-->
<private-request-attributes>false</private-request-attributes>
<private-session-attributes>false</private-session-attributes>
<render-weight>50</render-weight>
<header-portlet-css>/html/portlet/message_boards_modified/css/main.jsp</header-portlet-css>
<footer-portlet-javascript>/html/portlet/message_boards_modified/js/main.js</footer-portlet-javascript>
<css-class-wrapper>portlet-message-boards</css-class-wrapper>
<facebook-integration>fbml</facebook-integration>
<add-default-resource>true</add-default-resource>
</portlet>
3.Inside portlet-custom.xml i have given entry like this
<portlet>
<portlet-name>457</portlet-name>
<display-name>message_boards_modified</display-name>
<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
<init-param>
<name>view-action</name>
<value>/message_boards_modified/view</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<portlet-preferences>
<preference>
<name>priorities</name>
<value>Urgent,/message_boards-suresh/priority_urgent.png,3.0</value>
<value>Sticky,/message_boards-suresh/priority_sticky.png,2.0</value>
<value>Announcement,/message_boards-suresh/priority_announcement.png,1.0</value>
</preference>
<preference>
<name>ranks</name>
<value>Youngling=0</value>
<value>Padawan=25</value>
<value>Jedi Knight=100</value>
<value>Jedi Master=250</value>
<value>Jedi Council Member=500</value>
<value>Yoda=1000</value>
<value>Moderator=community-role:Message Boards Administrator</value>
<value>Moderator=organization:Message Boards Administrator</value>
<value>Moderator=organization-role:Message Boards Administrator</value>
<value>Moderator=regular-role:Message Boards Administrator</value>
<value>Moderator=user-group:Message Boards Administrator</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
4.Now i have created a new folder inside this path: "webapps \ ROOT \ html \ portlet" with the name "message_boards_modified". and i placed my modified files thr.
5.Now inside struts-config.xml i have given entry like this

<action path="/message_boards_modified/view" type="com.liferay.portlet.messageboards.action.ViewAction">
<forward name="portlet.message_boards.error" path="portlet.message_boards.error" />
<forward name="portlet.message_boards.view" path="portlet.message_boards.view" />
</action>
6.And inside tiles-defs.xml i have given entry like this

<definition name="portlet.message_boards_modified.view" extends="portlet.message_boards">
<put name="portlet_content" value="/portlet/message_boards_modified/view.jsp" />
</definition>

Once after doing all these things results are

1. I can able to register new portlet with 457 id
2. Now i placed my old message_board portlet(out of box) and new modified 457 on a page.

but the problem is both the portlets are showing the new view.jsp changes which i placed in "message_boards_modified" folder.

Please correct me if i did mistakes and help me out in resolving this issue.

Thanks & Regards

Suresh.Vadlamudi
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

I think you have a little error in step 5. Maybe I've forgot to mention it, sorry. You have to map the forward path you want to modify (with the tiles-def.xml) to a new path. Change it to: path="portlet.message_boards_modified.view" (the error path can stay the same if you don't modified it).

<action path="/message_boards_modified/view" type="com.liferay.portlet.messageboards.action.ViewAction">
<forward name="portlet.message_boards.error" path="portlet.message_boards.error" />
<forward name="portlet.message_boards.view" path="portlet.message_boards_modified.view" />
</action>

I hope changing this value and restarting the server will do the trick. If you're using the ext-environment you can place the xml modifications in the ext-files.

Greets Oli
An Jay, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Regular Member Beiträge: 160 Beitrittsdatum: 16.12.10 Neueste Beiträge
Hi Suresh,

Iam also trying to do modification in Message Board while retaining the original out of the box.

Can you send me steps to do this. can you walk me through.

I did download the source of the same from one of the svn trunk available. Now what to do, I saw all the file mentioned in the thread.

Should i copy the portlet into plugin sdk's portlet or should I create an ext to achieve the same.

can you please help me with this step by step.

Regards,
An
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Hi Jay,

Even i also not successed with the above steps which i followed.I am also not clear about how to bring the new portlet(Modified MessageBoards).If you have any success please post here.

Thanks & Regards
Suresh.Vadlamudi
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

did you try my suggestions from the last post? What errors are you getting?

Greets Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Greetings Oliver,

Yes..i tried your suggestion..still i am not able to see my new jsp changes independently on my new portlet.Both the portlets are reflecting with the changes.

Thanks & Regards
Suresh.Vadlamudi
An Jay, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Regular Member Beiträge: 160 Beitrittsdatum: 16.12.10 Neueste Beiträge
suresh,

I could not duplicate message board, but I did use asset pulisher for now.


Regards
An
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

my hints were only of "theoretical nature" that means I thought it will work that way but I don't test it. But give me some days and I will try it on my own. If I'm successful I will -of course- share the modified xml files.

Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Sure Oliver.Thanks for your support.
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

now I've found some time to configure a second message boards portlet. Take a look at the attached screenshot and zip-file for the sources. But this is only a first attempt to show how to display a modified jsp. If you want the complete message boards portlet to work (with all buttons and screens) you have to do some more config work.

HTH Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Hi Oliver,

Thanks for the solution.This helped me alot.Finally i can able to achive this.

I will post all the steps i follwed to achive this in my next reply.So that it colud be helpful for those who are facing this kind of issue.Once again thanks Oliver for your time and efforts.

Thanks & Regards
Suresh.Vadlamudi
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi,

I'm glad to hear that it's working for you now.

Your idea to write a summary for other users struggling with the same issue is great. Maybe you write it as a new wiki article and put the link in this thread. If you need additional info for the writing work let me know.

Regards Oli
An Jay, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Regular Member Beiträge: 160 Beitrittsdatum: 16.12.10 Neueste Beiträge
This is wonderful.

Thanks to Oliver and in advance to Suresh.

Please document the whole process and put it here for future referenec.
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Hi Oliver,


I have one more doubt ... when i register message_boards_modified portlet , it is showing me in the list as javax.portlet.title.message_boards_modified/javax.portlet.title.200 portlet.Can u please tell me how can i see this portlet title in the list with out javax.portlet.title added in the name of the portlet.

Coluld you please give any suggestion ?

Thanks & Regards
Suresh.Vadlamudi
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Suresh,

no problem. You have to create a language-ext_<language-key>.properties e.g. language-ext_en.properties in "ext-impl \ content" and add "javax.portlet.title.200=My modified Message Board Portlet". Maybe you can also use a hook for the new language key.

HTH Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
Where can i see ext-impl \ content? Actually i didn't see any ext-impl folder at my end..can u tell me the complete path where to put the language-ext_en.properties file

Suresh.Vadlamudi
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
yeah... got the location . I just created content folder under \ROOT\WEB-INF\classes\ and kept the Language_en.properties flie with the entry added like javax.portlet.title.200=Modified-MessageBoard .Now i can able to see my new messageboard portlet with the name Modified-MessageBoard.

Thanks & Regards
Suresh.Vadlamudi
Smile85 Always, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Regular Member Beiträge: 160 Beitrittsdatum: 16.12.10 Neueste Beiträge
Suresh

Dont forget to document like you said earlier. I am counting on you as I am stuck with some other work right now.
Oliver Bayer, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi,

maybe you can use my attached zip file to solve your issues.

Oli
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
hi sorry for the delay..i was bit busy with some urgent delivery.I will add all the details on this saturday with out failure.
bhavishya goyal, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
hi ,
can you tell me how can i see view.jsp page in eclipse .i have already configured lifray ide in eclipse.i am new so i don't know where can i found view.jsp of message board .please help me
suresh vadlamudi, geändert vor 13 Jahren.

RE: How to Create a new portlet using the existing out of box message board

Junior Member Beiträge: 35 Beitrittsdatum: 20.01.11 Neueste Beiträge
You can see here .. \tomcat-6.0.26\webapps\ROOT\html\portlet\message_boards