Hi,
I am trying to add new button functionality to the FCKEditor where by when a button is pressed, I want to display all the nodes in a treeview.
I want to load all the nodes into the root node and then programmatically create a .NET 2.0 treeview control.
Unfortunately the following call
Node rootNode = _nodeService.GetRootNodeByCultureAndSite(this.Culture, this.Site);
Ends up with rootNode having no ChidNodes. When I tried the following in a unit test, it contained the ChildNodes. I am guessing that this is something to do with either NHibernate caching or lazy loading.
How can I achieve my requirement, that is, how can I get the child nodes for a node or indeed the whole node structure in one shot??
Thanks
Paul
Hi,
you are right that childnodes are being lazy loaded but this should not leave you with an empty rootnode.
Did you inspect the values of Culture and Site while debugging?
Anyway, I would recommend loading all nodes at once, using something like:
string hql = "from Node n where n.Culture = :culture and n.Site.Id = :siteId order by n.Position";
and then build your tree, otherwise you will have a separate db query for every child collection.
@Martijn:
That reminds me of something I thought about: Including a graph/tree library supporting common scenarios like this. The categorization is tree based, too and will have very similar methods like the NodeService.
Hi,
Great thanks, I will try that.
On a side note, is the only way to control lazy loading via the lazy attribute or can it be controlled programmatically?
Thanks
Paul
Hi,
Thanks a bunch, I have created the link picker and all works fine. Just one question, when I am constructing the URL, I am using the following syntax:
node.Site.SiteUrl + node.ShortDescription
I'm just wondering if anyone sees a problem with this approach??
Thanks
Paul
Any chance of sharing the link picker? Seems like a great feature to add.
Absolutely,
It is not fully tested yet but I would be very pleased too when it is ready to ship.
We are using Cuyahoga too produce a CMS to a very tight schedule and the next thing we are going to produce is a preview functionality, so my questions are this:
1. How do I make this new functionality available to the community?
2. When creating this new functionality, I extended rather than changed the source code, for example rather than add new code to the INodeService interface i extended it like this
public interface IOrangeNodeService : INodeService
{
//extra functionality here
}
but for creating this preview functioniality, I feel I have no choice but to change the source. Has anyone any advice in how to best limit the change??
3. We are looking at workflow and are considering trying to hook into the up and coming Windows Workflow Foundation. There is a great article
here: I think this is a great option going forward. Has anyone else considered workflow??
You could subscribe to cuyahoga-devel list on sourceforge and discuss your changes there.
Another user (Dominique Paris) is currently working on a sequential workflow approach that would be fully integrated.
dagda11. How do I make this new functionality available to the community?
You could start by creating a .patch file that includes the new functionality and send that to the cuyahoga-devel mailinglist.
but for creating this preview functioniality, I feel I have no choice but to change the source. Has anyone any advice in how to best limit the change??
That totally depends on what you understand with preview functionality. Could you give us some ideas what you are trying to accomplish?
3. We are looking at workflow and are considering trying to hook into the up and coming Windows Workflow Foundation. There is a great article here: I think this is a great option going forward. Has anyone else considered workflow??
I'll leave the workflow things up to the people who know their stuff. I bet you'll get some responses on the mailing list :).
Hi,
As far as the preview functionality goes, I want to allow the user to view their uncommited pages. That is before commiting to the database, they can view how their uncommited changes will look.
Thanks
Paul