Fórum
Restrict deleting a page
Bharanitharan R, modificado 11 Anos atrás.
Restrict deleting a page
New Member Postagens: 23 Data de Entrada: 14/02/12 Postagens 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
I am new to this .
Thanks in advance
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
I am new to this .
Thanks in advance
Amit Doshi, modificado 11 Anos atrás.
RE: Restrict deleting a page
Liferay Master Postagens: 550 Data de Entrada: 29/12/10 Postagens 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
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, modificado 11 Anos atrás.
RE: Restrict deleting a page
New Member Postagens: 23 Data de Entrada: 14/02/12 Postagens 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
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
Amit Doshi, modificado 11 Anos atrás.
RE: Restrict deleting a page
Liferay Master Postagens: 550 Data de Entrada: 29/12/10 Postagens 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.
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
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