Changes to the page delete function

Permalink
The page delete function (concrete/js/ccm.sitemap.js, line 98) has 2 problems:
1. The simple "Are you sure?" message is not heavy enough. This is a big deal, not easily undone. The confirming needs a boost.
2. Once a page is deleted, the icon of the page remains on the screen. Users who think the delete failed try to re-delete, and get an error message. Answer is to refresh the page after the delete.

Here's the fix:
deletePage = function(cID) {
   ccm_hideMenus();
   if (!confirm("Page Deletion CANNOT BE UNDONE. Delete this page?")) {
       return;
   }
   if (confirm("Last chance -- Are you sure you want to delete this page?")) {
      $.getJSON(CCM_TOOLS_PATH + '/dashboard/sitemap_delete_request.php', {'cID': cID, 'ccm_token': CCM_SECURITY_TOKEN}, function(resp) {
         ccm_parseJSON(resp, function() {
            deleteBranchFade(cID);
         });
      });
   }
   window.location.reload();
}

nemonoman
 
frz replied on at Permalink Reply
frz
i assume you're talking about the sitemap, not deleting a page from the page itself, which for me redirects to its parent after deletion.
nemonoman replied on at Permalink Reply
nemonoman
Yes. The change above changes the site map deletion function.

To beef up the warnings for the delete function from the pages edit bar " move/delete " button, go to

concrete/elements/collection_mcd.php

Change Line 85 to
<a href="javascript:void(0)" onclick="if (!confirm('Page Deletion CANNOT BE UNDONE. Delete this page?')) {return;} if (confirm('Last chance -- Are you sure you want to delete this page?')) { $('#ccmDeletePageForm').get(0).submit()}" class="ccm-button-right accept"><span><?php echo t('Delete Page')?></span></a>


That function already refreshes automatically