I am trying to override the basetree (media) which is written out in various places in the back office (media section, image pickers etc...) and I am doing it through the ApplicationEventHandler:
privatevoid BaseTree_BeforeTreeRender(object sender, TreeEventArgs e)
{
//do stuff here to filter tree...
}
This is all working great as expected - however the trees within the multinode tree picker and digibiz advanced media picker are not filtering - i'm guessing they are not using the basetree? Is there any way to do somethign similar for the multinode tree picker - i read somewhere DAMP uses the same method?
Solved it - here it is, in case anyone else needs it - and so I can remember it in future! This allows you to filter all trees, showing only the nodes you want.
Override Tree - MNTP/DAMP Issue
Hi all,
I am trying to override the basetree (media) which is written out in various places in the back office (media section, image pickers etc...) and I am doing it through the ApplicationEventHandler:
This is all working great as expected - however the trees within the multinode tree picker and digibiz advanced media picker are not filtering - i'm guessing they are not using the basetree? Is there any way to do somethign similar for the multinode tree picker - i read somewhere DAMP uses the same method?
Thanks,
Kenny
Hi All -
Solved it - here it is, in case anyone else needs it - and so I can remember it in future! This allows you to filter all trees, showing only the nodes you want.
BaseTree.AfterTreeRender += BaseTree_AfterTreeRender;
private void BaseTree_AfterTreeRender(object sender, TreeEventArgs e)
{
var nodesToRemoveFromTree = new List<XmlTreeNode>();
var ms = ApplicationContext.Current.Services.MediaService;
foreach (var node in e.Tree.treeCollection)
{
if (node.NodeType == "media" || node.NodeType == "DigibizMediaTree")
{
var content = ms.GetById(Convert.ToInt32(node.NodeID));
if (//do your logic)
{
nodesToRemoveFromTree.Add(node);
}
}
}
foreach (var treeItem in nodesToRemoveFromTree)
{
e.Tree.Remove(treeItem);
}
}
is working on a reply...