AEM Author should be unable to delete content/page once it published.
- Once author selects page from sites console, we have to disable the delete button if page was in published status.
- we need to enable the delete button if page is not in published status.
- Once author selects any page from sites console it shows action bar that means we are calling listeners (java script files) for showing action bar buttons on sites console.
Question is:
please let me know exact listeners java script files or paths that calls when we select the page on sites console.
Overlay this node in your project /libs/wcm/core/content/sites/jcr:content/actions/selection
copy the above sites page from libs and paste it under /apps/wcm/core/content
Remove the deletepage node under this node.
it should not show disable mode in every time.it has to show enable mode when page is not in published status.
Below is the status has to show when page is in activated or deactivated status:
if page is activated -disable delete button
if page is not activated - enable delete button
when author selects the page from console it shows action tool bar (these action bar items populates using listeners). so i want the listeners (java script files) that shows for action bar after selecting the page from console.if we know that, we can add our disable condition on listener.
Views
Replies
Total Likes
Go to /libs/cq/gui/components/siteadmin/admin/clientlibs/collectionpage/js/viewpropertiesaction.js
Overlay the above js , copy to apps and edit the one in apps /apps/cq/gui/components/siteadmin/admin/clientlibs/collectionpage/js/viewpropertiesaction.js
go to line number line number 91 and add this line
if (isActivated(selections)) {
control.removeAttr("hidden");
$('.cq-siteadmin-admin-actions-delete-activator').attr('disabled','disabled');
}
Thank you for response.
- But it is disabling every time. can't we enable for not activated/not published pages.
- Can we do same for damadmin also ?
Views
Replies
Total Likes
Have you tried custom render conditions? Refer:
1. GitHub - nateyolles/aem-granite-rendercondition-demo: AEM Granite Render Condition demo
Disable functionality can also be achieved using ACL's as well (button will not get disabled but delete operation will fail). You can set ACL on content node of page or asset (remove delete privilege) via custom Preprocessor when a page/asset is published. When a page is unpublished, you can remove these ACLs.
There is no easy way to do so to solve problem efficiently.
On top of the solution suggested by Hemant, you can always check the status of page is activated or not and hide disable button accordingly.
Best way would be to create custom workflow and there you can put all the checks that you want to achieve.
~kautuk
Views
Replies
Total Likes
I guess you are looking this js- /libs/granite/ui/components/coral/foundation/clientlibs/foundation/js/collection/action/action.js
Views
Likes
Replies