掲示板

Restrict deleting a page

11年前 に Bharanitharan R によって更新されました。

Restrict deleting a page

New Member 投稿: 23 参加年月日: 12/02/14 最新の投稿
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
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: Restrict deleting a page

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
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
11年前 に Bharanitharan R によって更新されました。

RE: Restrict deleting a page

New Member 投稿: 23 参加年月日: 12/02/14 最新の投稿
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
thumbnail
11年前 に Amit Doshi によって更新されました。

RE: Restrict deleting a page

Liferay Master 投稿: 550 参加年月日: 10/12/29 最新の投稿
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.

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


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