There has been a few postings on the MySource Matrix forums about how to delete an asset using a trigger, but the posts are scattered and not comprehensive. So, I thought I would post the way that I remove assets using a trigger, ajax to “touch” the url, and javascript to hide the asset from view.
Update: This tutorial should now use the MySource Matrix jQuery plugin, which includes the matrixDelete plugin, allowing you to simply and easily delete assets. Please visit http://www.zedsaid.com/projects for more information.
[Intermediate] Delete asset using triggers and ajax
[quote]Conditions: Tree Location, URL Matches, Access Permission (You can change this to admin if needed)
[attachment=298:Picture_3.png][/quote]
Can I recommend re-ordering these conditions? You want Matrix to stop processing the trigger as soon as possible, so you should order your conditions from lowest occurrence to highest. In this instance, I'd use the following order instead:
- URL matches
- Access Permission
- Tree Location
[quote]Can I recommend re-ordering these conditions? You want Matrix to stop processing the trigger as soon as possible, so you should order your conditions from lowest occurrence to highest. In this instance, I'd use the following order instead:
- URL matches
- Access Permission
- Tree Location[/quote]
Thanks for the tip Avi, I have updated my trigger.
Hi i was trying to do this delete with triggers. but my problem is that when i delete it in the interface it is not visible anymore in the ui nor in the location in the asset tree, but it is also not in the trash. when i tried searching for the id it showed results but i can't find its location. Where could that possible be? HELP
Search by ID, then go to the Linking screen. The lineage will be displayed there. You can even click the binoculars icon to have the asset map expand to its location.
Already did that part but the linking displays "NONE". there are no links on that asset…
Maybe check your system log and see if it was indeed linked to the trash.
Did you make sure, in your trigger, to add a tick next to "Unlink from all parents"?
This is suggesting that the asset is becoming orphaned, i.e. unlinked from its parent but not linked to the Trash asset. Can you check your error logs to see if there are any errors being displayed when the trigger is fired?
already checked that one mu problem is this is the only part that is not working. I also have delete in other parts. but it is working well…just this one…
I'm trying to get this to work in Simple Edit by putting in a div with the script and another div with the button at the bottom of my layout. When you click the button the div with the button disappears (is that the div you're meant to replace in the script? Cause that's what I did…) but nothing else happens.
I've set my trigger up. Do I need to be getting other stuff involved? How do I make it actually parse the URL? And how can I control what happens when the asset is deleted… right now I don't see where the user is supposed to go…
I might be punching above my weight with this but if I could add a delete button to the simple edit interface that would be awesome so I'm trying…
Ok, you are going to hate me, but I actually removed all of the instructions for this script. Reason is, it is really old, and poorly coded. The new one that I have is SO much better, and much easier to understand. Give me a day or two, and I will have it added here, as well as added on my website, http://www.zedsaid.com/projects.
I am also working on getting all the other scripts that run my Simple Edit up so that anyone can download them, including all the tools that were shown at MMIUC2008.
Stay tuned.
If you need this right away, feel free to PM me.
LOL! Okay, look forward to seeing the New And Improved™ version. :lol: