Forums de discussion

Extending "Articles" portlet - Sending article by mail

Julien M, modifié il y a 16 années.

Extending "Articles" portlet - Sending article by mail

New Member Publications: 20 Date d'inscription: 31/03/08 Publications récentes
I have to develop a functionnality which would send the content of an article by email right after approving it.

I have really no idea where to start so I'm asking for some pointers.

Thanks in advance.
thumbnail
Gaurav Jain, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Regular Member Publications: 145 Date d'inscription: 31/01/11 Publications récentes
Hey Julien,

I am looking for some similar functionality to have some link which can email an article to friend.

Have you able to do so?
Oliver Bayer, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Liferay Master Publications: 894 Date d'inscription: 18/02/09 Publications récentes
Hi Julien,

take a look at the "JournalArticleLocalServiceImpl.sendEmail"-method where a MailMessage is created. You should override the variable "body".

Greets Oli
thumbnail
Gaurav Jain, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Regular Member Publications: 145 Date d'inscription: 31/01/11 Publications récentes
Hi Oliver,

I want to incorporate such functionality in WebContent Display portlet that any user can have functionality of mailing that article to his friends.

I mean as we have options to enable print/comments/etc in WebContent i.e Journal articles, similarly we could have Enable Mail.

And then a link or icon will appear on clicking it will ask for email ids and then on submitting it will send that article as an email to the entered IDs.

Can you please suggest some ideas.
Oliver Bayer, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Liferay Master Publications: 894 Date d'inscription: 18/02/09 Publications récentes
Hi Gaurav,

you can try the following steps:

1) create a new property e.g. "show.send.journalarticle.icon" which you can read in the jsp with "PropsUtil.get("show.send.journalarticle.icon")". Or you can modify the configuration.jsp and ConfigurationAction to save if the icon should be displayed in the portletpreferences table.

2) create a struts-action (struts-config.xml or struts-config-ext.xml) for the new link

3) create a method for the struts action in which you call the method I mentioned above or you can extract the code you need to send an email.

HTH Oli
thumbnail
Gaurav Jain, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Regular Member Publications: 145 Date d'inscription: 31/01/11 Publications récentes
Thanks Oliver,

however is it doable by hook as I don't want to use ext plugin.

And if yes how will I configure struts action in hook?
Oliver Bayer, modifié il y a 13 années.

RE: Extending "Articles" portlet - Sending article by mail

Liferay Master Publications: 894 Date d'inscription: 18/02/09 Publications récentes
Hi Gaurav,

sorry I'm developing with 5.2.3 and using the ext-environment for most of my changes.

But if I understand it right hooks are only used for overriding existing services, jsps ..... To achieve the new button action you have to write a new struts action so I don't think you can modify it with a hook (but I'm not 100% sure).

If you find a working solution please let me know and if you have additional questions feel free to ask.

Greets Oli