Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Elwyn 8 posts 28 karma points
    Apr 01, 2011 @ 02:46
    Elwyn
    0

    Displaying a custom delete confirmation

    Hello.

    How would I go about implementing a customisation for the delete confirmation? What I want is this:

    When a user right clicks a node, and selects delete, I want to run a check. Depending on the outcome of the check, the confirmation message will either show the standard

    "Are you sure you want to delete...", or

    "Are you sure you want to delete... + My extra custom message here"

     

    Basically I have set up non-hierarchical relationships between content, and need to check if deleting this content item is going to affect its relations. (e.g. sometimes deleting one content item causes other content items that are related to be deleted).

     

    Any hints on where I might start looking into this? I am aware I can customise the text the message displays through the lang xml files, however it's a bit more complex than that.

    I suspect the delete confirmation stuff all happens in JavaScript - I could create a custom control containing my logic which returns Json, and have some custom JavaScript call this and display messages appropriately. I'm just not sure where exactly to go to add this functionality.

    Of course if I can avoid modifying core files, and implement everything in a nice extensible way so future Umbraco updates don’t kill this functionality, that would be great.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 01, 2011 @ 08:20
    Jan Skovgaard
    0

    Hi Elwyn

    This sounds like a scenario where you would want to hook in to the "beforeDelete" event, where I guess it should then be possible to make a custom dialog about what would happen once a person tries to delete a node I suppose.

    For a list of possible events please have a look here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events

    You can also read more about the relation api here: http://blog.hendyracher.co.uk/umbraco-relation-api/

    Hope this helps a bit.

    /Jan

  • Daniel Bardi 927 posts 2562 karma points
    Apr 01, 2011 @ 08:23
    Daniel Bardi
    0

    You can attach to the delete event of a node by creating a custom class that inherits from ApplicationBase.  There's documentation on this here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events

    You can also attached the load event of umbraco.aspx by implementing an HttpHandler to watch for "umbraco.aspx".  After attached, you can insert your custom javascript.

    You can also attach to the create event of tree nodes and replace the delete menu action with your own action.

Please Sign in or register to post replies

Write your reply to:

Draft