While the content does refer to Umbraco 4.x and mentions the umbracoApp and umbracoAppTree tables like some of the above examples, these have now been moved to config files within the config directory and can be automatically populated by your application and tree classes by using the Application and Tree attributes to decorate the class (as referenced by theoutfield.net example.
The following two code samples should create an application and a tree in Umbraco6 - from this you should be able to expand using the numerous examples above.
For Application class
[Application("myApplication", "My Application", "icon.jpg", 0)]
public class MyApplication : IApplication { }
and for Tree class
[Tree("myApplication", "myApplicationTree", "My Application", FolderIcon, FolderIconOpen, "", false, true, 0)]
public class MyTree: BaseTree
{
public MyTree(string application) : base(application) {}
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
rootNode.Text = "My Tree";
rootNode.Icon = FolderIcon;
rootNode.OpenIcon = FolderIconOpen;
rootNode.NodeType = TreeAlias;
rootNode.Menu = new List<IAction>() { ActionRefresh.Instance };
}
public override void Render(ref XmlTree tree)
{
foreach(int i=0; i<5; i++)
{
var treeNode = XmlTreeNode.Create(this);
treeNode.NodeID = i.ToString();
treeNode.Text = String.Format("Item {0}", i);
treeNode.Icon = FolderIcon;
treeNode.OpenIcon = FolderIconOpen;
treeNode.Action = String.Format("javascript: UmbClientMgr.contentFrame('Plugins/MyPages/MyPage.aspx?Id={0}');", i);
treeNode.Menu = new List<IAction>() { ActionRefresh.Instance };
tree.Add(treeNode);
}
}
public override void RenderJS(ref StringBuilder Javascript)
{
// Add any javascript needed here...
}
}
On the custom tree, how can I hide the context menu? Some posts have said to use node.Menu.Clear() which kind of works, it removes an item from the menu, but when I right click on the node I get an empty context menu still. How can I hide that?
How to create a custom section in Umbraco 6 and above?
I need to create a custom section in umbraco 6. I've seen many references like,
http://adaodeveloper.blogspot.in/2013/01/create-new-custom-section-in-umbraco-48.html
http://our.umbraco.org/forum/developers/extending-umbraco/46141-How-to-create-a-custom-BaseTree-tree
nothing works, I found a similar question in stackoverflow,
How to create a Custom section in admin panel of umbraco 6?
but the link provided as an answer is not loading.
Many blogs says, the method of creating custom sections in older versions of umbraco. That doesn't work on umbraco 6.
Can anyone help me with this.
Hi Gopinath,
Did you try this:
http://www.theoutfield.net/blog/2012/07/creating-custom-applications-and-trees-in-umbraco-48plus
http://www.nibble.be/?p=71
Thanks, Alex
Thanks for the reply. I've tried those links too, but that doesn't work on umbraco 6 and above. It works well in umbraco 4+.
Hi,
When learning how to create custom sections in Umbraco 6 I found the following two blog posts rather helpful in regards to that matter...
http://www.robertgray.net.au/2011/5/10/creating-a-custom-content-tree-in-umbraco
and
http://www.robertgray.net.au/posts/2011/5/creating-custom-multi-level-trees-in-umbraco#.U1j9FPm2h8H
the same author also posted all his code on GitHub which was extremely useful for me in understanding how everything fitted together: https://github.com/robgray/f1speedguides/tree/master/src/atomicf1/cms/presentation
While the content does refer to Umbraco 4.x and mentions the umbracoApp and umbracoAppTree tables like some of the above examples, these have now been moved to config files within the config directory and can be automatically populated by your application and tree classes by using the Application and Tree attributes to decorate the class (as referenced by theoutfield.net example.
The following two code samples should create an application and a tree in Umbraco6 - from this you should be able to expand using the numerous examples above.
For Application class
and for Tree class
I hope that helps...
Kind regards,
Tim
Thank you Tim! The declaration on the MyTree class is exactly what I was missing!
On the custom tree, how can I hide the context menu? Some posts have said to use node.Menu.Clear() which kind of works, it removes an item from the menu, but when I right click on the node I get an empty context menu still. How can I hide that?
is working on a reply...