Disable the move button for published pages and enable the move button for unpublished pages. | Community
Skip to main content
Level 2
July 27, 2023
Question

Disable the move button for published pages and enable the move button for unpublished pages.

  • July 27, 2023
  • 3 replies
  • 1347 views

How do we disable the move button for published pages and enable the move button for unpublished pages,

This is in order to avoid the active pages being moved and the URL being changed. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

sarahxxu
Adobe Employee
Adobe Employee
July 27, 2023
Level 2
August 1, 2023

Did not find the related docs.

sarahxxu
Adobe Employee
Adobe Employee
August 2, 2023

Are you not able to access the link? It's to a separate forum where the AEM experts hang out. That might be a better location for your question if you are trying to work with AEM pages. 

partyush
Community Advisor
Community Advisor
August 13, 2023

Hi @nirmal_kumar1 

You can try this solution and approach. 

1. Add Custom Property:

  • Add a custom property to pages to indicate their publish status. You can use a property like publishStatus with values like published and unpublished.

2. Customize the Page Properties Dialog:

  • Modify the dialog for the page properties to include the publishStatus field. This can be done using the AEM dialog editor.

3. Use Permissions:

  • Set up permissions so that different user groups have different access levels.
  • Define two groups: one for users who can publish and move pages, and another for users who can only move pages.
  • Users who can publish and move pages should have the permission to modify the publishStatus property.

4. Implement Client-Side Logic:

  • Use JavaScript to disable the "Move" button on the page based on the publishStatus property.
  • Create a client-side library in AEM that contains the JavaScript logic.
  • Include this library in your pages' templates or components.

 

$(document).ready(function() { var publishStatus = "${currentPage.publishStatus}"; // Get the value of the publishStatus property if (publishStatus === "published") { $("#cq-move").prop("disabled", true); } else { $("#cq-move").prop("disabled", false); } });

 

 

5. Apply Customization:

  • Apply the customized dialog, permissions, and JavaScript logic to your AEM instance.

6. Test Thoroughly:

  • Test the solution thoroughly with both published and unpublished pages to ensure that the "Move" button behaves as expected based on the publish status.

7. Document Changes:

  • Document the changes you've made to your AEM project for future reference.

Remember that AEM environments can vary, and you might need to adapt the solution to match your specific AEM version and setup. Always test your customizations in a controlled environment before deploying them to a production instance.

Hope this information helps you ! 

kautuk_sahni
Community Manager
Community Manager
May 16, 2024

@nirmal_kumar1 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni