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.
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.
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.
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.
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
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.
is working on a reply...