フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Bharanitharan R
Restrict deleting a page
2012/06/14 23:33
答え

Bharanitharan R

ランク: New Member

投稿: 24

参加年月日: 2012/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
Amit Doshi
RE: Restrict deleting a page
2012/06/15 0:11
答え

Amit Doshi

ランク: Liferay Master

投稿: 549

参加年月日: 2010/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
Bharanitharan R
RE: Restrict deleting a page
2012/06/15 1:23
答え

Bharanitharan R

ランク: New Member

投稿: 24

参加年月日: 2012/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
Amit Doshi
RE: Restrict deleting a page
2012/06/15 5:10
答え

Amit Doshi

ランク: Liferay Master

投稿: 549

参加年月日: 2010/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.

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