Thursday, July 05, 2012

Liferay Hook Advance Part 2

LIFERAY HOOKS

Advance-II

Hook to override portal.properties
portal.properties file is most important file in liferay.
It changes most of the functionality and behavior of portal and portlets.
Note: Not all properties specified in file cannot be override by hook..
Only some properties can be modified.

For example :
Enable/display new plugin Notification :

plugin.notifications.enabled=true

Terms of use page applied /removed :

terms.of.use.required=true

Show web content in Place of Terms of use:

terms.of.use.journal.article.group.id=

terms.of.use.journal.article.id=

Update/remove /add new Locales to portal:

locales=ar_SA,eu_ES,bg_BG,ca_AD,ca_ES,zh_CN,

zh_TW,hr_HR,cs_CZ,nl_NL,nl_BE,en_US,en_GB,

et_EE,fi_FI,fr_FR,gl_ES,de_DE,el_GR,iw_IL,hi_IN,

hu_HU,in_ID,it_IT,ja_JP,ko_KR,nb_NO,fa_IR,pl_PL,

pt_BR,pt_PT,ro_RO,ru_RU,sr_RS,sr_RS_latin,

sl_SI,sk_SK,es_ES,sv_SE,tr_TR,uk_UA,vi_VN

Update/remove/add new remainder query for password.

users.reminder.queries.questions=what-is-your-primary-frequent-flyer-number,what-is-your-library-card-number,what-was-your-first-phone-number,what-was-your-first-teacher's-name,what-is-your-father's-middle-name

Steps

In myfirsthook-hook create liferay-plugins-sdk-6.1\hooks\myfirsthook-hook\docroot\WEB-INF\src folder.

Create portal.properties file within src folder.

Modify liferay-hook.xml.

<hook>

<portal-properties>portal.properties</portal-properties>

</hook>

Now modify portal.properties file as :

plugin.notifications.enabled=false

locales=hi_IN,en_US

terms.of.use.journal.article.group.id=10180

terms.of.use.journal.article.id=11864

users.reminder.queries.questions=what is your lucky number? what is ur girl friend name?

It disables plug-in notifications.

Making Locales only Hindi and English.

And Showing Web content for terms of use page.

Now Deploy hook to apply changes to portal.

Language Portlet will Look as :





Also Password Remainder Question :





Summary :
Override portal-properties file.
Deploying hook
Modifieing remainder query and language locales.

------------------------------------------------------------------------------------

Hook to Override JSP


Hooks to Override Portal Properties File


Hooks to override language Properties Files


Hooks to override user Login and Landing Page-PerLogin and Postlogin


Hooks To override Struts Actions


Hooks to override dockbar Portlet




------------------------------------------------------------------------------------ 



No comments:

Junit 5 Architecture

Modules in JUnit 5 : •         junit-jupiter-api: This module defines the API that you need to write your tests. •         ...