Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Bharanitharan R
Restrict deleting a page
14 de Junho de 2012 23:33
Resposta

Bharanitharan R

Ranking: New Member

Mensagens: 24

Data de entrada: 14 de Fevereiro de 2012

Mensagens recentes

Hi,

We are having a table - eg: 'mypage' (non liferay table) with some page id.
We have to give some custom message to the user when they try to delete any page which linked to 'mypage' table.

How to achieve this.

Please help emoticon

I am new to this .

Thanks in advance
Amit Doshi
RE: Restrict deleting a page
15 de Junho de 2012 00:11
Resposta

Amit Doshi

Ranking: Liferay Master

Mensagens: 549

Data de entrada: 29 de Dezembro de 2010

Mensagens recentes

Hi Bharanitharan,

Please write below line for Custom message in the controller side

SessionErrors.add(actionRequest, "dont-delete-page");

In Jsp page you should write as below :-

<liferay-ui:error key="dont-delete-page" message="dont-delete-page"></liferay-ui:error>

and on the Language.properties file as below:-

dont-delete-page=You can't delete the page it was in use // Write your Custom Error Message.

Hope I am clear.

Regards,
Amit Doshi
Bharanitharan R
RE: Restrict deleting a page
15 de Junho de 2012 01:23
Resposta

Bharanitharan R

Ranking: New Member

Mensagens: 24

Data de entrada: 14 de Fevereiro de 2012

Mensagens recentes

Hi Amit,
Thank you for your quick response.

Can you give it in detail in which controller we have to write.

The scenario is we are having a custom portlet having some links which points to some pages in our
portal. we are having this link reference in a custom table.

If a user (admin) try to delete any of those page from 'Manage pages' we have to check that pageid on our
table and we have to give a warning to the user.

How to handle this delete emoticon
Amit Doshi
RE: Restrict deleting a page
15 de Junho de 2012 05:10
Resposta

Amit Doshi

Ranking: Liferay Master

Mensagens: 549

Data de entrada: 29 de Dezembro de 2010

Mensagens recentes

Hi Bharanitharan,

As you not mentioned which page you want to restrict from deleting.

So here considering that you want to restrict the community page for getting deleted if it is using in your Custom table.

So for that pls check following files. html/portlet/communities/edit_pages.jsp , com.liferay.portlet.communities.action.EditPagesAction

Need to put message in edit_pages.jsp.

In EditPagesAction you will see the line as below for deleting the layout.

1else if (cmd.equals(Constants.DELETE)) {
2                CommunitiesUtil.deleteLayout(actionRequest, actionResponse);
3            }


So you can modify the method deleteLayout method of CommunitiesUtil in order to restrict according to your condition that you want to put on it.

But the point is that how you will access your Custom service Classes inside the EXT Environment in order to put your condition?

So for that you need to put your custom service jar file inside tomcat/lib/ext.

Regards,
Amit Doshi